The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1 | /****************************************************************************** |
| 2 | * |
Satya Calloji | c4e2596 | 2014-05-10 23:46:24 -0700 | [diff] [blame] | 3 | * Copyright (C) 2003-2014 Broadcom Corporation |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 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 API implementation file for the BTA device manager. |
| 22 | * |
| 23 | ******************************************************************************/ |
| 24 | |
Pavlin Radoslavov | 258c253 | 2015-09-27 20:59:05 -0700 | [diff] [blame] | 25 | #include "bt_common.h" |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 26 | #include "bta_sys.h" |
| 27 | #include "bta_api.h" |
Jakub Pawlowski | 5b12a83 | 2016-08-11 03:30:47 -0700 | [diff] [blame] | 28 | #include "bta_closure_api.h" |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 29 | #include "bta_dm_int.h" |
| 30 | #include "bta_sys_int.h" |
| 31 | #include "btm_api.h" |
| 32 | #include "btm_int.h" |
Myles Watson | d7ffd64 | 2016-10-27 10:27:36 -0700 | [diff] [blame] | 33 | #include "osi/include/osi.h" |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 34 | #include <string.h> |
Mike J. Chen | 5cd8bff | 2014-01-31 18:16:59 -0800 | [diff] [blame] | 35 | #include "utl.h" |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 36 | |
| 37 | /***************************************************************************** |
Myles Watson | 8af480e | 2016-11-09 10:40:23 -0800 | [diff] [blame^] | 38 | * Constants |
| 39 | ****************************************************************************/ |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 40 | |
| 41 | static const tBTA_SYS_REG bta_dm_reg = |
| 42 | { |
| 43 | bta_dm_sm_execute, |
| 44 | bta_dm_sm_disable |
| 45 | }; |
| 46 | |
| 47 | static const tBTA_SYS_REG bta_dm_search_reg = |
| 48 | { |
| 49 | bta_dm_search_sm_execute, |
| 50 | bta_dm_search_sm_disable |
| 51 | }; |
| 52 | |
| 53 | /******************************************************************************* |
Myles Watson | 8af480e | 2016-11-09 10:40:23 -0800 | [diff] [blame^] | 54 | * |
| 55 | * Function BTA_EnableBluetooth |
| 56 | * |
| 57 | * Description Enables bluetooth service. This function must be |
| 58 | * called before any other functions in the BTA API are called. |
| 59 | * |
| 60 | * |
| 61 | * Returns tBTA_STATUS |
| 62 | * |
| 63 | ******************************************************************************/ |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 64 | tBTA_STATUS BTA_EnableBluetooth(tBTA_DM_SEC_CBACK *p_cback) |
| 65 | { |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 66 | /* Bluetooth disabling is in progress */ |
| 67 | if (bta_dm_cb.disabling) |
| 68 | return BTA_FAILURE; |
| 69 | |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 70 | bta_sys_register(BTA_ID_DM, &bta_dm_reg ); |
| 71 | bta_sys_register(BTA_ID_DM_SEARCH, &bta_dm_search_reg ); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 72 | |
| 73 | /* if UUID list is not provided as static data */ |
| 74 | bta_sys_eir_register(bta_dm_eir_update_uuid); |
| 75 | |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 76 | tBTA_DM_API_ENABLE *p_msg = |
| 77 | (tBTA_DM_API_ENABLE *)osi_malloc(sizeof(tBTA_DM_API_ENABLE)); |
| 78 | p_msg->hdr.event = BTA_DM_API_ENABLE_EVT; |
| 79 | p_msg->p_sec_cback = p_cback; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 80 | |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 81 | bta_sys_sendmsg(p_msg); |
| 82 | |
| 83 | return BTA_SUCCESS; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 84 | } |
| 85 | |
| 86 | /******************************************************************************* |
Myles Watson | 8af480e | 2016-11-09 10:40:23 -0800 | [diff] [blame^] | 87 | * |
| 88 | * Function BTA_DisableBluetooth |
| 89 | * |
| 90 | * Description Disables bluetooth service. This function is called when |
| 91 | * the application no longer needs bluetooth service |
| 92 | * |
| 93 | * Returns void |
| 94 | * |
| 95 | ******************************************************************************/ |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 96 | tBTA_STATUS BTA_DisableBluetooth(void) |
| 97 | { |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 98 | BT_HDR *p_msg = (BT_HDR *)osi_malloc(sizeof(BT_HDR)); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 99 | |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 100 | p_msg->event = BTA_DM_API_DISABLE_EVT; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 101 | |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 102 | bta_sys_sendmsg(p_msg); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 103 | |
| 104 | return BTA_SUCCESS; |
| 105 | } |
| 106 | |
| 107 | /******************************************************************************* |
Myles Watson | 8af480e | 2016-11-09 10:40:23 -0800 | [diff] [blame^] | 108 | * |
| 109 | * Function BTA_EnableTestMode |
| 110 | * |
| 111 | * Description Enables bluetooth device under test mode |
| 112 | * |
| 113 | * |
| 114 | * Returns tBTA_STATUS |
| 115 | * |
| 116 | ******************************************************************************/ |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 117 | tBTA_STATUS BTA_EnableTestMode(void) |
| 118 | { |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 119 | BT_HDR *p_msg = (BT_HDR *)osi_malloc(sizeof(BT_HDR)); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 120 | |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 121 | APPL_TRACE_API("%s", __func__); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 122 | |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 123 | p_msg->event = BTA_DM_API_ENABLE_TEST_MODE_EVT; |
| 124 | bta_sys_sendmsg(p_msg); |
| 125 | |
| 126 | return BTA_SUCCESS; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 127 | } |
| 128 | |
| 129 | /******************************************************************************* |
Myles Watson | 8af480e | 2016-11-09 10:40:23 -0800 | [diff] [blame^] | 130 | * |
| 131 | * Function BTA_DisableTestMode |
| 132 | * |
| 133 | * Description Disable bluetooth device under test mode |
| 134 | * |
| 135 | * |
| 136 | * Returns None |
| 137 | * |
| 138 | ******************************************************************************/ |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 139 | void BTA_DisableTestMode(void) |
| 140 | { |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 141 | BT_HDR *p_msg = (BT_HDR *)osi_malloc(sizeof(BT_HDR)); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 142 | |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 143 | APPL_TRACE_API("%s", __func__); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 144 | |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 145 | p_msg->event = BTA_DM_API_DISABLE_TEST_MODE_EVT; |
| 146 | bta_sys_sendmsg(p_msg); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 147 | } |
| 148 | |
| 149 | /******************************************************************************* |
Myles Watson | 8af480e | 2016-11-09 10:40:23 -0800 | [diff] [blame^] | 150 | * |
| 151 | * Function BTA_DmSetDeviceName |
| 152 | * |
| 153 | * Description This function sets the Bluetooth name of local device |
| 154 | * |
| 155 | * |
| 156 | * Returns void |
| 157 | * |
| 158 | ******************************************************************************/ |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 159 | void BTA_DmSetDeviceName(char *p_name) |
| 160 | { |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 161 | tBTA_DM_API_SET_NAME *p_msg = |
| 162 | (tBTA_DM_API_SET_NAME *)osi_malloc(sizeof(tBTA_DM_API_SET_NAME)); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 163 | |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 164 | p_msg->hdr.event = BTA_DM_API_SET_NAME_EVT; |
| 165 | strlcpy((char*)p_msg->name, p_name, BD_NAME_LEN); |
| 166 | |
| 167 | bta_sys_sendmsg(p_msg); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 168 | } |
| 169 | |
| 170 | /******************************************************************************* |
Myles Watson | 8af480e | 2016-11-09 10:40:23 -0800 | [diff] [blame^] | 171 | * |
| 172 | * Function BTA_DmSetVisibility |
| 173 | * |
| 174 | * Description This function sets the Bluetooth connectable, |
| 175 | * discoverable, pairable and conn paired only modes of local device |
| 176 | * |
| 177 | * |
| 178 | * Returns void |
| 179 | * |
| 180 | ******************************************************************************/ |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame] | 181 | void BTA_DmSetVisibility(tBTA_DM_DISC disc_mode, tBTA_DM_CONN conn_mode, uint8_t pairable_mode, uint8_t conn_filter ) |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 182 | { |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 183 | tBTA_DM_API_SET_VISIBILITY *p_msg = |
| 184 | (tBTA_DM_API_SET_VISIBILITY *)osi_malloc(sizeof(tBTA_DM_MSG)); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 185 | |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 186 | p_msg->hdr.event = BTA_DM_API_SET_VISIBILITY_EVT; |
| 187 | p_msg->disc_mode = disc_mode; |
| 188 | p_msg->conn_mode = conn_mode; |
| 189 | p_msg->pair_mode = pairable_mode; |
| 190 | p_msg->conn_paired_only = conn_filter; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 191 | |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 192 | bta_sys_sendmsg(p_msg); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 193 | } |
| 194 | |
| 195 | /******************************************************************************* |
Myles Watson | 8af480e | 2016-11-09 10:40:23 -0800 | [diff] [blame^] | 196 | * |
| 197 | * Function BTA_DmSearch |
| 198 | * |
| 199 | * Description This function searches for peer Bluetooth devices. It performs |
| 200 | * an inquiry and gets the remote name for devices. Service |
| 201 | * discovery is done if services is non zero |
| 202 | * |
| 203 | * |
| 204 | * Returns void |
| 205 | * |
| 206 | ******************************************************************************/ |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 207 | void BTA_DmSearch(tBTA_DM_INQ *p_dm_inq, tBTA_SERVICE_MASK services, tBTA_DM_SEARCH_CBACK *p_cback) |
| 208 | { |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 209 | tBTA_DM_API_SEARCH *p_msg = |
| 210 | (tBTA_DM_API_SEARCH *)osi_calloc(sizeof(tBTA_DM_API_SEARCH)); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 211 | |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 212 | p_msg->hdr.event = BTA_DM_API_SEARCH_EVT; |
| 213 | memcpy(&p_msg->inq_params, p_dm_inq, sizeof(tBTA_DM_INQ)); |
| 214 | p_msg->services = services; |
| 215 | p_msg->p_cback = p_cback; |
| 216 | p_msg->rs_res = BTA_DM_RS_NONE; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 217 | |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 218 | bta_sys_sendmsg(p_msg); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 219 | } |
| 220 | |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 221 | /******************************************************************************* |
Myles Watson | 8af480e | 2016-11-09 10:40:23 -0800 | [diff] [blame^] | 222 | * |
| 223 | * Function BTA_DmSearchCancel |
| 224 | * |
| 225 | * Description This function cancels a search initiated by BTA_DmSearch |
| 226 | * |
| 227 | * |
| 228 | * Returns void |
| 229 | * |
| 230 | ******************************************************************************/ |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 231 | void BTA_DmSearchCancel(void) |
| 232 | { |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 233 | BT_HDR *p_msg = (BT_HDR *)osi_malloc(sizeof(BT_HDR)); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 234 | |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 235 | p_msg->event = BTA_DM_API_SEARCH_CANCEL_EVT; |
| 236 | bta_sys_sendmsg(p_msg); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 237 | } |
| 238 | |
| 239 | /******************************************************************************* |
Myles Watson | 8af480e | 2016-11-09 10:40:23 -0800 | [diff] [blame^] | 240 | * |
| 241 | * Function BTA_DmDiscover |
| 242 | * |
| 243 | * Description This function does service discovery for services of a |
| 244 | * peer device |
| 245 | * |
| 246 | * |
| 247 | * Returns void |
| 248 | * |
| 249 | ******************************************************************************/ |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 250 | void BTA_DmDiscover(BD_ADDR bd_addr, tBTA_SERVICE_MASK services, |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame] | 251 | tBTA_DM_SEARCH_CBACK *p_cback, bool sdp_search) |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 252 | { |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 253 | tBTA_DM_API_DISCOVER *p_msg = |
| 254 | (tBTA_DM_API_DISCOVER *)osi_calloc(sizeof(tBTA_DM_API_DISCOVER)); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 255 | |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 256 | p_msg->hdr.event = BTA_DM_API_DISCOVER_EVT; |
| 257 | bdcpy(p_msg->bd_addr, bd_addr); |
| 258 | p_msg->services = services; |
| 259 | p_msg->p_cback = p_cback; |
| 260 | p_msg->sdp_search = sdp_search; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 261 | |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 262 | bta_sys_sendmsg(p_msg); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 263 | } |
| 264 | |
| 265 | /******************************************************************************* |
Myles Watson | 8af480e | 2016-11-09 10:40:23 -0800 | [diff] [blame^] | 266 | * |
| 267 | * Function BTA_DmDiscoverUUID |
| 268 | * |
| 269 | * Description This function does service discovery for services of a |
| 270 | * peer device |
| 271 | * |
| 272 | * |
| 273 | * Returns void |
| 274 | * |
| 275 | ******************************************************************************/ |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 276 | void BTA_DmDiscoverUUID(BD_ADDR bd_addr, tSDP_UUID *uuid, |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame] | 277 | tBTA_DM_SEARCH_CBACK *p_cback, bool sdp_search) |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 278 | { |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 279 | tBTA_DM_API_DISCOVER *p_msg = |
| 280 | (tBTA_DM_API_DISCOVER *)osi_malloc(sizeof(tBTA_DM_API_DISCOVER)); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 281 | |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 282 | p_msg->hdr.event = BTA_DM_API_DISCOVER_EVT; |
| 283 | bdcpy(p_msg->bd_addr, bd_addr); |
| 284 | p_msg->services = BTA_USER_SERVICE_MASK; //Not exposed at API level |
| 285 | p_msg->p_cback = p_cback; |
| 286 | p_msg->sdp_search = sdp_search; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 287 | |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame] | 288 | #if (BLE_INCLUDED == TRUE && BTA_GATT_INCLUDED == TRUE) |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 289 | p_msg->num_uuid = 0; |
| 290 | p_msg->p_uuid = NULL; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 291 | #endif |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 292 | memcpy(&p_msg->uuid, uuid, sizeof(tSDP_UUID) ); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 293 | |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 294 | bta_sys_sendmsg(p_msg); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 295 | } |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 296 | |
| 297 | /******************************************************************************* |
Myles Watson | 8af480e | 2016-11-09 10:40:23 -0800 | [diff] [blame^] | 298 | * |
| 299 | * Function BTA_DmBond |
| 300 | * |
| 301 | * Description This function initiates a bonding procedure with a peer |
| 302 | * device |
| 303 | * |
| 304 | * |
| 305 | * Returns void |
| 306 | * |
| 307 | ******************************************************************************/ |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 308 | void BTA_DmBond(BD_ADDR bd_addr) |
| 309 | { |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 310 | tBTA_DM_API_BOND *p_msg = |
| 311 | (tBTA_DM_API_BOND *)osi_malloc(sizeof(tBTA_DM_API_BOND)); |
VenkatRaghavan VijayaRaghavan | 76356ae | 2015-04-21 11:32:29 -0700 | [diff] [blame] | 312 | |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 313 | p_msg->hdr.event = BTA_DM_API_BOND_EVT; |
| 314 | bdcpy(p_msg->bd_addr, bd_addr); |
| 315 | p_msg->transport = BTA_TRANSPORT_UNKNOWN; |
| 316 | |
| 317 | bta_sys_sendmsg(p_msg); |
Ganesh Ganapathi Batta | 7fa4fba | 2014-04-16 16:50:09 -0700 | [diff] [blame] | 318 | } |
| 319 | |
| 320 | /******************************************************************************* |
Myles Watson | 8af480e | 2016-11-09 10:40:23 -0800 | [diff] [blame^] | 321 | * |
| 322 | * Function BTA_DmBondByTransports |
| 323 | * |
| 324 | * Description This function initiates a bonding procedure with a peer |
| 325 | * device |
| 326 | * |
| 327 | * |
| 328 | * Returns void |
| 329 | * |
| 330 | ******************************************************************************/ |
Ganesh Ganapathi Batta | 7fa4fba | 2014-04-16 16:50:09 -0700 | [diff] [blame] | 331 | void BTA_DmBondByTransport(BD_ADDR bd_addr, tBTA_TRANSPORT transport) |
| 332 | { |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 333 | tBTA_DM_API_BOND *p_msg = |
| 334 | (tBTA_DM_API_BOND *)osi_malloc(sizeof(tBTA_DM_API_BOND)); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 335 | |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 336 | p_msg->hdr.event = BTA_DM_API_BOND_EVT; |
| 337 | bdcpy(p_msg->bd_addr, bd_addr); |
| 338 | p_msg->transport = transport; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 339 | |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 340 | bta_sys_sendmsg(p_msg); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 341 | } |
| 342 | |
| 343 | /******************************************************************************* |
Myles Watson | 8af480e | 2016-11-09 10:40:23 -0800 | [diff] [blame^] | 344 | * |
| 345 | * Function BTA_DmBondCancel |
| 346 | * |
| 347 | * Description This function cancels the bonding procedure with a peer |
| 348 | * device |
| 349 | * |
| 350 | * |
| 351 | * Returns void |
| 352 | * |
| 353 | ******************************************************************************/ |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 354 | void BTA_DmBondCancel(BD_ADDR bd_addr) |
| 355 | { |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 356 | tBTA_DM_API_BOND_CANCEL *p_msg = |
| 357 | (tBTA_DM_API_BOND_CANCEL *)osi_malloc(sizeof(tBTA_DM_API_BOND_CANCEL)); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 358 | |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 359 | p_msg->hdr.event = BTA_DM_API_BOND_CANCEL_EVT; |
| 360 | bdcpy(p_msg->bd_addr, bd_addr); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 361 | |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 362 | bta_sys_sendmsg(p_msg); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 363 | } |
| 364 | |
| 365 | /******************************************************************************* |
Myles Watson | 8af480e | 2016-11-09 10:40:23 -0800 | [diff] [blame^] | 366 | * |
| 367 | * Function BTA_DmPinReply |
| 368 | * |
| 369 | * Description This function provides a pincode for a remote device when |
| 370 | * one is requested by DM through BTA_DM_PIN_REQ_EVT |
| 371 | * |
| 372 | * |
| 373 | * Returns void |
| 374 | * |
| 375 | ******************************************************************************/ |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame] | 376 | void BTA_DmPinReply(BD_ADDR bd_addr, bool accept, uint8_t pin_len, uint8_t *p_pin) |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 377 | |
| 378 | { |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 379 | tBTA_DM_API_PIN_REPLY *p_msg = |
| 380 | (tBTA_DM_API_PIN_REPLY *)osi_malloc(sizeof(tBTA_DM_API_PIN_REPLY)); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 381 | |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 382 | p_msg->hdr.event = BTA_DM_API_PIN_REPLY_EVT; |
| 383 | bdcpy(p_msg->bd_addr, bd_addr); |
| 384 | p_msg->accept = accept; |
| 385 | if (accept) { |
| 386 | p_msg->pin_len = pin_len; |
| 387 | memcpy(p_msg->p_pin, p_pin, pin_len); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 388 | } |
| 389 | |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 390 | bta_sys_sendmsg(p_msg); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 391 | } |
| 392 | |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 393 | /******************************************************************************* |
Myles Watson | 8af480e | 2016-11-09 10:40:23 -0800 | [diff] [blame^] | 394 | * |
| 395 | * Function BTA_DmLocalOob |
| 396 | * |
| 397 | * Description This function retrieves the OOB data from local controller. |
| 398 | * The result is reported by: |
| 399 | * - bta_dm_co_loc_oob_ext() if device supports secure |
| 400 | * connections (SC) |
| 401 | * - bta_dm_co_loc_oob() if device doesn't support SC |
| 402 | * |
| 403 | * Returns void |
| 404 | * |
| 405 | ******************************************************************************/ |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 406 | void BTA_DmLocalOob(void) |
| 407 | { |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 408 | tBTA_DM_API_LOC_OOB *p_msg = |
| 409 | (tBTA_DM_API_LOC_OOB *)osi_malloc(sizeof(tBTA_DM_API_LOC_OOB)); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 410 | |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 411 | p_msg->hdr.event = BTA_DM_API_LOC_OOB_EVT; |
| 412 | bta_sys_sendmsg(p_msg); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 413 | } |
Jakub Pawlowski | 175da70 | 2015-11-12 15:00:58 -0800 | [diff] [blame] | 414 | |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 415 | /******************************************************************************* |
Myles Watson | 8af480e | 2016-11-09 10:40:23 -0800 | [diff] [blame^] | 416 | * |
| 417 | * Function BTA_DmConfirm |
| 418 | * |
| 419 | * Description This function accepts or rejects the numerical value of the |
| 420 | * Simple Pairing process on BTA_DM_SP_CFM_REQ_EVT |
| 421 | * |
| 422 | * Returns void |
| 423 | * |
| 424 | ******************************************************************************/ |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame] | 425 | void BTA_DmConfirm(BD_ADDR bd_addr, bool accept) |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 426 | { |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 427 | tBTA_DM_API_CONFIRM *p_msg = |
| 428 | (tBTA_DM_API_CONFIRM *)osi_malloc(sizeof(tBTA_DM_API_CONFIRM)); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 429 | |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 430 | p_msg->hdr.event = BTA_DM_API_CONFIRM_EVT; |
| 431 | bdcpy(p_msg->bd_addr, bd_addr); |
| 432 | p_msg->accept = accept; |
| 433 | |
| 434 | bta_sys_sendmsg(p_msg); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 435 | } |
| 436 | |
| 437 | /******************************************************************************* |
Myles Watson | 8af480e | 2016-11-09 10:40:23 -0800 | [diff] [blame^] | 438 | * |
| 439 | * Function BTA_DmAddDevice |
| 440 | * |
| 441 | * Description This function adds a device to the security database list of |
| 442 | * peer device |
| 443 | * |
| 444 | * |
| 445 | * Returns void |
| 446 | * |
| 447 | ******************************************************************************/ |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 448 | void BTA_DmAddDevice(BD_ADDR bd_addr, DEV_CLASS dev_class, LINK_KEY link_key, |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame] | 449 | tBTA_SERVICE_MASK trusted_mask, bool is_trusted, |
| 450 | uint8_t key_type, tBTA_IO_CAP io_cap, uint8_t pin_length) |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 451 | { |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 452 | tBTA_DM_API_ADD_DEVICE *p_msg = |
| 453 | (tBTA_DM_API_ADD_DEVICE *)osi_calloc(sizeof(tBTA_DM_API_ADD_DEVICE)); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 454 | |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 455 | p_msg->hdr.event = BTA_DM_API_ADD_DEVICE_EVT; |
| 456 | bdcpy(p_msg->bd_addr, bd_addr); |
| 457 | p_msg->tm = trusted_mask; |
| 458 | p_msg->is_trusted = is_trusted; |
| 459 | p_msg->io_cap = io_cap; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 460 | |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 461 | if (link_key) { |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame] | 462 | p_msg->link_key_known = true; |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 463 | p_msg->key_type = key_type; |
| 464 | memcpy(p_msg->link_key, link_key, LINK_KEY_LEN); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 465 | } |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 466 | |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 467 | /* Load device class if specified */ |
| 468 | if (dev_class) { |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame] | 469 | p_msg->dc_known = true; |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 470 | memcpy(p_msg->dc, dev_class, DEV_CLASS_LEN); |
| 471 | } |
| 472 | |
| 473 | memset(p_msg->bd_name, 0, BD_NAME_LEN + 1); |
| 474 | memset(p_msg->features, 0, sizeof (p_msg->features)); |
| 475 | p_msg->pin_length = pin_length; |
| 476 | |
| 477 | bta_sys_sendmsg(p_msg); |
| 478 | } |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 479 | |
| 480 | /******************************************************************************* |
Myles Watson | 8af480e | 2016-11-09 10:40:23 -0800 | [diff] [blame^] | 481 | * |
| 482 | * Function BTA_DmRemoveDevice |
| 483 | * |
| 484 | * Description This function removes a device fromthe security database list of |
| 485 | * peer device. It manages unpairing even while connected. |
| 486 | * |
| 487 | * |
| 488 | * Returns void |
| 489 | * |
| 490 | ******************************************************************************/ |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 491 | tBTA_STATUS BTA_DmRemoveDevice(BD_ADDR bd_addr) |
| 492 | { |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 493 | tBTA_DM_API_REMOVE_DEVICE *p_msg = |
| 494 | (tBTA_DM_API_REMOVE_DEVICE *)osi_calloc(sizeof(tBTA_DM_API_REMOVE_DEVICE)); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 495 | |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 496 | p_msg->hdr.event = BTA_DM_API_REMOVE_DEVICE_EVT; |
| 497 | bdcpy(p_msg->bd_addr, bd_addr); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 498 | |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 499 | bta_sys_sendmsg(p_msg); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 500 | |
| 501 | return BTA_SUCCESS; |
| 502 | } |
| 503 | |
| 504 | /******************************************************************************* |
Myles Watson | 8af480e | 2016-11-09 10:40:23 -0800 | [diff] [blame^] | 505 | * |
| 506 | * Function BTA_GetEirService |
| 507 | * |
| 508 | * Description This function is called to get BTA service mask from EIR. |
| 509 | * |
| 510 | * Parameters p_eir - pointer of EIR significant part |
| 511 | * p_services - return the BTA service mask |
| 512 | * |
| 513 | * Returns None |
| 514 | * |
| 515 | ******************************************************************************/ |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame] | 516 | extern const uint16_t bta_service_id_to_uuid_lkup_tbl []; |
| 517 | void BTA_GetEirService( uint8_t *p_eir, tBTA_SERVICE_MASK *p_services ) |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 518 | { |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame] | 519 | uint8_t xx, yy; |
| 520 | uint8_t num_uuid, max_num_uuid = 32; |
| 521 | uint8_t uuid_list[32*LEN_UUID_16]; |
| 522 | uint16_t *p_uuid16 = (uint16_t *)uuid_list; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 523 | tBTA_SERVICE_MASK mask; |
| 524 | |
| 525 | BTM_GetEirUuidList( p_eir, LEN_UUID_16, &num_uuid, uuid_list, max_num_uuid); |
| 526 | for( xx = 0; xx < num_uuid; xx++ ) |
| 527 | { |
| 528 | mask = 1; |
| 529 | for( yy = 0; yy < BTA_MAX_SERVICE_ID; yy++ ) |
| 530 | { |
| 531 | if( *(p_uuid16 + xx) == bta_service_id_to_uuid_lkup_tbl[yy] ) |
| 532 | { |
| 533 | *p_services |= mask; |
| 534 | break; |
| 535 | } |
| 536 | mask <<= 1; |
| 537 | } |
| 538 | |
| 539 | /* for HSP v1.2 only device */ |
| 540 | if (*(p_uuid16 + xx) == UUID_SERVCLASS_HEADSET_HS) |
| 541 | *p_services |= BTA_HSP_SERVICE_MASK; |
| 542 | |
| 543 | if (*(p_uuid16 + xx) == UUID_SERVCLASS_HDP_SOURCE) |
| 544 | *p_services |= BTA_HL_SERVICE_MASK; |
| 545 | |
| 546 | if (*(p_uuid16 + xx) == UUID_SERVCLASS_HDP_SINK) |
| 547 | *p_services |= BTA_HL_SERVICE_MASK; |
| 548 | } |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 549 | } |
| 550 | |
| 551 | /******************************************************************************* |
Myles Watson | 8af480e | 2016-11-09 10:40:23 -0800 | [diff] [blame^] | 552 | * |
| 553 | * Function BTA_DmGetConnectionState |
| 554 | * |
| 555 | * Description Returns whether the remote device is currently connected. |
| 556 | * |
| 557 | * Returns 0 if the device is NOT connected. |
| 558 | * |
| 559 | ******************************************************************************/ |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame] | 560 | uint16_t BTA_DmGetConnectionState(const BD_ADDR bd_addr ) |
Andre Eisenbach | 5c0b052 | 2014-06-18 12:20:37 -0700 | [diff] [blame] | 561 | { |
| 562 | tBTA_DM_PEER_DEVICE * p_dev = bta_dm_find_peer_device(bd_addr); |
| 563 | return (p_dev && p_dev->conn_state == BTA_DM_CONNECTED); |
| 564 | } |
| 565 | |
| 566 | |
| 567 | /******************************************************************************* |
Myles Watson | 8af480e | 2016-11-09 10:40:23 -0800 | [diff] [blame^] | 568 | * Device Identification (DI) Server Functions |
| 569 | ******************************************************************************/ |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 570 | /******************************************************************************* |
Myles Watson | 8af480e | 2016-11-09 10:40:23 -0800 | [diff] [blame^] | 571 | * |
| 572 | * Function BTA_DmSetLocalDiRecord |
| 573 | * |
| 574 | * Description This function adds a DI record to the local SDP database. |
| 575 | * |
| 576 | * Returns BTA_SUCCESS if record set sucessfully, otherwise error code. |
| 577 | * |
| 578 | ******************************************************************************/ |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 579 | tBTA_STATUS BTA_DmSetLocalDiRecord( tBTA_DI_RECORD *p_device_info, |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame] | 580 | uint32_t *p_handle ) |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 581 | { |
| 582 | tBTA_STATUS status = BTA_FAILURE; |
| 583 | |
| 584 | if(bta_dm_di_cb.di_num < BTA_DI_NUM_MAX) |
| 585 | { |
| 586 | if(SDP_SetLocalDiRecord((tSDP_DI_RECORD *)p_device_info, p_handle) == SDP_SUCCESS) |
| 587 | { |
| 588 | if(!p_device_info->primary_record) |
| 589 | { |
| 590 | bta_dm_di_cb.di_handle[bta_dm_di_cb.di_num] = *p_handle; |
| 591 | bta_dm_di_cb.di_num ++; |
| 592 | } |
| 593 | |
| 594 | bta_sys_add_uuid(UUID_SERVCLASS_PNP_INFORMATION); |
| 595 | status = BTA_SUCCESS; |
| 596 | } |
| 597 | } |
| 598 | |
| 599 | return status; |
| 600 | } |
| 601 | |
| 602 | /******************************************************************************* |
Myles Watson | 8af480e | 2016-11-09 10:40:23 -0800 | [diff] [blame^] | 603 | * |
| 604 | * Function bta_dmexecutecallback |
| 605 | * |
| 606 | * Description This function will request BTA to execute a call back in the context of BTU task |
| 607 | * This API was named in lower case because it is only intended |
| 608 | * for the internal customers(like BTIF). |
| 609 | * |
| 610 | * Returns void |
| 611 | * |
| 612 | ******************************************************************************/ |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 613 | void bta_dmexecutecallback (tBTA_DM_EXEC_CBACK* p_callback, void * p_param) |
| 614 | { |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 615 | tBTA_DM_API_EXECUTE_CBACK *p_msg = |
| 616 | (tBTA_DM_API_EXECUTE_CBACK *)osi_malloc(sizeof(tBTA_DM_MSG)); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 617 | |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 618 | p_msg->hdr.event = BTA_DM_API_EXECUTE_CBACK_EVT; |
| 619 | p_msg->p_param= p_param; |
| 620 | p_msg->p_exec_cback= p_callback; |
| 621 | |
| 622 | bta_sys_sendmsg(p_msg); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 623 | } |
| 624 | |
| 625 | /******************************************************************************* |
Myles Watson | 8af480e | 2016-11-09 10:40:23 -0800 | [diff] [blame^] | 626 | * |
| 627 | * Function BTA_DmAddBleKey |
| 628 | * |
| 629 | * Description Add/modify LE device information. This function will be |
| 630 | * normally called during host startup to restore all required |
| 631 | * information stored in the NVRAM. |
| 632 | * |
| 633 | * Parameters: bd_addr - BD address of the peer |
| 634 | * p_le_key - LE key values. |
| 635 | * key_type - LE SMP key type. |
| 636 | * |
| 637 | * Returns BTA_SUCCESS if successful |
| 638 | * BTA_FAIL if operation failed. |
| 639 | * |
| 640 | ******************************************************************************/ |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 641 | void BTA_DmAddBleKey (BD_ADDR bd_addr, tBTA_LE_KEY_VALUE *p_le_key, tBTA_LE_KEY_TYPE key_type) |
| 642 | { |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame] | 643 | #if (BLE_INCLUDED == TRUE) |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 644 | |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 645 | tBTA_DM_API_ADD_BLEKEY *p_msg = |
| 646 | (tBTA_DM_API_ADD_BLEKEY *)osi_calloc(sizeof(tBTA_DM_API_ADD_BLEKEY)); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 647 | |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 648 | p_msg->hdr.event = BTA_DM_API_ADD_BLEKEY_EVT; |
| 649 | p_msg->key_type = key_type; |
| 650 | bdcpy(p_msg->bd_addr, bd_addr); |
| 651 | memcpy(&p_msg->blekey, p_le_key, sizeof(tBTA_LE_KEY_VALUE)); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 652 | |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 653 | bta_sys_sendmsg(p_msg); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 654 | #endif |
| 655 | } |
| 656 | |
| 657 | /******************************************************************************* |
Myles Watson | 8af480e | 2016-11-09 10:40:23 -0800 | [diff] [blame^] | 658 | * |
| 659 | * Function BTA_DmAddBleDevice |
| 660 | * |
| 661 | * Description Add a BLE device. This function will be normally called |
| 662 | * during host startup to restore all required information |
| 663 | * for a LE device stored in the NVRAM. |
| 664 | * |
| 665 | * Parameters: bd_addr - BD address of the peer |
| 666 | * dev_type - Remote device's device type. |
| 667 | * addr_type - LE device address type. |
| 668 | * |
| 669 | * Returns void |
| 670 | * |
| 671 | ******************************************************************************/ |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 672 | void BTA_DmAddBleDevice(BD_ADDR bd_addr, tBLE_ADDR_TYPE addr_type, tBT_DEVICE_TYPE dev_type) |
| 673 | { |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame] | 674 | #if (BLE_INCLUDED == TRUE) |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 675 | tBTA_DM_API_ADD_BLE_DEVICE *p_msg = |
| 676 | (tBTA_DM_API_ADD_BLE_DEVICE *)osi_calloc(sizeof(tBTA_DM_API_ADD_BLE_DEVICE)); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 677 | |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 678 | p_msg->hdr.event = BTA_DM_API_ADD_BLEDEVICE_EVT; |
| 679 | bdcpy(p_msg->bd_addr, bd_addr); |
| 680 | p_msg->addr_type = addr_type; |
| 681 | p_msg->dev_type = dev_type; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 682 | |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 683 | bta_sys_sendmsg(p_msg); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 684 | #endif |
| 685 | } |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 686 | |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 687 | /******************************************************************************* |
Myles Watson | 8af480e | 2016-11-09 10:40:23 -0800 | [diff] [blame^] | 688 | * |
| 689 | * Function BTA_DmBlePasskeyReply |
| 690 | * |
| 691 | * Description Send BLE SMP passkey reply. |
| 692 | * |
| 693 | * Parameters: bd_addr - BD address of the peer |
| 694 | * accept - passkey entry sucessful or declined. |
| 695 | * passkey - passkey value, must be a 6 digit number, |
| 696 | * can be lead by 0. |
| 697 | * |
| 698 | * Returns void |
| 699 | * |
| 700 | ******************************************************************************/ |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame] | 701 | void BTA_DmBlePasskeyReply(BD_ADDR bd_addr, bool accept, uint32_t passkey) |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 702 | { |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame] | 703 | #if (BLE_INCLUDED == TRUE) |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 704 | tBTA_DM_API_PASSKEY_REPLY *p_msg = |
| 705 | (tBTA_DM_API_PASSKEY_REPLY *)osi_calloc(sizeof(tBTA_DM_API_PASSKEY_REPLY)); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 706 | |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 707 | p_msg->hdr.event = BTA_DM_API_BLE_PASSKEY_REPLY_EVT; |
| 708 | bdcpy(p_msg->bd_addr, bd_addr); |
| 709 | p_msg->accept = accept; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 710 | |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 711 | if (accept) |
| 712 | p_msg->passkey = passkey; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 713 | |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 714 | bta_sys_sendmsg(p_msg); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 715 | #endif |
| 716 | } |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 717 | |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 718 | /******************************************************************************* |
Myles Watson | 8af480e | 2016-11-09 10:40:23 -0800 | [diff] [blame^] | 719 | * |
| 720 | * Function BTA_DmBleConfirmReply |
| 721 | * |
| 722 | * Description Send BLE SMP SC user confirmation reply. |
| 723 | * |
| 724 | * Parameters: bd_addr - BD address of the peer |
| 725 | * accept - numbers to compare are the same or different. |
| 726 | * |
| 727 | * Returns void |
| 728 | * |
| 729 | ******************************************************************************/ |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame] | 730 | void BTA_DmBleConfirmReply(BD_ADDR bd_addr, bool accept) |
Satya Calloji | 444a8da | 2015-03-06 10:38:22 -0800 | [diff] [blame] | 731 | { |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame] | 732 | #if (BLE_INCLUDED == TRUE) |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 733 | tBTA_DM_API_CONFIRM *p_msg = |
| 734 | (tBTA_DM_API_CONFIRM *)osi_calloc(sizeof(tBTA_DM_API_CONFIRM)); |
| 735 | |
| 736 | p_msg->hdr.event = BTA_DM_API_BLE_CONFIRM_REPLY_EVT; |
| 737 | bdcpy(p_msg->bd_addr, bd_addr); |
| 738 | p_msg->accept = accept; |
| 739 | |
| 740 | bta_sys_sendmsg(p_msg); |
Andre Eisenbach | 7766821 | 2015-05-06 21:49:35 -0700 | [diff] [blame] | 741 | #endif |
Satya Calloji | 444a8da | 2015-03-06 10:38:22 -0800 | [diff] [blame] | 742 | } |
| 743 | |
| 744 | /******************************************************************************* |
Myles Watson | 8af480e | 2016-11-09 10:40:23 -0800 | [diff] [blame^] | 745 | * |
| 746 | * Function BTA_DmBleSecurityGrant |
| 747 | * |
| 748 | * Description Grant security request access. |
| 749 | * |
| 750 | * Parameters: bd_addr - BD address of the peer |
| 751 | * res - security grant status. |
| 752 | * |
| 753 | * Returns void |
| 754 | * |
| 755 | ******************************************************************************/ |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 756 | void BTA_DmBleSecurityGrant(BD_ADDR bd_addr, tBTA_DM_BLE_SEC_GRANT res) |
| 757 | { |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame] | 758 | #if (BLE_INCLUDED == TRUE) |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 759 | tBTA_DM_API_BLE_SEC_GRANT *p_msg = |
| 760 | (tBTA_DM_API_BLE_SEC_GRANT *)osi_calloc(sizeof(tBTA_DM_API_BLE_SEC_GRANT)); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 761 | |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 762 | p_msg->hdr.event = BTA_DM_API_BLE_SEC_GRANT_EVT; |
| 763 | bdcpy(p_msg->bd_addr, bd_addr); |
| 764 | p_msg->res = res; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 765 | |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 766 | bta_sys_sendmsg(p_msg); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 767 | #endif |
| 768 | } |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 769 | |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 770 | /******************************************************************************* |
Myles Watson | 8af480e | 2016-11-09 10:40:23 -0800 | [diff] [blame^] | 771 | * |
| 772 | * Function BTA_DmSetBlePrefConnParams |
| 773 | * |
| 774 | * Description This function is called to set the preferred connection |
| 775 | * parameters when default connection parameter is not desired. |
| 776 | * |
| 777 | * Parameters: bd_addr - BD address of the peripheral |
| 778 | * scan_interval - scan interval |
| 779 | * scan_window - scan window |
| 780 | * min_conn_int - minimum preferred connection interval |
| 781 | * max_conn_int - maximum preferred connection interval |
| 782 | * slave_latency - preferred slave latency |
| 783 | * supervision_tout - preferred supervision timeout |
| 784 | * |
| 785 | * |
| 786 | * Returns void |
| 787 | * |
| 788 | ******************************************************************************/ |
Jakub Pawlowski | 063ca02 | 2016-04-25 10:43:02 -0700 | [diff] [blame] | 789 | void BTA_DmSetBlePrefConnParams(const BD_ADDR bd_addr, |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame] | 790 | uint16_t min_conn_int, uint16_t max_conn_int, |
| 791 | uint16_t slave_latency, uint16_t supervision_tout ) |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 792 | { |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame] | 793 | #if (BLE_INCLUDED == TRUE) |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 794 | tBTA_DM_API_BLE_CONN_PARAMS *p_msg = |
| 795 | (tBTA_DM_API_BLE_CONN_PARAMS *)osi_calloc(sizeof(tBTA_DM_API_BLE_CONN_PARAMS)); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 796 | |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 797 | p_msg->hdr.event = BTA_DM_API_BLE_CONN_PARAM_EVT; |
| 798 | memcpy(p_msg->peer_bda, bd_addr, BD_ADDR_LEN); |
| 799 | p_msg->conn_int_max = max_conn_int; |
| 800 | p_msg->conn_int_min = min_conn_int; |
| 801 | p_msg->slave_latency = slave_latency; |
| 802 | p_msg->supervision_tout = supervision_tout; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 803 | |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 804 | bta_sys_sendmsg(p_msg); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 805 | #endif |
| 806 | } |
| 807 | |
| 808 | /******************************************************************************* |
Myles Watson | 8af480e | 2016-11-09 10:40:23 -0800 | [diff] [blame^] | 809 | * |
| 810 | * Function BTA_DmSetBleConnScanParams |
| 811 | * |
| 812 | * Description This function is called to set scan parameters used in |
| 813 | * BLE connection request |
| 814 | * |
| 815 | * Parameters: scan_interval - scan interval |
| 816 | * scan_window - scan window |
| 817 | * |
| 818 | * Returns void |
| 819 | * |
| 820 | ******************************************************************************/ |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame] | 821 | void BTA_DmSetBleConnScanParams(uint32_t scan_interval, uint32_t scan_window) |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 822 | { |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame] | 823 | #if (BLE_INCLUDED == TRUE) |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 824 | tBTA_DM_API_BLE_SCAN_PARAMS *p_msg = |
| 825 | (tBTA_DM_API_BLE_SCAN_PARAMS *)osi_calloc(sizeof(tBTA_DM_API_BLE_SCAN_PARAMS)); |
| 826 | |
| 827 | p_msg->hdr.event = BTA_DM_API_BLE_CONN_SCAN_PARAM_EVT; |
| 828 | p_msg->scan_int = scan_interval; |
| 829 | p_msg->scan_window = scan_window; |
| 830 | |
| 831 | bta_sys_sendmsg(p_msg); |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame] | 832 | #endif // BLE_INCLUDED == true |
Satya Calloji | 5725fc6 | 2015-03-31 13:24:32 -0700 | [diff] [blame] | 833 | } |
| 834 | |
| 835 | /******************************************************************************* |
Myles Watson | 8af480e | 2016-11-09 10:40:23 -0800 | [diff] [blame^] | 836 | * |
| 837 | * Function BTA_DmSetBleScanParams |
| 838 | * |
| 839 | * Description This function is called to set scan parameters |
| 840 | * |
| 841 | * Parameters: client_if - Client IF |
| 842 | * scan_interval - scan interval |
| 843 | * scan_window - scan window |
| 844 | * scan_mode - scan mode |
| 845 | * scan_param_setup_status_cback - Set scan param status callback |
| 846 | * |
| 847 | * Returns void |
| 848 | * |
| 849 | ******************************************************************************/ |
Scott James Remnant | dd339ab | 2015-11-19 15:27:41 -0800 | [diff] [blame] | 850 | |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame] | 851 | #if (BLE_INCLUDED == TRUE) |
| 852 | void BTA_DmSetBleScanParams(tGATT_IF client_if, uint32_t scan_interval, |
| 853 | uint32_t scan_window, tBLE_SCAN_MODE scan_mode, |
Satya Calloji | 5725fc6 | 2015-03-31 13:24:32 -0700 | [diff] [blame] | 854 | tBLE_SCAN_PARAM_SETUP_CBACK scan_param_setup_cback) |
| 855 | { |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 856 | tBTA_DM_API_BLE_SCAN_PARAMS *p_msg = |
| 857 | (tBTA_DM_API_BLE_SCAN_PARAMS *)osi_calloc(sizeof(tBTA_DM_API_BLE_SCAN_PARAMS)); |
Satya Calloji | 5725fc6 | 2015-03-31 13:24:32 -0700 | [diff] [blame] | 858 | |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 859 | p_msg->hdr.event = BTA_DM_API_BLE_SCAN_PARAM_EVT; |
| 860 | p_msg->client_if = client_if; |
| 861 | p_msg->scan_int = scan_interval; |
| 862 | p_msg->scan_window = scan_window; |
| 863 | p_msg->scan_mode = scan_mode; |
| 864 | p_msg->scan_param_setup_cback = scan_param_setup_cback; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 865 | |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 866 | bta_sys_sendmsg(p_msg); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 867 | } |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame] | 868 | #endif // BLE_INCLUDED == true |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 869 | |
| 870 | /******************************************************************************* |
Myles Watson | 8af480e | 2016-11-09 10:40:23 -0800 | [diff] [blame^] | 871 | * |
| 872 | * Function BTA_DmSetBleAdvParams |
| 873 | * |
| 874 | * Description This function sets the advertising parameters BLE functionality. |
| 875 | * It is to be called when device act in peripheral or broadcaster |
| 876 | * role. |
| 877 | * |
| 878 | * |
| 879 | * Returns void |
| 880 | * |
| 881 | ******************************************************************************/ |
Jakub Pawlowski | 5b12a83 | 2016-08-11 03:30:47 -0700 | [diff] [blame] | 882 | void BTA_DmSetBleAdvParams(uint16_t adv_int_min, uint16_t adv_int_max, |
Andre Eisenbach | 5c44e45 | 2013-08-06 18:19:37 -0700 | [diff] [blame] | 883 | tBLE_BD_ADDR *p_dir_bda) |
| 884 | { |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame] | 885 | #if (BLE_INCLUDED == TRUE) |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 886 | if (p_dir_bda != NULL) { |
Jakub Pawlowski | 5b12a83 | 2016-08-11 03:30:47 -0700 | [diff] [blame] | 887 | tBLE_BD_ADDR *bda = new tBLE_BD_ADDR; |
| 888 | memcpy(bda, p_dir_bda, sizeof(tBLE_BD_ADDR)); |
| 889 | do_in_bta_thread(FROM_HERE, |
| 890 | base::Bind(&bta_dm_ble_set_adv_params, adv_int_min, adv_int_max, base::Owned(bda))); |
Andre Eisenbach | 5c44e45 | 2013-08-06 18:19:37 -0700 | [diff] [blame] | 891 | } |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 892 | |
Jakub Pawlowski | 5b12a83 | 2016-08-11 03:30:47 -0700 | [diff] [blame] | 893 | do_in_bta_thread(FROM_HERE, |
| 894 | base::Bind(&bta_dm_ble_set_adv_params, adv_int_min, adv_int_max, nullptr)); |
| 895 | |
Andre Eisenbach | 5c44e45 | 2013-08-06 18:19:37 -0700 | [diff] [blame] | 896 | #endif |
| 897 | } |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 898 | |
Ganesh Ganapathi Batta | 7fa4fba | 2014-04-16 16:50:09 -0700 | [diff] [blame] | 899 | /******************************************************************************* |
Myles Watson | 8af480e | 2016-11-09 10:40:23 -0800 | [diff] [blame^] | 900 | * BLE ADV data management API |
| 901 | *******************************************************************************/ |
Andre Eisenbach | 5c44e45 | 2013-08-06 18:19:37 -0700 | [diff] [blame] | 902 | |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame] | 903 | #if (BLE_INCLUDED == TRUE) |
Andre Eisenbach | 5c44e45 | 2013-08-06 18:19:37 -0700 | [diff] [blame] | 904 | /******************************************************************************* |
Myles Watson | 8af480e | 2016-11-09 10:40:23 -0800 | [diff] [blame^] | 905 | * |
| 906 | * Function BTA_DmBleSetStorageParams |
| 907 | * |
| 908 | * Description This function is called to override the BTA scan response. |
| 909 | * |
| 910 | * Parameters batch_scan_full_max -Max storage space (in %) allocated to full scanning |
| 911 | * batch_scan_trunc_max -Max storage space (in %) allocated to truncated scanning |
| 912 | * batch_scan_notify_threshold -Setup notification level based on total space |
| 913 | * p_setup_cback - Setup callback pointer |
| 914 | * p_thres_cback - Threshold callback pointer |
| 915 | * p_rep_cback - Reports callback pointer |
| 916 | * ref_value - Ref value |
| 917 | * |
| 918 | * Returns None |
| 919 | * |
| 920 | ******************************************************************************/ |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame] | 921 | extern void BTA_DmBleSetStorageParams(uint8_t batch_scan_full_max, |
| 922 | uint8_t batch_scan_trunc_max, |
| 923 | uint8_t batch_scan_notify_threshold, |
Satya Calloji | c4e2596 | 2014-05-10 23:46:24 -0700 | [diff] [blame] | 924 | tBTA_BLE_SCAN_SETUP_CBACK *p_setup_cback, |
| 925 | tBTA_BLE_SCAN_THRESHOLD_CBACK *p_thres_cback, |
| 926 | tBTA_BLE_SCAN_REP_CBACK* p_rep_cback, |
| 927 | tBTA_DM_BLE_REF_VALUE ref_value) |
| 928 | { |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 929 | tBTA_DM_API_SET_STORAGE_CONFIG *p_msg = |
| 930 | (tBTA_DM_API_SET_STORAGE_CONFIG *)osi_malloc(sizeof(tBTA_DM_API_SET_STORAGE_CONFIG)); |
| 931 | |
Satya Calloji | c4e2596 | 2014-05-10 23:46:24 -0700 | [diff] [blame] | 932 | bta_dm_cb.p_setup_cback = p_setup_cback; |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 933 | |
| 934 | p_msg->hdr.event = BTA_DM_API_BLE_SETUP_STORAGE_EVT; |
| 935 | p_msg->p_setup_cback=bta_ble_scan_setup_cb; |
| 936 | p_msg->p_thres_cback=p_thres_cback; |
| 937 | p_msg->p_read_rep_cback=p_rep_cback; |
| 938 | p_msg->ref_value = ref_value; |
| 939 | p_msg->batch_scan_full_max = batch_scan_full_max; |
| 940 | p_msg->batch_scan_trunc_max = batch_scan_trunc_max; |
| 941 | p_msg->batch_scan_notify_threshold = batch_scan_notify_threshold; |
| 942 | |
| 943 | bta_sys_sendmsg(p_msg); |
Satya Calloji | c4e2596 | 2014-05-10 23:46:24 -0700 | [diff] [blame] | 944 | } |
| 945 | |
| 946 | /******************************************************************************* |
Myles Watson | 8af480e | 2016-11-09 10:40:23 -0800 | [diff] [blame^] | 947 | * |
| 948 | * Function BTA_DmBleEnableBatchScan |
| 949 | * |
| 950 | * Description This function is called to enable the batch scan |
| 951 | * |
| 952 | * Parameters scan_mode -Batch scan mode |
| 953 | * scan_interval - Scan interval |
| 954 | * scan_window - Scan window |
| 955 | * discard_rule -Discard rules |
| 956 | * addr_type - Address type |
| 957 | * ref_value - Reference value |
| 958 | * |
| 959 | * Returns None |
| 960 | * |
| 961 | ******************************************************************************/ |
Satya Calloji | 5725fc6 | 2015-03-31 13:24:32 -0700 | [diff] [blame] | 962 | extern void BTA_DmBleEnableBatchScan(tBTA_BLE_BATCH_SCAN_MODE scan_mode, |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame] | 963 | uint32_t scan_interval, uint32_t scan_window, |
Satya Calloji | c4e2596 | 2014-05-10 23:46:24 -0700 | [diff] [blame] | 964 | tBTA_BLE_DISCARD_RULE discard_rule, |
| 965 | tBLE_ADDR_TYPE addr_type, |
| 966 | tBTA_DM_BLE_REF_VALUE ref_value) |
| 967 | { |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 968 | tBTA_DM_API_ENABLE_SCAN *p_msg = |
| 969 | (tBTA_DM_API_ENABLE_SCAN *)osi_malloc(sizeof(tBTA_DM_API_ENABLE_SCAN)); |
Satya Calloji | c4e2596 | 2014-05-10 23:46:24 -0700 | [diff] [blame] | 970 | |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 971 | p_msg->hdr.event = BTA_DM_API_BLE_ENABLE_BATCH_SCAN_EVT; |
| 972 | p_msg->scan_mode = scan_mode; |
| 973 | p_msg->scan_int = scan_interval; |
| 974 | p_msg->scan_window = scan_window; |
| 975 | p_msg->discard_rule = discard_rule; |
| 976 | p_msg->addr_type = addr_type; |
| 977 | p_msg->ref_value = ref_value; |
| 978 | |
| 979 | bta_sys_sendmsg(p_msg); |
Satya Calloji | c4e2596 | 2014-05-10 23:46:24 -0700 | [diff] [blame] | 980 | } |
| 981 | |
| 982 | /******************************************************************************* |
Myles Watson | 8af480e | 2016-11-09 10:40:23 -0800 | [diff] [blame^] | 983 | * |
| 984 | * Function BTA_DmBleDisableBatchScan |
| 985 | * |
| 986 | * Description This function is called to disable the batch scan |
| 987 | * |
| 988 | * Parameters ref_value - Reference value |
| 989 | * |
| 990 | * Returns None |
| 991 | * |
| 992 | ******************************************************************************/ |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 993 | extern void BTA_DmBleDisableBatchScan(tBTA_DM_BLE_REF_VALUE ref_value) |
Satya Calloji | c4e2596 | 2014-05-10 23:46:24 -0700 | [diff] [blame] | 994 | { |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 995 | tBTA_DM_API_DISABLE_SCAN *p_msg = |
| 996 | (tBTA_DM_API_DISABLE_SCAN *)osi_malloc(sizeof(tBTA_DM_API_DISABLE_SCAN)); |
Satya Calloji | c4e2596 | 2014-05-10 23:46:24 -0700 | [diff] [blame] | 997 | |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 998 | p_msg->hdr.event = BTA_DM_API_BLE_DISABLE_BATCH_SCAN_EVT; |
| 999 | p_msg->ref_value = ref_value; |
| 1000 | |
| 1001 | bta_sys_sendmsg(p_msg); |
Satya Calloji | c4e2596 | 2014-05-10 23:46:24 -0700 | [diff] [blame] | 1002 | } |
| 1003 | |
| 1004 | /******************************************************************************* |
Myles Watson | 8af480e | 2016-11-09 10:40:23 -0800 | [diff] [blame^] | 1005 | * |
| 1006 | * Function BTA_DmBleReadScanReports |
| 1007 | * |
| 1008 | * Description This function is called to read scan reports |
| 1009 | * |
| 1010 | * Parameters scan_type -Batch scan mode |
| 1011 | * ref_value - Reference value |
| 1012 | * |
| 1013 | * Returns None |
| 1014 | * |
| 1015 | ******************************************************************************/ |
Satya Calloji | 5725fc6 | 2015-03-31 13:24:32 -0700 | [diff] [blame] | 1016 | extern void BTA_DmBleReadScanReports(tBTA_BLE_BATCH_SCAN_MODE scan_type, |
Satya Calloji | c4e2596 | 2014-05-10 23:46:24 -0700 | [diff] [blame] | 1017 | tBTA_DM_BLE_REF_VALUE ref_value) |
| 1018 | { |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 1019 | tBTA_DM_API_READ_SCAN_REPORTS *p_msg = |
| 1020 | (tBTA_DM_API_READ_SCAN_REPORTS *)osi_malloc(sizeof(tBTA_DM_API_READ_SCAN_REPORTS)); |
Satya Calloji | c4e2596 | 2014-05-10 23:46:24 -0700 | [diff] [blame] | 1021 | |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 1022 | p_msg->hdr.event = BTA_DM_API_BLE_READ_SCAN_REPORTS_EVT; |
| 1023 | p_msg->scan_type = scan_type; |
| 1024 | p_msg->ref_value = ref_value; |
| 1025 | |
| 1026 | bta_sys_sendmsg(p_msg); |
Satya Calloji | c4e2596 | 2014-05-10 23:46:24 -0700 | [diff] [blame] | 1027 | } |
| 1028 | |
| 1029 | /******************************************************************************* |
Myles Watson | 8af480e | 2016-11-09 10:40:23 -0800 | [diff] [blame^] | 1030 | * |
| 1031 | * Function BTA_DmBleTrackAdvertiser |
| 1032 | * |
| 1033 | * Description This function is called to track advertiser |
| 1034 | * |
| 1035 | * Parameters ref_value - Reference value |
| 1036 | * p_track_adv_cback - Track ADV callback |
| 1037 | * |
| 1038 | * Returns None |
| 1039 | * |
| 1040 | ******************************************************************************/ |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 1041 | extern void BTA_DmBleTrackAdvertiser(tBTA_DM_BLE_REF_VALUE ref_value, |
Satya Calloji | 1acb61c | 2014-06-14 23:16:18 -0700 | [diff] [blame] | 1042 | tBTA_BLE_TRACK_ADV_CBACK *p_track_adv_cback) |
| 1043 | { |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 1044 | tBTA_DM_API_TRACK_ADVERTISER *p_msg = |
| 1045 | (tBTA_DM_API_TRACK_ADVERTISER *)osi_malloc(sizeof(tBTA_DM_API_TRACK_ADVERTISER)); |
Satya Calloji | 1acb61c | 2014-06-14 23:16:18 -0700 | [diff] [blame] | 1046 | |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 1047 | p_msg->hdr.event = BTA_DM_API_BLE_TRACK_ADVERTISER_EVT; |
| 1048 | p_msg->p_track_adv_cback = p_track_adv_cback; |
| 1049 | p_msg->ref_value = ref_value; |
| 1050 | |
| 1051 | bta_sys_sendmsg(p_msg); |
Satya Calloji | 1acb61c | 2014-06-14 23:16:18 -0700 | [diff] [blame] | 1052 | } |
| 1053 | |
VenkatRaghavan VijayaRaghavan | 76356ae | 2015-04-21 11:32:29 -0700 | [diff] [blame] | 1054 | #endif |
| 1055 | |
| 1056 | /******************************************************************************* |
Myles Watson | 8af480e | 2016-11-09 10:40:23 -0800 | [diff] [blame^] | 1057 | * BLE ADV data management API |
| 1058 | *******************************************************************************/ |
VenkatRaghavan VijayaRaghavan | 76356ae | 2015-04-21 11:32:29 -0700 | [diff] [blame] | 1059 | |
Satya Calloji | 1acb61c | 2014-06-14 23:16:18 -0700 | [diff] [blame] | 1060 | /******************************************************************************* |
Myles Watson | 8af480e | 2016-11-09 10:40:23 -0800 | [diff] [blame^] | 1061 | * |
| 1062 | * Function BTA_DmBleSetBgConnType |
| 1063 | * |
| 1064 | * Description This function is called to set BLE connectable mode for a |
| 1065 | * peripheral device. |
| 1066 | * |
| 1067 | * Parameters bg_conn_type: it can be auto connection, or selective connection. |
| 1068 | * p_select_cback: callback function when selective connection procedure |
| 1069 | * is being used. |
| 1070 | * |
| 1071 | * Returns void |
| 1072 | * |
| 1073 | ******************************************************************************/ |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1074 | void BTA_DmBleSetBgConnType(tBTA_DM_BLE_CONN_TYPE bg_conn_type, tBTA_DM_BLE_SEL_CBACK *p_select_cback) |
| 1075 | { |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame] | 1076 | #if (BLE_INCLUDED == TRUE) |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 1077 | tBTA_DM_API_BLE_SET_BG_CONN_TYPE *p_msg = |
| 1078 | (tBTA_DM_API_BLE_SET_BG_CONN_TYPE *)osi_calloc(sizeof(tBTA_DM_API_BLE_SET_BG_CONN_TYPE)); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1079 | |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 1080 | p_msg->hdr.event = BTA_DM_API_BLE_SET_BG_CONN_TYPE; |
| 1081 | p_msg->bg_conn_type = bg_conn_type; |
| 1082 | p_msg->p_select_cback = p_select_cback; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1083 | |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 1084 | bta_sys_sendmsg(p_msg); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1085 | #endif |
| 1086 | } |
Ganesh Ganapathi Batta | 7fa4fba | 2014-04-16 16:50:09 -0700 | [diff] [blame] | 1087 | |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1088 | /******************************************************************************* |
Myles Watson | 8af480e | 2016-11-09 10:40:23 -0800 | [diff] [blame^] | 1089 | * |
| 1090 | * Function bta_dm_discover_send_msg |
| 1091 | * |
| 1092 | * Description This function send discover message to BTA task. |
| 1093 | * |
| 1094 | * Returns void |
| 1095 | * |
| 1096 | ******************************************************************************/ |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame] | 1097 | #if (BLE_INCLUDED == TRUE && BTA_GATT_INCLUDED == TRUE) |
Ganesh Ganapathi Batta | 7fa4fba | 2014-04-16 16:50:09 -0700 | [diff] [blame] | 1098 | static void bta_dm_discover_send_msg(BD_ADDR bd_addr, tBTA_SERVICE_MASK_EXT *p_services, |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame] | 1099 | tBTA_DM_SEARCH_CBACK *p_cback, bool sdp_search, |
Ganesh Ganapathi Batta | 7fa4fba | 2014-04-16 16:50:09 -0700 | [diff] [blame] | 1100 | tBTA_TRANSPORT transport) |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1101 | { |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 1102 | const size_t len = p_services ? |
| 1103 | (sizeof(tBTA_DM_API_DISCOVER) + sizeof(tBT_UUID) * p_services->num_uuid) |
| 1104 | : sizeof(tBTA_DM_API_DISCOVER); |
| 1105 | tBTA_DM_API_DISCOVER *p_msg = (tBTA_DM_API_DISCOVER *)osi_calloc(len); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1106 | |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 1107 | p_msg->hdr.event = BTA_DM_API_DISCOVER_EVT; |
| 1108 | bdcpy(p_msg->bd_addr, bd_addr); |
| 1109 | p_msg->p_cback = p_cback; |
| 1110 | p_msg->sdp_search = sdp_search; |
| 1111 | p_msg->transport = transport; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1112 | |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 1113 | if (p_services != NULL) { |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame] | 1114 | #if (BLE_INCLUDED == TRUE && BTA_GATT_INCLUDED == TRUE) |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 1115 | p_msg->services = p_services->srvc_mask; |
| 1116 | p_msg->num_uuid = p_services->num_uuid; |
| 1117 | if (p_services->num_uuid != 0) { |
| 1118 | p_msg->p_uuid = (tBT_UUID *)(p_msg + 1); |
| 1119 | memcpy(p_msg->p_uuid, p_services->p_uuid, |
| 1120 | sizeof(tBT_UUID) * p_services->num_uuid); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1121 | } |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 1122 | #endif |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1123 | } |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 1124 | |
| 1125 | bta_sys_sendmsg(p_msg); |
Ganesh Ganapathi Batta | 7fa4fba | 2014-04-16 16:50:09 -0700 | [diff] [blame] | 1126 | } |
VenkatRaghavan VijayaRaghavan | 76356ae | 2015-04-21 11:32:29 -0700 | [diff] [blame] | 1127 | #endif |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 1128 | |
Ganesh Ganapathi Batta | 7fa4fba | 2014-04-16 16:50:09 -0700 | [diff] [blame] | 1129 | /******************************************************************************* |
Myles Watson | 8af480e | 2016-11-09 10:40:23 -0800 | [diff] [blame^] | 1130 | * |
| 1131 | * Function BTA_DmDiscoverByTransport |
| 1132 | * |
| 1133 | * Description This function does service discovery on particular transport |
| 1134 | * for services of a |
| 1135 | * peer device. When services.num_uuid is 0, it indicates all |
| 1136 | * GATT based services are to be searched; otherwise a list of |
| 1137 | * UUID of interested services should be provided through |
| 1138 | * p_services->p_uuid. |
| 1139 | * |
| 1140 | * |
| 1141 | * |
| 1142 | * Returns void |
| 1143 | * |
| 1144 | ******************************************************************************/ |
Ganesh Ganapathi Batta | 7fa4fba | 2014-04-16 16:50:09 -0700 | [diff] [blame] | 1145 | void BTA_DmDiscoverByTransport(BD_ADDR bd_addr, tBTA_SERVICE_MASK_EXT *p_services, |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame] | 1146 | tBTA_DM_SEARCH_CBACK *p_cback, bool sdp_search, |
Ganesh Ganapathi Batta | 7fa4fba | 2014-04-16 16:50:09 -0700 | [diff] [blame] | 1147 | tBTA_TRANSPORT transport) |
| 1148 | { |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame] | 1149 | #if (BLE_INCLUDED == TRUE && BTA_GATT_INCLUDED == TRUE) |
Ganesh Ganapathi Batta | 7fa4fba | 2014-04-16 16:50:09 -0700 | [diff] [blame] | 1150 | bta_dm_discover_send_msg(bd_addr, p_services, p_cback, sdp_search, transport); |
VenkatRaghavan VijayaRaghavan | 76356ae | 2015-04-21 11:32:29 -0700 | [diff] [blame] | 1151 | #endif |
Ganesh Ganapathi Batta | 7fa4fba | 2014-04-16 16:50:09 -0700 | [diff] [blame] | 1152 | } |
| 1153 | |
| 1154 | |
| 1155 | /******************************************************************************* |
Myles Watson | 8af480e | 2016-11-09 10:40:23 -0800 | [diff] [blame^] | 1156 | * |
| 1157 | * Function BTA_DmDiscoverExt |
| 1158 | * |
| 1159 | * Description This function does service discovery for services of a |
| 1160 | * peer device. When services.num_uuid is 0, it indicates all |
| 1161 | * GATT based services are to be searched; other wise a list of |
| 1162 | * UUID of interested services should be provided through |
| 1163 | * p_services->p_uuid. |
| 1164 | * |
| 1165 | * |
| 1166 | * |
| 1167 | * Returns void |
| 1168 | * |
| 1169 | ******************************************************************************/ |
Ganesh Ganapathi Batta | 7fa4fba | 2014-04-16 16:50:09 -0700 | [diff] [blame] | 1170 | void BTA_DmDiscoverExt(BD_ADDR bd_addr, tBTA_SERVICE_MASK_EXT *p_services, |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame] | 1171 | tBTA_DM_SEARCH_CBACK *p_cback, bool sdp_search) |
Ganesh Ganapathi Batta | 7fa4fba | 2014-04-16 16:50:09 -0700 | [diff] [blame] | 1172 | { |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame] | 1173 | #if (BLE_INCLUDED == TRUE && BTA_GATT_INCLUDED == TRUE) |
Ganesh Ganapathi Batta | 7fa4fba | 2014-04-16 16:50:09 -0700 | [diff] [blame] | 1174 | bta_dm_discover_send_msg(bd_addr, p_services, p_cback, sdp_search, BTA_TRANSPORT_UNKNOWN); |
VenkatRaghavan VijayaRaghavan | 76356ae | 2015-04-21 11:32:29 -0700 | [diff] [blame] | 1175 | #endif |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1176 | |
| 1177 | } |
| 1178 | |
| 1179 | /******************************************************************************* |
Myles Watson | 8af480e | 2016-11-09 10:40:23 -0800 | [diff] [blame^] | 1180 | * |
| 1181 | * Function BTA_DmSearchExt |
| 1182 | * |
| 1183 | * Description This function searches for peer Bluetooth devices. It performs |
| 1184 | * an inquiry and gets the remote name for devices. Service |
| 1185 | * discovery is done if services is non zero |
| 1186 | * |
| 1187 | * Parameters p_dm_inq: inquiry conditions |
| 1188 | * p_services: if service is not empty, service discovery will be done. |
| 1189 | * for all GATT based service condition, put num_uuid, and |
| 1190 | * p_uuid is the pointer to the list of UUID values. |
| 1191 | * p_cback: callback functino when search is completed. |
| 1192 | * |
| 1193 | * |
| 1194 | * |
| 1195 | * Returns void |
| 1196 | * |
| 1197 | ******************************************************************************/ |
Myles Watson | d628a06 | 2016-10-27 10:02:37 -0700 | [diff] [blame] | 1198 | #if (BLE_INCLUDED == TRUE && BTA_GATT_INCLUDED == TRUE) |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1199 | void BTA_DmSearchExt(tBTA_DM_INQ *p_dm_inq, tBTA_SERVICE_MASK_EXT *p_services, tBTA_DM_SEARCH_CBACK *p_cback) |
| 1200 | { |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 1201 | const size_t len = p_services ? |
| 1202 | (sizeof(tBTA_DM_API_SEARCH) + sizeof(tBT_UUID) * p_services->num_uuid) |
| 1203 | : sizeof(tBTA_DM_API_SEARCH); |
| 1204 | tBTA_DM_API_SEARCH *p_msg = (tBTA_DM_API_SEARCH *)osi_calloc(len); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1205 | |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 1206 | p_msg->hdr.event = BTA_DM_API_SEARCH_EVT; |
| 1207 | memcpy(&p_msg->inq_params, p_dm_inq, sizeof(tBTA_DM_INQ)); |
| 1208 | p_msg->p_cback = p_cback; |
| 1209 | p_msg->rs_res = BTA_DM_RS_NONE; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1210 | |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 1211 | if (p_services != NULL) { |
| 1212 | p_msg->services = p_services->srvc_mask; |
| 1213 | p_msg->num_uuid = p_services->num_uuid; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1214 | |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 1215 | if (p_services->num_uuid != 0) { |
| 1216 | p_msg->p_uuid = (tBT_UUID *)(p_msg + 1); |
| 1217 | memcpy(p_msg->p_uuid, p_services->p_uuid, |
| 1218 | sizeof(tBT_UUID) * p_services->num_uuid); |
| 1219 | } else { |
| 1220 | p_msg->p_uuid = NULL; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1221 | } |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1222 | } |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 1223 | |
| 1224 | bta_sys_sendmsg(p_msg); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1225 | } |
Myles Watson | d628a06 | 2016-10-27 10:02:37 -0700 | [diff] [blame] | 1226 | #else |
| 1227 | void BTA_DmSearchExt(UNUSED_ATTR tBTA_DM_INQ *p_dm_inq, |
| 1228 | UNUSED_ATTR tBTA_SERVICE_MASK_EXT *p_services, |
| 1229 | UNUSED_ATTR tBTA_DM_SEARCH_CBACK *p_cback) |
| 1230 | { |
| 1231 | } |
| 1232 | #endif |
Ganesh Ganapathi Batta | ead3cde | 2013-02-05 15:22:31 -0800 | [diff] [blame] | 1233 | /******************************************************************************* |
Myles Watson | 8af480e | 2016-11-09 10:40:23 -0800 | [diff] [blame^] | 1234 | * |
| 1235 | * Function BTA_DmBleUpdateConnectionParam |
| 1236 | * |
| 1237 | * Description Update connection parameters, can only be used when connection is up. |
| 1238 | * |
| 1239 | * Parameters: bd_addr - BD address of the peer |
| 1240 | * min_int - minimum connection interval, [0x0004~ 0x4000] |
| 1241 | * max_int - maximum connection interval, [0x0004~ 0x4000] |
| 1242 | * latency - slave latency [0 ~ 500] |
| 1243 | * timeout - supervision timeout [0x000a ~ 0xc80] |
| 1244 | * |
| 1245 | * Returns void |
| 1246 | * |
| 1247 | ******************************************************************************/ |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame] | 1248 | void BTA_DmBleUpdateConnectionParam(BD_ADDR bd_addr, uint16_t min_int, |
| 1249 | uint16_t max_int, uint16_t latency, |
| 1250 | uint16_t timeout) |
Ganesh Ganapathi Batta | ead3cde | 2013-02-05 15:22:31 -0800 | [diff] [blame] | 1251 | { |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame] | 1252 | #if (BLE_INCLUDED == TRUE) |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 1253 | tBTA_DM_API_UPDATE_CONN_PARAM *p_msg = |
| 1254 | (tBTA_DM_API_UPDATE_CONN_PARAM *)osi_calloc(sizeof(tBTA_DM_API_UPDATE_CONN_PARAM)); |
VenkatRaghavan VijayaRaghavan | 76356ae | 2015-04-21 11:32:29 -0700 | [diff] [blame] | 1255 | |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 1256 | p_msg->hdr.event = BTA_DM_API_UPDATE_CONN_PARAM_EVT; |
| 1257 | bdcpy(p_msg->bd_addr, bd_addr); |
| 1258 | p_msg->min_int = min_int; |
| 1259 | p_msg->max_int = max_int; |
| 1260 | p_msg->latency = latency; |
| 1261 | p_msg->timeout = timeout; |
VenkatRaghavan VijayaRaghavan | 76356ae | 2015-04-21 11:32:29 -0700 | [diff] [blame] | 1262 | |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 1263 | bta_sys_sendmsg(p_msg); |
VenkatRaghavan VijayaRaghavan | 76356ae | 2015-04-21 11:32:29 -0700 | [diff] [blame] | 1264 | #endif |
Ganesh Ganapathi Batta | ead3cde | 2013-02-05 15:22:31 -0800 | [diff] [blame] | 1265 | } |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 1266 | |
Ganesh Ganapathi Batta | ead3cde | 2013-02-05 15:22:31 -0800 | [diff] [blame] | 1267 | /******************************************************************************* |
Myles Watson | 8af480e | 2016-11-09 10:40:23 -0800 | [diff] [blame^] | 1268 | * |
| 1269 | * Function BTA_DmBleConfigLocalPrivacy |
| 1270 | * |
| 1271 | * Description Enable/disable privacy on the local device |
| 1272 | * |
| 1273 | * Parameters: privacy_enable - enable/disabe privacy on remote device. |
| 1274 | * |
| 1275 | * Returns void |
| 1276 | * |
| 1277 | ******************************************************************************/ |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame] | 1278 | void BTA_DmBleConfigLocalPrivacy(bool privacy_enable) |
Ganesh Ganapathi Batta | ead3cde | 2013-02-05 15:22:31 -0800 | [diff] [blame] | 1279 | { |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame] | 1280 | #if (BLE_INCLUDED == TRUE && BLE_PRIVACY_SPT == TRUE) |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 1281 | tBTA_DM_API_LOCAL_PRIVACY *p_msg = |
| 1282 | (tBTA_DM_API_LOCAL_PRIVACY *)osi_calloc(sizeof(tBTA_DM_API_ENABLE_PRIVACY)); |
Wei Wang | ed534e3 | 2014-05-20 06:30:13 +0000 | [diff] [blame] | 1283 | |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 1284 | p_msg->hdr.event = BTA_DM_API_LOCAL_PRIVACY_EVT; |
| 1285 | p_msg->privacy_enable = privacy_enable; |
Wei Wang | ed534e3 | 2014-05-20 06:30:13 +0000 | [diff] [blame] | 1286 | |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 1287 | bta_sys_sendmsg(p_msg); |
Wei Wang | ed534e3 | 2014-05-20 06:30:13 +0000 | [diff] [blame] | 1288 | #else |
Prerepa Viswanadham | 16fe082 | 2014-08-07 11:38:06 -0700 | [diff] [blame] | 1289 | UNUSED (privacy_enable); |
Wei Wang | ed534e3 | 2014-05-20 06:30:13 +0000 | [diff] [blame] | 1290 | #endif |
Ganesh Ganapathi Batta | ead3cde | 2013-02-05 15:22:31 -0800 | [diff] [blame] | 1291 | } |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1292 | |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame] | 1293 | #if (BLE_INCLUDED == TRUE) |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1294 | /******************************************************************************* |
Myles Watson | 8af480e | 2016-11-09 10:40:23 -0800 | [diff] [blame^] | 1295 | * |
| 1296 | * Function BTA_DmBleCfgFilterCondition |
| 1297 | * |
| 1298 | * Description This function is called to configure the adv data payload filter |
| 1299 | * condition. |
| 1300 | * |
| 1301 | * Parameters action: to read/write/clear |
| 1302 | * cond_type: filter condition type |
| 1303 | * filt_index - Filter index |
| 1304 | * p_cond: filter condition parameter |
| 1305 | * p_cmpl_back - Command completed callback |
| 1306 | * ref_value - Reference value |
| 1307 | * |
| 1308 | * Returns void |
| 1309 | * |
| 1310 | ******************************************************************************/ |
Myles Watson | d628a06 | 2016-10-27 10:02:37 -0700 | [diff] [blame] | 1311 | #if (BLE_ANDROID_CONTROLLER_SCAN_FILTER == TRUE) |
Satya Calloji | 1a9247a | 2014-06-05 13:15:15 -0700 | [diff] [blame] | 1312 | void BTA_DmBleCfgFilterCondition(tBTA_DM_BLE_SCAN_COND_OP action, |
| 1313 | tBTA_DM_BLE_PF_COND_TYPE cond_type, |
| 1314 | tBTA_DM_BLE_PF_FILT_INDEX filt_index, |
| 1315 | tBTA_DM_BLE_PF_COND_PARAM *p_cond, |
| 1316 | tBTA_DM_BLE_PF_CFG_CBACK *p_cmpl_cback, |
| 1317 | tBTA_DM_BLE_REF_VALUE ref_value) |
| 1318 | { |
Satya Calloji | 1a9247a | 2014-06-05 13:15:15 -0700 | [diff] [blame] | 1319 | tBTA_DM_API_CFG_FILTER_COND *p_msg; |
| 1320 | APPL_TRACE_API ("BTA_DmBleCfgFilterCondition: %d, %d", action, cond_type); |
| 1321 | |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame] | 1322 | uint16_t len = sizeof(tBTA_DM_API_CFG_FILTER_COND) + |
Satya Calloji | 6cbb113 | 2014-09-03 10:01:44 -0700 | [diff] [blame] | 1323 | sizeof(tBTA_DM_BLE_PF_COND_PARAM); |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame] | 1324 | uint8_t *p; |
Satya Calloji | 1a9247a | 2014-06-05 13:15:15 -0700 | [diff] [blame] | 1325 | |
Satya Calloji | 6cbb113 | 2014-09-03 10:01:44 -0700 | [diff] [blame] | 1326 | if (NULL != p_cond) |
| 1327 | { |
| 1328 | switch(cond_type) |
| 1329 | { |
| 1330 | case BTA_DM_BLE_PF_SRVC_DATA_PATTERN: |
| 1331 | case BTA_DM_BLE_PF_MANU_DATA: |
| 1332 | /* Length of pattern and pattern mask and other elements in */ |
| 1333 | /* tBTA_DM_BLE_PF_MANU_COND */ |
| 1334 | len += ((p_cond->manu_data.data_len) * 2) + |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame] | 1335 | sizeof(uint16_t) + sizeof(uint16_t) + sizeof(uint8_t); |
Satya Calloji | 6cbb113 | 2014-09-03 10:01:44 -0700 | [diff] [blame] | 1336 | break; |
| 1337 | |
| 1338 | case BTA_DM_BLE_PF_LOCAL_NAME: |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame] | 1339 | len += ((p_cond->local_name.data_len) + sizeof(uint8_t)); |
Satya Calloji | 6cbb113 | 2014-09-03 10:01:44 -0700 | [diff] [blame] | 1340 | break; |
| 1341 | |
| 1342 | case BTM_BLE_PF_SRVC_UUID: |
| 1343 | case BTM_BLE_PF_SRVC_SOL_UUID: |
| 1344 | len += sizeof(tBLE_BD_ADDR) + sizeof(tBTA_DM_BLE_PF_COND_MASK); |
| 1345 | break; |
| 1346 | |
| 1347 | default: |
| 1348 | break; |
| 1349 | } |
| 1350 | } |
| 1351 | |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 1352 | p_msg = (tBTA_DM_API_CFG_FILTER_COND *)osi_calloc(len); |
| 1353 | p_msg->hdr.event = BTA_DM_API_CFG_FILTER_COND_EVT; |
| 1354 | p_msg->action = action; |
| 1355 | p_msg->cond_type = cond_type; |
| 1356 | p_msg->filt_index = filt_index; |
| 1357 | p_msg->p_filt_cfg_cback = p_cmpl_cback; |
| 1358 | p_msg->ref_value = ref_value; |
| 1359 | if (p_cond) { |
| 1360 | p_msg->p_cond_param = (tBTA_DM_BLE_PF_COND_PARAM *)(p_msg + 1); |
| 1361 | memcpy(p_msg->p_cond_param, p_cond, sizeof(tBTA_DM_BLE_PF_COND_PARAM)); |
VenkatRaghavan VijayaRaghavan | 76356ae | 2015-04-21 11:32:29 -0700 | [diff] [blame] | 1362 | |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame] | 1363 | p = (uint8_t *)(p_msg->p_cond_param + 1); |
Satya Calloji | 1a9247a | 2014-06-05 13:15:15 -0700 | [diff] [blame] | 1364 | |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 1365 | if (cond_type == BTA_DM_BLE_PF_SRVC_DATA_PATTERN || |
| 1366 | cond_type == BTA_DM_BLE_PF_MANU_DATA) { |
| 1367 | p_msg->p_cond_param->manu_data.p_pattern = p; |
| 1368 | p_msg->p_cond_param->manu_data.data_len = p_cond->manu_data.data_len; |
| 1369 | memcpy(p_msg->p_cond_param->manu_data.p_pattern, p_cond->manu_data.p_pattern, |
| 1370 | p_cond->manu_data.data_len); |
| 1371 | p += p_cond->manu_data.data_len; |
Satya Calloji | 1a9247a | 2014-06-05 13:15:15 -0700 | [diff] [blame] | 1372 | |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 1373 | if (cond_type == BTA_DM_BLE_PF_MANU_DATA) { |
| 1374 | p_msg->p_cond_param->manu_data.company_id_mask = |
| 1375 | p_cond->manu_data.company_id_mask; |
| 1376 | if ( p_cond->manu_data.p_pattern_mask != NULL) { |
| 1377 | p_msg->p_cond_param->manu_data.p_pattern_mask = p; |
| 1378 | memcpy(p_msg->p_cond_param->manu_data.p_pattern_mask, |
| 1379 | p_cond->manu_data.p_pattern_mask, |
| 1380 | p_cond->manu_data.data_len); |
Satya Calloji | 1a9247a | 2014-06-05 13:15:15 -0700 | [diff] [blame] | 1381 | } |
| 1382 | } |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 1383 | } else if (cond_type == BTA_DM_BLE_PF_LOCAL_NAME) { |
| 1384 | p_msg->p_cond_param->local_name.p_data = p; |
| 1385 | p_msg->p_cond_param->local_name.data_len = |
| 1386 | p_cond->local_name.data_len; |
| 1387 | memcpy(p_msg->p_cond_param->local_name.p_data, |
| 1388 | p_cond->local_name.p_data, p_cond->local_name.data_len); |
| 1389 | } else if (cond_type == BTM_BLE_PF_SRVC_UUID || |
| 1390 | cond_type == BTM_BLE_PF_SRVC_SOL_UUID) { |
| 1391 | if (p_cond->srvc_uuid.p_target_addr != NULL) { |
| 1392 | p_msg->p_cond_param->srvc_uuid.p_target_addr = (tBLE_BD_ADDR *)(p); |
| 1393 | p_msg->p_cond_param->srvc_uuid.p_target_addr->type = |
| 1394 | p_cond->srvc_uuid.p_target_addr->type; |
| 1395 | memcpy(p_msg->p_cond_param->srvc_uuid.p_target_addr->bda, |
| 1396 | p_cond->srvc_uuid.p_target_addr->bda, BD_ADDR_LEN); |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame] | 1397 | p = (uint8_t *)(p_msg->p_cond_param->srvc_uuid.p_target_addr + 1); |
Satya Calloji | 1a9247a | 2014-06-05 13:15:15 -0700 | [diff] [blame] | 1398 | } |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 1399 | if (p_cond->srvc_uuid.p_uuid_mask) { |
| 1400 | p_msg->p_cond_param->srvc_uuid.p_uuid_mask = (tBTA_DM_BLE_PF_COND_MASK *)p; |
| 1401 | memcpy(p_msg->p_cond_param->srvc_uuid.p_uuid_mask, |
| 1402 | p_cond->srvc_uuid.p_uuid_mask, |
| 1403 | sizeof(tBTA_DM_BLE_PF_COND_MASK)); |
Satya Calloji | 1a9247a | 2014-06-05 13:15:15 -0700 | [diff] [blame] | 1404 | } |
| 1405 | } |
Satya Calloji | 1a9247a | 2014-06-05 13:15:15 -0700 | [diff] [blame] | 1406 | } |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 1407 | |
| 1408 | bta_sys_sendmsg(p_msg); |
| 1409 | |
Satya Calloji | 1a9247a | 2014-06-05 13:15:15 -0700 | [diff] [blame] | 1410 | } |
Myles Watson | d628a06 | 2016-10-27 10:02:37 -0700 | [diff] [blame] | 1411 | #else |
| 1412 | void BTA_DmBleCfgFilterCondition(UNUSED_ATTR tBTA_DM_BLE_SCAN_COND_OP action, |
| 1413 | UNUSED_ATTR tBTA_DM_BLE_PF_COND_TYPE cond_type, |
| 1414 | UNUSED_ATTR tBTA_DM_BLE_PF_FILT_INDEX filt_index, |
| 1415 | UNUSED_ATTR tBTA_DM_BLE_PF_COND_PARAM *p_cond, |
| 1416 | UNUSED_ATTR tBTA_DM_BLE_PF_CFG_CBACK *p_cmpl_cback, |
| 1417 | UNUSED_ATTR tBTA_DM_BLE_REF_VALUE ref_value) |
| 1418 | { |
| 1419 | } |
| 1420 | #endif |
Satya Calloji | 1a9247a | 2014-06-05 13:15:15 -0700 | [diff] [blame] | 1421 | |
| 1422 | /******************************************************************************* |
Myles Watson | 8af480e | 2016-11-09 10:40:23 -0800 | [diff] [blame^] | 1423 | * |
| 1424 | * Function BTA_DmBleScanFilterSetup |
| 1425 | * |
| 1426 | * Description This function is called to setup the adv data payload filter param |
| 1427 | * |
| 1428 | * Parameters p_target: enable the filter condition on a target device; if NULL |
| 1429 | * filt_index - Filter index |
| 1430 | * p_filt_params -Filter parameters |
| 1431 | * ref_value - Reference value |
| 1432 | * action - Add, delete or clear |
| 1433 | * p_cmpl_back - Command completed callback |
| 1434 | * |
| 1435 | * Returns void |
| 1436 | * |
| 1437 | ******************************************************************************/ |
Myles Watson | d628a06 | 2016-10-27 10:02:37 -0700 | [diff] [blame] | 1438 | #if (BLE_ANDROID_CONTROLLER_SCAN_FILTER == TRUE) |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame] | 1439 | void BTA_DmBleScanFilterSetup(uint8_t action, |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 1440 | tBTA_DM_BLE_PF_FILT_INDEX filt_index, |
| 1441 | tBTA_DM_BLE_PF_FILT_PARAMS *p_filt_params, |
| 1442 | tBLE_BD_ADDR *p_target, |
| 1443 | tBTA_DM_BLE_PF_PARAM_CBACK *p_cmpl_cback, |
| 1444 | tBTA_DM_BLE_REF_VALUE ref_value) |
Satya Calloji | 1a9247a | 2014-06-05 13:15:15 -0700 | [diff] [blame] | 1445 | { |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 1446 | const size_t len = sizeof(tBTA_DM_API_SCAN_FILTER_PARAM_SETUP) + |
| 1447 | sizeof(tBLE_BD_ADDR); |
| 1448 | tBTA_DM_API_SCAN_FILTER_PARAM_SETUP *p_msg = |
| 1449 | (tBTA_DM_API_SCAN_FILTER_PARAM_SETUP *)osi_calloc(len); |
Satya Calloji | 1a9247a | 2014-06-05 13:15:15 -0700 | [diff] [blame] | 1450 | |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 1451 | APPL_TRACE_API("%s: %d", __func__, action); |
Satya Calloji | 1a9247a | 2014-06-05 13:15:15 -0700 | [diff] [blame] | 1452 | |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 1453 | p_msg->hdr.event = BTA_DM_API_SCAN_FILTER_SETUP_EVT; |
| 1454 | p_msg->action = action; |
| 1455 | p_msg->filt_index = filt_index; |
| 1456 | if (p_filt_params) { |
| 1457 | memcpy(&p_msg->filt_params, p_filt_params, |
| 1458 | sizeof(tBTA_DM_BLE_PF_FILT_PARAMS)); |
Satya Calloji | 1a9247a | 2014-06-05 13:15:15 -0700 | [diff] [blame] | 1459 | } |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 1460 | p_msg->p_filt_param_cback = p_cmpl_cback; |
| 1461 | p_msg->ref_value = ref_value; |
| 1462 | |
| 1463 | if (p_target) { |
| 1464 | p_msg->p_target = (tBLE_BD_ADDR *)(p_msg + 1); |
| 1465 | memcpy(p_msg->p_target, p_target, sizeof(tBLE_BD_ADDR)); |
| 1466 | } |
| 1467 | |
| 1468 | bta_sys_sendmsg(p_msg); |
Satya Calloji | 1a9247a | 2014-06-05 13:15:15 -0700 | [diff] [blame] | 1469 | } |
Myles Watson | d628a06 | 2016-10-27 10:02:37 -0700 | [diff] [blame] | 1470 | #else |
| 1471 | void BTA_DmBleScanFilterSetup(UNUSED_ATTR uint8_t action, |
| 1472 | UNUSED_ATTR tBTA_DM_BLE_PF_FILT_INDEX filt_index, |
| 1473 | UNUSED_ATTR tBTA_DM_BLE_PF_FILT_PARAMS *p_filt_params, |
| 1474 | UNUSED_ATTR tBLE_BD_ADDR *p_target, |
| 1475 | UNUSED_ATTR tBTA_DM_BLE_PF_PARAM_CBACK *p_cmpl_cback, |
| 1476 | UNUSED_ATTR tBTA_DM_BLE_REF_VALUE ref_value) |
| 1477 | } |
| 1478 | #endif |
Satya Calloji | 1a9247a | 2014-06-05 13:15:15 -0700 | [diff] [blame] | 1479 | |
| 1480 | /******************************************************************************* |
Myles Watson | 8af480e | 2016-11-09 10:40:23 -0800 | [diff] [blame^] | 1481 | * |
| 1482 | * Function BTA_DmBleGetEnergyInfo |
| 1483 | * |
| 1484 | * Description This function is called to obtain the energy info |
| 1485 | * |
| 1486 | * Parameters p_cmpl_cback - Command complete callback |
| 1487 | * |
| 1488 | * Returns void |
| 1489 | * |
| 1490 | ******************************************************************************/ |
Satya Calloji | e5ba884 | 2014-07-03 17:18:02 -0700 | [diff] [blame] | 1491 | void BTA_DmBleGetEnergyInfo(tBTA_BLE_ENERGY_INFO_CBACK *p_cmpl_cback) |
| 1492 | { |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 1493 | const size_t len = sizeof(tBTA_DM_API_ENERGY_INFO) + sizeof(tBLE_BD_ADDR); |
| 1494 | tBTA_DM_API_ENERGY_INFO *p_msg = (tBTA_DM_API_ENERGY_INFO *)osi_calloc(len); |
Satya Calloji | e5ba884 | 2014-07-03 17:18:02 -0700 | [diff] [blame] | 1495 | |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 1496 | APPL_TRACE_API("%s", __func__); |
Satya Calloji | e5ba884 | 2014-07-03 17:18:02 -0700 | [diff] [blame] | 1497 | |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 1498 | p_msg->hdr.event = BTA_DM_API_BLE_ENERGY_INFO_EVT; |
| 1499 | p_msg->p_energy_info_cback = p_cmpl_cback; |
| 1500 | |
| 1501 | bta_sys_sendmsg(p_msg); |
Satya Calloji | e5ba884 | 2014-07-03 17:18:02 -0700 | [diff] [blame] | 1502 | } |
| 1503 | |
| 1504 | /******************************************************************************* |
Myles Watson | 8af480e | 2016-11-09 10:40:23 -0800 | [diff] [blame^] | 1505 | * |
| 1506 | * Function BTA_DmEnableScanFilter |
| 1507 | * |
| 1508 | * Description This function is called to enable the adv data payload filter |
| 1509 | * |
| 1510 | * Parameters action - enable or disable the APCF feature |
| 1511 | * p_cmpl_cback - Command completed callback |
| 1512 | * ref_value - Reference value |
| 1513 | * |
| 1514 | * Returns void |
| 1515 | * |
| 1516 | ******************************************************************************/ |
Myles Watson | d628a06 | 2016-10-27 10:02:37 -0700 | [diff] [blame] | 1517 | #if (BLE_ANDROID_CONTROLLER_SCAN_FILTER == TRUE) |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame] | 1518 | void BTA_DmEnableScanFilter(uint8_t action, tBTA_DM_BLE_PF_STATUS_CBACK *p_cmpl_cback, |
Satya Calloji | 1a9247a | 2014-06-05 13:15:15 -0700 | [diff] [blame] | 1519 | tBTA_DM_BLE_REF_VALUE ref_value) |
| 1520 | { |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 1521 | const size_t len = sizeof(tBTA_DM_API_ENABLE_SCAN_FILTER) + |
| 1522 | sizeof(tBLE_BD_ADDR); |
| 1523 | tBTA_DM_API_ENABLE_SCAN_FILTER *p_msg = |
| 1524 | (tBTA_DM_API_ENABLE_SCAN_FILTER *)osi_calloc(len); |
Satya Calloji | 1a9247a | 2014-06-05 13:15:15 -0700 | [diff] [blame] | 1525 | |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 1526 | APPL_TRACE_API("%s: %d", __func__, action); |
Satya Calloji | 1a9247a | 2014-06-05 13:15:15 -0700 | [diff] [blame] | 1527 | |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 1528 | p_msg->hdr.event = BTA_DM_API_SCAN_FILTER_ENABLE_EVT; |
| 1529 | p_msg->action = action; |
| 1530 | p_msg->ref_value = ref_value; |
| 1531 | p_msg->p_filt_status_cback = p_cmpl_cback; |
Satya Calloji | 1a9247a | 2014-06-05 13:15:15 -0700 | [diff] [blame] | 1532 | |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 1533 | bta_sys_sendmsg(p_msg); |
Satya Calloji | 1a9247a | 2014-06-05 13:15:15 -0700 | [diff] [blame] | 1534 | |
Satya Calloji | 1a9247a | 2014-06-05 13:15:15 -0700 | [diff] [blame] | 1535 | } |
Myles Watson | d628a06 | 2016-10-27 10:02:37 -0700 | [diff] [blame] | 1536 | #else |
| 1537 | void BTA_DmEnableScanFilter(UNUSED_ATTR uint8_t action, |
| 1538 | UNUSED_ATTR tBTA_DM_BLE_PF_STATUS_CBACK *p_cmpl_cback, |
| 1539 | UNUSED_ATTR tBTA_DM_BLE_REF_VALUE ref_value) |
| 1540 | { |
| 1541 | } |
| 1542 | #endif |
Satya Calloji | 1a9247a | 2014-06-05 13:15:15 -0700 | [diff] [blame] | 1543 | |
| 1544 | /******************************************************************************* |
Myles Watson | 8af480e | 2016-11-09 10:40:23 -0800 | [diff] [blame^] | 1545 | * |
| 1546 | * Function BTA_DmBleUpdateConnectionParams |
| 1547 | * |
| 1548 | * Description Update connection parameters, can only be used when connection is up. |
| 1549 | * |
| 1550 | * Parameters: bd_addr - BD address of the peer |
| 1551 | * min_int - minimum connection interval, [0x0004~ 0x4000] |
| 1552 | * max_int - maximum connection interval, [0x0004~ 0x4000] |
| 1553 | * latency - slave latency [0 ~ 500] |
| 1554 | * timeout - supervision timeout [0x000a ~ 0xc80] |
| 1555 | * |
| 1556 | * Returns void |
| 1557 | * |
| 1558 | ******************************************************************************/ |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame] | 1559 | void BTA_DmBleUpdateConnectionParams(const BD_ADDR bd_addr, uint16_t min_int, uint16_t max_int, |
| 1560 | uint16_t latency, uint16_t timeout) |
Ganesh Ganapathi Batta | 7fa4fba | 2014-04-16 16:50:09 -0700 | [diff] [blame] | 1561 | { |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 1562 | tBTA_DM_API_UPDATE_CONN_PARAM *p_msg = |
| 1563 | (tBTA_DM_API_UPDATE_CONN_PARAM *)osi_calloc(sizeof(tBTA_DM_API_UPDATE_CONN_PARAM)); |
Ganesh Ganapathi Batta | 7fa4fba | 2014-04-16 16:50:09 -0700 | [diff] [blame] | 1564 | |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 1565 | p_msg->hdr.event = BTA_DM_API_UPDATE_CONN_PARAM_EVT; |
| 1566 | bdcpy(p_msg->bd_addr, bd_addr); |
| 1567 | p_msg->min_int = min_int; |
| 1568 | p_msg->max_int = max_int; |
| 1569 | p_msg->latency = latency; |
| 1570 | p_msg->timeout = timeout; |
Ganesh Ganapathi Batta | 7fa4fba | 2014-04-16 16:50:09 -0700 | [diff] [blame] | 1571 | |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 1572 | bta_sys_sendmsg(p_msg); |
Wei Wang | ea85048 | 2014-05-20 04:52:26 +0000 | [diff] [blame] | 1573 | } |
Priti Aghera | 636d671 | 2014-12-18 13:55:48 -0800 | [diff] [blame] | 1574 | |
| 1575 | /******************************************************************************* |
Myles Watson | 8af480e | 2016-11-09 10:40:23 -0800 | [diff] [blame^] | 1576 | * |
| 1577 | * Function BTA_DmBleSetDataLength |
| 1578 | * |
| 1579 | * Description This function is to set maximum LE data packet size |
| 1580 | * |
| 1581 | * Returns void |
| 1582 | * |
| 1583 | * |
| 1584 | ******************************************************************************/ |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame] | 1585 | void BTA_DmBleSetDataLength(BD_ADDR remote_device, uint16_t tx_data_length) |
Priti Aghera | 636d671 | 2014-12-18 13:55:48 -0800 | [diff] [blame] | 1586 | { |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 1587 | tBTA_DM_API_BLE_SET_DATA_LENGTH *p_msg = |
| 1588 | (tBTA_DM_API_BLE_SET_DATA_LENGTH *)osi_malloc(sizeof(tBTA_DM_API_BLE_SET_DATA_LENGTH)); |
Priti Aghera | 636d671 | 2014-12-18 13:55:48 -0800 | [diff] [blame] | 1589 | |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 1590 | bdcpy(p_msg->remote_bda, remote_device); |
| 1591 | p_msg->hdr.event = BTA_DM_API_SET_DATA_LENGTH_EVT; |
| 1592 | p_msg->tx_data_length = tx_data_length; |
Priti Aghera | 636d671 | 2014-12-18 13:55:48 -0800 | [diff] [blame] | 1593 | |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 1594 | bta_sys_sendmsg(p_msg); |
Priti Aghera | 636d671 | 2014-12-18 13:55:48 -0800 | [diff] [blame] | 1595 | } |
| 1596 | |
Wei Wang | a6ce775 | 2014-05-20 06:30:32 +0000 | [diff] [blame] | 1597 | #endif |
Ganesh Ganapathi Batta | 7fa4fba | 2014-04-16 16:50:09 -0700 | [diff] [blame] | 1598 | |
| 1599 | /******************************************************************************* |
Myles Watson | 8af480e | 2016-11-09 10:40:23 -0800 | [diff] [blame^] | 1600 | * |
| 1601 | * Function BTA_DmSetEncryption |
| 1602 | * |
| 1603 | * Description This function is called to ensure that connection is |
| 1604 | * encrypted. Should be called only on an open connection. |
| 1605 | * Typically only needed for connections that first want to |
| 1606 | * bring up unencrypted links, then later encrypt them. |
| 1607 | * |
| 1608 | * Parameters: bd_addr - Address of the peer device |
| 1609 | * transport - transport of the link to be encruypted |
| 1610 | * p_callback - Pointer to callback function to indicat the |
| 1611 | * link encryption status |
| 1612 | * sec_act - This is the security action to indicate |
| 1613 | * what knid of BLE security level is required for |
| 1614 | * the BLE link if the BLE is supported |
| 1615 | * Note: This parameter is ignored for the BR/EDR link |
| 1616 | * or the BLE is not supported |
| 1617 | * |
| 1618 | * Returns void |
| 1619 | * |
| 1620 | ******************************************************************************/ |
Ganesh Ganapathi Batta | 7fa4fba | 2014-04-16 16:50:09 -0700 | [diff] [blame] | 1621 | void BTA_DmSetEncryption(BD_ADDR bd_addr, tBTA_TRANSPORT transport, tBTA_DM_ENCRYPT_CBACK *p_callback, |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1622 | tBTA_DM_BLE_SEC_ACT sec_act) |
| 1623 | { |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 1624 | tBTA_DM_API_SET_ENCRYPTION *p_msg = (tBTA_DM_API_SET_ENCRYPTION *)osi_calloc(sizeof(tBTA_DM_API_SET_ENCRYPTION)); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1625 | |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 1626 | APPL_TRACE_API("%s", __func__); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1627 | |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 1628 | p_msg->hdr.event = BTA_DM_API_SET_ENCRYPTION_EVT; |
| 1629 | memcpy(p_msg->bd_addr, bd_addr, BD_ADDR_LEN); |
| 1630 | p_msg->transport = transport; |
| 1631 | p_msg->p_callback = p_callback; |
| 1632 | p_msg->sec_act = sec_act; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1633 | |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 1634 | bta_sys_sendmsg(p_msg); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1635 | } |
| 1636 | |
Ganesh Ganapathi Batta | ead3cde | 2013-02-05 15:22:31 -0800 | [diff] [blame] | 1637 | /******************************************************************************* |
Myles Watson | 8af480e | 2016-11-09 10:40:23 -0800 | [diff] [blame^] | 1638 | * |
| 1639 | * Function BTA_DmCloseACL |
| 1640 | * |
| 1641 | * Description This function force to close an ACL connection and remove the |
| 1642 | * device from the security database list of known devices. |
| 1643 | * |
| 1644 | * Parameters: bd_addr - Address of the peer device |
| 1645 | * remove_dev - remove device or not after link down |
| 1646 | * |
| 1647 | * Returns void |
| 1648 | * |
| 1649 | ******************************************************************************/ |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame] | 1650 | void BTA_DmCloseACL(BD_ADDR bd_addr, bool remove_dev, tBTA_TRANSPORT transport) |
Ganesh Ganapathi Batta | ead3cde | 2013-02-05 15:22:31 -0800 | [diff] [blame] | 1651 | { |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 1652 | tBTA_DM_API_REMOVE_ACL *p_msg = |
| 1653 | (tBTA_DM_API_REMOVE_ACL *)osi_calloc(sizeof(tBTA_DM_API_REMOVE_ACL)); |
Ganesh Ganapathi Batta | ead3cde | 2013-02-05 15:22:31 -0800 | [diff] [blame] | 1654 | |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 1655 | APPL_TRACE_API("%s", __func__); |
Ganesh Ganapathi Batta | ead3cde | 2013-02-05 15:22:31 -0800 | [diff] [blame] | 1656 | |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 1657 | p_msg->hdr.event = BTA_DM_API_REMOVE_ACL_EVT; |
| 1658 | memcpy(p_msg->bd_addr, bd_addr, BD_ADDR_LEN); |
| 1659 | p_msg->remove_dev = remove_dev; |
| 1660 | p_msg->transport = transport; |
Ganesh Ganapathi Batta | ead3cde | 2013-02-05 15:22:31 -0800 | [diff] [blame] | 1661 | |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 1662 | bta_sys_sendmsg(p_msg); |
Ganesh Ganapathi Batta | ead3cde | 2013-02-05 15:22:31 -0800 | [diff] [blame] | 1663 | } |
| 1664 | |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame] | 1665 | #if (BLE_INCLUDED == TRUE) |
Ganesh Ganapathi Batta | ead3cde | 2013-02-05 15:22:31 -0800 | [diff] [blame] | 1666 | /******************************************************************************* |
Myles Watson | 8af480e | 2016-11-09 10:40:23 -0800 | [diff] [blame^] | 1667 | * |
| 1668 | * Function BTA_DmBleObserve |
| 1669 | * |
| 1670 | * Description This procedure keep the device listening for advertising |
| 1671 | * events from a broadcast device. |
| 1672 | * |
| 1673 | * Parameters start: start or stop observe. |
| 1674 | * |
| 1675 | * Returns void |
Ganesh Ganapathi Batta | ead3cde | 2013-02-05 15:22:31 -0800 | [diff] [blame] | 1676 | |
Myles Watson | 8af480e | 2016-11-09 10:40:23 -0800 | [diff] [blame^] | 1677 | * |
| 1678 | * Returns void. |
| 1679 | * |
| 1680 | ******************************************************************************/ |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame] | 1681 | extern void BTA_DmBleObserve(bool start, uint8_t duration, |
June R. Tate-Gans | 24933b5 | 2014-09-24 15:25:02 -0700 | [diff] [blame] | 1682 | tBTA_DM_SEARCH_CBACK *p_results_cb) |
Ganesh Ganapathi Batta | ead3cde | 2013-02-05 15:22:31 -0800 | [diff] [blame] | 1683 | { |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 1684 | tBTA_DM_API_BLE_OBSERVE *p_msg = |
| 1685 | (tBTA_DM_API_BLE_OBSERVE *)osi_calloc(sizeof(tBTA_DM_API_BLE_OBSERVE)); |
Ganesh Ganapathi Batta | ead3cde | 2013-02-05 15:22:31 -0800 | [diff] [blame] | 1686 | |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 1687 | APPL_TRACE_API("%s:start = %d ", __func__, start); |
Ganesh Ganapathi Batta | ead3cde | 2013-02-05 15:22:31 -0800 | [diff] [blame] | 1688 | |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 1689 | p_msg->hdr.event = BTA_DM_API_BLE_OBSERVE_EVT; |
| 1690 | p_msg->start = start; |
| 1691 | p_msg->duration = duration; |
| 1692 | p_msg->p_cback = p_results_cb; |
Ganesh Ganapathi Batta | ead3cde | 2013-02-05 15:22:31 -0800 | [diff] [blame] | 1693 | |
Pavlin Radoslavov | 717a4a9 | 2016-02-06 08:36:06 -0800 | [diff] [blame] | 1694 | bta_sys_sendmsg(p_msg); |
Ganesh Ganapathi Batta | ead3cde | 2013-02-05 15:22:31 -0800 | [diff] [blame] | 1695 | } |
Prerepa Viswanadham | 16fe082 | 2014-08-07 11:38:06 -0700 | [diff] [blame] | 1696 | |
| 1697 | /******************************************************************************* |
Myles Watson | 8af480e | 2016-11-09 10:40:23 -0800 | [diff] [blame^] | 1698 | * |
| 1699 | * Function BTA_VendorInit |
| 1700 | * |
| 1701 | * Description This function initializes vendor specific |
| 1702 | * |
| 1703 | * Returns void |
| 1704 | * |
| 1705 | ******************************************************************************/ |
Prerepa Viswanadham | 16fe082 | 2014-08-07 11:38:06 -0700 | [diff] [blame] | 1706 | void BTA_VendorInit (void) |
| 1707 | { |
| 1708 | APPL_TRACE_API("BTA_VendorInit"); |
| 1709 | } |
| 1710 | |
| 1711 | /******************************************************************************* |
Myles Watson | 8af480e | 2016-11-09 10:40:23 -0800 | [diff] [blame^] | 1712 | * |
| 1713 | * Function BTA_VendorCleanup |
| 1714 | * |
| 1715 | * Description This function frees up Broadcom specific VS specific dynamic memory |
| 1716 | * |
| 1717 | * Returns void |
| 1718 | * |
| 1719 | ******************************************************************************/ |
Prerepa Viswanadham | 16fe082 | 2014-08-07 11:38:06 -0700 | [diff] [blame] | 1720 | void BTA_VendorCleanup (void) |
| 1721 | { |
| 1722 | tBTM_BLE_VSC_CB cmn_ble_vsc_cb; |
Satya Calloji | adb7bb5 | 2014-08-13 13:57:27 -0700 | [diff] [blame] | 1723 | BTM_BleGetVendorCapabilities(&cmn_ble_vsc_cb); |
Prerepa Viswanadham | 16fe082 | 2014-08-07 11:38:06 -0700 | [diff] [blame] | 1724 | |
| 1725 | #if (BLE_INCLUDED == TRUE && BLE_ANDROID_CONTROLLER_SCAN_FILTER == TRUE) |
Satya Calloji | adb7bb5 | 2014-08-13 13:57:27 -0700 | [diff] [blame] | 1726 | if (cmn_ble_vsc_cb.max_filter > 0) |
| 1727 | { |
| 1728 | btm_ble_adv_filter_cleanup(); |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame] | 1729 | #if (BLE_PRIVACY_SPT == TRUE) |
Satya Calloji | 444a8da | 2015-03-06 10:38:22 -0800 | [diff] [blame] | 1730 | btm_ble_resolving_list_cleanup (); |
| 1731 | #endif |
Satya Calloji | adb7bb5 | 2014-08-13 13:57:27 -0700 | [diff] [blame] | 1732 | } |
Prerepa Viswanadham | 16fe082 | 2014-08-07 11:38:06 -0700 | [diff] [blame] | 1733 | |
Satya Calloji | adb7bb5 | 2014-08-13 13:57:27 -0700 | [diff] [blame] | 1734 | if (cmn_ble_vsc_cb.tot_scan_results_strg > 0) |
| 1735 | btm_ble_batchscan_cleanup(); |
| 1736 | #endif |
Prerepa Viswanadham | 16fe082 | 2014-08-07 11:38:06 -0700 | [diff] [blame] | 1737 | |
| 1738 | if(cmn_ble_vsc_cb.adv_inst_max > 0) |
| 1739 | btm_ble_multi_adv_cleanup(); |
| 1740 | } |
| 1741 | |
Mike J. Chen | bf9a8aa | 2014-02-11 13:51:29 -0800 | [diff] [blame] | 1742 | #endif |