• Home
  • Raw
  • Download

Lines Matching refs:p_scb

204 static void bta_ag_send_result(tBTA_AG_SCB* p_scb, size_t code,  in bta_ag_send_result()  argument
222 if (p_scb->conn_service == BTA_AG_HSP) { in bta_ag_send_result()
250 PORT_WriteData(p_scb->conn_handle, buf, (uint16_t)(p - buf), &len); in bta_ag_send_result()
263 static void bta_ag_send_ok(tBTA_AG_SCB* p_scb) { in bta_ag_send_ok() argument
264 bta_ag_send_result(p_scb, BTA_AG_LOCAL_RES_OK, nullptr, 0); in bta_ag_send_ok()
278 static void bta_ag_send_error(tBTA_AG_SCB* p_scb, int16_t errcode) { in bta_ag_send_error() argument
280 if (p_scb->conn_service == BTA_AG_HFP && p_scb->cmee_enabled) in bta_ag_send_error()
281 bta_ag_send_result(p_scb, BTA_AG_LOCAL_RES_CMEE, nullptr, errcode); in bta_ag_send_error()
283 bta_ag_send_result(p_scb, BTA_AG_LOCAL_RES_ERROR, nullptr, 0); in bta_ag_send_error()
296 static void bta_ag_send_ind(tBTA_AG_SCB* p_scb, uint16_t id, uint16_t value, in bta_ag_send_ind() argument
303 if ((p_scb->bia_masked_out & ((uint32_t)1 << id)) && in bta_ag_send_ind()
311 if ((value == p_scb->call_ind) && (!on_demand)) return; in bta_ag_send_ind()
313 p_scb->call_ind = (uint8_t)value; in bta_ag_send_ind()
317 if (value == p_scb->callsetup_ind) return; in bta_ag_send_ind()
319 p_scb->callsetup_ind = (uint8_t)value; in bta_ag_send_ind()
323 if (value == p_scb->service_ind) return; in bta_ag_send_ind()
325 p_scb->service_ind = (uint8_t)value; in bta_ag_send_ind()
328 if (value == p_scb->signal_ind) return; in bta_ag_send_ind()
330 p_scb->signal_ind = (uint8_t)value; in bta_ag_send_ind()
333 if (value == p_scb->roam_ind) return; in bta_ag_send_ind()
335 p_scb->roam_ind = (uint8_t)value; in bta_ag_send_ind()
338 if (value == p_scb->battchg_ind) return; in bta_ag_send_ind()
340 p_scb->battchg_ind = (uint8_t)value; in bta_ag_send_ind()
345 if ((value != 1) && (value == p_scb->callheld_ind)) return; in bta_ag_send_ind()
347 p_scb->callheld_ind = (uint8_t)value; in bta_ag_send_ind()
350 if (p_scb->cmer_enabled) { in bta_ag_send_ind()
354 bta_ag_send_result(p_scb, BTA_AG_IND_RES, str, 0); in bta_ag_send_ind()
412 static uint8_t bta_ag_parse_chld(UNUSED_ATTR tBTA_AG_SCB* p_scb, char* p_s) { in bta_ag_parse_chld() argument
441 static tBTA_AG_PEER_CODEC bta_ag_parse_bac(tBTA_AG_SCB* p_scb, char* p_s, in bta_ag_parse_bac() argument
534 bool bta_ag_inband_enabled(tBTA_AG_SCB* p_scb) { in bta_ag_inband_enabled() argument
536 return p_scb->inband_enabled && !bta_ag_other_scb_open(p_scb); in bta_ag_inband_enabled()
549 void bta_ag_send_call_inds(tBTA_AG_SCB* p_scb, tBTA_AG_RES result) { in bta_ag_send_call_inds() argument
562 call = p_scb->call_ind; in bta_ag_send_call_inds()
566 bta_ag_send_ind(p_scb, BTA_AG_IND_CALL, call, false); in bta_ag_send_call_inds()
567 bta_ag_send_ind(p_scb, BTA_AG_IND_CALLSETUP, callsetup, false); in bta_ag_send_call_inds()
580 void bta_ag_at_hsp_cback(tBTA_AG_SCB* p_scb, uint16_t command_id, in bta_ag_at_hsp_cback() argument
586 bta_ag_send_ok(p_scb); in bta_ag_at_hsp_cback()
589 val.hdr.handle = bta_ag_scb_to_idx(p_scb); in bta_ag_at_hsp_cback()
590 val.hdr.app_id = p_scb->app_id; in bta_ag_at_hsp_cback()
595 bta_ag_send_error(p_scb, BTA_AG_ERR_TEXT_TOO_LONG); in bta_ag_at_hsp_cback()
634 static int bta_ag_find_empty_hf_ind(tBTA_AG_SCB* p_scb) { in bta_ag_find_empty_hf_ind() argument
636 if (p_scb->peer_hf_indicators[index].ind_id == 0) return index; in bta_ag_find_empty_hf_ind()
672 static bool bta_ag_parse_bind_set(tBTA_AG_SCB* p_scb, tBTA_AG_VAL val) { in bta_ag_parse_bind_set() argument
678 int index = bta_ag_find_empty_hf_ind(p_scb); in bta_ag_parse_bind_set()
684 p_scb->peer_hf_indicators[index].ind_id = rcv_ind_id; in bta_ag_parse_bind_set()
703 static void bta_ag_bind_response(tBTA_AG_SCB* p_scb, uint8_t arg_type) { in bta_ag_bind_response() argument
721 bta_ag_send_result(p_scb, BTA_AG_BIND_RES, buffer, 0); in bta_ag_bind_response()
722 bta_ag_send_ok(p_scb); in bta_ag_bind_response()
733 p_scb->local_hf_indicators[i].ind_id = in bta_ag_bind_response()
735 p_scb->local_hf_indicators[i].is_supported = in bta_ag_bind_response()
737 p_scb->local_hf_indicators[i].is_enable = in bta_ag_bind_response()
741 p_scb->peer_hf_indicators, BTA_AG_MAX_NUM_PEER_HF_IND, in bta_ag_bind_response()
742 p_scb->local_hf_indicators[i].ind_id); in bta_ag_bind_response()
745 if (p_scb->local_hf_indicators[i].is_supported && peer_index != -1) { in bta_ag_bind_response()
747 p += utl_itoa((uint16_t)p_scb->local_hf_indicators[i].ind_id, p); in bta_ag_bind_response()
749 p += utl_itoa((uint16_t)p_scb->local_hf_indicators[i].is_enable, p); in bta_ag_bind_response()
751 bta_ag_send_result(p_scb, BTA_AG_BIND_RES, buffer, 0); in bta_ag_bind_response()
758 p_scb->local_hf_indicators[i].is_enable = false; in bta_ag_bind_response()
762 bta_ag_send_ok(p_scb); in bta_ag_bind_response()
765 if (!p_scb->svc_conn) { in bta_ag_bind_response()
766 bta_ag_svc_conn_open(p_scb, tBTA_AG_DATA::kEmpty); in bta_ag_bind_response()
781 static bool bta_ag_parse_biev_response(tBTA_AG_SCB* p_scb, tBTA_AG_VAL* val) { in bta_ag_parse_biev_response() argument
802 p_scb->local_hf_indicators, BTA_AG_MAX_NUM_LOCAL_HF_IND, rcv_ind_id); in bta_ag_parse_biev_response()
804 !p_scb->local_hf_indicators[local_index].is_supported || in bta_ag_parse_biev_response()
805 !p_scb->local_hf_indicators[local_index].is_enable) { in bta_ag_parse_biev_response()
835 tBTA_AG_SCB* p_scb = (tBTA_AG_SCB*)data; in bta_ag_bind_timer_cback() local
836 bta_ag_svc_conn_open(p_scb, tBTA_AG_DATA::kEmpty); in bta_ag_bind_timer_cback()
849 void bta_ag_at_hfp_cback(tBTA_AG_SCB* p_scb, uint16_t cmd, uint8_t arg_type, in bta_ag_at_hfp_cback() argument
857 bta_ag_send_error(p_scb, BTA_AG_ERR_INV_CHAR_IN_TSTR); in bta_ag_at_hfp_cback()
864 val.hdr.handle = bta_ag_scb_to_idx(p_scb); in bta_ag_at_hfp_cback()
865 val.hdr.app_id = p_scb->app_id; in bta_ag_at_hfp_cback()
868 val.bd_addr = p_scb->peer_addr; in bta_ag_at_hfp_cback()
872 bta_ag_send_error(p_scb, BTA_AG_ERR_TEXT_TOO_LONG); in bta_ag_at_hfp_cback()
895 bta_ag_send_ok(p_scb); in bta_ag_at_hfp_cback()
899 if (!bta_ag_sco_is_active_device(p_scb->peer_addr)) { in bta_ag_at_hfp_cback()
900 LOG(WARNING) << __func__ << ": AT+CHUP rejected as " << p_scb->peer_addr in bta_ag_at_hfp_cback()
903 bta_ag_send_error(p_scb, BTA_AG_ERR_OP_NOT_ALLOWED); in bta_ag_at_hfp_cback()
905 bta_ag_send_ok(p_scb); in bta_ag_at_hfp_cback()
926 bta_ag_send_error(p_scb, BTA_AG_ERR_INV_CHAR_IN_DSTR); in bta_ag_at_hfp_cback()
931 if (!((p_scb->peer_features & BTA_AG_PEER_FEAT_VOIP) && in bta_ag_at_hfp_cback()
932 (p_scb->features & BTA_AG_FEAT_VOIP))) { in bta_ag_at_hfp_cback()
934 bta_ag_send_error(p_scb, BTA_AG_ERR_OP_NOT_SUPPORTED); in bta_ag_at_hfp_cback()
946 bta_ag_send_error(p_scb, BTA_AG_ERR_INV_CHAR_IN_DSTR); in bta_ag_at_hfp_cback()
953 p_scb->ccwa_enabled = (bool)int_arg; in bta_ag_at_hfp_cback()
956 bta_ag_send_ok(p_scb); in bta_ag_at_hfp_cback()
966 if ((p_scb->peer_version >= HFP_VERSION_1_5) && in bta_ag_at_hfp_cback()
967 (p_scb->features & BTA_AG_FEAT_ECC) && in bta_ag_at_hfp_cback()
968 (p_scb->peer_features & BTA_AG_PEER_FEAT_ECC)) in bta_ag_at_hfp_cback()
969 bta_ag_send_result(p_scb, BTA_AG_IN_CALL_HELD_RES, in bta_ag_at_hfp_cback()
972 bta_ag_send_result(p_scb, BTA_AG_IN_CALL_HELD_RES, in bta_ag_at_hfp_cback()
976 bta_ag_send_ok(p_scb); in bta_ag_at_hfp_cback()
981 if (!p_scb->svc_conn && in bta_ag_at_hfp_cback()
982 !((p_scb->masked_features & BTA_AG_FEAT_HF_IND) && in bta_ag_at_hfp_cback()
983 (p_scb->peer_features & BTA_AG_PEER_FEAT_HF_IND))) { in bta_ag_at_hfp_cback()
984 bta_ag_svc_conn_open(p_scb, tBTA_AG_DATA::kEmpty); in bta_ag_at_hfp_cback()
986 if (p_scb->peer_version >= HFP_VERSION_1_7 && in bta_ag_at_hfp_cback()
988 &p_scb->peer_addr)) { in bta_ag_at_hfp_cback()
989 alarm_set_on_mloop(p_scb->bind_timer, BTA_AG_BIND_TIMEOUT_MS, in bta_ag_at_hfp_cback()
990 bta_ag_bind_timer_cback, p_scb); in bta_ag_at_hfp_cback()
994 val.idx = bta_ag_parse_chld(p_scb, val.str); in bta_ag_at_hfp_cback()
998 bta_ag_send_error(p_scb, BTA_AG_ERR_OP_NOT_SUPPORTED); in bta_ag_at_hfp_cback()
1002 !((p_scb->features & BTA_AG_FEAT_ECC) && in bta_ag_at_hfp_cback()
1003 (p_scb->peer_features & BTA_AG_PEER_FEAT_ECC))) { in bta_ag_at_hfp_cback()
1007 bta_ag_send_error(p_scb, BTA_AG_ERR_OP_NOT_SUPPORTED); in bta_ag_at_hfp_cback()
1034 alarm_cancel(p_scb->bind_timer); in bta_ag_at_hfp_cback()
1036 if (bta_ag_parse_bind_set(p_scb, val)) { in bta_ag_at_hfp_cback()
1037 bta_ag_send_ok(p_scb); in bta_ag_at_hfp_cback()
1040 bta_ag_send_error(p_scb, BTA_AG_ERR_INVALID_INDEX); in bta_ag_at_hfp_cback()
1043 bta_ag_bind_response(p_scb, arg_type); in bta_ag_at_hfp_cback()
1052 if (bta_ag_parse_biev_response(p_scb, &val)) { in bta_ag_at_hfp_cback()
1053 bta_ag_send_ok(p_scb); in bta_ag_at_hfp_cback()
1055 bta_ag_send_error(p_scb, BTA_AG_ERR_INVALID_INDEX); in bta_ag_at_hfp_cback()
1067 bta_ag_send_result(p_scb, BTA_AG_CIND_RES, p_bta_ag_cfg->cind_info, 0); in bta_ag_at_hfp_cback()
1068 bta_ag_send_ok(p_scb); in bta_ag_at_hfp_cback()
1074 p_scb->clip_enabled = (bool)int_arg; in bta_ag_at_hfp_cback()
1075 bta_ag_send_ok(p_scb); in bta_ag_at_hfp_cback()
1080 if (bta_ag_parse_cmer(p_arg, p_end, &p_scb->cmer_enabled)) { in bta_ag_at_hfp_cback()
1081 bta_ag_send_ok(p_scb); in bta_ag_at_hfp_cback()
1086 if (!p_scb->svc_conn && in bta_ag_at_hfp_cback()
1087 !((p_scb->masked_features & BTA_AG_FEAT_3WAY) && in bta_ag_at_hfp_cback()
1088 (p_scb->peer_features & BTA_AG_PEER_FEAT_3WAY)) && in bta_ag_at_hfp_cback()
1089 !((p_scb->masked_features & BTA_AG_FEAT_HF_IND) && in bta_ag_at_hfp_cback()
1090 (p_scb->peer_features & BTA_AG_PEER_FEAT_HF_IND))) { in bta_ag_at_hfp_cback()
1091 bta_ag_svc_conn_open(p_scb, tBTA_AG_DATA::kEmpty); in bta_ag_at_hfp_cback()
1094 bta_ag_send_error(p_scb, BTA_AG_ERR_INV_CHAR_IN_TSTR); in bta_ag_at_hfp_cback()
1101 bta_ag_send_ok(p_scb); in bta_ag_at_hfp_cback()
1104 bta_ag_send_error(p_scb, BTA_AG_ERR_INV_CHAR_IN_TSTR); in bta_ag_at_hfp_cback()
1110 if (!(p_scb->features & BTA_AG_FEAT_VTAG)) { in bta_ag_at_hfp_cback()
1112 bta_ag_send_error(p_scb, BTA_AG_ERR_OP_NOT_SUPPORTED); in bta_ag_at_hfp_cback()
1119 if (!(p_scb->features & BTA_AG_FEAT_VREC)) { in bta_ag_at_hfp_cback()
1121 bta_ag_send_error(p_scb, BTA_AG_ERR_OP_NOT_SUPPORTED); in bta_ag_at_hfp_cback()
1127 p_scb->peer_features = (uint16_t)int_arg; in bta_ag_at_hfp_cback()
1129 if (p_scb->peer_version < HFP_VERSION_1_7) { in bta_ag_at_hfp_cback()
1130 p_scb->masked_features &= HFP_1_6_FEAT_MASK; in bta_ag_at_hfp_cback()
1134 p_scb->peer_features, p_scb->masked_features); in bta_ag_at_hfp_cback()
1137 bta_ag_send_result(p_scb, BTA_AG_LOCAL_RES_BRSF, nullptr, in bta_ag_at_hfp_cback()
1138 (int16_t)p_scb->masked_features); in bta_ag_at_hfp_cback()
1139 bta_ag_send_ok(p_scb); in bta_ag_at_hfp_cback()
1145 if (p_scb->features & BTA_AG_FEAT_ECNR) { in bta_ag_at_hfp_cback()
1146 bta_ag_send_ok(p_scb); in bta_ag_at_hfp_cback()
1149 bta_ag_send_error(p_scb, BTA_AG_ERR_OP_NOT_SUPPORTED); in bta_ag_at_hfp_cback()
1155 if (p_scb->features & BTA_AG_FEAT_BTRH) { in bta_ag_at_hfp_cback()
1164 bta_ag_send_ok(p_scb); in bta_ag_at_hfp_cback()
1171 bta_ag_send_error(p_scb, BTA_AG_ERR_OP_NOT_SUPPORTED); in bta_ag_at_hfp_cback()
1181 bta_ag_send_ok(p_scb); in bta_ag_at_hfp_cback()
1186 if (p_scb->features & BTA_AG_FEAT_EXTERR) { in bta_ag_at_hfp_cback()
1188 p_scb->cmee_enabled = (bool)int_arg; in bta_ag_at_hfp_cback()
1191 bta_ag_send_ok(p_scb); in bta_ag_at_hfp_cback()
1193 bta_ag_send_error(p_scb, BTA_AG_ERR_OP_NOT_SUPPORTED); in bta_ag_at_hfp_cback()
1200 bia_masked_out = p_scb->bia_masked_out; in bta_ag_at_hfp_cback()
1223 p_scb->bia_masked_out = bia_masked_out; in bta_ag_at_hfp_cback()
1225 bta_ag_send_ok(p_scb); in bta_ag_at_hfp_cback()
1228 bta_ag_send_error(p_scb, BTA_AG_ERR_INVALID_INDEX); in bta_ag_at_hfp_cback()
1236 if (!(p_scb->features & BTA_AG_FEAT_ECS)) { in bta_ag_at_hfp_cback()
1238 bta_ag_send_error(p_scb, BTA_AG_ERR_OP_NOT_SUPPORTED); in bta_ag_at_hfp_cback()
1243 bta_ag_send_ok(p_scb); in bta_ag_at_hfp_cback()
1244 p_scb->received_at_bac = true; in bta_ag_at_hfp_cback()
1247 if ((p_scb->peer_features & BTA_AG_PEER_FEAT_CODEC) && in bta_ag_at_hfp_cback()
1248 (p_scb->features & BTA_AG_FEAT_CODEC)) { in bta_ag_at_hfp_cback()
1249 p_scb->peer_codecs = bta_ag_parse_bac(p_scb, p_arg, p_end); in bta_ag_at_hfp_cback()
1250 p_scb->codec_updated = true; in bta_ag_at_hfp_cback()
1252 if (p_scb->peer_codecs & BTA_AG_CODEC_MSBC) { in bta_ag_at_hfp_cback()
1253 p_scb->sco_codec = UUID_CODEC_MSBC; in bta_ag_at_hfp_cback()
1256 p_scb->sco_codec = UUID_CODEC_CVSD; in bta_ag_at_hfp_cback()
1265 val.num = p_scb->peer_codecs; in bta_ag_at_hfp_cback()
1268 (bta_ag_cb.sco.p_curr_scb == p_scb)) { in bta_ag_at_hfp_cback()
1269 bta_ag_codec_negotiate(p_scb); in bta_ag_at_hfp_cback()
1272 p_scb->peer_codecs = BTA_AG_CODEC_CVSD; in bta_ag_at_hfp_cback()
1280 bta_ag_send_ok(p_scb); in bta_ag_at_hfp_cback()
1281 alarm_cancel(p_scb->codec_negotiation_timer); in bta_ag_at_hfp_cback()
1296 if (p_scb->codec_fallback) in bta_ag_at_hfp_cback()
1299 codec_sent = p_scb->sco_codec; in bta_ag_at_hfp_cback()
1301 bta_ag_sco_codec_nego(p_scb, codec_type == codec_sent); in bta_ag_at_hfp_cback()
1308 if (!bta_ag_sco_is_active_device(p_scb->peer_addr)) { in bta_ag_at_hfp_cback()
1309 LOG(WARNING) << __func__ << ": AT+BCC rejected as " << p_scb->peer_addr in bta_ag_at_hfp_cback()
1311 bta_ag_send_error(p_scb, BTA_AG_ERR_OP_NOT_ALLOWED); in bta_ag_at_hfp_cback()
1314 bta_ag_send_ok(p_scb); in bta_ag_at_hfp_cback()
1315 bta_ag_sco_open(p_scb, tBTA_AG_DATA::kEmpty); in bta_ag_at_hfp_cback()
1319 bta_ag_send_error(p_scb, BTA_AG_ERR_OP_NOT_SUPPORTED); in bta_ag_at_hfp_cback()
1339 void bta_ag_at_err_cback(tBTA_AG_SCB* p_scb, bool unknown, const char* p_arg) { in bta_ag_at_err_cback() argument
1342 bta_ag_send_ok(p_scb); in bta_ag_at_err_cback()
1348 if (unknown && (p_scb->features & BTA_AG_FEAT_UNAT)) { in bta_ag_at_err_cback()
1349 val.hdr.handle = bta_ag_scb_to_idx(p_scb); in bta_ag_at_err_cback()
1350 val.hdr.app_id = p_scb->app_id; in bta_ag_at_err_cback()
1356 bta_ag_send_error(p_scb, BTA_AG_ERR_OP_NOT_SUPPORTED); in bta_ag_at_err_cback()
1370 static void bta_ag_hsp_result(tBTA_AG_SCB* p_scb, in bta_ag_hsp_result() argument
1377 bta_ag_send_result(p_scb, result.result, nullptr, result.data.num); in bta_ag_hsp_result()
1382 bta_sys_sco_use(BTA_ID_AG, p_scb->app_id, p_scb->peer_addr); in bta_ag_hsp_result()
1385 if (bta_ag_sco_is_open(p_scb) || !bta_ag_inband_enabled(p_scb) || in bta_ag_hsp_result()
1386 (p_scb->features & BTA_AG_FEAT_NOSCO)) { in bta_ag_hsp_result()
1387 bta_ag_send_ring(p_scb, tBTA_AG_DATA::kEmpty); in bta_ag_hsp_result()
1391 if (p_scb->peer_version >= HSP_VERSION_1_2) { in bta_ag_hsp_result()
1392 p_scb->post_sco = BTA_AG_POST_SCO_NONE; in bta_ag_hsp_result()
1394 p_scb->post_sco = BTA_AG_POST_SCO_RING; in bta_ag_hsp_result()
1396 bta_ag_sco_open(p_scb, tBTA_AG_DATA::kEmpty); in bta_ag_hsp_result()
1404 alarm_cancel(p_scb->ring_timer); in bta_ag_hsp_result()
1407 if (!(p_scb->features & BTA_AG_FEAT_NOSCO)) { in bta_ag_hsp_result()
1409 if (result.data.audio_handle == bta_ag_scb_to_idx(p_scb) && in bta_ag_hsp_result()
1410 !bta_ag_sco_is_open(p_scb)) { in bta_ag_hsp_result()
1411 bta_ag_sco_open(p_scb, tBTA_AG_DATA::kEmpty); in bta_ag_hsp_result()
1413 bta_ag_sco_is_open(p_scb)) { in bta_ag_hsp_result()
1415 bta_ag_sco_close(p_scb, tBTA_AG_DATA::kEmpty); in bta_ag_hsp_result()
1421 alarm_cancel(p_scb->ring_timer); in bta_ag_hsp_result()
1424 if ((bta_ag_sco_is_open(p_scb) || bta_ag_sco_is_opening(p_scb)) && in bta_ag_hsp_result()
1425 !(p_scb->features & BTA_AG_FEAT_NOSCO)) { in bta_ag_hsp_result()
1426 bta_ag_sco_close(p_scb, tBTA_AG_DATA::kEmpty); in bta_ag_hsp_result()
1429 bta_sys_sco_unuse(BTA_ID_AG, p_scb->app_id, p_scb->peer_addr); in bta_ag_hsp_result()
1434 p_scb->inband_enabled = result.data.state; in bta_ag_hsp_result()
1435 APPL_TRACE_DEBUG("inband_enabled set to %d", p_scb->inband_enabled); in bta_ag_hsp_result()
1441 bta_ag_send_result(p_scb, result.result, result.data.str, 0); in bta_ag_hsp_result()
1444 if (result.data.ok_flag == BTA_AG_OK_DONE) bta_ag_send_ok(p_scb); in bta_ag_hsp_result()
1446 bta_ag_send_error(p_scb, BTA_AG_ERR_INV_CHAR_IN_TSTR); in bta_ag_hsp_result()
1466 static void bta_ag_hfp_result(tBTA_AG_SCB* p_scb, in bta_ag_hfp_result() argument
1473 bta_ag_send_result(p_scb, result.result, nullptr, result.data.num); in bta_ag_hfp_result()
1478 bta_sys_sco_use(BTA_ID_AG, p_scb->app_id, p_scb->peer_addr); in bta_ag_hfp_result()
1480 p_scb->clip[0] = 0; in bta_ag_hfp_result()
1482 snprintf(p_scb->clip, sizeof(p_scb->clip), "%s", result.data.str); in bta_ag_hfp_result()
1485 if (p_scb->post_sco == BTA_AG_POST_SCO_CALL_END) { in bta_ag_hfp_result()
1488 p_scb->post_sco = BTA_AG_POST_SCO_CALL_END_INCALL; in bta_ag_hfp_result()
1490 bta_ag_send_call_inds(p_scb, result.result); in bta_ag_hfp_result()
1493 if (bta_ag_sco_is_open(p_scb) || !bta_ag_inband_enabled(p_scb) || in bta_ag_hfp_result()
1494 (p_scb->features & BTA_AG_FEAT_NOSCO) || in bta_ag_hfp_result()
1495 (result.data.audio_handle != bta_ag_scb_to_idx(p_scb))) { in bta_ag_hfp_result()
1496 bta_ag_send_ring(p_scb, tBTA_AG_DATA::kEmpty); in bta_ag_hfp_result()
1499 p_scb->post_sco = BTA_AG_POST_SCO_RING; in bta_ag_hfp_result()
1500 bta_ag_sco_open(p_scb, tBTA_AG_DATA::kEmpty); in bta_ag_hfp_result()
1506 alarm_cancel(p_scb->ring_timer); in bta_ag_hfp_result()
1511 bta_ag_send_call_inds(p_scb, result.result); in bta_ag_hfp_result()
1513 if (!(p_scb->features & BTA_AG_FEAT_NOSCO)) { in bta_ag_hfp_result()
1514 if (result.data.audio_handle == bta_ag_scb_to_idx(p_scb) && in bta_ag_hfp_result()
1515 !bta_ag_sco_is_open(p_scb)) { in bta_ag_hfp_result()
1516 bta_ag_sco_open(p_scb, tBTA_AG_DATA::kEmpty); in bta_ag_hfp_result()
1518 bta_ag_sco_is_open(p_scb)) { in bta_ag_hfp_result()
1519 bta_ag_sco_close(p_scb, tBTA_AG_DATA::kEmpty); in bta_ag_hfp_result()
1525 alarm_cancel(p_scb->ring_timer); in bta_ag_hfp_result()
1527 bta_ag_send_call_inds(p_scb, result.result); in bta_ag_hfp_result()
1532 bta_ag_send_call_inds(p_scb, result.result); in bta_ag_hfp_result()
1533 if (result.data.audio_handle == bta_ag_scb_to_idx(p_scb) && in bta_ag_hfp_result()
1534 !(p_scb->features & BTA_AG_FEAT_NOSCO)) { in bta_ag_hfp_result()
1535 bta_ag_sco_open(p_scb, tBTA_AG_DATA::kEmpty); in bta_ag_hfp_result()
1541 bta_ag_send_call_inds(p_scb, result.result); in bta_ag_hfp_result()
1542 if (result.data.audio_handle == bta_ag_scb_to_idx(p_scb) && in bta_ag_hfp_result()
1543 !(p_scb->features & BTA_AG_FEAT_NOSCO)) { in bta_ag_hfp_result()
1544 bta_ag_sco_open(p_scb, tBTA_AG_DATA::kEmpty); in bta_ag_hfp_result()
1551 if (!(p_scb->features & BTA_AG_FEAT_NOSCO)) { in bta_ag_hfp_result()
1552 if (result.data.audio_handle == bta_ag_scb_to_idx(p_scb)) { in bta_ag_hfp_result()
1553 bta_ag_sco_open(p_scb, tBTA_AG_DATA::kEmpty); in bta_ag_hfp_result()
1555 bta_ag_sco_close(p_scb, tBTA_AG_DATA::kEmpty); in bta_ag_hfp_result()
1562 bta_ag_send_call_inds(p_scb, result.result); in bta_ag_hfp_result()
1565 if (!(p_scb->features & BTA_AG_FEAT_NOSCO)) { in bta_ag_hfp_result()
1566 if (result.data.audio_handle == bta_ag_scb_to_idx(p_scb)) { in bta_ag_hfp_result()
1567 bta_ag_sco_open(p_scb, tBTA_AG_DATA::kEmpty); in bta_ag_hfp_result()
1569 bta_ag_sco_close(p_scb, tBTA_AG_DATA::kEmpty); in bta_ag_hfp_result()
1576 bta_ag_send_call_inds(p_scb, result.result); in bta_ag_hfp_result()
1580 alarm_cancel(p_scb->ring_timer); in bta_ag_hfp_result()
1583 if ((bta_ag_sco_is_open(p_scb) || bta_ag_sco_is_opening(p_scb)) && in bta_ag_hfp_result()
1584 !(p_scb->features & BTA_AG_FEAT_NOSCO)) { in bta_ag_hfp_result()
1585 p_scb->post_sco = BTA_AG_POST_SCO_CALL_END; in bta_ag_hfp_result()
1586 bta_ag_sco_close(p_scb, tBTA_AG_DATA::kEmpty); in bta_ag_hfp_result()
1587 } else if (p_scb->post_sco == BTA_AG_POST_SCO_CALL_END_INCALL) { in bta_ag_hfp_result()
1590 p_scb->post_sco = BTA_AG_POST_SCO_CALL_END; in bta_ag_hfp_result()
1592 bta_ag_send_call_inds(p_scb, result.result); in bta_ag_hfp_result()
1595 bta_sys_sco_unuse(BTA_ID_AG, p_scb->app_id, p_scb->peer_addr); in bta_ag_hfp_result()
1600 p_scb->inband_enabled = result.data.state; in bta_ag_hfp_result()
1601 APPL_TRACE_DEBUG("inband_enabled set to %d", p_scb->inband_enabled); in bta_ag_hfp_result()
1602 bta_ag_send_result(p_scb, result.result, nullptr, result.data.state); in bta_ag_hfp_result()
1607 p_scb->call_ind = result.data.str[0] - '0'; in bta_ag_hfp_result()
1608 p_scb->callsetup_ind = result.data.str[2] - '0'; in bta_ag_hfp_result()
1609 p_scb->service_ind = result.data.str[4] - '0'; in bta_ag_hfp_result()
1610 p_scb->signal_ind = result.data.str[6] - '0'; in bta_ag_hfp_result()
1611 p_scb->roam_ind = result.data.str[8] - '0'; in bta_ag_hfp_result()
1612 p_scb->battchg_ind = result.data.str[10] - '0'; in bta_ag_hfp_result()
1613 p_scb->callheld_ind = result.data.str[12] - '0'; in bta_ag_hfp_result()
1614 APPL_TRACE_DEBUG("cind call:%d callsetup:%d", p_scb->call_ind, in bta_ag_hfp_result()
1615 p_scb->callsetup_ind); in bta_ag_hfp_result()
1617 bta_ag_send_result(p_scb, result.result, result.data.str, 0); in bta_ag_hfp_result()
1618 bta_ag_send_ok(p_scb); in bta_ag_hfp_result()
1627 bta_ag_send_result(p_scb, result.result, result.data.str, 0); in bta_ag_hfp_result()
1630 if (result.data.ok_flag == BTA_AG_OK_DONE) bta_ag_send_ok(p_scb); in bta_ag_hfp_result()
1632 bta_ag_send_error(p_scb, result.data.errcode); in bta_ag_hfp_result()
1642 bta_ag_send_result(p_scb, result_copy.result, result_copy.data.str, in bta_ag_hfp_result()
1646 bta_ag_send_ok(p_scb); in bta_ag_hfp_result()
1649 bta_ag_send_error(p_scb, result.data.errcode); in bta_ag_hfp_result()
1655 if (p_scb->ccwa_enabled) { in bta_ag_hfp_result()
1656 bta_ag_send_result(p_scb, result.result, result.data.str, 0); in bta_ag_hfp_result()
1658 bta_ag_send_call_inds(p_scb, result.result); in bta_ag_hfp_result()
1662 bta_ag_send_ind(p_scb, result.data.ind.id, result.data.ind.value, false); in bta_ag_hfp_result()
1666 bta_ag_send_ind(p_scb, result.data.ind.id, result.data.ind.value, true); in bta_ag_hfp_result()
1670 bta_ag_send_result(p_scb, result.result, nullptr, result.data.state); in bta_ag_hfp_result()
1677 bta_ag_send_result(p_scb, result.result, nullptr, result.data.num); in bta_ag_hfp_result()
1682 bta_ag_send_ok(p_scb); in bta_ag_hfp_result()
1685 bta_ag_send_error(p_scb, result.data.errcode); in bta_ag_hfp_result()
1691 int local_index = bta_ag_find_hf_ind_by_id(p_scb->local_hf_indicators, in bta_ag_hfp_result()
1701 int peer_index = bta_ag_find_hf_ind_by_id(p_scb->peer_hf_indicators, in bta_ag_hfp_result()
1711 if (p_scb->local_hf_indicators[local_index].is_enable != in bta_ag_hfp_result()
1716 p_scb->local_hf_indicators[local_index].is_enable = in bta_ag_hfp_result()
1720 p += utl_itoa(p_scb->local_hf_indicators[local_index].is_enable, p); in bta_ag_hfp_result()
1722 bta_ag_send_result(p_scb, result.result, buffer, 0); in bta_ag_hfp_result()
1746 void bta_ag_result(tBTA_AG_SCB* p_scb, const tBTA_AG_DATA& data) { in bta_ag_result() argument
1747 if (p_scb->conn_service == BTA_AG_HSP) { in bta_ag_result()
1748 bta_ag_hsp_result(p_scb, data.api_result); in bta_ag_result()
1750 bta_ag_hfp_result(p_scb, data.api_result); in bta_ag_result()
1763 void bta_ag_send_bcs(tBTA_AG_SCB* p_scb) { in bta_ag_send_bcs() argument
1766 if (p_scb->codec_fallback) { in bta_ag_send_bcs()
1769 switch (p_scb->sco_codec) { in bta_ag_send_bcs()
1781 p_scb->sco_codec); in bta_ag_send_bcs()
1789 bta_ag_send_result(p_scb, BTA_AG_LOCAL_RES_BCS, nullptr, codec_uuid); in bta_ag_send_bcs()
1802 void bta_ag_send_ring(tBTA_AG_SCB* p_scb, in bta_ag_send_ring() argument
1804 if ((p_scb->conn_service == BTA_AG_HFP) && in bta_ag_send_ring()
1805 p_scb->callsetup_ind != BTA_AG_CALLSETUP_INCOMING) { in bta_ag_send_ring()
1807 << std::to_string(p_scb->conn_service) in bta_ag_send_ring()
1808 << ", callsetup_ind=" << std::to_string(p_scb->callsetup_ind); in bta_ag_send_ring()
1812 bta_ag_send_result(p_scb, BTA_AG_LOCAL_RES_RING, nullptr, 0); in bta_ag_send_ring()
1815 if (p_scb->conn_service == BTA_AG_HFP && p_scb->clip_enabled && in bta_ag_send_ring()
1816 p_scb->clip[0] != 0) { in bta_ag_send_ring()
1817 bta_ag_send_result(p_scb, BTA_AG_LOCAL_RES_CLIP, p_scb->clip, 0); in bta_ag_send_ring()
1820 bta_sys_start_timer(p_scb->ring_timer, BTA_AG_RING_TIMEOUT_MS, in bta_ag_send_ring()
1821 BTA_AG_RING_TIMEOUT_EVT, bta_ag_scb_to_idx(p_scb)); in bta_ag_send_ring()