blob: 6d9fc17f29ce96aa8423969d39d040cf55583aea [file] [log] [blame]
The Android Open Source Project5738f832012-12-12 16:00:35 -08001/******************************************************************************
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 Remnant933926c2015-04-02 15:22:14 -070025#include <stddef.h>
Myles Watsonf355ef52016-11-09 13:04:33 -080026
Myles Watsoncd1fd072016-11-09 13:17:43 -080027#include "bt_common.h"
The Android Open Source Project5738f832012-12-12 16:00:35 -080028#include "bta_api.h"
29#include "bta_sys.h"
30#include "bta_sys_int.h"
Myles Watsond7ffd642016-10-27 10:27:36 -070031#include "osi/include/osi.h"
Mike J. Chen5cd8bff2014-01-31 18:16:59 -080032#include "utl.h"
The Android Open Source Project5738f832012-12-12 16:00:35 -080033
34/*******************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -080035 *
36 * Function bta_sys_rm_register
37 *
38 * Description Called by BTA DM to register role management callbacks
39 *
40 *
41 * Returns void
42 *
43 ******************************************************************************/
Myles Watsoncd1fd072016-11-09 13:17:43 -080044void bta_sys_rm_register(tBTA_SYS_CONN_CBACK* p_cback) {
45 bta_sys_cb.prm_cb = p_cback;
The Android Open Source Project5738f832012-12-12 16:00:35 -080046}
47
The Android Open Source Project5738f832012-12-12 16:00:35 -080048/*******************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -080049 *
50 * Function bta_sys_policy_register
51 *
52 * Description Called by BTA DM to register link policy change callbacks
53 *
54 *
55 * Returns void
56 *
57 ******************************************************************************/
Myles Watsoncd1fd072016-11-09 13:17:43 -080058void bta_sys_policy_register(tBTA_SYS_CONN_CBACK* p_cback) {
59 bta_sys_cb.p_policy_cb = p_cback;
The Android Open Source Project5738f832012-12-12 16:00:35 -080060}
61
62/*******************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -080063 *
64 * Function bta_sys_role_chg_register
65 *
66 * Description Called by BTA AV to register role change callbacks
67 *
68 *
69 * Returns void
70 *
71 ******************************************************************************/
Myles Watsoncd1fd072016-11-09 13:17:43 -080072void bta_sys_role_chg_register(tBTA_SYS_CONN_CBACK* p_cback) {
73 bta_sys_cb.p_role_cb = p_cback;
The Android Open Source Project5738f832012-12-12 16:00:35 -080074}
75/*******************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -080076 *
77 * Function bta_sys_ssr_cfg_register
78 *
79 * Description Called by BTA DM to register SSR configuration callback
80 *
81 *
82 * Returns void
83 *
84 ******************************************************************************/
The Android Open Source Project5738f832012-12-12 16:00:35 -080085#if (BTM_SSR_INCLUDED == TRUE)
Myles Watsoncd1fd072016-11-09 13:17:43 -080086void bta_sys_ssr_cfg_register(tBTA_SYS_SSR_CFG_CBACK* p_cback) {
87 bta_sys_cb.p_ssr_cb = p_cback;
The Android Open Source Project5738f832012-12-12 16:00:35 -080088}
89#endif
90/*******************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -080091 *
92 * Function bta_sys_role_chg_register
93 *
94 * Description Called by BTA AV to register role change callbacks
95 *
96 *
97 * Returns void
98 *
99 ******************************************************************************/
Jakub Pawlowskia484a882017-06-24 17:30:18 -0700100void bta_sys_notify_role_chg(const RawAddress& p_bda, uint8_t new_role,
Myles Watsoncd1fd072016-11-09 13:17:43 -0800101 uint8_t hci_status) {
102 if (bta_sys_cb.p_role_cb) {
Jakub Pawlowskic752e132017-06-16 12:52:23 -0700103 bta_sys_cb.p_role_cb(BTA_SYS_ROLE_CHANGE, new_role, hci_status, &p_bda);
Myles Watsoncd1fd072016-11-09 13:17:43 -0800104 }
The Android Open Source Project5738f832012-12-12 16:00:35 -0800105}
106
107/*******************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -0800108 *
109 * Function bta_sys_collision_register
110 *
111 * Description Called by any BTA module to register for collision event.
112 *
113 *
114 * Returns void
115 *
116 ******************************************************************************/
Myles Watsoncd1fd072016-11-09 13:17:43 -0800117void bta_sys_collision_register(uint8_t bta_id, tBTA_SYS_CONN_CBACK* p_cback) {
118 uint8_t index;
The Android Open Source Project5738f832012-12-12 16:00:35 -0800119
Myles Watsoncd1fd072016-11-09 13:17:43 -0800120 for (index = 0; index < MAX_COLLISION_REG; index++) {
121 if ((bta_sys_cb.colli_reg.id[index] == bta_id) ||
122 (bta_sys_cb.colli_reg.id[index] == 0)) {
123 bta_sys_cb.colli_reg.id[index] = bta_id;
124 bta_sys_cb.colli_reg.p_coll_cback[index] = p_cback;
125 return;
The Android Open Source Project5738f832012-12-12 16:00:35 -0800126 }
Myles Watsoncd1fd072016-11-09 13:17:43 -0800127 }
The Android Open Source Project5738f832012-12-12 16:00:35 -0800128}
129
130/*******************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -0800131 *
132 * Function bta_sys_notify_collision
133 *
134 * Description Called by BTA DM to notify collision event.
135 *
136 *
137 * Returns void
138 *
139 ******************************************************************************/
Jakub Pawlowskia484a882017-06-24 17:30:18 -0700140void bta_sys_notify_collision(const RawAddress& p_bda) {
Myles Watsoncd1fd072016-11-09 13:17:43 -0800141 uint8_t index;
The Android Open Source Project5738f832012-12-12 16:00:35 -0800142
Myles Watsoncd1fd072016-11-09 13:17:43 -0800143 for (index = 0; index < MAX_COLLISION_REG; index++) {
144 if ((bta_sys_cb.colli_reg.id[index] != 0) &&
145 (bta_sys_cb.colli_reg.p_coll_cback[index] != NULL)) {
Jakub Pawlowskic752e132017-06-16 12:52:23 -0700146 bta_sys_cb.colli_reg.p_coll_cback[index](0, BTA_ID_SYS, 0, &p_bda);
The Android Open Source Project5738f832012-12-12 16:00:35 -0800147 }
Myles Watsoncd1fd072016-11-09 13:17:43 -0800148 }
The Android Open Source Project5738f832012-12-12 16:00:35 -0800149}
150
151/*******************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -0800152 *
153 * Function bta_sys_sco_register
154 *
155 * Description Called by BTA AV to register sco connection change callbacks
156 *
157 *
158 * Returns void
159 *
160 ******************************************************************************/
Myles Watsoncd1fd072016-11-09 13:17:43 -0800161void bta_sys_sco_register(tBTA_SYS_CONN_CBACK* p_cback) {
162 bta_sys_cb.p_sco_cb = p_cback;
The Android Open Source Project5738f832012-12-12 16:00:35 -0800163}
164
165/*******************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -0800166 *
167 * Function bta_sys_pm_register
168 *
169 * Description Called by BTA DM to register power management callbacks
170 *
171 *
172 * Returns void
173 *
174 ******************************************************************************/
Myles Watsoncd1fd072016-11-09 13:17:43 -0800175void bta_sys_pm_register(tBTA_SYS_CONN_CBACK* p_cback) {
176 bta_sys_cb.ppm_cb = p_cback;
The Android Open Source Project5738f832012-12-12 16:00:35 -0800177}
178
179/*******************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -0800180 *
181 * Function bta_sys_conn_open
182 *
183 * Description Called by BTA subsystems when a connection is made to
184 * the service
185 *
186 *
187 * Returns void
188 *
189 ******************************************************************************/
Jakub Pawlowskic752e132017-06-16 12:52:23 -0700190void bta_sys_conn_open(uint8_t id, uint8_t app_id,
Jakub Pawlowskia484a882017-06-24 17:30:18 -0700191 const RawAddress& peer_addr) {
Myles Watsoncd1fd072016-11-09 13:17:43 -0800192 if (bta_sys_cb.prm_cb) {
Jakub Pawlowskic752e132017-06-16 12:52:23 -0700193 bta_sys_cb.prm_cb(BTA_SYS_CONN_OPEN, id, app_id, &peer_addr);
Myles Watsoncd1fd072016-11-09 13:17:43 -0800194 }
The Android Open Source Project5738f832012-12-12 16:00:35 -0800195
Myles Watsoncd1fd072016-11-09 13:17:43 -0800196 if (bta_sys_cb.ppm_cb) {
Jakub Pawlowskic752e132017-06-16 12:52:23 -0700197 bta_sys_cb.ppm_cb(BTA_SYS_CONN_OPEN, id, app_id, &peer_addr);
Myles Watsoncd1fd072016-11-09 13:17:43 -0800198 }
The Android Open Source Project5738f832012-12-12 16:00:35 -0800199}
200
The Android Open Source Project5738f832012-12-12 16:00:35 -0800201/*******************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -0800202 *
203 * Function bta_sys_conn_close
204 *
205 * Description Called by BTA subsystems when a connection to the service
206 * is closed
207 *
208 *
209 * Returns void
210 *
211 ******************************************************************************/
Jakub Pawlowskic752e132017-06-16 12:52:23 -0700212void bta_sys_conn_close(uint8_t id, uint8_t app_id,
Jakub Pawlowskia484a882017-06-24 17:30:18 -0700213 const RawAddress& peer_addr) {
Myles Watsoncd1fd072016-11-09 13:17:43 -0800214 if (bta_sys_cb.prm_cb) {
Jakub Pawlowskic752e132017-06-16 12:52:23 -0700215 bta_sys_cb.prm_cb(BTA_SYS_CONN_CLOSE, id, app_id, &peer_addr);
Myles Watsoncd1fd072016-11-09 13:17:43 -0800216 }
The Android Open Source Project5738f832012-12-12 16:00:35 -0800217
Myles Watsoncd1fd072016-11-09 13:17:43 -0800218 if (bta_sys_cb.ppm_cb) {
Jakub Pawlowskic752e132017-06-16 12:52:23 -0700219 bta_sys_cb.ppm_cb(BTA_SYS_CONN_CLOSE, id, app_id, &peer_addr);
Myles Watsoncd1fd072016-11-09 13:17:43 -0800220 }
The Android Open Source Project5738f832012-12-12 16:00:35 -0800221}
222
The Android Open Source Project5738f832012-12-12 16:00:35 -0800223/*******************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -0800224 *
225 * Function bta_sys_app_open
226 *
Myles Watsoncd1fd072016-11-09 13:17:43 -0800227 * Description Called by BTA subsystems when application initiates
Myles Watson1baaae32016-11-09 14:25:23 -0800228 * connection to a peer device
Myles Watson8af480e2016-11-09 10:40:23 -0800229 *
230 *
231 * Returns void
232 *
233 ******************************************************************************/
Jakub Pawlowskia484a882017-06-24 17:30:18 -0700234void bta_sys_app_open(uint8_t id, uint8_t app_id, const RawAddress& peer_addr) {
Myles Watsoncd1fd072016-11-09 13:17:43 -0800235 if (bta_sys_cb.ppm_cb) {
Jakub Pawlowskic752e132017-06-16 12:52:23 -0700236 bta_sys_cb.ppm_cb(BTA_SYS_APP_OPEN, id, app_id, &peer_addr);
Myles Watsoncd1fd072016-11-09 13:17:43 -0800237 }
The Android Open Source Project5738f832012-12-12 16:00:35 -0800238}
239
The Android Open Source Project5738f832012-12-12 16:00:35 -0800240/*******************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -0800241 *
242 * Function bta_sys_app_close
243 *
244 * Description Called by BTA subsystems when application initiates close
245 * of connection to peer device
246 *
247 * Returns void
248 *
249 ******************************************************************************/
Jakub Pawlowskic752e132017-06-16 12:52:23 -0700250void bta_sys_app_close(uint8_t id, uint8_t app_id,
Jakub Pawlowskia484a882017-06-24 17:30:18 -0700251 const RawAddress& peer_addr) {
Myles Watsoncd1fd072016-11-09 13:17:43 -0800252 if (bta_sys_cb.ppm_cb) {
Jakub Pawlowskic752e132017-06-16 12:52:23 -0700253 bta_sys_cb.ppm_cb(BTA_SYS_APP_CLOSE, id, app_id, &peer_addr);
Myles Watsoncd1fd072016-11-09 13:17:43 -0800254 }
The Android Open Source Project5738f832012-12-12 16:00:35 -0800255}
256
The Android Open Source Project5738f832012-12-12 16:00:35 -0800257/*******************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -0800258 *
259 * Function bta_sys_sco_open
260 *
Myles Watsoncd1fd072016-11-09 13:17:43 -0800261 * Description Called by BTA subsystems when sco connection for that
Myles Watson1baaae32016-11-09 14:25:23 -0800262 * service is open
Myles Watson8af480e2016-11-09 10:40:23 -0800263 *
264 * Returns void
265 *
266 ******************************************************************************/
Jakub Pawlowskia484a882017-06-24 17:30:18 -0700267void bta_sys_sco_open(uint8_t id, uint8_t app_id, const RawAddress& peer_addr) {
Myles Watsoncd1fd072016-11-09 13:17:43 -0800268 /* AG triggers p_sco_cb by bta_sys_sco_use. */
269 if ((id != BTA_ID_AG) && (bta_sys_cb.p_sco_cb)) {
270 /* without querying BTM_GetNumScoLinks() */
Jakub Pawlowskic752e132017-06-16 12:52:23 -0700271 bta_sys_cb.p_sco_cb(BTA_SYS_SCO_OPEN, 1, app_id, &peer_addr);
Myles Watsoncd1fd072016-11-09 13:17:43 -0800272 }
The Android Open Source Project5738f832012-12-12 16:00:35 -0800273
Myles Watsoncd1fd072016-11-09 13:17:43 -0800274 if (bta_sys_cb.ppm_cb) {
Jakub Pawlowskic752e132017-06-16 12:52:23 -0700275 bta_sys_cb.ppm_cb(BTA_SYS_SCO_OPEN, id, app_id, &peer_addr);
Myles Watsoncd1fd072016-11-09 13:17:43 -0800276 }
The Android Open Source Project5738f832012-12-12 16:00:35 -0800277}
278
279/*******************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -0800280 *
281 * Function bta_sys_sco_close
282 *
Myles Watsoncd1fd072016-11-09 13:17:43 -0800283 * Description Called by BTA subsystems when sco connection for that
Myles Watson1baaae32016-11-09 14:25:23 -0800284 * service is closed
Myles Watson8af480e2016-11-09 10:40:23 -0800285 *
286 * Returns void
287 *
288 ******************************************************************************/
Jakub Pawlowskic752e132017-06-16 12:52:23 -0700289void bta_sys_sco_close(uint8_t id, uint8_t app_id,
Jakub Pawlowskia484a882017-06-24 17:30:18 -0700290 const RawAddress& peer_addr) {
Myles Watsoncd1fd072016-11-09 13:17:43 -0800291 uint8_t num_sco_links;
The Android Open Source Project5738f832012-12-12 16:00:35 -0800292
Myles Watsoncd1fd072016-11-09 13:17:43 -0800293 if ((id != BTA_ID_AG) && (bta_sys_cb.p_sco_cb)) {
294 num_sco_links = BTM_GetNumScoLinks();
Jakub Pawlowskic752e132017-06-16 12:52:23 -0700295 bta_sys_cb.p_sco_cb(BTA_SYS_SCO_CLOSE, num_sco_links, app_id, &peer_addr);
Myles Watsoncd1fd072016-11-09 13:17:43 -0800296 }
The Android Open Source Project5738f832012-12-12 16:00:35 -0800297
Myles Watsoncd1fd072016-11-09 13:17:43 -0800298 if (bta_sys_cb.ppm_cb) {
Jakub Pawlowskic752e132017-06-16 12:52:23 -0700299 bta_sys_cb.ppm_cb(BTA_SYS_SCO_CLOSE, id, app_id, &peer_addr);
Myles Watsoncd1fd072016-11-09 13:17:43 -0800300 }
The Android Open Source Project5738f832012-12-12 16:00:35 -0800301}
302
303/*******************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -0800304 *
305 * Function bta_sys_sco_use
306 *
307 * Description Called by BTA subsystems when that service needs to use sco.
308 *
309 *
310 * Returns void
311 *
312 ******************************************************************************/
Myles Watsond35a6482016-10-27 08:52:16 -0700313void bta_sys_sco_use(UNUSED_ATTR uint8_t id, uint8_t app_id,
Jakub Pawlowskia484a882017-06-24 17:30:18 -0700314 const RawAddress& peer_addr) {
Myles Watsoncd1fd072016-11-09 13:17:43 -0800315 /* AV streaming need to be suspended before SCO is connected. */
316 if (bta_sys_cb.p_sco_cb) {
317 /* without querying BTM_GetNumScoLinks() */
Jakub Pawlowskic752e132017-06-16 12:52:23 -0700318 bta_sys_cb.p_sco_cb(BTA_SYS_SCO_OPEN, 1, app_id, &peer_addr);
Myles Watsoncd1fd072016-11-09 13:17:43 -0800319 }
The Android Open Source Project5738f832012-12-12 16:00:35 -0800320}
321
322/*******************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -0800323 *
324 * Function bta_sys_sco_unuse
325 *
Myles Watsoncd1fd072016-11-09 13:17:43 -0800326 * Description Called by BTA subsystems when sco connection for that
Myles Watson1baaae32016-11-09 14:25:23 -0800327 * service is no longer needed.
Myles Watson8af480e2016-11-09 10:40:23 -0800328 *
329 * Returns void
330 *
331 ******************************************************************************/
Jakub Pawlowskic752e132017-06-16 12:52:23 -0700332void bta_sys_sco_unuse(uint8_t id, uint8_t app_id,
Jakub Pawlowskia484a882017-06-24 17:30:18 -0700333 const RawAddress& peer_addr) {
Myles Watsoncd1fd072016-11-09 13:17:43 -0800334 if ((bta_sys_cb.p_sco_cb)) {
Jakub Pawlowskic752e132017-06-16 12:52:23 -0700335 uint8_t num_sco_links = BTM_GetNumScoLinks();
336 bta_sys_cb.p_sco_cb(BTA_SYS_SCO_CLOSE, num_sco_links, app_id, &peer_addr);
Myles Watsoncd1fd072016-11-09 13:17:43 -0800337 }
The Android Open Source Project5738f832012-12-12 16:00:35 -0800338}
339/*******************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -0800340 *
341 * Function bta_sys_chg_ssr_config
342 *
Myles Watsoncd1fd072016-11-09 13:17:43 -0800343 * Description Called by BTA subsystems to indicate that the given app SSR
Myles Watson1baaae32016-11-09 14:25:23 -0800344 * setting needs to be changed.
Myles Watson8af480e2016-11-09 10:40:23 -0800345 *
346 * Returns void
347 *
348 ******************************************************************************/
The Android Open Source Project5738f832012-12-12 16:00:35 -0800349#if (BTM_SSR_INCLUDED == TRUE)
Myles Watsoncd1fd072016-11-09 13:17:43 -0800350void bta_sys_chg_ssr_config(uint8_t id, uint8_t app_id, uint16_t max_latency,
351 uint16_t min_tout) {
352 if (bta_sys_cb.p_ssr_cb) {
353 bta_sys_cb.p_ssr_cb(id, app_id, max_latency, min_tout);
354 }
The Android Open Source Project5738f832012-12-12 16:00:35 -0800355}
356#endif
357/*******************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -0800358 *
359 * Function bta_sys_set_policy
360 *
361 * Description Called by BTA subsystems to indicate that the given link
362 * policy to peer device should be set
363 *
364 * Returns void
365 *
366 ******************************************************************************/
Jakub Pawlowskic752e132017-06-16 12:52:23 -0700367void bta_sys_set_policy(uint8_t id, uint8_t policy,
Jakub Pawlowskia484a882017-06-24 17:30:18 -0700368 const RawAddress& peer_addr) {
Myles Watsoncd1fd072016-11-09 13:17:43 -0800369 if (bta_sys_cb.p_policy_cb) {
Jakub Pawlowskic752e132017-06-16 12:52:23 -0700370 bta_sys_cb.p_policy_cb(BTA_SYS_PLCY_SET, id, policy, &peer_addr);
Myles Watsoncd1fd072016-11-09 13:17:43 -0800371 }
The Android Open Source Project5738f832012-12-12 16:00:35 -0800372}
373
374/*******************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -0800375 *
376 * Function bta_sys_clear_policy
377 *
378 * Description Called by BTA subsystems to indicate that the given link
379 * policy to peer device should be clear
380 *
381 * Returns void
382 *
383 ******************************************************************************/
Jakub Pawlowskic752e132017-06-16 12:52:23 -0700384void bta_sys_clear_policy(uint8_t id, uint8_t policy,
Jakub Pawlowskia484a882017-06-24 17:30:18 -0700385 const RawAddress& peer_addr) {
Myles Watsoncd1fd072016-11-09 13:17:43 -0800386 if (bta_sys_cb.p_policy_cb) {
Jakub Pawlowskic752e132017-06-16 12:52:23 -0700387 bta_sys_cb.p_policy_cb(BTA_SYS_PLCY_CLR, id, policy, &peer_addr);
Myles Watsoncd1fd072016-11-09 13:17:43 -0800388 }
The Android Open Source Project5738f832012-12-12 16:00:35 -0800389}
390
391/*******************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -0800392 *
393 * Function bta_sys_set_default_policy
394 *
395 * Description Called by BTA subsystems to indicate that the given default
396 * link policy should be set
397 *
398 * Returns void
399 *
400 ******************************************************************************/
Myles Watsoncd1fd072016-11-09 13:17:43 -0800401void bta_sys_set_default_policy(uint8_t id, uint8_t policy) {
402 if (bta_sys_cb.p_policy_cb) {
403 bta_sys_cb.p_policy_cb(BTA_SYS_PLCY_DEF_SET, id, policy, NULL);
404 }
The Android Open Source Project5738f832012-12-12 16:00:35 -0800405}
406
407/*******************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -0800408 *
409 * Function bta_sys_clear_default_policy
410 *
411 * Description Called by BTA subsystems to indicate that the given default
412 * link policy should be clear
413 *
414 * Returns void
415 *
416 ******************************************************************************/
Myles Watsoncd1fd072016-11-09 13:17:43 -0800417void bta_sys_clear_default_policy(uint8_t id, uint8_t policy) {
418 if (bta_sys_cb.p_policy_cb) {
419 bta_sys_cb.p_policy_cb(BTA_SYS_PLCY_DEF_CLR, id, policy, NULL);
420 }
The Android Open Source Project5738f832012-12-12 16:00:35 -0800421}
422
423/*******************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -0800424 *
425 * Function bta_sys_idle
426 *
427 * Description Called by BTA subsystems to indicate that the connection to
428 * peer device is idle
429 *
430 * Returns void
431 *
432 ******************************************************************************/
Jakub Pawlowskia484a882017-06-24 17:30:18 -0700433void bta_sys_idle(uint8_t id, uint8_t app_id, const RawAddress& peer_addr) {
Myles Watsoncd1fd072016-11-09 13:17:43 -0800434 if (bta_sys_cb.prm_cb) {
Jakub Pawlowskic752e132017-06-16 12:52:23 -0700435 bta_sys_cb.prm_cb(BTA_SYS_CONN_IDLE, id, app_id, &peer_addr);
Myles Watsoncd1fd072016-11-09 13:17:43 -0800436 }
The Android Open Source Project5738f832012-12-12 16:00:35 -0800437
Myles Watsoncd1fd072016-11-09 13:17:43 -0800438 if (bta_sys_cb.ppm_cb) {
Jakub Pawlowskic752e132017-06-16 12:52:23 -0700439 bta_sys_cb.ppm_cb(BTA_SYS_CONN_IDLE, id, app_id, &peer_addr);
Myles Watsoncd1fd072016-11-09 13:17:43 -0800440 }
The Android Open Source Project5738f832012-12-12 16:00:35 -0800441}
442
443/*******************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -0800444 *
445 * Function bta_sys_busy
446 *
447 * Description Called by BTA subsystems to indicate that the connection to
448 * peer device is busy
449 *
450 * Returns void
451 *
452 ******************************************************************************/
Jakub Pawlowskia484a882017-06-24 17:30:18 -0700453void bta_sys_busy(uint8_t id, uint8_t app_id, const RawAddress& peer_addr) {
Myles Watsoncd1fd072016-11-09 13:17:43 -0800454 if (bta_sys_cb.prm_cb) {
Jakub Pawlowskic752e132017-06-16 12:52:23 -0700455 bta_sys_cb.prm_cb(BTA_SYS_CONN_BUSY, id, app_id, &peer_addr);
Myles Watsoncd1fd072016-11-09 13:17:43 -0800456 }
The Android Open Source Project5738f832012-12-12 16:00:35 -0800457
Myles Watsoncd1fd072016-11-09 13:17:43 -0800458 if (bta_sys_cb.ppm_cb) {
Jakub Pawlowskic752e132017-06-16 12:52:23 -0700459 bta_sys_cb.ppm_cb(BTA_SYS_CONN_BUSY, id, app_id, &peer_addr);
Myles Watsoncd1fd072016-11-09 13:17:43 -0800460 }
The Android Open Source Project5738f832012-12-12 16:00:35 -0800461}
462
Chris Manton1e61ce12014-10-24 09:12:41 -0700463#if (BTA_EIR_CANNED_UUID_LIST != TRUE)
The Android Open Source Project5738f832012-12-12 16:00:35 -0800464/*******************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -0800465 *
466 * Function bta_sys_eir_register
467 *
Myles Watsoncd1fd072016-11-09 13:17:43 -0800468 * Description Called by BTA DM to register EIR utility function that can
Myles Watson1baaae32016-11-09 14:25:23 -0800469 * be used by the other BTA modules to add/remove UUID.
Myles Watson8af480e2016-11-09 10:40:23 -0800470 *
471 * Returns void
472 *
473 ******************************************************************************/
Myles Watsoncd1fd072016-11-09 13:17:43 -0800474void bta_sys_eir_register(tBTA_SYS_EIR_CBACK* p_cback) {
475 bta_sys_cb.eir_cb = p_cback;
The Android Open Source Project5738f832012-12-12 16:00:35 -0800476}
477
478/*******************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -0800479 *
480 * Function bta_sys_add_uuid
481 *
482 * Description Called by BTA subsystems to indicate to DM that new service
483 * class UUID is added.
484 *
485 * Returns void
486 *
487 ******************************************************************************/
Myles Watsoncd1fd072016-11-09 13:17:43 -0800488void bta_sys_add_uuid(uint16_t uuid16) {
489 if (bta_sys_cb.eir_cb) {
490 bta_sys_cb.eir_cb(uuid16, true);
491 }
The Android Open Source Project5738f832012-12-12 16:00:35 -0800492}
493
494/*******************************************************************************
Myles Watson8af480e2016-11-09 10:40:23 -0800495 *
496 * Function bta_sys_remove_uuid
497 *
498 * Description Called by BTA subsystems to indicate to DM that the service
499 * class UUID is removed.
500 *
501 * Returns void
502 *
503 ******************************************************************************/
Myles Watsoncd1fd072016-11-09 13:17:43 -0800504void bta_sys_remove_uuid(uint16_t uuid16) {
505 if (bta_sys_cb.eir_cb) {
506 bta_sys_cb.eir_cb(uuid16, false);
507 }
The Android Open Source Project5738f832012-12-12 16:00:35 -0800508}
509#endif