The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1 | /****************************************************************************** |
| 2 | * |
| 3 | * Copyright (C) 2003-2012 Broadcom Corporation |
| 4 | * |
| 5 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | * you may not use this file except in compliance with the License. |
| 7 | * You may obtain a copy of the License at: |
| 8 | * |
| 9 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | * |
| 11 | * Unless required by applicable law or agreed to in writing, software |
| 12 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | * See the License for the specific language governing permissions and |
| 15 | * limitations under the License. |
| 16 | * |
| 17 | ******************************************************************************/ |
| 18 | |
| 19 | /****************************************************************************** |
| 20 | * |
| 21 | * Routes connection status callbacks from various sub systems to DM |
| 22 | * |
| 23 | ******************************************************************************/ |
| 24 | |
Scott James Remnant | 933926c | 2015-04-02 15:22:14 -0700 | [diff] [blame] | 25 | #include <stddef.h> |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 26 | #include "bta_api.h" |
| 27 | #include "bta_sys.h" |
| 28 | #include "bta_sys_int.h" |
Pavlin Radoslavov | 258c253 | 2015-09-27 20:59:05 -0700 | [diff] [blame] | 29 | #include "bt_common.h" |
Myles Watson | d7ffd64 | 2016-10-27 10:27:36 -0700 | [diff] [blame] | 30 | #include "osi/include/osi.h" |
Mike J. Chen | 5cd8bff | 2014-01-31 18:16:59 -0800 | [diff] [blame] | 31 | #include "utl.h" |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 32 | |
| 33 | /******************************************************************************* |
Myles Watson | 8af480e | 2016-11-09 10:40:23 -0800 | [diff] [blame^] | 34 | * |
| 35 | * Function bta_sys_rm_register |
| 36 | * |
| 37 | * Description Called by BTA DM to register role management callbacks |
| 38 | * |
| 39 | * |
| 40 | * Returns void |
| 41 | * |
| 42 | ******************************************************************************/ |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 43 | void bta_sys_rm_register(tBTA_SYS_CONN_CBACK * p_cback) |
| 44 | { |
| 45 | bta_sys_cb.prm_cb = p_cback; |
| 46 | } |
| 47 | |
| 48 | |
| 49 | /******************************************************************************* |
Myles Watson | 8af480e | 2016-11-09 10:40:23 -0800 | [diff] [blame^] | 50 | * |
| 51 | * Function bta_sys_policy_register |
| 52 | * |
| 53 | * Description Called by BTA DM to register link policy change callbacks |
| 54 | * |
| 55 | * |
| 56 | * Returns void |
| 57 | * |
| 58 | ******************************************************************************/ |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 59 | void bta_sys_policy_register(tBTA_SYS_CONN_CBACK * p_cback) |
| 60 | { |
| 61 | bta_sys_cb.p_policy_cb = p_cback; |
| 62 | } |
| 63 | |
| 64 | /******************************************************************************* |
Myles Watson | 8af480e | 2016-11-09 10:40:23 -0800 | [diff] [blame^] | 65 | * |
| 66 | * Function bta_sys_role_chg_register |
| 67 | * |
| 68 | * Description Called by BTA AV to register role change callbacks |
| 69 | * |
| 70 | * |
| 71 | * Returns void |
| 72 | * |
| 73 | ******************************************************************************/ |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 74 | void bta_sys_role_chg_register(tBTA_SYS_CONN_CBACK * p_cback) |
| 75 | { |
| 76 | bta_sys_cb.p_role_cb = p_cback; |
| 77 | } |
| 78 | /******************************************************************************* |
Myles Watson | 8af480e | 2016-11-09 10:40:23 -0800 | [diff] [blame^] | 79 | * |
| 80 | * Function bta_sys_ssr_cfg_register |
| 81 | * |
| 82 | * Description Called by BTA DM to register SSR configuration callback |
| 83 | * |
| 84 | * |
| 85 | * Returns void |
| 86 | * |
| 87 | ******************************************************************************/ |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 88 | #if (BTM_SSR_INCLUDED == TRUE) |
| 89 | void bta_sys_ssr_cfg_register(tBTA_SYS_SSR_CFG_CBACK * p_cback) |
| 90 | { |
| 91 | bta_sys_cb.p_ssr_cb = p_cback; |
| 92 | } |
| 93 | #endif |
| 94 | /******************************************************************************* |
Myles Watson | 8af480e | 2016-11-09 10:40:23 -0800 | [diff] [blame^] | 95 | * |
| 96 | * Function bta_sys_role_chg_register |
| 97 | * |
| 98 | * Description Called by BTA AV to register role change callbacks |
| 99 | * |
| 100 | * |
| 101 | * Returns void |
| 102 | * |
| 103 | ******************************************************************************/ |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame] | 104 | void bta_sys_notify_role_chg(BD_ADDR_PTR p_bda, uint8_t new_role, uint8_t hci_status) |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 105 | { |
| 106 | if (bta_sys_cb.p_role_cb) |
| 107 | { |
| 108 | bta_sys_cb.p_role_cb(BTA_SYS_ROLE_CHANGE, new_role, hci_status, p_bda); |
| 109 | } |
| 110 | } |
| 111 | |
| 112 | /******************************************************************************* |
Myles Watson | 8af480e | 2016-11-09 10:40:23 -0800 | [diff] [blame^] | 113 | * |
| 114 | * Function bta_sys_collision_register |
| 115 | * |
| 116 | * Description Called by any BTA module to register for collision event. |
| 117 | * |
| 118 | * |
| 119 | * Returns void |
| 120 | * |
| 121 | ******************************************************************************/ |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame] | 122 | void bta_sys_collision_register(uint8_t bta_id, tBTA_SYS_CONN_CBACK *p_cback) |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 123 | { |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame] | 124 | uint8_t index; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 125 | |
| 126 | for (index = 0; index < MAX_COLLISION_REG; index++) |
| 127 | { |
| 128 | if ((bta_sys_cb.colli_reg.id[index] == bta_id) || |
| 129 | (bta_sys_cb.colli_reg.id[index] == 0)) |
| 130 | { |
| 131 | bta_sys_cb.colli_reg.id[index] = bta_id; |
| 132 | bta_sys_cb.colli_reg.p_coll_cback[index] = p_cback; |
| 133 | return; |
| 134 | } |
| 135 | } |
| 136 | } |
| 137 | |
| 138 | /******************************************************************************* |
Myles Watson | 8af480e | 2016-11-09 10:40:23 -0800 | [diff] [blame^] | 139 | * |
| 140 | * Function bta_sys_notify_collision |
| 141 | * |
| 142 | * Description Called by BTA DM to notify collision event. |
| 143 | * |
| 144 | * |
| 145 | * Returns void |
| 146 | * |
| 147 | ******************************************************************************/ |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 148 | void bta_sys_notify_collision (BD_ADDR_PTR p_bda) |
| 149 | { |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame] | 150 | uint8_t index; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 151 | |
| 152 | for (index = 0; index < MAX_COLLISION_REG; index++) |
| 153 | { |
| 154 | if ((bta_sys_cb.colli_reg.id[index] != 0) && |
| 155 | (bta_sys_cb.colli_reg.p_coll_cback[index] != NULL)) |
| 156 | { |
| 157 | bta_sys_cb.colli_reg.p_coll_cback[index] (0, BTA_ID_SYS, 0, p_bda); |
| 158 | } |
| 159 | } |
| 160 | } |
| 161 | |
| 162 | /******************************************************************************* |
Myles Watson | 8af480e | 2016-11-09 10:40:23 -0800 | [diff] [blame^] | 163 | * |
| 164 | * Function bta_sys_sco_register |
| 165 | * |
| 166 | * Description Called by BTA AV to register sco connection change callbacks |
| 167 | * |
| 168 | * |
| 169 | * Returns void |
| 170 | * |
| 171 | ******************************************************************************/ |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 172 | void bta_sys_sco_register(tBTA_SYS_CONN_CBACK * p_cback) |
| 173 | { |
| 174 | bta_sys_cb.p_sco_cb = p_cback; |
| 175 | } |
| 176 | |
| 177 | /******************************************************************************* |
Myles Watson | 8af480e | 2016-11-09 10:40:23 -0800 | [diff] [blame^] | 178 | * |
| 179 | * Function bta_sys_pm_register |
| 180 | * |
| 181 | * Description Called by BTA DM to register power management callbacks |
| 182 | * |
| 183 | * |
| 184 | * Returns void |
| 185 | * |
| 186 | ******************************************************************************/ |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 187 | void bta_sys_pm_register(tBTA_SYS_CONN_CBACK * p_cback) |
| 188 | { |
| 189 | bta_sys_cb.ppm_cb = p_cback; |
| 190 | } |
| 191 | |
| 192 | /******************************************************************************* |
Myles Watson | 8af480e | 2016-11-09 10:40:23 -0800 | [diff] [blame^] | 193 | * |
| 194 | * Function bta_sys_conn_open |
| 195 | * |
| 196 | * Description Called by BTA subsystems when a connection is made to |
| 197 | * the service |
| 198 | * |
| 199 | * |
| 200 | * Returns void |
| 201 | * |
| 202 | ******************************************************************************/ |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame] | 203 | void bta_sys_conn_open(uint8_t id, uint8_t app_id, BD_ADDR peer_addr) |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 204 | { |
| 205 | if(bta_sys_cb.prm_cb) |
| 206 | { |
| 207 | |
| 208 | bta_sys_cb.prm_cb(BTA_SYS_CONN_OPEN, id, app_id, peer_addr); |
| 209 | |
| 210 | } |
| 211 | |
| 212 | if(bta_sys_cb.ppm_cb) |
| 213 | { |
| 214 | |
| 215 | bta_sys_cb.ppm_cb(BTA_SYS_CONN_OPEN, id, app_id, peer_addr); |
| 216 | |
| 217 | } |
| 218 | } |
| 219 | |
| 220 | |
| 221 | |
| 222 | /******************************************************************************* |
Myles Watson | 8af480e | 2016-11-09 10:40:23 -0800 | [diff] [blame^] | 223 | * |
| 224 | * Function bta_sys_conn_close |
| 225 | * |
| 226 | * Description Called by BTA subsystems when a connection to the service |
| 227 | * is closed |
| 228 | * |
| 229 | * |
| 230 | * Returns void |
| 231 | * |
| 232 | ******************************************************************************/ |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame] | 233 | void bta_sys_conn_close(uint8_t id, uint8_t app_id, BD_ADDR peer_addr) |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 234 | { |
| 235 | if(bta_sys_cb.prm_cb) |
| 236 | { |
| 237 | |
| 238 | bta_sys_cb.prm_cb(BTA_SYS_CONN_CLOSE, id, app_id, peer_addr); |
| 239 | |
| 240 | } |
| 241 | |
| 242 | if(bta_sys_cb.ppm_cb) |
| 243 | { |
| 244 | |
| 245 | bta_sys_cb.ppm_cb(BTA_SYS_CONN_CLOSE, id, app_id, peer_addr); |
| 246 | |
| 247 | } |
| 248 | } |
| 249 | |
| 250 | |
| 251 | /******************************************************************************* |
Myles Watson | 8af480e | 2016-11-09 10:40:23 -0800 | [diff] [blame^] | 252 | * |
| 253 | * Function bta_sys_app_open |
| 254 | * |
| 255 | * Description Called by BTA subsystems when application initiates connection |
| 256 | * to a peer device |
| 257 | * |
| 258 | * |
| 259 | * Returns void |
| 260 | * |
| 261 | ******************************************************************************/ |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame] | 262 | void bta_sys_app_open(uint8_t id, uint8_t app_id, BD_ADDR peer_addr) |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 263 | { |
| 264 | if(bta_sys_cb.ppm_cb) |
| 265 | { |
| 266 | bta_sys_cb.ppm_cb(BTA_SYS_APP_OPEN, id, app_id, peer_addr); |
| 267 | } |
| 268 | } |
| 269 | |
| 270 | |
| 271 | |
| 272 | /******************************************************************************* |
Myles Watson | 8af480e | 2016-11-09 10:40:23 -0800 | [diff] [blame^] | 273 | * |
| 274 | * Function bta_sys_app_close |
| 275 | * |
| 276 | * Description Called by BTA subsystems when application initiates close |
| 277 | * of connection to peer device |
| 278 | * |
| 279 | * Returns void |
| 280 | * |
| 281 | ******************************************************************************/ |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame] | 282 | void bta_sys_app_close(uint8_t id, uint8_t app_id, BD_ADDR peer_addr) |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 283 | { |
| 284 | if(bta_sys_cb.ppm_cb) |
| 285 | { |
| 286 | bta_sys_cb.ppm_cb(BTA_SYS_APP_CLOSE, id, app_id, peer_addr); |
| 287 | } |
| 288 | } |
| 289 | |
| 290 | |
| 291 | /******************************************************************************* |
Myles Watson | 8af480e | 2016-11-09 10:40:23 -0800 | [diff] [blame^] | 292 | * |
| 293 | * Function bta_sys_sco_open |
| 294 | * |
| 295 | * Description Called by BTA subsystems when sco connection for that service |
| 296 | * is open |
| 297 | * |
| 298 | * Returns void |
| 299 | * |
| 300 | ******************************************************************************/ |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame] | 301 | void bta_sys_sco_open(uint8_t id, uint8_t app_id, BD_ADDR peer_addr) |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 302 | { |
| 303 | /* AG triggers p_sco_cb by bta_sys_sco_use. */ |
| 304 | if((id != BTA_ID_AG) && (bta_sys_cb.p_sco_cb)) |
| 305 | { |
| 306 | /* without querying BTM_GetNumScoLinks() */ |
| 307 | bta_sys_cb.p_sco_cb(BTA_SYS_SCO_OPEN, 1, app_id, peer_addr); |
| 308 | } |
| 309 | |
| 310 | if(bta_sys_cb.ppm_cb) |
| 311 | { |
| 312 | bta_sys_cb.ppm_cb(BTA_SYS_SCO_OPEN, id, app_id, peer_addr); |
| 313 | } |
| 314 | } |
| 315 | |
| 316 | /******************************************************************************* |
Myles Watson | 8af480e | 2016-11-09 10:40:23 -0800 | [diff] [blame^] | 317 | * |
| 318 | * Function bta_sys_sco_close |
| 319 | * |
| 320 | * Description Called by BTA subsystems when sco connection for that service |
| 321 | * is closed |
| 322 | * |
| 323 | * Returns void |
| 324 | * |
| 325 | ******************************************************************************/ |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame] | 326 | void bta_sys_sco_close(uint8_t id, uint8_t app_id, BD_ADDR peer_addr) |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 327 | { |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame] | 328 | uint8_t num_sco_links; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 329 | |
| 330 | if((id != BTA_ID_AG) && (bta_sys_cb.p_sco_cb)) |
| 331 | { |
| 332 | num_sco_links = BTM_GetNumScoLinks(); |
| 333 | bta_sys_cb.p_sco_cb(BTA_SYS_SCO_CLOSE, num_sco_links, app_id, peer_addr); |
| 334 | } |
| 335 | |
| 336 | if(bta_sys_cb.ppm_cb) |
| 337 | { |
| 338 | bta_sys_cb.ppm_cb(BTA_SYS_SCO_CLOSE, id, app_id, peer_addr); |
| 339 | } |
| 340 | } |
| 341 | |
| 342 | /******************************************************************************* |
Myles Watson | 8af480e | 2016-11-09 10:40:23 -0800 | [diff] [blame^] | 343 | * |
| 344 | * Function bta_sys_sco_use |
| 345 | * |
| 346 | * Description Called by BTA subsystems when that service needs to use sco. |
| 347 | * |
| 348 | * |
| 349 | * Returns void |
| 350 | * |
| 351 | ******************************************************************************/ |
Myles Watson | d35a648 | 2016-10-27 08:52:16 -0700 | [diff] [blame] | 352 | void bta_sys_sco_use(UNUSED_ATTR uint8_t id, uint8_t app_id, |
| 353 | BD_ADDR peer_addr) |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 354 | { |
| 355 | /* AV streaming need to be suspended before SCO is connected. */ |
| 356 | if(bta_sys_cb.p_sco_cb) |
| 357 | { |
| 358 | /* without querying BTM_GetNumScoLinks() */ |
| 359 | bta_sys_cb.p_sco_cb(BTA_SYS_SCO_OPEN, 1, app_id, peer_addr); |
| 360 | } |
| 361 | } |
| 362 | |
| 363 | /******************************************************************************* |
Myles Watson | 8af480e | 2016-11-09 10:40:23 -0800 | [diff] [blame^] | 364 | * |
| 365 | * Function bta_sys_sco_unuse |
| 366 | * |
| 367 | * Description Called by BTA subsystems when sco connection for that service |
| 368 | * is no longer needed. |
| 369 | * |
| 370 | * Returns void |
| 371 | * |
| 372 | ******************************************************************************/ |
Myles Watson | d35a648 | 2016-10-27 08:52:16 -0700 | [diff] [blame] | 373 | void bta_sys_sco_unuse(UNUSED_ATTR uint8_t id, uint8_t app_id, |
| 374 | BD_ADDR peer_addr) |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 375 | { |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame] | 376 | uint8_t num_sco_links; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 377 | |
| 378 | if((bta_sys_cb.p_sco_cb)) |
| 379 | { |
| 380 | num_sco_links = BTM_GetNumScoLinks(); |
| 381 | bta_sys_cb.p_sco_cb(BTA_SYS_SCO_CLOSE, num_sco_links, app_id, peer_addr); |
| 382 | } |
| 383 | } |
| 384 | /******************************************************************************* |
Myles Watson | 8af480e | 2016-11-09 10:40:23 -0800 | [diff] [blame^] | 385 | * |
| 386 | * Function bta_sys_chg_ssr_config |
| 387 | * |
| 388 | * Description Called by BTA subsystems to indicate that the given app SSR setting |
| 389 | * need to be changed. |
| 390 | * |
| 391 | * Returns void |
| 392 | * |
| 393 | ******************************************************************************/ |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 394 | #if (BTM_SSR_INCLUDED == TRUE) |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame] | 395 | void bta_sys_chg_ssr_config (uint8_t id, uint8_t app_id, uint16_t max_latency, uint16_t min_tout) |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 396 | { |
| 397 | if(bta_sys_cb.p_ssr_cb) |
| 398 | { |
| 399 | bta_sys_cb.p_ssr_cb(id, app_id, max_latency, min_tout); |
| 400 | } |
| 401 | } |
| 402 | #endif |
| 403 | /******************************************************************************* |
Myles Watson | 8af480e | 2016-11-09 10:40:23 -0800 | [diff] [blame^] | 404 | * |
| 405 | * Function bta_sys_set_policy |
| 406 | * |
| 407 | * Description Called by BTA subsystems to indicate that the given link |
| 408 | * policy to peer device should be set |
| 409 | * |
| 410 | * Returns void |
| 411 | * |
| 412 | ******************************************************************************/ |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame] | 413 | void bta_sys_set_policy (uint8_t id, uint8_t policy, BD_ADDR peer_addr) |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 414 | { |
| 415 | if(bta_sys_cb.p_policy_cb) |
| 416 | { |
| 417 | bta_sys_cb.p_policy_cb(BTA_SYS_PLCY_SET, id, policy, peer_addr); |
| 418 | } |
| 419 | } |
| 420 | |
| 421 | /******************************************************************************* |
Myles Watson | 8af480e | 2016-11-09 10:40:23 -0800 | [diff] [blame^] | 422 | * |
| 423 | * Function bta_sys_clear_policy |
| 424 | * |
| 425 | * Description Called by BTA subsystems to indicate that the given link |
| 426 | * policy to peer device should be clear |
| 427 | * |
| 428 | * Returns void |
| 429 | * |
| 430 | ******************************************************************************/ |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame] | 431 | void bta_sys_clear_policy (uint8_t id, uint8_t policy, BD_ADDR peer_addr) |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 432 | { |
| 433 | if(bta_sys_cb.p_policy_cb) |
| 434 | { |
| 435 | bta_sys_cb.p_policy_cb(BTA_SYS_PLCY_CLR, id, policy, peer_addr); |
| 436 | } |
| 437 | } |
| 438 | |
| 439 | /******************************************************************************* |
Myles Watson | 8af480e | 2016-11-09 10:40:23 -0800 | [diff] [blame^] | 440 | * |
| 441 | * Function bta_sys_set_default_policy |
| 442 | * |
| 443 | * Description Called by BTA subsystems to indicate that the given default |
| 444 | * link policy should be set |
| 445 | * |
| 446 | * Returns void |
| 447 | * |
| 448 | ******************************************************************************/ |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame] | 449 | void bta_sys_set_default_policy (uint8_t id, uint8_t policy) |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 450 | { |
| 451 | if(bta_sys_cb.p_policy_cb) |
| 452 | { |
| 453 | bta_sys_cb.p_policy_cb(BTA_SYS_PLCY_DEF_SET, id, policy, NULL); |
| 454 | } |
| 455 | } |
| 456 | |
| 457 | /******************************************************************************* |
Myles Watson | 8af480e | 2016-11-09 10:40:23 -0800 | [diff] [blame^] | 458 | * |
| 459 | * Function bta_sys_clear_default_policy |
| 460 | * |
| 461 | * Description Called by BTA subsystems to indicate that the given default |
| 462 | * link policy should be clear |
| 463 | * |
| 464 | * Returns void |
| 465 | * |
| 466 | ******************************************************************************/ |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame] | 467 | void bta_sys_clear_default_policy (uint8_t id, uint8_t policy) |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 468 | { |
| 469 | if(bta_sys_cb.p_policy_cb) |
| 470 | { |
| 471 | bta_sys_cb.p_policy_cb(BTA_SYS_PLCY_DEF_CLR, id, policy, NULL); |
| 472 | } |
| 473 | } |
| 474 | |
| 475 | /******************************************************************************* |
Myles Watson | 8af480e | 2016-11-09 10:40:23 -0800 | [diff] [blame^] | 476 | * |
| 477 | * Function bta_sys_idle |
| 478 | * |
| 479 | * Description Called by BTA subsystems to indicate that the connection to |
| 480 | * peer device is idle |
| 481 | * |
| 482 | * Returns void |
| 483 | * |
| 484 | ******************************************************************************/ |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame] | 485 | void bta_sys_idle(uint8_t id, uint8_t app_id, BD_ADDR peer_addr) |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 486 | { |
| 487 | |
| 488 | if(bta_sys_cb.prm_cb) |
| 489 | { |
| 490 | |
| 491 | bta_sys_cb.prm_cb(BTA_SYS_CONN_IDLE, id, app_id, peer_addr); |
| 492 | |
| 493 | } |
| 494 | |
| 495 | if(bta_sys_cb.ppm_cb) |
| 496 | { |
| 497 | |
| 498 | bta_sys_cb.ppm_cb(BTA_SYS_CONN_IDLE, id, app_id, peer_addr); |
| 499 | } |
| 500 | } |
| 501 | |
| 502 | /******************************************************************************* |
Myles Watson | 8af480e | 2016-11-09 10:40:23 -0800 | [diff] [blame^] | 503 | * |
| 504 | * Function bta_sys_busy |
| 505 | * |
| 506 | * Description Called by BTA subsystems to indicate that the connection to |
| 507 | * peer device is busy |
| 508 | * |
| 509 | * Returns void |
| 510 | * |
| 511 | ******************************************************************************/ |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame] | 512 | void bta_sys_busy(uint8_t id, uint8_t app_id, BD_ADDR peer_addr) |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 513 | { |
| 514 | if(bta_sys_cb.prm_cb) |
| 515 | { |
| 516 | |
| 517 | bta_sys_cb.prm_cb(BTA_SYS_CONN_BUSY, id, app_id, peer_addr); |
| 518 | |
| 519 | } |
| 520 | |
| 521 | if(bta_sys_cb.ppm_cb) |
| 522 | { |
| 523 | |
| 524 | bta_sys_cb.ppm_cb(BTA_SYS_CONN_BUSY, id, app_id, peer_addr); |
| 525 | |
| 526 | } |
| 527 | } |
| 528 | |
Chris Manton | 1e61ce1 | 2014-10-24 09:12:41 -0700 | [diff] [blame] | 529 | #if (BTA_EIR_CANNED_UUID_LIST != TRUE) |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 530 | /******************************************************************************* |
Myles Watson | 8af480e | 2016-11-09 10:40:23 -0800 | [diff] [blame^] | 531 | * |
| 532 | * Function bta_sys_eir_register |
| 533 | * |
| 534 | * Description Called by BTA DM to register EIR utility function that can be |
| 535 | * used by the other BTA modules to add/remove UUID. |
| 536 | * |
| 537 | * Returns void |
| 538 | * |
| 539 | ******************************************************************************/ |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 540 | void bta_sys_eir_register(tBTA_SYS_EIR_CBACK * p_cback) |
| 541 | { |
| 542 | bta_sys_cb.eir_cb = p_cback; |
| 543 | } |
| 544 | |
| 545 | /******************************************************************************* |
Myles Watson | 8af480e | 2016-11-09 10:40:23 -0800 | [diff] [blame^] | 546 | * |
| 547 | * Function bta_sys_add_uuid |
| 548 | * |
| 549 | * Description Called by BTA subsystems to indicate to DM that new service |
| 550 | * class UUID is added. |
| 551 | * |
| 552 | * Returns void |
| 553 | * |
| 554 | ******************************************************************************/ |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame] | 555 | void bta_sys_add_uuid(uint16_t uuid16) |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 556 | { |
| 557 | if(bta_sys_cb.eir_cb) |
| 558 | { |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame] | 559 | bta_sys_cb.eir_cb(uuid16, true ); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 560 | } |
| 561 | } |
| 562 | |
| 563 | /******************************************************************************* |
Myles Watson | 8af480e | 2016-11-09 10:40:23 -0800 | [diff] [blame^] | 564 | * |
| 565 | * Function bta_sys_remove_uuid |
| 566 | * |
| 567 | * Description Called by BTA subsystems to indicate to DM that the service |
| 568 | * class UUID is removed. |
| 569 | * |
| 570 | * Returns void |
| 571 | * |
| 572 | ******************************************************************************/ |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame] | 573 | void bta_sys_remove_uuid(uint16_t uuid16) |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 574 | { |
| 575 | if(bta_sys_cb.eir_cb) |
| 576 | { |
Marie Janssen | e9e58ce | 2016-06-17 14:12:17 -0700 | [diff] [blame] | 577 | bta_sys_cb.eir_cb(uuid16, false); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 578 | } |
| 579 | } |
| 580 | #endif |