Loading system/bta/ag/bta_ag_act.cc +0 −10 Original line number Diff line number Diff line Loading @@ -341,10 +341,8 @@ void bta_ag_rfc_fail(tBTA_AG_SCB* p_scb, UNUSED_ATTR tBTA_AG_DATA* p_data) { p_scb->conn_handle = 0; p_scb->conn_service = 0; p_scb->peer_features = 0; #if (BTM_WBS_INCLUDED == TRUE) p_scb->peer_codecs = BTA_AG_CODEC_CVSD; p_scb->sco_codec = BTA_AG_CODEC_CVSD; #endif p_scb->role = 0; p_scb->svc_conn = false; p_scb->hsp_version = HSP_VERSION_1_2; Loading Loading @@ -376,14 +374,12 @@ void bta_ag_rfc_close(tBTA_AG_SCB* p_scb, UNUSED_ATTR tBTA_AG_DATA* p_data) { /* reinitialize stuff */ p_scb->conn_service = 0; p_scb->peer_features = 0; #if (BTM_WBS_INCLUDED == TRUE) p_scb->peer_codecs = BTA_AG_CODEC_CVSD; p_scb->sco_codec = BTA_AG_CODEC_CVSD; /* Clear these flags upon SLC teardown */ p_scb->codec_updated = false; p_scb->codec_fallback = false; p_scb->codec_msbc_settings = BTA_AG_SCO_MSBC_SETTINGS_T2; #endif p_scb->role = 0; p_scb->post_sco = BTA_AG_POST_SCO_NONE; p_scb->svc_conn = false; Loading @@ -395,9 +391,7 @@ void bta_ag_rfc_close(tBTA_AG_SCB* p_scb, UNUSED_ATTR tBTA_AG_DATA* p_data) { /* stop timers */ alarm_cancel(p_scb->ring_timer); #if (BTM_WBS_INCLUDED == TRUE) alarm_cancel(p_scb->codec_negotiation_timer); #endif close.hdr.handle = bta_ag_scb_to_idx(p_scb); close.hdr.app_id = p_scb->app_id; Loading Loading @@ -762,9 +756,7 @@ void bta_ag_svc_conn_open(tBTA_AG_SCB* p_scb, evt.hdr.app_id = p_scb->app_id; evt.peer_feat = p_scb->peer_features; bdcpy(evt.bd_addr, p_scb->peer_addr); #if (BTM_WBS_INCLUDED == TRUE) evt.peer_codec = p_scb->peer_codecs; #endif if ((p_scb->call_ind != BTA_AG_CALL_INACTIVE) || (p_scb->callsetup_ind != BTA_AG_CALLSETUP_NONE)) { Loading Loading @@ -834,7 +826,6 @@ void bta_ag_rcvd_slc_ready(tBTA_AG_SCB* p_scb, * ******************************************************************************/ void bta_ag_setcodec(tBTA_AG_SCB* p_scb, tBTA_AG_DATA* p_data) { #if (BTM_WBS_INCLUDED == TRUE) tBTA_AG_PEER_CODEC codec_type = p_data->api_setcodec.codec; tBTA_AG_VAL val; Loading Loading @@ -864,5 +855,4 @@ void bta_ag_setcodec(tBTA_AG_SCB* p_scb, tBTA_AG_DATA* p_data) { } (*bta_ag_cb.p_cback)(BTA_AG_WBS_EVT, (tBTA_AG*)&val); #endif } system/bta/ag/bta_ag_cmd.cc +0 −8 Original line number Diff line number Diff line Loading @@ -443,7 +443,6 @@ static uint8_t bta_ag_parse_chld(UNUSED_ATTR tBTA_AG_SCB* p_scb, char* p_s) { return (retval); } #if (BTM_WBS_INCLUDED == TRUE) /******************************************************************************* * * Function bta_ag_parse_bac Loading Loading @@ -492,7 +491,6 @@ static tBTA_AG_PEER_CODEC bta_ag_parse_bac(tBTA_AG_SCB* p_scb, char* p_s) { return (retval); } #endif /******************************************************************************* * Loading Loading @@ -830,9 +828,7 @@ void bta_ag_at_hfp_cback(tBTA_AG_SCB* p_scb, uint16_t cmd, uint8_t arg_type, tBTA_AG_SCB* ag_scb; uint32_t i, ind_id; uint32_t bia_masked_out; #if (BTM_WBS_INCLUDED == TRUE) tBTA_AG_PEER_CODEC codec_type, codec_sent; #endif if (p_arg == NULL) { APPL_TRACE_ERROR("%s: p_arg is null, send error and return", __func__); bta_ag_send_error(p_scb, BTA_AG_ERR_INV_CHAR_IN_TSTR); Loading Loading @@ -1173,7 +1169,6 @@ void bta_ag_at_hfp_cback(tBTA_AG_SCB* p_scb, uint16_t cmd, uint8_t arg_type, } break; #if (BTM_WBS_INCLUDED == TRUE) case BTA_AG_AT_BAC_EVT: bta_ag_send_ok(p_scb); Loading Loading @@ -1244,7 +1239,6 @@ void bta_ag_at_hfp_cback(tBTA_AG_SCB* p_scb, uint16_t cmd, uint8_t arg_type, bta_ag_send_ok(p_scb); bta_ag_sco_open(p_scb, NULL); break; #endif default: bta_ag_send_error(p_scb, BTA_AG_ERR_OP_NOT_SUPPORTED); Loading Loading @@ -1684,7 +1678,6 @@ void bta_ag_result(tBTA_AG_SCB* p_scb, tBTA_AG_DATA* p_data) { } } #if (BTM_WBS_INCLUDED == TRUE) /******************************************************************************* * * Function bta_ag_send_bcs Loading Loading @@ -1722,7 +1715,6 @@ void bta_ag_send_bcs(tBTA_AG_SCB* p_scb, tBTA_AG_DATA* p_data) { APPL_TRACE_DEBUG("send +BCS codec is %d", codec_uuid); bta_ag_send_result(p_scb, BTA_AG_LOCAL_RES_BCS, NULL, codec_uuid); } #endif /******************************************************************************* * Loading system/bta/ag/bta_ag_int.h +3 −17 Original line number Diff line number Diff line Loading @@ -119,9 +119,7 @@ enum { enum { BTA_AG_SCO_SHUTDOWN_ST, /* no sco listening, all sco connections closed */ BTA_AG_SCO_LISTEN_ST, /* sco listening */ #if (BTM_WBS_INCLUDED == TRUE) BTA_AG_SCO_CODEC_ST, /* sco codec negotiation */ #endif BTA_AG_SCO_OPENING_ST, /* sco connection opening */ BTA_AG_SCO_OPEN_CL_ST, /* opening sco connection being closed */ BTA_AG_SCO_OPEN_XFER_ST, /* opening sco connection being transferred */ Loading Loading @@ -199,9 +197,7 @@ typedef union { tBTA_AG_API_REGISTER api_register; tBTA_AG_API_OPEN api_open; tBTA_AG_API_RESULT api_result; #if (BTM_WBS_INCLUDED == TRUE) tBTA_AG_API_SETCODEC api_setcodec; #endif tBTA_AG_DISC_RESULT disc_result; tBTA_AG_RFC rfc; tBTA_AG_CI_RX_WRITE ci_rx_write; Loading @@ -213,12 +209,10 @@ typedef struct { uint8_t scn; } tBTA_AG_PROFILE; #if (BTM_WBS_INCLUDED == TRUE) typedef enum { BTA_AG_SCO_MSBC_SETTINGS_T2 = 0, /* preferred/default when codec is mSBC */ BTA_AG_SCO_MSBC_SETTINGS_T1, } tBTA_AG_SCO_MSBC_SETTINGS; #endif /* type for each service control block */ typedef struct { Loading Loading @@ -262,19 +256,15 @@ typedef struct { uint32_t bia_masked_out; /* indicators HF does not want us to send */ alarm_t* collision_timer; alarm_t* ring_timer; #if (BTM_WBS_INCLUDED == TRUE) alarm_t* codec_negotiation_timer; tBTA_AG_PEER_CODEC peer_codecs; /* codecs for eSCO supported by the peer */ tBTA_AG_PEER_CODEC sco_codec; /* codec to be used for eSCO connection */ #endif tBTA_AG_PEER_CODEC inuse_codec; /* codec being used for the current SCO connection */ #if (BTM_WBS_INCLUDED == TRUE) bool codec_updated; /* set to true whenever the app updates codec type */ bool codec_fallback; /* If sco nego fails for mSBC, fallback to CVSD */ tBTA_AG_SCO_MSBC_SETTINGS codec_msbc_settings; /* settings to be used for the impending eSCO */ #endif tBTA_AG_HF_IND peer_hf_indicators[BTA_AG_MAX_NUM_PEER_HF_IND]; /* Peer supported Loading Loading @@ -395,10 +385,8 @@ extern void bta_ag_sco_open(tBTA_AG_SCB* p_scb, tBTA_AG_DATA* p_data); extern void bta_ag_ci_sco_open_continue(tBTA_AG_SCB* p_scb, tBTA_AG_DATA* p_data); extern void bta_ag_sco_close(tBTA_AG_SCB* p_scb, tBTA_AG_DATA* p_data); #if (BTM_WBS_INCLUDED == TRUE) extern void bta_ag_sco_codec_nego(tBTA_AG_SCB* p_scb, bool result); extern void bta_ag_codec_negotiate(tBTA_AG_SCB* p_scb); #endif extern void bta_ag_sco_shutdown(tBTA_AG_SCB* p_scb, tBTA_AG_DATA* p_data); extern void bta_ag_sco_conn_open(tBTA_AG_SCB* p_scb, tBTA_AG_DATA* p_data); extern void bta_ag_sco_conn_close(tBTA_AG_SCB* p_scb, tBTA_AG_DATA* p_data); Loading @@ -407,9 +395,7 @@ extern void bta_ag_post_sco_close(tBTA_AG_SCB* p_scb, tBTA_AG_DATA* p_data); extern void bta_ag_svc_conn_open(tBTA_AG_SCB* p_scb, tBTA_AG_DATA* p_data); extern void bta_ag_result(tBTA_AG_SCB* p_scb, tBTA_AG_DATA* p_data); extern void bta_ag_setcodec(tBTA_AG_SCB* p_scb, tBTA_AG_DATA* p_data); #if (BTM_WBS_INCLUDED == TRUE) extern void bta_ag_send_bcs(tBTA_AG_SCB* p_scb, tBTA_AG_DATA* p_data); #endif extern void bta_ag_send_ring(tBTA_AG_SCB* p_scb, tBTA_AG_DATA* p_data); extern void bta_ag_ci_sco_data(tBTA_AG_SCB* p_scb, tBTA_AG_DATA* p_data); extern void bta_ag_ci_rx_data(tBTA_AG_SCB* p_scb, tBTA_AG_DATA* p_data); Loading system/bta/ag/bta_ag_main.cc +0 −8 Original line number Diff line number Diff line Loading @@ -274,20 +274,16 @@ static tBTA_AG_SCB* bta_ag_scb_alloc(void) { /* initialize variables */ p_scb->in_use = true; p_scb->sco_idx = BTM_INVALID_SCO_INDEX; #if (BTM_WBS_INCLUDED == TRUE) p_scb->codec_updated = false; p_scb->peer_codecs = BTA_AG_CODEC_CVSD; p_scb->sco_codec = BTA_AG_CODEC_CVSD; #endif /* set up timers */ p_scb->ring_timer = alarm_new("bta_ag.scb_ring_timer"); p_scb->collision_timer = alarm_new("bta_ag.scb_collision_timer"); #if (BTM_WBS_INCLUDED == TRUE) p_scb->codec_negotiation_timer = alarm_new("bta_ag.scb_codec_negotiation_timer"); /* set eSCO mSBC setting to T2 as the preferred */ p_scb->codec_msbc_settings = BTA_AG_SCO_MSBC_SETTINGS_T2; #endif APPL_TRACE_DEBUG("bta_ag_scb_alloc %d", bta_ag_scb_to_idx(p_scb)); break; } Loading Loading @@ -319,9 +315,7 @@ void bta_ag_scb_dealloc(tBTA_AG_SCB* p_scb) { /* stop and free timers */ alarm_free(p_scb->ring_timer); #if (BTM_WBS_INCLUDED == TRUE) alarm_free(p_scb->codec_negotiation_timer); #endif alarm_free(p_scb->collision_timer); /* initialize control block */ Loading Loading @@ -609,9 +603,7 @@ static void bta_ag_api_enable(tBTA_AG_DATA* p_data) { /* initialize control block */ for (size_t i = 0; i < BTA_AG_NUM_SCB; i++) { alarm_free(bta_ag_cb.scb[i].ring_timer); #if (BTM_WBS_INCLUDED == TRUE) alarm_free(bta_ag_cb.scb[i].codec_negotiation_timer); #endif alarm_free(bta_ag_cb.scb[i].collision_timer); } memset(&bta_ag_cb, 0, sizeof(tBTA_AG_CB)); Loading system/bta/ag/bta_ag_sco.cc +0 −106 Original line number Diff line number Diff line Loading @@ -64,10 +64,8 @@ enum { BTA_AG_SCO_OPEN_E, /* open request */ BTA_AG_SCO_OPEN_PENDING_E, /* Pending operations in open request */ BTA_AG_SCO_XFER_E, /* transfer request */ #if (BTM_WBS_INCLUDED == TRUE) BTA_AG_SCO_CN_DONE_E, /* codec negotiation done */ BTA_AG_SCO_REOPEN_E, /* Retry with other codec when failed */ #endif BTA_AG_SCO_CLOSE_E, /* close request */ BTA_AG_SCO_SHUTDOWN_E, /* shutdown request */ BTA_AG_SCO_CONN_OPEN_E, /* sco open */ Loading Loading @@ -162,7 +160,6 @@ static void bta_ag_sco_disc_cback(uint16_t sco_idx) { bta_dm_sco_co_close(); #endif #if (BTM_WBS_INCLUDED == TRUE) /* Restore settings */ if (bta_ag_cb.sco.p_curr_scb->inuse_codec == BTA_AG_CODEC_MSBC) { /* Bypass vendor specific and voice settings if enhanced eSCO supported */ Loading @@ -188,7 +185,6 @@ static void bta_ag_sco_disc_cback(uint16_t sco_idx) { } bta_ag_cb.sco.p_curr_scb->inuse_codec = BTA_AG_CODEC_NONE; #endif BT_HDR* p_buf = (BT_HDR*)osi_malloc(sizeof(BT_HDR)); p_buf->event = BTA_AG_SCO_CLOSE_EVT; Loading Loading @@ -378,7 +374,6 @@ static void bta_ag_create_sco(tBTA_AG_SCB* p_scb, bool is_orig) { controller_get_interface() ->supports_enhanced_setup_synchronous_connection()); #if (BTM_WBS_INCLUDED == TRUE) if ((p_scb->sco_codec == BTA_AG_CODEC_MSBC) && !p_scb->codec_fallback && !p_scb->retry_with_sco_only) esco_codec = BTA_AG_CODEC_MSBC; Loading Loading @@ -416,21 +411,6 @@ static void bta_ag_create_sco(tBTA_AG_SCB* p_scb, bool is_orig) { params.retransmission_effort = ESCO_RETRANSMISSION_POWER; } } #else /* When WBS is not included, use CVSD by default */ params = esco_parameters_for_codec(ESCO_CODEC_CVSD); /* Use the applicable packet types (3-EV3 is not allowed according to errata * 2363) */ params.packet_types = p_bta_ag_cfg->sco_pkt_types | ESCO_PKT_TYPES_MASK_NO_3_EV3; if ((!(p_scb->features & BTA_AG_FEAT_ESCO)) || (!(p_scb->peer_features & BTA_AG_PEER_FEAT_ESCO))) { params.max_latency_ms = 10; params.retransmission_effort = ESCO_RETRANSMISSION_POWER; } #endif /* if initiating set current scb and peer bd addr */ if (is_orig) { Loading @@ -445,7 +425,6 @@ static void bta_ag_create_sco(tBTA_AG_SCB* p_scb, bool is_orig) { !((params.packet_types & ~(BTM_ESCO_LINK_ONLY_MASK | BTM_SCO_LINK_ONLY_MASK)) ^ BTA_AG_NO_EDR_ESCO)) { #if (BTM_WBS_INCLUDED == TRUE) if (esco_codec != BTA_AG_CODEC_MSBC) { p_scb->retry_with_sco_only = true; APPL_TRACE_API("Setting retry_with_sco_only to TRUE"); Loading @@ -454,10 +433,6 @@ static void bta_ag_create_sco(tBTA_AG_SCB* p_scb, bool is_orig) { p_scb->retry_with_sco_only = false; APPL_TRACE_API("Setting retry_with_sco_only to FALSE"); } #else p_scb->retry_with_sco_only = true; APPL_TRACE_API("Setting retry_with_sco_only to TRUE"); #endif } } else { if (p_scb->retry_with_sco_only) APPL_TRACE_API("retrying with SCO only"); Loading @@ -474,17 +449,12 @@ static void bta_ag_create_sco(tBTA_AG_SCB* p_scb, bool is_orig) { /* tell sys to stop av if any */ bta_sys_sco_use(BTA_ID_AG, p_scb->app_id, p_scb->peer_addr); #if (BTM_WBS_INCLUDED == TRUE) /* Allow any platform specific pre-SCO set up to take place After the pre-SCO Vendor Specific commands are sent,bta_ag_ci_audio_open_continue call-in needs to be called by the app to continue with SCO connection creation */ bta_ag_co_audio_state(bta_ag_scb_to_idx(p_scb), p_scb->app_id, SCO_STATE_SETUP, esco_codec); #else bta_ag_co_audio_state(bta_ag_scb_to_idx(p_scb), p_scb->app_id, SCO_STATE_SETUP); #endif } else { p_scb->retry_with_sco_only = false; p_bd_addr = p_scb->peer_addr; Loading Loading @@ -523,11 +493,9 @@ static void bta_ag_create_pending_sco(tBTA_AG_SCB* p_scb, bool is_local) { if (is_local) { if (bta_ag_cb.sco.set_audio_status == BTA_AG_SUCCESS) { if (esco_codec == BTA_AG_CODEC_MSBC) { #if (BTM_WBS_INCLUDED == TRUE) if (p_scb->codec_msbc_settings == BTA_AG_SCO_MSBC_SETTINGS_T2) { params = esco_parameters_for_codec(ESCO_CODEC_MSBC_T2); } else #endif params = esco_parameters_for_codec(ESCO_CODEC_MSBC_T1); } else { params = esco_parameters_for_codec(ESCO_CODEC_CVSD); Loading @@ -538,7 +506,6 @@ static void bta_ag_create_pending_sco(tBTA_AG_SCB* p_scb, bool is_local) { } } #if (BTM_WBS_INCLUDED == TRUE) /* Bypass vendor specific and voice settings if enhanced eSCO supported */ if (!(controller_get_interface() ->supports_enhanced_setup_synchronous_connection())) { Loading @@ -547,7 +514,6 @@ static void bta_ag_create_pending_sco(tBTA_AG_SCB* p_scb, bool is_local) { else BTM_WriteVoiceSettings(BTM_VOICE_SETTING_CVSD); } #endif #if (BTM_SCO_HCI_INCLUDED == TRUE) /* initialize SCO setup, no voice setting for AG, data rate <==> sample Loading Loading @@ -585,7 +551,6 @@ static void bta_ag_create_pending_sco(tBTA_AG_SCB* p_scb, bool is_local) { } } #if (BTM_WBS_INCLUDED == TRUE) /******************************************************************************* * * Function bta_ag_attempt_msbc_safe_settings Loading Loading @@ -658,7 +623,6 @@ void bta_ag_codec_negotiate(tBTA_AG_SCB* p_scb) { bta_ag_sco_codec_nego(p_scb, true); } } #endif /* (BTM_WBS_INCLUDED == TRUE) */ /******************************************************************************* * Loading @@ -672,9 +636,7 @@ void bta_ag_codec_negotiate(tBTA_AG_SCB* p_scb) { ******************************************************************************/ static void bta_ag_sco_event(tBTA_AG_SCB* p_scb, uint8_t event) { tBTA_AG_SCO_CB* p_sco = &bta_ag_cb.sco; #if (BTM_WBS_INCLUDED == TRUE) tBTA_AG_SCB* p_cn_scb = NULL; /* For codec negotiation */ #endif #if (BTM_SCO_HCI_INCLUDED == TRUE) BT_HDR* p_buf; #endif Loading Loading @@ -740,15 +702,9 @@ static void bta_ag_sco_event(tBTA_AG_SCB* p_scb, uint8_t event) { /* remove listening connection */ bta_ag_remove_sco(p_scb, false); #if (BTM_WBS_INCLUDED == TRUE) /* start codec negotiation */ p_sco->state = BTA_AG_SCO_CODEC_ST; p_cn_scb = p_scb; #else /* create sco connection to peer */ bta_ag_create_sco(p_scb, true); p_sco->state = BTA_AG_SCO_OPENING_ST; #endif break; case BTA_AG_SCO_SHUTDOWN_E: Loading Loading @@ -784,7 +740,6 @@ static void bta_ag_sco_event(tBTA_AG_SCB* p_scb, uint8_t event) { } break; #if (BTM_WBS_INCLUDED == TRUE) case BTA_AG_SCO_CODEC_ST: switch (event) { case BTA_AG_SCO_LISTEN_E: Loading Loading @@ -833,7 +788,6 @@ static void bta_ag_sco_event(tBTA_AG_SCB* p_scb, uint8_t event) { break; } break; #endif case BTA_AG_SCO_OPENING_ST: switch (event) { Loading @@ -845,13 +799,11 @@ static void bta_ag_sco_event(tBTA_AG_SCB* p_scb, uint8_t event) { } break; #if (BTM_WBS_INCLUDED == TRUE) case BTA_AG_SCO_REOPEN_E: /* start codec negotiation */ p_sco->state = BTA_AG_SCO_CODEC_ST; p_cn_scb = p_scb; break; #endif case BTA_AG_SCO_OPEN_PENDING_E: /* Send pending commands to create SCO connection to peer */ Loading Loading @@ -1079,15 +1031,9 @@ static void bta_ag_sco_event(tBTA_AG_SCB* p_scb, uint8_t event) { break; case BTA_AG_SCO_CONN_CLOSE_E: #if (BTM_WBS_INCLUDED == TRUE) /* start codec negotiation */ p_sco->state = BTA_AG_SCO_CODEC_ST; p_cn_scb = p_scb; #else /* open sco connection */ bta_ag_create_sco(p_scb, true); p_sco->state = BTA_AG_SCO_OPENING_ST; #endif break; case BTA_AG_SCO_LISTEN_E: Loading Loading @@ -1133,17 +1079,10 @@ static void bta_ag_sco_event(tBTA_AG_SCB* p_scb, uint8_t event) { bta_ag_create_sco(p_scb, false); bta_ag_remove_sco(p_sco->p_xfer_scb, false); #if (BTM_WBS_INCLUDED == TRUE) /* start codec negotiation */ p_sco->state = BTA_AG_SCO_CODEC_ST; p_cn_scb = p_sco->p_xfer_scb; p_sco->p_xfer_scb = NULL; #else /* create sco connection to peer */ bta_ag_create_sco(p_sco->p_xfer_scb, true); p_sco->p_xfer_scb = NULL; p_sco->state = BTA_AG_SCO_OPENING_ST; #endif break; default: Loading Loading @@ -1222,11 +1161,9 @@ static void bta_ag_sco_event(tBTA_AG_SCB* p_scb, uint8_t event) { } #endif #if (BTM_WBS_INCLUDED == TRUE) if (p_cn_scb) { bta_ag_codec_negotiate(p_cn_scb); } #endif } /******************************************************************************* Loading Loading @@ -1332,22 +1269,16 @@ void bta_ag_ci_sco_open_continue(tBTA_AG_SCB* p_scb, tBTA_AG_DATA* p_data) { ******************************************************************************/ void bta_ag_sco_close(tBTA_AG_SCB* p_scb, UNUSED_ATTR tBTA_AG_DATA* p_data) { /* if scb is in use */ #if (BTM_WBS_INCLUDED == TRUE) /* sco_idx is not allocated in SCO_CODEC_ST, still need to move to listen * state. */ if ((p_scb->sco_idx != BTM_INVALID_SCO_INDEX) || (bta_ag_cb.sco.state == BTA_AG_SCO_CODEC_ST)) #else if (p_scb->sco_idx != BTM_INVALID_SCO_INDEX) #endif { APPL_TRACE_DEBUG("bta_ag_sco_close: sco_inx = %d", p_scb->sco_idx); bta_ag_sco_event(p_scb, BTA_AG_SCO_CLOSE_E); } } #if (BTM_WBS_INCLUDED == TRUE) /******************************************************************************* * * Function bta_ag_sco_codec_nego Loading @@ -1367,7 +1298,6 @@ void bta_ag_sco_codec_nego(tBTA_AG_SCB* p_scb, bool result) { } else /* codec negotiation failed */ bta_ag_sco_event(p_scb, BTA_AG_SCO_CLOSE_E); } #endif /******************************************************************************* * Loading Loading @@ -1399,12 +1329,8 @@ void bta_ag_sco_conn_open(tBTA_AG_SCB* p_scb, bta_sys_sco_open(BTA_ID_AG, p_scb->app_id, p_scb->peer_addr); #if (BTM_WBS_INCLUDED == TRUE) bta_ag_co_audio_state(bta_ag_scb_to_idx(p_scb), p_scb->app_id, SCO_STATE_ON, p_scb->inuse_codec); #else bta_ag_co_audio_state(bta_ag_scb_to_idx(p_scb), p_scb->app_id, SCO_STATE_ON); #endif #if (BTM_SCO_HCI_INCLUDED == TRUE) /* open SCO codec if SCO is routed through transport */ Loading @@ -1416,10 +1342,8 @@ void bta_ag_sco_conn_open(tBTA_AG_SCB* p_scb, bta_ag_cback_sco(p_scb, BTA_AG_AUDIO_OPEN_EVT); p_scb->retry_with_sco_only = false; #if (BTM_WBS_INCLUDED == TRUE) /* reset to mSBC T2 settings as the preferred */ p_scb->codec_msbc_settings = BTA_AG_SCO_MSBC_SETTINGS_T2; #endif } /******************************************************************************* Loading @@ -1440,7 +1364,6 @@ void bta_ag_sco_conn_close(tBTA_AG_SCB* p_scb, bta_ag_cb.sco.p_curr_scb = NULL; p_scb->sco_idx = BTM_INVALID_SCO_INDEX; #if (BTM_WBS_INCLUDED == TRUE) /* codec_fallback is set when AG is initiator and connection failed for mSBC. */ /* OR if codec is msbc and T2 settings failed, then retry Safe T1 settings */ Loading @@ -1452,23 +1375,11 @@ void bta_ag_sco_conn_close(tBTA_AG_SCB* p_scb, * eSCO */ bta_ag_create_sco(p_scb, true); } #else /* retry_with_sco_only, will be set only when AG is initiator ** and AG is first trying to establish an eSCO connection */ if (p_scb->retry_with_sco_only && p_scb->svc_conn) { bta_ag_create_sco(p_scb, true); } #endif else { sco_state_t sco_state = bta_ag_cb.sco.p_xfer_scb ? SCO_STATE_OFF_TRANSFER : SCO_STATE_OFF; #if (BTM_WBS_INCLUDED == TRUE) /* Indicate if the closing of audio is because of transfer */ bta_ag_co_audio_state(handle, p_scb->app_id, sco_state, p_scb->inuse_codec); #else /* Indicate if the closing of audio is because of transfer */ bta_ag_co_audio_state(handle, p_scb->app_id, sco_state); #endif bta_ag_sco_event(p_scb, BTA_AG_SCO_CONN_CLOSE_E); bta_sys_sco_close(BTA_ID_AG, p_scb->app_id, p_scb->peer_addr); Loading @@ -1483,9 +1394,7 @@ void bta_ag_sco_conn_close(tBTA_AG_SCB* p_scb, /* call app callback */ bta_ag_cback_sco(p_scb, BTA_AG_AUDIO_CLOSE_EVT); #if (BTM_WBS_INCLUDED == TRUE) p_scb->codec_msbc_settings = BTA_AG_SCO_MSBC_SETTINGS_T2; #endif } p_scb->retry_with_sco_only = false; } Loading Loading @@ -1513,19 +1422,10 @@ void bta_ag_sco_conn_rsp(tBTA_AG_SCB* p_scb, bta_ag_cb.sco.state == BTA_AG_SCO_OPEN_XFER_ST) { /* tell sys to stop av if any */ bta_sys_sco_use(BTA_ID_AG, p_scb->app_id, p_scb->peer_addr); #if (BTM_WBS_INCLUDED == FALSE) /* Allow any platform specific pre-SCO set up to take place After the pre-SCO Vendor Specific commands are sent, bta_ag_ci_audio_open_continue call-in needs to be called by the app to continue with SCO accept/reject HCI commands*/ bta_ag_co_audio_state(bta_ag_scb_to_idx(p_scb), p_scb->app_id, SCO_STATE_SETUP); #else /* When HS initiated SCO, it cannot be WBS. */ /* Allow any platform specific pre-SCO set up to take place */ bta_ag_co_audio_state(bta_ag_scb_to_idx(p_scb), p_scb->app_id, SCO_STATE_SETUP, BTA_AG_CODEC_CVSD); #endif #if (BTM_SCO_HCI_INCLUDED == TRUE) /* Configure the transport being used */ Loading @@ -1533,10 +1433,8 @@ void bta_ag_sco_conn_rsp(tBTA_AG_SCB* p_scb, #endif } #if (BTM_WBS_INCLUDED == TRUE) /* If SCO open was initiated from HS, it must be CVSD */ p_scb->inuse_codec = BTA_AG_CODEC_NONE; #endif } /******************************************************************************* Loading Loading @@ -1571,12 +1469,10 @@ static char* bta_ag_sco_evt_str(uint8_t event) { return "Open pending request"; case BTA_AG_SCO_XFER_E: return "Transfer Request"; #if (BTM_WBS_INCLUDED == TRUE) case BTA_AG_SCO_CN_DONE_E: return "Codec Negotiation Done"; case BTA_AG_SCO_REOPEN_E: return "Reopen Request"; #endif case BTA_AG_SCO_CLOSE_E: return "Close Request"; case BTA_AG_SCO_SHUTDOWN_E: Loading @@ -1598,10 +1494,8 @@ static char* bta_ag_sco_state_str(uint8_t state) { return "Shutdown"; case BTA_AG_SCO_LISTEN_ST: return "Listening"; #if (BTM_WBS_INCLUDED == TRUE) case BTA_AG_SCO_CODEC_ST: return "Codec Negotiation"; #endif case BTA_AG_SCO_OPENING_ST: return "Opening"; case BTA_AG_SCO_OPEN_CL_ST: Loading Loading
system/bta/ag/bta_ag_act.cc +0 −10 Original line number Diff line number Diff line Loading @@ -341,10 +341,8 @@ void bta_ag_rfc_fail(tBTA_AG_SCB* p_scb, UNUSED_ATTR tBTA_AG_DATA* p_data) { p_scb->conn_handle = 0; p_scb->conn_service = 0; p_scb->peer_features = 0; #if (BTM_WBS_INCLUDED == TRUE) p_scb->peer_codecs = BTA_AG_CODEC_CVSD; p_scb->sco_codec = BTA_AG_CODEC_CVSD; #endif p_scb->role = 0; p_scb->svc_conn = false; p_scb->hsp_version = HSP_VERSION_1_2; Loading Loading @@ -376,14 +374,12 @@ void bta_ag_rfc_close(tBTA_AG_SCB* p_scb, UNUSED_ATTR tBTA_AG_DATA* p_data) { /* reinitialize stuff */ p_scb->conn_service = 0; p_scb->peer_features = 0; #if (BTM_WBS_INCLUDED == TRUE) p_scb->peer_codecs = BTA_AG_CODEC_CVSD; p_scb->sco_codec = BTA_AG_CODEC_CVSD; /* Clear these flags upon SLC teardown */ p_scb->codec_updated = false; p_scb->codec_fallback = false; p_scb->codec_msbc_settings = BTA_AG_SCO_MSBC_SETTINGS_T2; #endif p_scb->role = 0; p_scb->post_sco = BTA_AG_POST_SCO_NONE; p_scb->svc_conn = false; Loading @@ -395,9 +391,7 @@ void bta_ag_rfc_close(tBTA_AG_SCB* p_scb, UNUSED_ATTR tBTA_AG_DATA* p_data) { /* stop timers */ alarm_cancel(p_scb->ring_timer); #if (BTM_WBS_INCLUDED == TRUE) alarm_cancel(p_scb->codec_negotiation_timer); #endif close.hdr.handle = bta_ag_scb_to_idx(p_scb); close.hdr.app_id = p_scb->app_id; Loading Loading @@ -762,9 +756,7 @@ void bta_ag_svc_conn_open(tBTA_AG_SCB* p_scb, evt.hdr.app_id = p_scb->app_id; evt.peer_feat = p_scb->peer_features; bdcpy(evt.bd_addr, p_scb->peer_addr); #if (BTM_WBS_INCLUDED == TRUE) evt.peer_codec = p_scb->peer_codecs; #endif if ((p_scb->call_ind != BTA_AG_CALL_INACTIVE) || (p_scb->callsetup_ind != BTA_AG_CALLSETUP_NONE)) { Loading Loading @@ -834,7 +826,6 @@ void bta_ag_rcvd_slc_ready(tBTA_AG_SCB* p_scb, * ******************************************************************************/ void bta_ag_setcodec(tBTA_AG_SCB* p_scb, tBTA_AG_DATA* p_data) { #if (BTM_WBS_INCLUDED == TRUE) tBTA_AG_PEER_CODEC codec_type = p_data->api_setcodec.codec; tBTA_AG_VAL val; Loading Loading @@ -864,5 +855,4 @@ void bta_ag_setcodec(tBTA_AG_SCB* p_scb, tBTA_AG_DATA* p_data) { } (*bta_ag_cb.p_cback)(BTA_AG_WBS_EVT, (tBTA_AG*)&val); #endif }
system/bta/ag/bta_ag_cmd.cc +0 −8 Original line number Diff line number Diff line Loading @@ -443,7 +443,6 @@ static uint8_t bta_ag_parse_chld(UNUSED_ATTR tBTA_AG_SCB* p_scb, char* p_s) { return (retval); } #if (BTM_WBS_INCLUDED == TRUE) /******************************************************************************* * * Function bta_ag_parse_bac Loading Loading @@ -492,7 +491,6 @@ static tBTA_AG_PEER_CODEC bta_ag_parse_bac(tBTA_AG_SCB* p_scb, char* p_s) { return (retval); } #endif /******************************************************************************* * Loading Loading @@ -830,9 +828,7 @@ void bta_ag_at_hfp_cback(tBTA_AG_SCB* p_scb, uint16_t cmd, uint8_t arg_type, tBTA_AG_SCB* ag_scb; uint32_t i, ind_id; uint32_t bia_masked_out; #if (BTM_WBS_INCLUDED == TRUE) tBTA_AG_PEER_CODEC codec_type, codec_sent; #endif if (p_arg == NULL) { APPL_TRACE_ERROR("%s: p_arg is null, send error and return", __func__); bta_ag_send_error(p_scb, BTA_AG_ERR_INV_CHAR_IN_TSTR); Loading Loading @@ -1173,7 +1169,6 @@ void bta_ag_at_hfp_cback(tBTA_AG_SCB* p_scb, uint16_t cmd, uint8_t arg_type, } break; #if (BTM_WBS_INCLUDED == TRUE) case BTA_AG_AT_BAC_EVT: bta_ag_send_ok(p_scb); Loading Loading @@ -1244,7 +1239,6 @@ void bta_ag_at_hfp_cback(tBTA_AG_SCB* p_scb, uint16_t cmd, uint8_t arg_type, bta_ag_send_ok(p_scb); bta_ag_sco_open(p_scb, NULL); break; #endif default: bta_ag_send_error(p_scb, BTA_AG_ERR_OP_NOT_SUPPORTED); Loading Loading @@ -1684,7 +1678,6 @@ void bta_ag_result(tBTA_AG_SCB* p_scb, tBTA_AG_DATA* p_data) { } } #if (BTM_WBS_INCLUDED == TRUE) /******************************************************************************* * * Function bta_ag_send_bcs Loading Loading @@ -1722,7 +1715,6 @@ void bta_ag_send_bcs(tBTA_AG_SCB* p_scb, tBTA_AG_DATA* p_data) { APPL_TRACE_DEBUG("send +BCS codec is %d", codec_uuid); bta_ag_send_result(p_scb, BTA_AG_LOCAL_RES_BCS, NULL, codec_uuid); } #endif /******************************************************************************* * Loading
system/bta/ag/bta_ag_int.h +3 −17 Original line number Diff line number Diff line Loading @@ -119,9 +119,7 @@ enum { enum { BTA_AG_SCO_SHUTDOWN_ST, /* no sco listening, all sco connections closed */ BTA_AG_SCO_LISTEN_ST, /* sco listening */ #if (BTM_WBS_INCLUDED == TRUE) BTA_AG_SCO_CODEC_ST, /* sco codec negotiation */ #endif BTA_AG_SCO_OPENING_ST, /* sco connection opening */ BTA_AG_SCO_OPEN_CL_ST, /* opening sco connection being closed */ BTA_AG_SCO_OPEN_XFER_ST, /* opening sco connection being transferred */ Loading Loading @@ -199,9 +197,7 @@ typedef union { tBTA_AG_API_REGISTER api_register; tBTA_AG_API_OPEN api_open; tBTA_AG_API_RESULT api_result; #if (BTM_WBS_INCLUDED == TRUE) tBTA_AG_API_SETCODEC api_setcodec; #endif tBTA_AG_DISC_RESULT disc_result; tBTA_AG_RFC rfc; tBTA_AG_CI_RX_WRITE ci_rx_write; Loading @@ -213,12 +209,10 @@ typedef struct { uint8_t scn; } tBTA_AG_PROFILE; #if (BTM_WBS_INCLUDED == TRUE) typedef enum { BTA_AG_SCO_MSBC_SETTINGS_T2 = 0, /* preferred/default when codec is mSBC */ BTA_AG_SCO_MSBC_SETTINGS_T1, } tBTA_AG_SCO_MSBC_SETTINGS; #endif /* type for each service control block */ typedef struct { Loading Loading @@ -262,19 +256,15 @@ typedef struct { uint32_t bia_masked_out; /* indicators HF does not want us to send */ alarm_t* collision_timer; alarm_t* ring_timer; #if (BTM_WBS_INCLUDED == TRUE) alarm_t* codec_negotiation_timer; tBTA_AG_PEER_CODEC peer_codecs; /* codecs for eSCO supported by the peer */ tBTA_AG_PEER_CODEC sco_codec; /* codec to be used for eSCO connection */ #endif tBTA_AG_PEER_CODEC inuse_codec; /* codec being used for the current SCO connection */ #if (BTM_WBS_INCLUDED == TRUE) bool codec_updated; /* set to true whenever the app updates codec type */ bool codec_fallback; /* If sco nego fails for mSBC, fallback to CVSD */ tBTA_AG_SCO_MSBC_SETTINGS codec_msbc_settings; /* settings to be used for the impending eSCO */ #endif tBTA_AG_HF_IND peer_hf_indicators[BTA_AG_MAX_NUM_PEER_HF_IND]; /* Peer supported Loading Loading @@ -395,10 +385,8 @@ extern void bta_ag_sco_open(tBTA_AG_SCB* p_scb, tBTA_AG_DATA* p_data); extern void bta_ag_ci_sco_open_continue(tBTA_AG_SCB* p_scb, tBTA_AG_DATA* p_data); extern void bta_ag_sco_close(tBTA_AG_SCB* p_scb, tBTA_AG_DATA* p_data); #if (BTM_WBS_INCLUDED == TRUE) extern void bta_ag_sco_codec_nego(tBTA_AG_SCB* p_scb, bool result); extern void bta_ag_codec_negotiate(tBTA_AG_SCB* p_scb); #endif extern void bta_ag_sco_shutdown(tBTA_AG_SCB* p_scb, tBTA_AG_DATA* p_data); extern void bta_ag_sco_conn_open(tBTA_AG_SCB* p_scb, tBTA_AG_DATA* p_data); extern void bta_ag_sco_conn_close(tBTA_AG_SCB* p_scb, tBTA_AG_DATA* p_data); Loading @@ -407,9 +395,7 @@ extern void bta_ag_post_sco_close(tBTA_AG_SCB* p_scb, tBTA_AG_DATA* p_data); extern void bta_ag_svc_conn_open(tBTA_AG_SCB* p_scb, tBTA_AG_DATA* p_data); extern void bta_ag_result(tBTA_AG_SCB* p_scb, tBTA_AG_DATA* p_data); extern void bta_ag_setcodec(tBTA_AG_SCB* p_scb, tBTA_AG_DATA* p_data); #if (BTM_WBS_INCLUDED == TRUE) extern void bta_ag_send_bcs(tBTA_AG_SCB* p_scb, tBTA_AG_DATA* p_data); #endif extern void bta_ag_send_ring(tBTA_AG_SCB* p_scb, tBTA_AG_DATA* p_data); extern void bta_ag_ci_sco_data(tBTA_AG_SCB* p_scb, tBTA_AG_DATA* p_data); extern void bta_ag_ci_rx_data(tBTA_AG_SCB* p_scb, tBTA_AG_DATA* p_data); Loading
system/bta/ag/bta_ag_main.cc +0 −8 Original line number Diff line number Diff line Loading @@ -274,20 +274,16 @@ static tBTA_AG_SCB* bta_ag_scb_alloc(void) { /* initialize variables */ p_scb->in_use = true; p_scb->sco_idx = BTM_INVALID_SCO_INDEX; #if (BTM_WBS_INCLUDED == TRUE) p_scb->codec_updated = false; p_scb->peer_codecs = BTA_AG_CODEC_CVSD; p_scb->sco_codec = BTA_AG_CODEC_CVSD; #endif /* set up timers */ p_scb->ring_timer = alarm_new("bta_ag.scb_ring_timer"); p_scb->collision_timer = alarm_new("bta_ag.scb_collision_timer"); #if (BTM_WBS_INCLUDED == TRUE) p_scb->codec_negotiation_timer = alarm_new("bta_ag.scb_codec_negotiation_timer"); /* set eSCO mSBC setting to T2 as the preferred */ p_scb->codec_msbc_settings = BTA_AG_SCO_MSBC_SETTINGS_T2; #endif APPL_TRACE_DEBUG("bta_ag_scb_alloc %d", bta_ag_scb_to_idx(p_scb)); break; } Loading Loading @@ -319,9 +315,7 @@ void bta_ag_scb_dealloc(tBTA_AG_SCB* p_scb) { /* stop and free timers */ alarm_free(p_scb->ring_timer); #if (BTM_WBS_INCLUDED == TRUE) alarm_free(p_scb->codec_negotiation_timer); #endif alarm_free(p_scb->collision_timer); /* initialize control block */ Loading Loading @@ -609,9 +603,7 @@ static void bta_ag_api_enable(tBTA_AG_DATA* p_data) { /* initialize control block */ for (size_t i = 0; i < BTA_AG_NUM_SCB; i++) { alarm_free(bta_ag_cb.scb[i].ring_timer); #if (BTM_WBS_INCLUDED == TRUE) alarm_free(bta_ag_cb.scb[i].codec_negotiation_timer); #endif alarm_free(bta_ag_cb.scb[i].collision_timer); } memset(&bta_ag_cb, 0, sizeof(tBTA_AG_CB)); Loading
system/bta/ag/bta_ag_sco.cc +0 −106 Original line number Diff line number Diff line Loading @@ -64,10 +64,8 @@ enum { BTA_AG_SCO_OPEN_E, /* open request */ BTA_AG_SCO_OPEN_PENDING_E, /* Pending operations in open request */ BTA_AG_SCO_XFER_E, /* transfer request */ #if (BTM_WBS_INCLUDED == TRUE) BTA_AG_SCO_CN_DONE_E, /* codec negotiation done */ BTA_AG_SCO_REOPEN_E, /* Retry with other codec when failed */ #endif BTA_AG_SCO_CLOSE_E, /* close request */ BTA_AG_SCO_SHUTDOWN_E, /* shutdown request */ BTA_AG_SCO_CONN_OPEN_E, /* sco open */ Loading Loading @@ -162,7 +160,6 @@ static void bta_ag_sco_disc_cback(uint16_t sco_idx) { bta_dm_sco_co_close(); #endif #if (BTM_WBS_INCLUDED == TRUE) /* Restore settings */ if (bta_ag_cb.sco.p_curr_scb->inuse_codec == BTA_AG_CODEC_MSBC) { /* Bypass vendor specific and voice settings if enhanced eSCO supported */ Loading @@ -188,7 +185,6 @@ static void bta_ag_sco_disc_cback(uint16_t sco_idx) { } bta_ag_cb.sco.p_curr_scb->inuse_codec = BTA_AG_CODEC_NONE; #endif BT_HDR* p_buf = (BT_HDR*)osi_malloc(sizeof(BT_HDR)); p_buf->event = BTA_AG_SCO_CLOSE_EVT; Loading Loading @@ -378,7 +374,6 @@ static void bta_ag_create_sco(tBTA_AG_SCB* p_scb, bool is_orig) { controller_get_interface() ->supports_enhanced_setup_synchronous_connection()); #if (BTM_WBS_INCLUDED == TRUE) if ((p_scb->sco_codec == BTA_AG_CODEC_MSBC) && !p_scb->codec_fallback && !p_scb->retry_with_sco_only) esco_codec = BTA_AG_CODEC_MSBC; Loading Loading @@ -416,21 +411,6 @@ static void bta_ag_create_sco(tBTA_AG_SCB* p_scb, bool is_orig) { params.retransmission_effort = ESCO_RETRANSMISSION_POWER; } } #else /* When WBS is not included, use CVSD by default */ params = esco_parameters_for_codec(ESCO_CODEC_CVSD); /* Use the applicable packet types (3-EV3 is not allowed according to errata * 2363) */ params.packet_types = p_bta_ag_cfg->sco_pkt_types | ESCO_PKT_TYPES_MASK_NO_3_EV3; if ((!(p_scb->features & BTA_AG_FEAT_ESCO)) || (!(p_scb->peer_features & BTA_AG_PEER_FEAT_ESCO))) { params.max_latency_ms = 10; params.retransmission_effort = ESCO_RETRANSMISSION_POWER; } #endif /* if initiating set current scb and peer bd addr */ if (is_orig) { Loading @@ -445,7 +425,6 @@ static void bta_ag_create_sco(tBTA_AG_SCB* p_scb, bool is_orig) { !((params.packet_types & ~(BTM_ESCO_LINK_ONLY_MASK | BTM_SCO_LINK_ONLY_MASK)) ^ BTA_AG_NO_EDR_ESCO)) { #if (BTM_WBS_INCLUDED == TRUE) if (esco_codec != BTA_AG_CODEC_MSBC) { p_scb->retry_with_sco_only = true; APPL_TRACE_API("Setting retry_with_sco_only to TRUE"); Loading @@ -454,10 +433,6 @@ static void bta_ag_create_sco(tBTA_AG_SCB* p_scb, bool is_orig) { p_scb->retry_with_sco_only = false; APPL_TRACE_API("Setting retry_with_sco_only to FALSE"); } #else p_scb->retry_with_sco_only = true; APPL_TRACE_API("Setting retry_with_sco_only to TRUE"); #endif } } else { if (p_scb->retry_with_sco_only) APPL_TRACE_API("retrying with SCO only"); Loading @@ -474,17 +449,12 @@ static void bta_ag_create_sco(tBTA_AG_SCB* p_scb, bool is_orig) { /* tell sys to stop av if any */ bta_sys_sco_use(BTA_ID_AG, p_scb->app_id, p_scb->peer_addr); #if (BTM_WBS_INCLUDED == TRUE) /* Allow any platform specific pre-SCO set up to take place After the pre-SCO Vendor Specific commands are sent,bta_ag_ci_audio_open_continue call-in needs to be called by the app to continue with SCO connection creation */ bta_ag_co_audio_state(bta_ag_scb_to_idx(p_scb), p_scb->app_id, SCO_STATE_SETUP, esco_codec); #else bta_ag_co_audio_state(bta_ag_scb_to_idx(p_scb), p_scb->app_id, SCO_STATE_SETUP); #endif } else { p_scb->retry_with_sco_only = false; p_bd_addr = p_scb->peer_addr; Loading Loading @@ -523,11 +493,9 @@ static void bta_ag_create_pending_sco(tBTA_AG_SCB* p_scb, bool is_local) { if (is_local) { if (bta_ag_cb.sco.set_audio_status == BTA_AG_SUCCESS) { if (esco_codec == BTA_AG_CODEC_MSBC) { #if (BTM_WBS_INCLUDED == TRUE) if (p_scb->codec_msbc_settings == BTA_AG_SCO_MSBC_SETTINGS_T2) { params = esco_parameters_for_codec(ESCO_CODEC_MSBC_T2); } else #endif params = esco_parameters_for_codec(ESCO_CODEC_MSBC_T1); } else { params = esco_parameters_for_codec(ESCO_CODEC_CVSD); Loading @@ -538,7 +506,6 @@ static void bta_ag_create_pending_sco(tBTA_AG_SCB* p_scb, bool is_local) { } } #if (BTM_WBS_INCLUDED == TRUE) /* Bypass vendor specific and voice settings if enhanced eSCO supported */ if (!(controller_get_interface() ->supports_enhanced_setup_synchronous_connection())) { Loading @@ -547,7 +514,6 @@ static void bta_ag_create_pending_sco(tBTA_AG_SCB* p_scb, bool is_local) { else BTM_WriteVoiceSettings(BTM_VOICE_SETTING_CVSD); } #endif #if (BTM_SCO_HCI_INCLUDED == TRUE) /* initialize SCO setup, no voice setting for AG, data rate <==> sample Loading Loading @@ -585,7 +551,6 @@ static void bta_ag_create_pending_sco(tBTA_AG_SCB* p_scb, bool is_local) { } } #if (BTM_WBS_INCLUDED == TRUE) /******************************************************************************* * * Function bta_ag_attempt_msbc_safe_settings Loading Loading @@ -658,7 +623,6 @@ void bta_ag_codec_negotiate(tBTA_AG_SCB* p_scb) { bta_ag_sco_codec_nego(p_scb, true); } } #endif /* (BTM_WBS_INCLUDED == TRUE) */ /******************************************************************************* * Loading @@ -672,9 +636,7 @@ void bta_ag_codec_negotiate(tBTA_AG_SCB* p_scb) { ******************************************************************************/ static void bta_ag_sco_event(tBTA_AG_SCB* p_scb, uint8_t event) { tBTA_AG_SCO_CB* p_sco = &bta_ag_cb.sco; #if (BTM_WBS_INCLUDED == TRUE) tBTA_AG_SCB* p_cn_scb = NULL; /* For codec negotiation */ #endif #if (BTM_SCO_HCI_INCLUDED == TRUE) BT_HDR* p_buf; #endif Loading Loading @@ -740,15 +702,9 @@ static void bta_ag_sco_event(tBTA_AG_SCB* p_scb, uint8_t event) { /* remove listening connection */ bta_ag_remove_sco(p_scb, false); #if (BTM_WBS_INCLUDED == TRUE) /* start codec negotiation */ p_sco->state = BTA_AG_SCO_CODEC_ST; p_cn_scb = p_scb; #else /* create sco connection to peer */ bta_ag_create_sco(p_scb, true); p_sco->state = BTA_AG_SCO_OPENING_ST; #endif break; case BTA_AG_SCO_SHUTDOWN_E: Loading Loading @@ -784,7 +740,6 @@ static void bta_ag_sco_event(tBTA_AG_SCB* p_scb, uint8_t event) { } break; #if (BTM_WBS_INCLUDED == TRUE) case BTA_AG_SCO_CODEC_ST: switch (event) { case BTA_AG_SCO_LISTEN_E: Loading Loading @@ -833,7 +788,6 @@ static void bta_ag_sco_event(tBTA_AG_SCB* p_scb, uint8_t event) { break; } break; #endif case BTA_AG_SCO_OPENING_ST: switch (event) { Loading @@ -845,13 +799,11 @@ static void bta_ag_sco_event(tBTA_AG_SCB* p_scb, uint8_t event) { } break; #if (BTM_WBS_INCLUDED == TRUE) case BTA_AG_SCO_REOPEN_E: /* start codec negotiation */ p_sco->state = BTA_AG_SCO_CODEC_ST; p_cn_scb = p_scb; break; #endif case BTA_AG_SCO_OPEN_PENDING_E: /* Send pending commands to create SCO connection to peer */ Loading Loading @@ -1079,15 +1031,9 @@ static void bta_ag_sco_event(tBTA_AG_SCB* p_scb, uint8_t event) { break; case BTA_AG_SCO_CONN_CLOSE_E: #if (BTM_WBS_INCLUDED == TRUE) /* start codec negotiation */ p_sco->state = BTA_AG_SCO_CODEC_ST; p_cn_scb = p_scb; #else /* open sco connection */ bta_ag_create_sco(p_scb, true); p_sco->state = BTA_AG_SCO_OPENING_ST; #endif break; case BTA_AG_SCO_LISTEN_E: Loading Loading @@ -1133,17 +1079,10 @@ static void bta_ag_sco_event(tBTA_AG_SCB* p_scb, uint8_t event) { bta_ag_create_sco(p_scb, false); bta_ag_remove_sco(p_sco->p_xfer_scb, false); #if (BTM_WBS_INCLUDED == TRUE) /* start codec negotiation */ p_sco->state = BTA_AG_SCO_CODEC_ST; p_cn_scb = p_sco->p_xfer_scb; p_sco->p_xfer_scb = NULL; #else /* create sco connection to peer */ bta_ag_create_sco(p_sco->p_xfer_scb, true); p_sco->p_xfer_scb = NULL; p_sco->state = BTA_AG_SCO_OPENING_ST; #endif break; default: Loading Loading @@ -1222,11 +1161,9 @@ static void bta_ag_sco_event(tBTA_AG_SCB* p_scb, uint8_t event) { } #endif #if (BTM_WBS_INCLUDED == TRUE) if (p_cn_scb) { bta_ag_codec_negotiate(p_cn_scb); } #endif } /******************************************************************************* Loading Loading @@ -1332,22 +1269,16 @@ void bta_ag_ci_sco_open_continue(tBTA_AG_SCB* p_scb, tBTA_AG_DATA* p_data) { ******************************************************************************/ void bta_ag_sco_close(tBTA_AG_SCB* p_scb, UNUSED_ATTR tBTA_AG_DATA* p_data) { /* if scb is in use */ #if (BTM_WBS_INCLUDED == TRUE) /* sco_idx is not allocated in SCO_CODEC_ST, still need to move to listen * state. */ if ((p_scb->sco_idx != BTM_INVALID_SCO_INDEX) || (bta_ag_cb.sco.state == BTA_AG_SCO_CODEC_ST)) #else if (p_scb->sco_idx != BTM_INVALID_SCO_INDEX) #endif { APPL_TRACE_DEBUG("bta_ag_sco_close: sco_inx = %d", p_scb->sco_idx); bta_ag_sco_event(p_scb, BTA_AG_SCO_CLOSE_E); } } #if (BTM_WBS_INCLUDED == TRUE) /******************************************************************************* * * Function bta_ag_sco_codec_nego Loading @@ -1367,7 +1298,6 @@ void bta_ag_sco_codec_nego(tBTA_AG_SCB* p_scb, bool result) { } else /* codec negotiation failed */ bta_ag_sco_event(p_scb, BTA_AG_SCO_CLOSE_E); } #endif /******************************************************************************* * Loading Loading @@ -1399,12 +1329,8 @@ void bta_ag_sco_conn_open(tBTA_AG_SCB* p_scb, bta_sys_sco_open(BTA_ID_AG, p_scb->app_id, p_scb->peer_addr); #if (BTM_WBS_INCLUDED == TRUE) bta_ag_co_audio_state(bta_ag_scb_to_idx(p_scb), p_scb->app_id, SCO_STATE_ON, p_scb->inuse_codec); #else bta_ag_co_audio_state(bta_ag_scb_to_idx(p_scb), p_scb->app_id, SCO_STATE_ON); #endif #if (BTM_SCO_HCI_INCLUDED == TRUE) /* open SCO codec if SCO is routed through transport */ Loading @@ -1416,10 +1342,8 @@ void bta_ag_sco_conn_open(tBTA_AG_SCB* p_scb, bta_ag_cback_sco(p_scb, BTA_AG_AUDIO_OPEN_EVT); p_scb->retry_with_sco_only = false; #if (BTM_WBS_INCLUDED == TRUE) /* reset to mSBC T2 settings as the preferred */ p_scb->codec_msbc_settings = BTA_AG_SCO_MSBC_SETTINGS_T2; #endif } /******************************************************************************* Loading @@ -1440,7 +1364,6 @@ void bta_ag_sco_conn_close(tBTA_AG_SCB* p_scb, bta_ag_cb.sco.p_curr_scb = NULL; p_scb->sco_idx = BTM_INVALID_SCO_INDEX; #if (BTM_WBS_INCLUDED == TRUE) /* codec_fallback is set when AG is initiator and connection failed for mSBC. */ /* OR if codec is msbc and T2 settings failed, then retry Safe T1 settings */ Loading @@ -1452,23 +1375,11 @@ void bta_ag_sco_conn_close(tBTA_AG_SCB* p_scb, * eSCO */ bta_ag_create_sco(p_scb, true); } #else /* retry_with_sco_only, will be set only when AG is initiator ** and AG is first trying to establish an eSCO connection */ if (p_scb->retry_with_sco_only && p_scb->svc_conn) { bta_ag_create_sco(p_scb, true); } #endif else { sco_state_t sco_state = bta_ag_cb.sco.p_xfer_scb ? SCO_STATE_OFF_TRANSFER : SCO_STATE_OFF; #if (BTM_WBS_INCLUDED == TRUE) /* Indicate if the closing of audio is because of transfer */ bta_ag_co_audio_state(handle, p_scb->app_id, sco_state, p_scb->inuse_codec); #else /* Indicate if the closing of audio is because of transfer */ bta_ag_co_audio_state(handle, p_scb->app_id, sco_state); #endif bta_ag_sco_event(p_scb, BTA_AG_SCO_CONN_CLOSE_E); bta_sys_sco_close(BTA_ID_AG, p_scb->app_id, p_scb->peer_addr); Loading @@ -1483,9 +1394,7 @@ void bta_ag_sco_conn_close(tBTA_AG_SCB* p_scb, /* call app callback */ bta_ag_cback_sco(p_scb, BTA_AG_AUDIO_CLOSE_EVT); #if (BTM_WBS_INCLUDED == TRUE) p_scb->codec_msbc_settings = BTA_AG_SCO_MSBC_SETTINGS_T2; #endif } p_scb->retry_with_sco_only = false; } Loading Loading @@ -1513,19 +1422,10 @@ void bta_ag_sco_conn_rsp(tBTA_AG_SCB* p_scb, bta_ag_cb.sco.state == BTA_AG_SCO_OPEN_XFER_ST) { /* tell sys to stop av if any */ bta_sys_sco_use(BTA_ID_AG, p_scb->app_id, p_scb->peer_addr); #if (BTM_WBS_INCLUDED == FALSE) /* Allow any platform specific pre-SCO set up to take place After the pre-SCO Vendor Specific commands are sent, bta_ag_ci_audio_open_continue call-in needs to be called by the app to continue with SCO accept/reject HCI commands*/ bta_ag_co_audio_state(bta_ag_scb_to_idx(p_scb), p_scb->app_id, SCO_STATE_SETUP); #else /* When HS initiated SCO, it cannot be WBS. */ /* Allow any platform specific pre-SCO set up to take place */ bta_ag_co_audio_state(bta_ag_scb_to_idx(p_scb), p_scb->app_id, SCO_STATE_SETUP, BTA_AG_CODEC_CVSD); #endif #if (BTM_SCO_HCI_INCLUDED == TRUE) /* Configure the transport being used */ Loading @@ -1533,10 +1433,8 @@ void bta_ag_sco_conn_rsp(tBTA_AG_SCB* p_scb, #endif } #if (BTM_WBS_INCLUDED == TRUE) /* If SCO open was initiated from HS, it must be CVSD */ p_scb->inuse_codec = BTA_AG_CODEC_NONE; #endif } /******************************************************************************* Loading Loading @@ -1571,12 +1469,10 @@ static char* bta_ag_sco_evt_str(uint8_t event) { return "Open pending request"; case BTA_AG_SCO_XFER_E: return "Transfer Request"; #if (BTM_WBS_INCLUDED == TRUE) case BTA_AG_SCO_CN_DONE_E: return "Codec Negotiation Done"; case BTA_AG_SCO_REOPEN_E: return "Reopen Request"; #endif case BTA_AG_SCO_CLOSE_E: return "Close Request"; case BTA_AG_SCO_SHUTDOWN_E: Loading @@ -1598,10 +1494,8 @@ static char* bta_ag_sco_state_str(uint8_t state) { return "Shutdown"; case BTA_AG_SCO_LISTEN_ST: return "Listening"; #if (BTM_WBS_INCLUDED == TRUE) case BTA_AG_SCO_CODEC_ST: return "Codec Negotiation"; #endif case BTA_AG_SCO_OPENING_ST: return "Opening"; case BTA_AG_SCO_OPEN_CL_ST: Loading