Home | History | Annotate | Download | only in ag

Lines Matching refs:p_scb

329 static void bta_ag_send_result(tBTA_AG_SCB *p_scb, UINT8 code, char *p_arg,
346 if(p_scb->conn_service == BTA_AG_HSP)
386 PORT_WriteData(p_scb->conn_handle, buf, (UINT16) (p - buf), &len);
400 static void bta_ag_send_multi_result(tBTA_AG_SCB *p_scb, tBTA_AG_MULTI_RESULT_CB *m_res_cb)
450 PORT_WriteData(p_scb->conn_handle, buf, (UINT16) (p - buf), &len);
464 static void bta_ag_send_ok(tBTA_AG_SCB *p_scb)
466 bta_ag_send_result(p_scb
480 static void bta_ag_send_error(tBTA_AG_SCB *p_scb, INT16 errcode)
483 if (p_scb->conn_service == BTA_AG_HFP && p_scb->cmee_enabled)
484 bta_ag_send_result(p_scb, BTA_AG_RES_CMEE, NULL, errcode);
486 bta_ag_send_result(p_scb, BTA_AG_RES_ERROR, NULL, 0);
499 static void bta_ag_send_ind(tBTA_AG_SCB *p_scb, UINT16 id, UINT16 value, BOOLEAN on_demand)
506 if ((p_scb->bia_masked_out & ((UINT32)1 << id)) &&
514 if ((value == p_scb->call_ind) && (on_demand == FALSE))
517 p_scb->call_ind = (UINT8)value;
522 if (value == p_scb->callsetup_ind)
525 p_scb->callsetup_ind = (UINT8)value;
530 if (value == p_scb->service_ind)
533 p_scb->service_ind = (UINT8)value;
537 if (value == p_scb->signal_ind)
540 p_scb->signal_ind = (UINT8)value;
544 if (value == p_scb->roam_ind)
547 p_scb->roam_ind = (UINT8)value;
551 if (value == p_scb->battchg_ind)
554 p_scb->battchg_ind = (UINT8)value;
560 if ((value != 1) && (value == p_scb->callheld_ind))
563 p_scb->callheld_ind = (UINT8)value;
566 if (p_scb->cmer_enabled)
571 bta_ag_send_result(p_scb, BTA_AG_RES_CIEV, str, 0);
630 static UINT8 bta_ag_parse_chld(tBTA_AG_SCB *p_scb, char *p_s)
656 static tBTA_AG_PEER_CODEC bta_ag_parse_bac(tBTA_AG_SCB *p_scb, char *p_s)
760 BOOLEAN bta_ag_inband_enabled(tBTA_AG_SCB *p_scb)
763 if (p_scb->inband_enabled && !bta_ag_other_scb_open(p_scb))
783 void bta_ag_send_call_inds(tBTA_AG_SCB *p_scb, tBTA_AG_RES result)
785 UINT8 call = p_scb->call_ind;
802 call = p_scb->call_ind;
806 bta_ag_send_ind(p_scb, BTA_AG_IND_CALL, call, FALSE);
807 bta_ag_send_ind(p_scb, BTA_AG_IND_CALLSETUP, callsetup, FALSE);
820 void bta_ag_at_hsp_cback(tBTA_AG_SCB *p_scb, UINT16 cmd, UINT8 arg_type,
829 bta_ag_send_ok(p_scb);
831 val.hdr.handle = bta_ag_scb_to_idx(p_scb);
832 val.hdr.app_id = p_scb->app_id;
851 void bta_ag_at_hfp_cback(tBTA_AG_SCB *p_scb, UINT16 cmd, UINT8 arg_type,
866 val.hdr.handle = bta_ag_scb_to_idx(p_scb);
867 val.hdr.app_id = p_scb->app_id;
882 bta_ag_send_ok(p_scb);
900 bta_ag_send_error(p_scb, BTA_AG_ERR_INV_CHAR_IN_DSTR);
906 if(!((p_scb->peer_features & BTA_AG_PEER_FEAT_VOIP) && (p_scb->features & BTA_AG_FEAT_VOIP)))
909 bta_ag_send_error(p_scb, BTA_AG_ERR_OP_NOT_SUPPORTED);
919 bta_ag_send_error(p_scb, BTA_AG_ERR_INV_CHAR_IN_DSTR);
926 p_scb->ccwa_enabled = (BOOLEAN) int_arg;
929 bta_ag_send_ok(p_scb);
940 if ((p_scb->peer_version >= HFP_VERSION_1_5) &&
941 (p_scb->features & BTA_AG_FEAT_ECC) &&
942 (p_scb->peer_features & BTA_AG_PEER_FEAT_ECC))
943 bta_ag_send_result(p_scb, BTA_AG_RES_CHLD, p_bta_ag_cfg->chld_val_ecc, 0);
945 bta_ag_send_result(p_scb, BTA_AG_RES_CHLD, p_bta_ag_cfg->chld_val, 0);
948 bta_ag_send_ok(p_scb);
951 bta_ag_svc_conn_open(p_scb, NULL);
956 val.idx = bta_ag_parse_chld(p_scb, val.str);
958 if(val.idx && !((p_scb->features & BTA_AG_FEAT_ECC) && (p_scb->peer_features & BTA_AG_PEER_FEAT_ECC)))
962 bta_ag_send_error(p_scb, BTA_AG_ERR_OP_NOT_SUPPORTED);
986 /* bta_ag_send_ok(p_scb); */
997 bta_ag_send_result(p_scb, BTA_AG_RES_CIND, p_bta_ag_cfg->cind_info, 0);
998 bta_ag_send_ok(p_scb);
1004 p_scb->clip_enabled = (BOOLEAN) int_arg;
1005 bta_ag_send_ok(p_scb);
1010 if (bta_ag_parse_cmer(p_arg, &p_scb->cmer_enabled))
1012 bta_ag_send_ok(p_scb);
1017 if (!p_scb->svc_conn &&
1018 !((p_scb->features & BTA_AG_FEAT_3WAY) && (p_scb->peer_features & BTA_AG_PEER_FEAT_3WAY)))
1020 bta_ag_svc_conn_open(p_scb, NULL);
1025 bta_ag_send_error(p_scb, BTA_AG_ERR_INV_CHAR_IN_TSTR);
1033 bta_ag_send_ok(p_scb);
1038 bta_ag_send_error(p_scb, BTA_AG_ERR_INV_CHAR_IN_TSTR);
1044 if (!(p_scb->features & BTA_AG_FEAT_VTAG))
1047 bta_ag_send_error(p_scb, BTA_AG_ERR_OP_NOT_SUPPORTED);
1053 if (!(p_scb->features & BTA_AG_FEAT_VREC))
1056 bta_ag_send_error(p_scb, BTA_AG_ERR_OP_NOT_SUPPORTED);
1062 p_scb->peer_features = (UINT16) int_arg;
1065 bta_ag_send_result(p_scb, BTA_AG_RES_BRSF, NULL,
1066 (INT16) (p_scb->features & BTA_AG_BSRF_FEAT_SPEC));
1067 bta_ag_send_ok(p_scb);
1072 if (p_scb->features & BTA_AG_FEAT_ECNR)
1074 bta_ag_send_ok(p_scb);
1079 bta_ag_send_error(p_scb, BTA_AG_ERR_OP_NOT_SUPPORTED);
1085 if (p_scb->features & BTA_AG_FEAT_BTRH)
1097 bta_ag_send_ok(p_scb);
1107 bta_ag_send_error(p_scb, BTA_AG_ERR_OP_NOT_SUPPORTED);
1118 bta_ag_send_ok(p_scb);
1123 if (p_scb->features & BTA_AG_FEAT_EXTERR)
1126 p_scb->cmee_enabled = (BOOLEAN) int_arg;
1129 bta_ag_send_ok(p_scb);
1133 bta_ag_send_error(p_scb, BTA_AG_ERR_OP_NOT_SUPPORTED);
1143 bia_masked_out = p_scb->bia_masked_out;
1164 p_scb->bia_masked_out = bia_masked_out;
1165 bta_ag_send_ok (p_scb);
1168 bta_ag_send_error (p_scb, BTA_AG_ERR_INVALID_INDEX);
1174 if(!(p_scb->features & BTA_AG_FEAT_ECS))
1177 bta_ag_send_error(p_scb, BTA_AG_ERR_OP_NOT_SUPPORTED);
1183 bta_ag_send_ok(p_scb);
1186 if((p_scb->peer_features & BTA_AG_PEER_FEAT_CODEC) && (p_scb->features & BTA_AG_FEAT_CODEC))
1188 p_scb->peer_codecs = bta_ag_parse_bac(p_scb, p_arg);
1189 p_scb->codec_updated = TRUE;
1191 if (p_scb->peer_codecs & BTA_AG_CODEC_MSBC)
1193 p_scb->sco_codec = UUID_CODEC_MSBC;
1198 p_scb->sco_codec = UUID_CODEC_CVSD;
1203 if ((bta_ag_cb.sco.state == BTA_AG_SCO_CODEC_ST) && (bta_ag_cb.sco.p_curr_scb == p_scb))
1205 bta_ag_codec_negotiate (p_scb);
1210 p_scb->peer_codecs = BTA_AG_CODEC_NONE;
1217 bta_sys_stop_timer(&p_scb->cn_timer);
1229 if (p_scb->codec_fallback)
1232 codec_sent = p_scb->sco_codec;
1235 bta_ag_sco_codec_nego(p_scb, TRUE);
1237 bta_ag_sco_codec_nego(p_scb, FALSE);
1239 bta_ag_send_ok(p_scb);
1243 bta_ag_send_ok(p_scb);
1244 bta_ag_sco_open(p_scb, NULL);
1269 void bta_ag_at_err_cback(tBTA_AG_SCB *p_scb, BOOLEAN unknown, char *p_arg)
1276 bta_ag_send_ok(p_scb);
1281 if (unknown && (p_scb->features & BTA_AG_FEAT_UNAT))
1283 val.hdr.handle = bta_ag_scb_to_idx(p_scb);
1284 val.hdr.app_id = p_scb->app_id;
1292 bta_ag_send_error(p_scb, BTA_AG_ERR_OP_NOT_SUPPORTED);
1306 void bta_ag_hsp_result(tBTA_AG_SCB *p_scb, tBTA_AG_API_RESULT *p_result)
1316 bta_ag_send_result(p_scb, code, NULL, p_result->data.num);
1321 bta_sys_sco_use(BTA_ID_AG, p_scb->app_id, p_scb->peer_addr);
1324 if (bta_ag_sco_is_open(p_scb) || !bta_ag_inband_enabled(p_scb) ||
1325 (p_scb->features & BTA_AG_FEAT_NOSCO))
1327 bta_ag_send_ring(p_scb, (tBTA_AG_DATA *) p_result);
1333 if (p_scb->hsp_version >= HSP_VERSION_1_2)
1334 p_scb->post_sco = BTA_AG_POST_SCO_NONE;
1336 p_scb->post_sco = BTA_AG_POST_SCO_RING;
1338 bta_ag_sco_open(p_scb, (tBTA_AG_DATA *) p_result);
1347 bta_sys_stop_timer(&p_scb->act_timer);
1350 if (!(p_scb->features & BTA_AG_FEAT_NOSCO))
1353 if (p_result->data.audio_handle == bta_ag_scb_to_idx(p_scb))
1355 bta_ag_sco_open(p_scb, (tBTA_AG_DATA *) p_result);
1360 bta_ag_sco_close(p_scb, (tBTA_AG_DATA *) p_result);
1367 bta_sys_stop_timer(&p_scb->act_timer);
1370 if ((bta_ag_sco_is_open(p_scb) || bta_ag_sco_is_opening(p_scb)) && !(p_scb->features & BTA_AG_FEAT_NOSCO))
1372 bta_ag_sco_close(p_scb, (tBTA_AG_DATA *) p_result);
1377 bta_sys_sco_unuse(BTA_ID_AG, p_scb->app_id, p_scb->peer_addr);
1382 p_scb->inband_enabled = p_result->data.state;
1383 APPL_TRACE_DEBUG1("inband_enabled set to %d", p_scb->inband_enabled);
1391 bta_ag_send_result(p_scb, code, p_result->data.str, 0);
1395 bta_ag_send_ok(p_scb);
1399 bta_ag_send_error(p_scb, BTA_AG_ERR_INV_CHAR_IN_TSTR);
1419 void bta_ag_hfp_result(tBTA_AG_SCB *p_scb, tBTA_AG_API_RESULT *p_result)
1429 bta_ag_send_result(p_scb, code, NULL, p_result->data.num);
1434 bta_sys_sco_use(BTA_ID_AG, p_scb->app_id, p_scb->peer_addr);
1447 p_scb->clip[0] = 0;
1449 sprintf(p_scb->clip,"%s,%d", p_result->data.str, p_result->data.num);
1452 if (p_scb->post_sco == BTA_AG_POST_SCO_CALL_END)
1455 p_scb->post_sco = BTA_AG_POST_SCO_CALL_END_INCALL;
1459 bta_ag_send_call_inds(p_scb, p_result->result);
1462 if (bta_ag_sco_is_open(p_scb) || !bta_ag_inband_enabled(p_scb) ||
1463 (p_scb->features & BTA_AG_FEAT_NOSCO))
1465 bta_ag_send_ring(p_scb, (tBTA_AG_DATA *) p_result);
1470 p_scb->post_sco = BTA_AG_POST_SCO_RING;
1471 bta_ag_sco_open(p_scb, (tBTA_AG_DATA *) p_result);
1478 bta_sys_stop_timer(&p_scb->act_timer);
1483 if (p_result->data.audio_handle == bta_ag_scb_to_idx(p_scb) &&
1484 !bta_ag_sco_is_open(p_scb) && !(p_scb->features & BTA_AG_FEAT_NOSCO))
1486 p_scb->post_sco = BTA_AG_POST_SCO_CALL_CONN;
1487 bta_ag_sco_open(p_scb, (tBTA_AG_DATA *) p_result);
1493 bta_ag_sco_is_open(p_scb) && !(p_scb->features & BTA_AG_FEAT_NOSCO))
1495 p_scb->post_sco = BTA_AG_POST_SCO_CALL_CONN;
1496 bta_ag_sco_close(p_scb, (tBTA_AG_DATA *) p_result);
1501 bta_ag_send_call_inds(p_scb, p_result->result);
1507 bta_sys_stop_timer(&p_scb->act_timer);
1509 bta_ag_send_call_inds(p_scb, p_result->result);
1518 bta_ag_sco_is_open(p_scb) && !(p_scb->features & BTA_AG_FEAT_NOSCO))
1520 p_scb->post_sco = BTA_AG_POST_SCO_CALL_ORIG;
1521 bta_ag_sco_close(p_scb, (tBTA_AG_DATA *) p_result);
1525 bta_ag_send_call_inds(p_scb, p_result->result);
1526 if (p_result->data.audio_handle == bta_ag_scb_to_idx(p_scb) &&
1527 !(p_scb->features & BTA_AG_FEAT_NOSCO))
1529 bta_ag_sco_open(p_scb, (tBTA_AG_DATA *) p_result);
1536 bta_ag_send_call_inds(p_scb, p_result->result);
1537 if (p_result->data.audio_handle == bta_ag_scb_to_idx(p_scb) &&
1538 !(p_scb->features & BTA_AG_FEAT_NOSCO))
1540 bta_ag_sco_open(p_scb, (tBTA_AG_DATA *) p_result);
1546 bta_ag_send_call_inds(p_scb, p_result->result);
1549 if (!(p_scb->features & BTA_AG_FEAT_NOSCO))
1551 if (p_result->data.audio_handle == bta_ag_scb_to_idx(p_scb))
1553 bta_ag_sco_open(p_scb, (tBTA_AG_DATA *) p_result);
1557 bta_ag_sco_close(p_scb, (tBTA_AG_DATA *) p_result);
1564 bta_ag_send_call_inds(p_scb, p_result->result);
1569 bta_sys_stop_timer(&p_scb->act_timer);
1572 if ((bta_ag_sco_is_open(p_scb) || bta_ag_sco_is_opening(p_scb)) && !(p_scb->features & BTA_AG_FEAT_NOSCO))
1574 p_scb->post_sco = BTA_AG_POST_SCO_CALL_END;
1575 bta_ag_sco_close(p_scb, (tBTA_AG_DATA *) p_result);
1577 else if (p_scb->post_sco == BTA_AG_POST_SCO_CALL_END_INCALL)
1581 p_scb->post_sco = BTA_AG_POST_SCO_CALL_END;
1585 bta_ag_send_call_inds(p_scb, p_result->result);
1588 bta_sys_sco_unuse(BTA_ID_AG, p_scb->app_id, p_scb->peer_addr);
1593 p_scb->inband_enabled = p_result->data.state;
1594 APPL_TRACE_DEBUG1("inband_enabled set to %d", p_scb->inband_enabled);
1595 bta_ag_send_result(p_scb, code, NULL, p_result->data.state);
1600 p_scb->call_ind = p_result->data.str[0] - '0';
1601 p_scb->callsetup_ind = p_result->data.str[2] - '0';
1602 p_scb->service_ind = p_result->data.str[4] - '0';
1603 p_scb->signal_ind = p_result->data.str[6] - '0';
1604 p_scb->roam_ind = p_result->data.str[8] - '0';
1605 p_scb->battchg_ind = p_result->data.str[10] - '0';
1606 APPL_TRACE_DEBUG2("cind call:%d callsetup:%d", p_scb->call_ind, p_scb->callsetup_ind);
1608 bta_ag_send_result(p_scb, code, p_result->data.str, 0);
1609 bta_ag_send_ok(p_scb);
1620 bta_ag_send_result(p_scb, code, p_result->data.str, 0);
1624 bta_ag_send_ok(p_scb);
1628 bta_ag_send_error(p_scb, p_result->data.errcode);
1640 bta_ag_send_result(p_scb, code, p_result->data.str, 0);
1644 bta_ag_send_ok(p_scb);
1648 bta_ag_send_error(p_scb, p_result->data.errcode);
1653 if (p_scb->ccwa_enabled)
1655 bta_ag_send_result(p_scb, code, p_result->data.str, 0);
1657 bta_ag_send_call_inds(p_scb, p_result->result);
1661 bta_ag_send_ind(p_scb, p_result->data.ind.id, p_result->data.ind.value, FALSE);
1665 bta_ag_send_result(p_scb, code, NULL, p_result->data.state);
1674 bta_ag_send_result(p_scb, code, NULL, p_result->data.num);
1679 bta_ag_send_ok(p_scb);
1683 bta_ag_send_error(p_scb, p_result->data.errcode);
1703 void bta_ag_result(tBTA_AG_SCB *p_scb, tBTA_AG_DATA *p_data)
1705 if (p_scb->conn_service == BTA_AG_HSP)
1707 bta_ag_hsp_result(p_scb, &p_data->api_result);
1711 bta_ag_hfp_result(p_scb, &p_data->api_result);
1725 void bta_ag_setcodec(tBTA_AG_SCB *p_scb, tBTA_AG_DATA *p_data)
1739 if((p_scb->peer_codecs & codec_type) || (codec_type == BTA_AG_CODEC_NONE) || (codec_type == BTA_AG_CODEC_CVSD))
1741 p_scb->sco_codec = codec_type;
1742 p_scb->codec_updated = TRUE;
1763 void bta_ag_send_bcs(tBTA_AG_SCB *p_scb, tBTA_AG_DATA *p_data)
1767 if (p_scb->codec_fallback)
1773 switch(p_scb->sco_codec)
1779 APPL_TRACE_ERROR1("bta_ag_send_bcs: unknown codec %d, use CVSD", p_scb->sco_codec);
1786 bta_ag_send_result(p_scb, BTA_AG_RES_BCS, NULL, codec_uuid);
1801 void bta_ag_send_ring(tBTA_AG_SCB *p_scb, tBTA_AG_DATA *p_data)
1806 if (p_scb->conn_service == BTA_AG_HFP && p_scb->clip_enabled && p_scb->clip[0] != 0)
1812 AT_SET_RES_CB(m_res_cb.res_cb[1], BTA_AG_RES_CLIP, p_scb->clip, 0)
1814 bta_ag_send_multi_result(p_scb, &m_res_cb);
1819 bta_ag_send_result(p_scb, BTA_AG_RES_RING, NULL, 0);
1823 bta_ag_send_result(p_scb, BTA_AG_RES_RING, NULL, 0);
1826 if (p_scb->conn_service == BTA_AG_HFP && p_scb->clip_enabled && p_scb->clip[0] != 0)
1828 bta_ag_send_result(p_scb, BTA_AG_RES_CLIP, p_scb->clip, 0);
1833 bta_sys_start_timer(&p_scb->act_timer, BTA_AG_RING_TOUT_EVT, BTA_AG_RING_TOUT);