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 interface file for device mananger callout functions. 22 * 23 ******************************************************************************/ 24 #ifndef BTA_DM_CO_H 25 #define BTA_DM_CO_H 26 27 #include "bta_sys.h" 28 29 30 #ifndef BTA_SCO_OUT_PKT_SIZE 31 #define BTA_SCO_OUT_PKT_SIZE BTM_SCO_DATA_SIZE_MAX 32 #endif 33 34 #define BTA_SCO_CODEC_PCM 0 /* used for regular SCO */ 35 #define BTA_SCO_CODEC_SBC 1 /* used for WBS */ 36 typedef UINT8 tBTA_SCO_CODEC_TYPE; 37 38 #define BTA_DM_SCO_SAMP_RATE_8K 8000 39 #define BTA_DM_SCO_SAMP_RATE_16K 16000 40 41 /* SCO codec information */ 42 typedef struct 43 { 44 tBTA_SCO_CODEC_TYPE codec_type; 45 }tBTA_CODEC_INFO; 46 47 #define BTA_DM_SCO_ROUTE_PCM BTM_SCO_ROUTE_PCM 48 #define BTA_DM_SCO_ROUTE_HCI BTM_SCO_ROUTE_HCI 49 50 typedef tBTM_SCO_ROUTE_TYPE tBTA_DM_SCO_ROUTE_TYPE; 51 52 53 /***************************************************************************** 54 ** Function Declarations 55 *****************************************************************************/ 56 57 /******************************************************************************* 58 ** 59 ** Function bta_dm_co_io_req 60 ** 61 ** Description This callout function is executed by DM to get IO capabilities 62 ** of the local device for the Simple Pairing process 63 ** 64 ** Parameters bd_addr - The peer device 65 ** *p_io_cap - The local Input/Output capabilities 66 ** *p_oob_data - TRUE, if OOB data is available for the peer device. 67 ** *p_auth_req - TRUE, if MITM protection is required. 68 ** 69 ** Returns void. 70 ** 71 *******************************************************************************/ 72 extern void bta_dm_co_io_req(BD_ADDR bd_addr, tBTA_IO_CAP *p_io_cap, 73 tBTA_OOB_DATA *p_oob_data, tBTA_AUTH_REQ *p_auth_req, 74 BOOLEAN is_orig); 75 76 /******************************************************************************* 77 ** 78 ** Function bta_dm_co_io_rsp 79 ** 80 ** Description This callout function is executed by DM to report IO capabilities 81 ** of the peer device for the Simple Pairing process 82 ** 83 ** Parameters bd_addr - The peer device 84 ** io_cap - The remote Input/Output capabilities 85 ** oob_data - TRUE, if OOB data is available for the peer device. 86 ** auth_req - TRUE, if MITM protection is required. 87 ** 88 ** Returns void. 89 ** 90 *******************************************************************************/ 91 extern void bta_dm_co_io_rsp(BD_ADDR bd_addr, tBTA_IO_CAP io_cap, 92 tBTA_OOB_DATA oob_data, tBTA_AUTH_REQ auth_req); 93 94 /******************************************************************************* 95 ** 96 ** Function bta_dm_co_lk_upgrade 97 ** 98 ** Description This callout function is executed by DM to check if the 99 ** platform wants allow link key upgrade 100 ** 101 ** Parameters bd_addr - The peer device 102 ** *p_upgrade - TRUE, if link key upgrade is desired. 103 ** 104 ** Returns void. 105 ** 106 *******************************************************************************/ 107 extern void bta_dm_co_lk_upgrade(BD_ADDR bd_addr, BOOLEAN *p_upgrade ); 108 109 /******************************************************************************* 110 ** 111 ** Function bta_dm_co_loc_oob 112 ** 113 ** Description This callout function is executed by DM to report the OOB 114 ** data of the local device for the Simple Pairing process 115 ** 116 ** Parameters valid - TRUE, if the local OOB data is retrieved from LM 117 ** c - Simple Pairing Hash C 118 ** r - Simple Pairing Randomnizer R 119 ** 120 ** Returns void. 121 ** 122 *******************************************************************************/ 123 extern void bta_dm_co_loc_oob(BOOLEAN valid, BT_OCTET16 c, BT_OCTET16 r); 124 125 /******************************************************************************* 126 ** 127 ** Function bta_dm_co_rmt_oob 128 ** 129 ** Description This callout function is executed by DM to request the OOB 130 ** data for the remote device for the Simple Pairing process 131 ** 132 ** Parameters bd_addr - The peer device 133 ** 134 ** Returns void. 135 ** 136 *******************************************************************************/ 137 extern void bta_dm_co_rmt_oob(BD_ADDR bd_addr); 138 139 /***************************************************************************** 140 ** SCO over HCI Function Declarations 141 *****************************************************************************/ 142 /******************************************************************************* 143 ** 144 ** Function bta_dm_sco_co_init 145 ** 146 ** Description This function can be used by the phone to initialize audio 147 ** codec or for other initialization purposes before SCO connection 148 ** is opened. 149 ** 150 ** 151 ** Returns Void. 152 ** 153 *******************************************************************************/ 154 extern tBTA_DM_SCO_ROUTE_TYPE bta_dm_sco_co_init(UINT32 rx_bw, UINT32 tx_bw, 155 tBTA_CODEC_INFO *p_codec_info, UINT8 app_id); 156 157 158 /******************************************************************************* 159 ** 160 ** Function bta_dm_sco_co_open 161 ** 162 ** Description This function is executed when a SCO connection is open. 163 ** 164 ** 165 ** Returns void 166 ** 167 *******************************************************************************/ 168 extern void bta_dm_sco_co_open(UINT16 handle, UINT8 pkt_size, UINT16 event); 169 170 /******************************************************************************* 171 ** 172 ** Function bta_dm_sco_co_close 173 ** 174 ** Description This function is called when a SCO connection is closed 175 ** 176 ** 177 ** Returns void 178 ** 179 *******************************************************************************/ 180 extern void bta_dm_sco_co_close(void); 181 182 /******************************************************************************* 183 ** 184 ** Function bta_dm_sco_co_out_data 185 ** 186 ** Description This function is called to send SCO data over HCI. 187 ** 188 ** Returns void 189 ** 190 *******************************************************************************/ 191 extern void bta_dm_sco_co_out_data(BT_HDR **p_buf); 192 193 /******************************************************************************* 194 ** 195 ** Function bta_dm_sco_co_in_data 196 ** 197 ** Description This function is called to send incoming SCO data to application. 198 ** 199 ** Returns void 200 ** 201 *******************************************************************************/ 202 extern void bta_dm_sco_co_in_data(BT_HDR *p_buf, tBTM_SCO_DATA_FLAG status); 203 204 205 206 /******************************************************************************* 207 ** 208 ** Function bta_dm_co_ble_io_req 209 ** 210 ** Description This callout function is executed by DM to get BLE IO capabilities 211 ** before SMP pairing gets going. 212 ** 213 ** Parameters bd_addr - The peer device 214 ** *p_io_cap - The local Input/Output capabilities 215 ** *p_oob_data - TRUE, if OOB data is available for the peer device. 216 ** *p_auth_req - Auth request setting (Bonding and MITM required or not) 217 ** *p_max_key_size - max key size local device supported. 218 ** *p_init_key - initiator keys. 219 ** *p_resp_key - responder keys. 220 ** 221 ** Returns void. 222 ** 223 *******************************************************************************/ 224 extern void bta_dm_co_ble_io_req(BD_ADDR bd_addr, tBTA_IO_CAP *p_io_cap, 225 tBTA_OOB_DATA *p_oob_data, 226 tBTA_LE_AUTH_REQ *p_auth_req, 227 UINT8 *p_max_key_size, 228 tBTA_LE_KEY_TYPE *p_init_key, 229 tBTA_LE_KEY_TYPE *p_resp_key ); 230 231 232 /******************************************************************************* 233 ** 234 ** Function bta_dm_co_ble_local_key_reload 235 ** 236 ** Description This callout function is to load the local BLE keys if available 237 ** on the device. 238 ** 239 ** Parameters none 240 ** 241 ** Returns void. 242 ** 243 *******************************************************************************/ 244 extern void bta_dm_co_ble_load_local_keys (tBTA_DM_BLE_LOCAL_KEY_MASK *p_key_mask, BT_OCTET16 er, 245 tBTA_BLE_LOCAL_ID_KEYS *p_id_keys); 246 247 // btla-specific ++ 248 /******************************************************************************* 249 ** 250 ** Function bta_dm_co_ble_io_req 251 ** 252 ** Description This callout function is executed by DM to get BLE IO capabilities 253 ** before SMP pairing gets going. 254 ** 255 ** Parameters bd_addr - The peer device 256 ** *p_io_cap - The local Input/Output capabilities 257 ** *p_oob_data - TRUE, if OOB data is available for the peer device. 258 ** *p_auth_req - Auth request setting (Bonding and MITM required or not) 259 ** *p_max_key_size - max key size local device supported. 260 ** *p_init_key - initiator keys. 261 ** *p_resp_key - responder keys. 262 ** 263 ** Returns void. 264 ** 265 *******************************************************************************/ 266 extern void bta_dm_co_ble_io_req(BD_ADDR bd_addr, tBTA_IO_CAP *p_io_cap, 267 tBTA_OOB_DATA *p_oob_data, 268 tBTA_LE_AUTH_REQ *p_auth_req, 269 UINT8 *p_max_key_size, 270 tBTA_LE_KEY_TYPE *p_init_key, 271 tBTA_LE_KEY_TYPE *p_resp_key ); 272 // btla-specific -- 273 274 #endif 275