• Home
  • Raw
  • Download

Lines Matching refs:p_scb

57 typedef void (*tBTA_AG_ATCMD_CBACK)(tBTA_AG_SCB* p_scb, uint16_t cmd,
74 static void bta_ag_cback_open(tBTA_AG_SCB* p_scb, const RawAddress& bd_addr, in bta_ag_cback_open() argument
79 open.hdr.handle = bta_ag_scb_to_idx(p_scb); in bta_ag_cback_open()
80 open.hdr.app_id = p_scb->app_id; in bta_ag_cback_open()
82 open.service_id = bta_ag_svc_id[p_scb->conn_service]; in bta_ag_cback_open()
99 void bta_ag_register(tBTA_AG_SCB* p_scb, const tBTA_AG_DATA& data) { in bta_ag_register() argument
101 p_scb->reg_services = data.api_register.services; in bta_ag_register()
102 p_scb->features = data.api_register.features; in bta_ag_register()
103 p_scb->masked_features = data.api_register.features; in bta_ag_register()
104 p_scb->app_id = data.api_register.app_id; in bta_ag_register()
107 bta_ag_create_records(p_scb, data); in bta_ag_register()
110 bta_ag_start_servers(p_scb, p_scb->reg_services); in bta_ag_register()
114 reg.hdr.handle = bta_ag_scb_to_idx(p_scb); in bta_ag_register()
115 reg.hdr.app_id = p_scb->app_id; in bta_ag_register()
131 void bta_ag_deregister(tBTA_AG_SCB* p_scb, const tBTA_AG_DATA& data) { in bta_ag_deregister() argument
133 p_scb->dealloc = true; in bta_ag_deregister()
136 bta_ag_del_records(p_scb); in bta_ag_deregister()
139 bta_ag_close_servers(p_scb, p_scb->reg_services); in bta_ag_deregister()
142 bta_ag_scb_dealloc(p_scb); in bta_ag_deregister()
155 void bta_ag_start_dereg(tBTA_AG_SCB* p_scb, const tBTA_AG_DATA& data) { in bta_ag_start_dereg() argument
157 p_scb->dealloc = true; in bta_ag_start_dereg()
160 bta_ag_del_records(p_scb); in bta_ag_start_dereg()
173 void bta_ag_start_open(tBTA_AG_SCB* p_scb, const tBTA_AG_DATA& data) { in bta_ag_start_open() argument
174 p_scb->peer_addr = data.api_open.bd_addr; in bta_ag_start_open()
175 p_scb->open_services = p_scb->reg_services; in bta_ag_start_open()
183 bta_ag_collision_cback(BTA_SYS_CONN_OPEN, BTA_ID_AG, 0, p_scb->peer_addr); in bta_ag_start_open()
188 bta_ag_close_servers(p_scb, p_scb->reg_services); in bta_ag_start_open()
191 p_scb->role = BTA_AG_INT; in bta_ag_start_open()
194 bta_ag_do_disc(p_scb, p_scb->open_services); in bta_ag_start_open()
207 void bta_ag_disc_int_res(tBTA_AG_SCB* p_scb, const tBTA_AG_DATA& data) { in bta_ag_disc_int_res() argument
216 if (bta_ag_sdp_find_attr(p_scb, p_scb->open_services)) { in bta_ag_disc_int_res()
218 p_scb->conn_service = bta_ag_service_to_idx(p_scb->open_services); in bta_ag_disc_int_res()
226 bta_ag_free_db(p_scb, data); in bta_ag_disc_int_res()
233 if ((p_scb->open_services & BTA_HFP_SERVICE_MASK) && in bta_ag_disc_int_res()
234 (p_scb->open_services & BTA_HSP_SERVICE_MASK)) { in bta_ag_disc_int_res()
236 p_scb->open_services &= ~BTA_HFP_SERVICE_MASK; in bta_ag_disc_int_res()
237 bta_ag_do_disc(p_scb, p_scb->open_services); in bta_ag_disc_int_res()
238 } else if ((p_scb->open_services & BTA_HSP_SERVICE_MASK) && in bta_ag_disc_int_res()
239 (p_scb->hsp_version == HSP_VERSION_1_2)) { in bta_ag_disc_int_res()
241 p_scb->hsp_version = HSP_VERSION_1_0; in bta_ag_disc_int_res()
242 bta_ag_do_disc(p_scb, p_scb->open_services); in bta_ag_disc_int_res()
245 bta_ag_sm_execute(p_scb, event, data); in bta_ag_disc_int_res()
249 bta_ag_sm_execute(p_scb, event, data); in bta_ag_disc_int_res()
263 void bta_ag_disc_acp_res(tBTA_AG_SCB* p_scb, const tBTA_AG_DATA& data) { in bta_ag_disc_acp_res() argument
268 bta_ag_sdp_find_attr(p_scb, bta_ag_svc_mask[p_scb->conn_service]); in bta_ag_disc_acp_res()
272 bta_ag_free_db(p_scb, data); in bta_ag_disc_acp_res()
285 void bta_ag_disc_fail(tBTA_AG_SCB* p_scb, in bta_ag_disc_fail() argument
288 bta_ag_start_servers(p_scb, p_scb->reg_services); in bta_ag_disc_fail()
293 RawAddress peer_addr = p_scb->peer_addr; in bta_ag_disc_fail()
294 p_scb->peer_addr = RawAddress::kEmpty; in bta_ag_disc_fail()
297 bta_ag_cback_open(p_scb, peer_addr, BTA_AG_FAIL_SDP); in bta_ag_disc_fail()
310 void bta_ag_open_fail(tBTA_AG_SCB* p_scb, const tBTA_AG_DATA& data) { in bta_ag_open_fail() argument
312 bta_ag_cback_open(p_scb, data.api_open.bd_addr, BTA_AG_FAIL_RESOURCES); in bta_ag_open_fail()
325 void bta_ag_rfc_fail(tBTA_AG_SCB* p_scb, UNUSED_ATTR const tBTA_AG_DATA& data) { in bta_ag_rfc_fail() argument
326 RawAddress peer_addr = p_scb->peer_addr; in bta_ag_rfc_fail()
328 p_scb->conn_handle = 0; in bta_ag_rfc_fail()
329 p_scb->conn_service = 0; in bta_ag_rfc_fail()
330 p_scb->peer_features = 0; in bta_ag_rfc_fail()
331 p_scb->peer_codecs = BTA_AG_CODEC_CVSD; in bta_ag_rfc_fail()
332 p_scb->sco_codec = BTA_AG_CODEC_CVSD; in bta_ag_rfc_fail()
333 p_scb->role = 0; in bta_ag_rfc_fail()
334 p_scb->svc_conn = false; in bta_ag_rfc_fail()
335 p_scb->hsp_version = HSP_VERSION_1_2; in bta_ag_rfc_fail()
337 p_scb->peer_addr = RawAddress::kEmpty; in bta_ag_rfc_fail()
340 bta_ag_start_servers(p_scb, p_scb->reg_services); in bta_ag_rfc_fail()
343 bta_ag_cback_open(p_scb, peer_addr, BTA_AG_FAIL_RFCOMM); in bta_ag_rfc_fail()
356 void bta_ag_rfc_close(tBTA_AG_SCB* p_scb, in bta_ag_rfc_close() argument
363 p_scb->conn_service = 0; in bta_ag_rfc_close()
364 p_scb->peer_features = 0; in bta_ag_rfc_close()
365 p_scb->masked_features = p_scb->features; in bta_ag_rfc_close()
366 p_scb->peer_codecs = BTA_AG_CODEC_CVSD; in bta_ag_rfc_close()
367 p_scb->sco_codec = BTA_AG_CODEC_CVSD; in bta_ag_rfc_close()
369 p_scb->codec_updated = false; in bta_ag_rfc_close()
370 p_scb->codec_fallback = false; in bta_ag_rfc_close()
371 p_scb->codec_msbc_settings = BTA_AG_SCO_MSBC_SETTINGS_T2; in bta_ag_rfc_close()
372 p_scb->role = 0; in bta_ag_rfc_close()
373 p_scb->post_sco = BTA_AG_POST_SCO_NONE; in bta_ag_rfc_close()
374 p_scb->svc_conn = false; in bta_ag_rfc_close()
375 p_scb->hsp_version = HSP_VERSION_1_2; in bta_ag_rfc_close()
376 bta_ag_at_reinit(&p_scb->at_cb); in bta_ag_rfc_close()
378 for (auto& peer_hf_indicator : p_scb->peer_hf_indicators) { in bta_ag_rfc_close()
381 for (auto& local_hf_indicator : p_scb->local_hf_indicators) { in bta_ag_rfc_close()
386 alarm_cancel(p_scb->ring_timer); in bta_ag_rfc_close()
387 alarm_cancel(p_scb->codec_negotiation_timer); in bta_ag_rfc_close()
389 close.hdr.handle = bta_ag_scb_to_idx(p_scb); in bta_ag_rfc_close()
390 close.hdr.app_id = p_scb->app_id; in bta_ag_rfc_close()
391 close.bd_addr = p_scb->peer_addr; in bta_ag_rfc_close()
393 bta_sys_conn_close(BTA_ID_AG, p_scb->app_id, p_scb->peer_addr); in bta_ag_rfc_close()
395 if (bta_ag_get_active_device() == p_scb->peer_addr) { in bta_ag_rfc_close()
403 if (!p_scb->dealloc) { in bta_ag_rfc_close()
405 p_scb->peer_addr = RawAddress::kEmpty; in bta_ag_rfc_close()
408 services = p_scb->reg_services; in bta_ag_rfc_close()
410 if (p_scb->serv_handle[i]) in bta_ag_rfc_close()
413 bta_ag_start_servers(p_scb, services); in bta_ag_rfc_close()
415 p_scb->conn_handle = 0; in bta_ag_rfc_close()
418 bta_ag_sco_shutdown(p_scb, tBTA_AG_DATA::kEmpty); in bta_ag_rfc_close()
427 bta_sys_sco_unuse(BTA_ID_AG, p_scb->app_id, p_scb->peer_addr); in bta_ag_rfc_close()
433 RFCOMM_RemoveServer(p_scb->conn_handle); in bta_ag_rfc_close()
434 bta_ag_scb_dealloc(p_scb); in bta_ag_rfc_close()
448 void bta_ag_rfc_open(tBTA_AG_SCB* p_scb, const tBTA_AG_DATA& data) { in bta_ag_rfc_open() argument
450 p_scb->clip_enabled = false; in bta_ag_rfc_open()
451 p_scb->ccwa_enabled = false; in bta_ag_rfc_open()
452 p_scb->cmer_enabled = false; in bta_ag_rfc_open()
453 p_scb->cmee_enabled = false; in bta_ag_rfc_open()
454 p_scb->inband_enabled = in bta_ag_rfc_open()
455 ((p_scb->features & BTA_AG_FEAT_INBAND) == BTA_AG_FEAT_INBAND); in bta_ag_rfc_open()
456 if (p_scb->conn_service == BTA_AG_HFP) { in bta_ag_rfc_open()
457 size_t version_value_size = sizeof(p_scb->peer_version); in bta_ag_rfc_open()
459 p_scb->peer_addr.ToString(), HFP_VERSION_CONFIG_KEY, in bta_ag_rfc_open()
460 (uint8_t*)&p_scb->peer_version, &version_value_size)) { in bta_ag_rfc_open()
462 __func__, p_scb->peer_addr.ToString().c_str()); in bta_ag_rfc_open()
463 p_scb->peer_version = HFP_HSP_VERSION_UNKNOWN; in bta_ag_rfc_open()
465 size_t sdp_features_size = sizeof(p_scb->peer_sdp_features); in bta_ag_rfc_open()
467 p_scb->peer_addr.ToString(), HFP_SDP_FEATURES_CONFIG_KEY, in bta_ag_rfc_open()
468 (uint8_t*)&p_scb->peer_sdp_features, &sdp_features_size)) { in bta_ag_rfc_open()
469 bool sdp_wbs_support = p_scb->peer_sdp_features & BTA_AG_FEAT_WBS_SUPPORT; in bta_ag_rfc_open()
470 if (!p_scb->received_at_bac && sdp_wbs_support) { in bta_ag_rfc_open()
471 p_scb->codec_updated = true; in bta_ag_rfc_open()
472 p_scb->peer_codecs = BTA_AG_CODEC_CVSD & BTA_AG_CODEC_MSBC; in bta_ag_rfc_open()
473 p_scb->sco_codec = UUID_CODEC_MSBC; in bta_ag_rfc_open()
477 __func__, p_scb->peer_addr.ToString().c_str()); in bta_ag_rfc_open()
482 p_scb->at_cb.p_at_tbl = bta_ag_at_tbl[p_scb->conn_service]; in bta_ag_rfc_open()
483 p_scb->at_cb.p_cmd_cback = bta_ag_at_cback_tbl[p_scb->conn_service]; in bta_ag_rfc_open()
484 p_scb->at_cb.p_err_cback = bta_ag_at_err_cback; in bta_ag_rfc_open()
485 p_scb->at_cb.p_user = p_scb; in bta_ag_rfc_open()
486 p_scb->at_cb.cmd_max_len = BTA_AG_CMD_MAX; in bta_ag_rfc_open()
487 bta_ag_at_init(&p_scb->at_cb); in bta_ag_rfc_open()
489 bta_sys_conn_open(BTA_ID_AG, p_scb->app_id, p_scb->peer_addr); in bta_ag_rfc_open()
491 bta_ag_cback_open(p_scb, p_scb->peer_addr, BTA_AG_SUCCESS); in bta_ag_rfc_open()
493 if (p_scb->conn_service == BTA_AG_HFP) { in bta_ag_rfc_open()
495 bta_sys_start_timer(p_scb->ring_timer, p_bta_ag_cfg->conn_tout, in bta_ag_rfc_open()
496 BTA_AG_SVC_TIMEOUT_EVT, bta_ag_scb_to_idx(p_scb)); in bta_ag_rfc_open()
499 bta_ag_svc_conn_open(p_scb, data); in bta_ag_rfc_open()
513 void bta_ag_rfc_acp_open(tBTA_AG_SCB* p_scb, const tBTA_AG_DATA& data) { in bta_ag_rfc_acp_open() argument
515 p_scb->serv_handle[0], p_scb->serv_handle[1]); in bta_ag_rfc_acp_open()
517 p_scb->role = BTA_AG_ACP; in bta_ag_rfc_acp_open()
535 if (dev_addr != ag_scb.peer_addr && p_scb != &ag_scb) { in bta_ag_rfc_acp_open()
540 if (dev_addr == ag_scb.peer_addr && p_scb != &ag_scb) { in bta_ag_rfc_acp_open()
559 << ", index=" << bta_ag_scb_to_idx(p_scb); in bta_ag_rfc_acp_open()
562 p_scb->peer_addr = dev_addr; in bta_ag_rfc_acp_open()
568 p_scb->serv_handle[i], data.rfc.port_handle); in bta_ag_rfc_acp_open()
570 if (p_scb->serv_handle[i] == data.rfc.port_handle) { in bta_ag_rfc_acp_open()
571 p_scb->conn_service = i; in bta_ag_rfc_acp_open()
572 p_scb->conn_handle = data.rfc.port_handle; in bta_ag_rfc_acp_open()
578 p_scb->conn_service, p_scb->conn_handle); in bta_ag_rfc_acp_open()
582 p_scb, (p_scb->reg_services & ~bta_ag_svc_mask[p_scb->conn_service])); in bta_ag_rfc_acp_open()
585 bta_ag_do_disc(p_scb, bta_ag_svc_mask[p_scb->conn_service]); in bta_ag_rfc_acp_open()
588 bta_ag_rfc_open(p_scb, data); in bta_ag_rfc_acp_open()
601 void bta_ag_rfc_data(tBTA_AG_SCB* p_scb, UNUSED_ATTR const tBTA_AG_DATA& data) { in bta_ag_rfc_data() argument
610 if (PORT_ReadData(p_scb->conn_handle, buf, BTA_AG_RFC_READ_MAX, &len) != in bta_ag_rfc_data()
612 LOG(ERROR) << __func__ << ": failed to read data " << p_scb->peer_addr; in bta_ag_rfc_data()
618 LOG(WARNING) << __func__ << ": no data for " << p_scb->peer_addr; in bta_ag_rfc_data()
623 bta_sys_busy(BTA_ID_AG, p_scb->app_id, p_scb->peer_addr); in bta_ag_rfc_data()
624 bta_ag_at_parse(&p_scb->at_cb, buf, len); in bta_ag_rfc_data()
625 if ((p_scb->sco_idx != BTM_INVALID_SCO_INDEX) && in bta_ag_rfc_data()
626 bta_ag_sco_is_open(p_scb)) { in bta_ag_rfc_data()
628 bta_sys_sco_open(BTA_ID_AG, p_scb->app_id, p_scb->peer_addr); in bta_ag_rfc_data()
630 bta_sys_idle(BTA_ID_AG, p_scb->app_id, p_scb->peer_addr); in bta_ag_rfc_data()
650 void bta_ag_start_close(tBTA_AG_SCB* p_scb, const tBTA_AG_DATA& data) { in bta_ag_start_close() argument
652 bta_dm_pm_active(p_scb->peer_addr); in bta_ag_start_close()
653 L2CA_SetIdleTimeoutByBdAddr(p_scb->peer_addr, 0, BT_TRANSPORT_BR_EDR); in bta_ag_start_close()
656 if (bta_ag_sco_is_open(p_scb)) { in bta_ag_start_close()
657 p_scb->post_sco = BTA_AG_POST_SCO_CLOSE_RFC; in bta_ag_start_close()
659 p_scb->post_sco = BTA_AG_POST_SCO_NONE; in bta_ag_start_close()
660 bta_ag_rfc_do_close(p_scb, data); in bta_ag_start_close()
664 bta_ag_sco_shutdown(p_scb, data); in bta_ag_start_close()
677 void bta_ag_post_sco_open(tBTA_AG_SCB* p_scb, const tBTA_AG_DATA& data) { in bta_ag_post_sco_open() argument
678 switch (p_scb->post_sco) { in bta_ag_post_sco_open()
680 bta_ag_send_ring(p_scb, data); in bta_ag_post_sco_open()
681 p_scb->post_sco = BTA_AG_POST_SCO_NONE; in bta_ag_post_sco_open()
685 bta_ag_send_call_inds(p_scb, BTA_AG_IN_CALL_CONN_RES); in bta_ag_post_sco_open()
686 p_scb->post_sco = BTA_AG_POST_SCO_NONE; in bta_ag_post_sco_open()
704 void bta_ag_post_sco_close(tBTA_AG_SCB* p_scb, const tBTA_AG_DATA& data) { in bta_ag_post_sco_close() argument
705 switch (p_scb->post_sco) { in bta_ag_post_sco_close()
707 bta_ag_rfc_do_close(p_scb, data); in bta_ag_post_sco_close()
708 p_scb->post_sco = BTA_AG_POST_SCO_NONE; in bta_ag_post_sco_close()
712 bta_ag_send_call_inds(p_scb, BTA_AG_IN_CALL_CONN_RES); in bta_ag_post_sco_close()
713 p_scb->post_sco = BTA_AG_POST_SCO_NONE; in bta_ag_post_sco_close()
717 bta_ag_send_call_inds(p_scb, BTA_AG_OUT_CALL_ORIG_RES); in bta_ag_post_sco_close()
718 p_scb->post_sco = BTA_AG_POST_SCO_NONE; in bta_ag_post_sco_close()
722 bta_ag_send_call_inds(p_scb, BTA_AG_END_CALL_RES); in bta_ag_post_sco_close()
723 p_scb->post_sco = BTA_AG_POST_SCO_NONE; in bta_ag_post_sco_close()
727 bta_ag_send_call_inds(p_scb, BTA_AG_END_CALL_RES); in bta_ag_post_sco_close()
730 bta_ag_send_call_inds(p_scb, BTA_AG_IN_CALL_RES); in bta_ag_post_sco_close()
732 if (bta_ag_inband_enabled(p_scb) && in bta_ag_post_sco_close()
733 !(p_scb->features & BTA_AG_FEAT_NOSCO)) { in bta_ag_post_sco_close()
734 p_scb->post_sco = BTA_AG_POST_SCO_RING; in bta_ag_post_sco_close()
735 bta_ag_sco_open(p_scb, data); in bta_ag_post_sco_close()
737 p_scb->post_sco = BTA_AG_POST_SCO_NONE; in bta_ag_post_sco_close()
738 bta_ag_send_ring(p_scb, data); in bta_ag_post_sco_close()
757 void bta_ag_svc_conn_open(tBTA_AG_SCB* p_scb, in bta_ag_svc_conn_open() argument
761 if (!p_scb->svc_conn) { in bta_ag_svc_conn_open()
763 p_scb->svc_conn = true; in bta_ag_svc_conn_open()
766 p_scb->bia_masked_out = 0; in bta_ag_svc_conn_open()
768 alarm_cancel(p_scb->ring_timer); in bta_ag_svc_conn_open()
771 evt.hdr.handle = bta_ag_scb_to_idx(p_scb); in bta_ag_svc_conn_open()
772 evt.hdr.app_id = p_scb->app_id; in bta_ag_svc_conn_open()
773 evt.peer_feat = p_scb->peer_features; in bta_ag_svc_conn_open()
774 evt.bd_addr = p_scb->peer_addr; in bta_ag_svc_conn_open()
775 evt.peer_codec = p_scb->peer_codecs; in bta_ag_svc_conn_open()
777 if ((p_scb->call_ind != BTA_AG_CALL_INACTIVE) || in bta_ag_svc_conn_open()
778 (p_scb->callsetup_ind != BTA_AG_CALLSETUP_NONE)) { in bta_ag_svc_conn_open()
779 bta_sys_sco_use(BTA_ID_AG, p_scb->app_id, p_scb->peer_addr); in bta_ag_svc_conn_open()
782 bta_ag_api_set_active_device(p_scb->peer_addr); in bta_ag_svc_conn_open()
798 void bta_ag_setcodec(tBTA_AG_SCB* p_scb, const tBTA_AG_DATA& data) { in bta_ag_setcodec() argument
801 val.hdr.handle = bta_ag_scb_to_idx(p_scb); in bta_ag_setcodec()
814 if ((p_scb->peer_codecs & codec_type) || (codec_type == BTA_AG_CODEC_NONE) || in bta_ag_setcodec()
816 p_scb->sco_codec = codec_type; in bta_ag_setcodec()
817 p_scb->codec_updated = true; in bta_ag_setcodec()
841 void bta_ag_handle_collision(tBTA_AG_SCB* p_scb, in bta_ag_handle_collision() argument
844 if (p_scb->p_disc_db) { in bta_ag_handle_collision()
845 SDP_CancelServiceSearch(p_scb->p_disc_db); in bta_ag_handle_collision()
846 bta_ag_free_db(p_scb, tBTA_AG_DATA::kEmpty); in bta_ag_handle_collision()
851 if (bta_ag_is_server_closed(p_scb)) { in bta_ag_handle_collision()
852 bta_ag_start_servers(p_scb, p_scb->reg_services); in bta_ag_handle_collision()
856 alarm_set_on_mloop(p_scb->collision_timer, BTA_AG_COLLISION_TIMEOUT_MS, in bta_ag_handle_collision()
857 bta_ag_collision_timer_cback, p_scb); in bta_ag_handle_collision()