1 /****************************************************************************** 2 * 3 * Copyright 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/include/bta_api.h" 28 #include "stack/include/bt_hdr.h" 29 #include "stack/include/bt_types.h" 30 #include "stack/include/btm_api_types.h" 31 #include "types/raw_address.h" 32 33 #ifndef BTA_SCO_OUT_PKT_SIZE 34 #define BTA_SCO_OUT_PKT_SIZE BTM_SCO_DATA_SIZE_MAX 35 #endif 36 37 /***************************************************************************** 38 * Function Declarations 39 ****************************************************************************/ 40 41 /******************************************************************************* 42 * 43 * Function bta_dm_co_io_req 44 * 45 * Description This callout function is executed by DM to get IO 46 * capabilities of the local device for the Simple Pairing 47 * process 48 * 49 * Parameters bd_addr - The peer device 50 * *p_io_cap - The local Input/Output capabilities 51 * *p_oob_data - true, if OOB data is available for the peer 52 * device. 53 * *p_auth_req - true, if MITM protection is required. 54 * 55 * Returns void. 56 * 57 ******************************************************************************/ 58 extern void bta_dm_co_io_req(const RawAddress& bd_addr, tBTM_IO_CAP* p_io_cap, 59 tBTM_OOB_DATA* p_oob_data, 60 tBTM_AUTH_REQ* p_auth_req, bool is_orig); 61 62 /******************************************************************************* 63 * 64 * Function bta_dm_co_io_rsp 65 * 66 * Description This callout function is executed by DM to report IO 67 * capabilities of the peer device for the Simple Pairing 68 * process 69 * 70 * Parameters bd_addr - The peer device 71 * io_cap - The remote Input/Output capabilities 72 * oob_data - true, if OOB data is available for the peer 73 * device. 74 * auth_req - true, if MITM protection is required. 75 * 76 * Returns void. 77 * 78 ******************************************************************************/ 79 extern void bta_dm_co_io_rsp(const RawAddress& bd_addr, tBTM_IO_CAP io_cap, 80 tBTM_OOB_DATA oob_data, tBTM_AUTH_REQ auth_req); 81 82 /******************************************************************************* 83 * 84 * Function bta_dm_co_loc_oob 85 * 86 * Description This callout function is executed by DM to report the OOB 87 * data of the local device for the Simple Pairing process 88 * 89 * Parameters valid - true, if the local OOB data is retrieved from LM 90 * c - Simple Pairing Hash C 91 * r - Simple Pairing Randomnizer R 92 * 93 * Returns void. 94 * 95 ******************************************************************************/ 96 extern void bta_dm_co_loc_oob(bool valid, const Octet16& c, const Octet16& r); 97 98 /******************************************************************************* 99 * 100 * Function bta_dm_co_rmt_oob 101 * 102 * Description This callout function is executed by DM to request the OOB 103 * data for the remote device for the Simple Pairing process 104 * 105 * Parameters bd_addr - The peer device 106 * 107 * Returns void. 108 * 109 ******************************************************************************/ 110 extern void bta_dm_co_rmt_oob(const RawAddress& bd_addr); 111 112 /******************************************************************************* 113 * 114 * Function bta_dm_sco_co_open 115 * 116 * Description This function is executed when a SCO connection is open. 117 * 118 * 119 * Returns void 120 * 121 ******************************************************************************/ 122 extern void bta_dm_sco_co_open(uint16_t handle, uint8_t pkt_size, 123 uint16_t event); 124 125 /******************************************************************************* 126 * 127 * Function bta_dm_sco_co_close 128 * 129 * Description This function is called when a SCO connection is closed 130 * 131 * 132 * Returns void 133 * 134 ******************************************************************************/ 135 extern void bta_dm_sco_co_close(void); 136 137 /******************************************************************************* 138 * 139 * Function bta_dm_sco_co_out_data 140 * 141 * Description This function is called to send SCO data over HCI. 142 * 143 * Returns void 144 * 145 ******************************************************************************/ 146 extern void bta_dm_sco_co_out_data(BT_HDR** p_buf); 147 148 /******************************************************************************* 149 * 150 * Function bta_dm_sco_co_in_data 151 * 152 * Description This function is called to send incoming SCO data to 153 * application. 154 * 155 * Returns void 156 * 157 ******************************************************************************/ 158 extern void bta_dm_sco_co_in_data(BT_HDR* p_buf, tBTM_SCO_DATA_FLAG status); 159 160 /******************************************************************************* 161 * 162 * Function bta_dm_co_ble_io_req 163 * 164 * Description This callout function is executed by DM to get BLE IO 165 * capabilities before SMP pairing gets going. 166 * 167 * Parameters bd_addr - The peer device 168 * *p_io_cap - The local Input/Output capabilities 169 * *p_oob_data - true, if OOB data is available for the peer 170 * device. 171 * *p_auth_req - Auth request setting (Bonding and MITM 172 * required or not) 173 * *p_max_key_size - max key size local device supported. 174 * *p_init_key - initiator keys. 175 * *p_resp_key - responder keys. 176 * 177 * Returns void. 178 * 179 ******************************************************************************/ 180 extern void bta_dm_co_ble_io_req( 181 const RawAddress& bd_addr, tBTM_IO_CAP* p_io_cap, tBTM_OOB_DATA* p_oob_data, 182 tBTM_LE_AUTH_REQ* p_auth_req, uint8_t* p_max_key_size, 183 tBTM_LE_KEY_TYPE* p_init_key, tBTM_LE_KEY_TYPE* p_resp_key); 184 185 /******************************************************************************* 186 * 187 * Function bta_dm_co_ble_local_key_reload 188 * 189 * Description This callout function is to load the local BLE keys if 190 * available on the device. 191 * 192 * Parameters none 193 * 194 * Returns void. 195 * 196 ******************************************************************************/ 197 extern void bta_dm_co_ble_load_local_keys( 198 tBTA_DM_BLE_LOCAL_KEY_MASK* p_key_mask, Octet16* p_er, 199 tBTA_BLE_LOCAL_ID_KEYS* p_id_keys); 200 201 #endif /* BTA_DM_CO_H */ 202