Home | History | Annotate | Download | only in ag

Lines Matching full:p_scb

335 static void bta_ag_send_result(tBTA_AG_SCB *p_scb, UINT8 code, char *p_arg,
352 if(p_scb->conn_service == BTA_AG_HSP)
392 PORT_WriteData(p_scb->conn_handle, buf, (UINT16) (p - buf), &len);
406 static void bta_ag_send_multi_result(tBTA_AG_SCB *p_scb, tBTA_AG_MULTI_RESULT_CB *m_res_cb)
456 PORT_WriteData(p_scb->conn_handle, buf, (UINT16) (p - buf), &len);
470 static void bta_ag_send_ok(tBTA_AG_SCB *p_scb)
472 bta_ag_send_result(p_scb, BTA_AG_RES_OK, NULL, 0);
486 static void bta_ag_send_error(tBTA_AG_SCB *p_scb, INT16 errcode)
489 if (p_scb->conn_service == BTA_AG_HFP && p_scb->cmee_enabled)
490 bta_ag_send_result(p_scb, BTA_AG_RES_CMEE, NULL, errcode);
492 bta_ag_send_result(p_scb, BTA_AG_RES_ERROR, NULL, 0);
505 static void bta_ag_send_ind(tBTA_AG_SCB *p_scb, UINT16 id, UINT16 value, BOOLEAN on_demand)
512 if ((p_scb->bia_masked_out & ((UINT32)1 << id)) &&
520 if ((value == p_scb->call_ind) && (on_demand == FALSE))
523 p_scb->call_ind = (UINT8)value;
528 if (value == p_scb->callsetup_ind)
531 p_scb->callsetup_ind = (UINT8)value;
536 if (value == p_scb->service_ind)
539 p_scb->service_ind = (UINT8)value;
543 if (value == p_scb->signal_ind)
546 p_scb->signal_ind = (UINT8)value;
550 if (value == p_scb->roam_ind)
553 p_scb->roam_ind = (UINT8)value;
557 if (value == p_scb->battchg_ind)
560 p_scb->battchg_ind = (UINT8)value;
566 if ((value != 1) && (value == p_scb->callheld_ind))
569 p_scb->callheld_ind = (UINT8)value;
572 if (p_scb->cmer_enabled)
577 bta_ag_send_result(p_scb, BTA_AG_RES_CIEV, str, 0);
637 static UINT8 bta_ag_parse_chld(tBTA_AG_SCB *p_scb, char *p_s)
641 UNUSED(p_scb);
675 static tBTA_AG_PEER_CODEC bta_ag_parse_bac(tBTA_AG_SCB *p_scb, char *p_s)
779 BOOLEAN bta_ag_inband_enabled(tBTA_AG_SCB *p_scb)
782 if (p_scb->inband_enabled && !bta_ag_other_scb_open(p_scb))
802 void bta_ag_send_call_inds(tBTA_AG_SCB *p_scb, tBTA_AG_RES result)
804 UINT8 call = p_scb->call_ind;
821 call = p_scb->call_ind;
825 bta_ag_send_ind(p_scb, BTA_AG_IND_CALL, call, FALSE);
826 bta_ag_send_ind(p_scb, BTA_AG_IND_CALLSETUP, callsetup, FALSE);
839 void bta_ag_at_hsp_cback(tBTA_AG_SCB *p_scb, UINT16 cmd, UINT8 arg_type,
848 bta_ag_send_ok(p_scb);
850 val.hdr.handle = bta_ag_scb_to_idx(p_scb);
851 val.hdr.app_id = p_scb->app_id;
870 void bta_ag_at_hfp_cback(tBTA_AG_SCB *p_scb, UINT16 cmd, UINT8 arg_type,
884 bta_ag_send_error(p_scb, BTA_AG_ERR_INV_CHAR_IN_TSTR);
891 val.hdr.handle = bta_ag_scb_to_idx(p_scb);
892 val.hdr.app_id = p_scb->app_id;
894 bdcpy(val.bd_addr, p_scb->peer_addr);
908 bta_ag_send_ok(p_scb);
926 bta_ag_send_error(p_scb, BTA_AG_ERR_INV_CHAR_IN_DSTR);
932 if(!((p_scb->peer_features & BTA_AG_PEER_FEAT_VOIP) && (p_scb->features & BTA_AG_FEAT_VOIP)))
935 bta_ag_send_error(p_scb, BTA_AG_ERR_OP_NOT_SUPPORTED);
945 bta_ag_send_error(p_scb, BTA_AG_ERR_INV_CHAR_IN_DSTR);
952 p_scb->ccwa_enabled = (BOOLEAN) int_arg;
955 bta_ag_send_ok(p_scb);
966 if ((p_scb->peer_version >= HFP_VERSION_1_5) &&
967 (p_scb->features & BTA_AG_FEAT_ECC) &&
968 (p_scb->peer_features & BTA_AG_PEER_FEAT_ECC))
969 bta_ag_send_result(p_scb, BTA_AG_RES_CHLD, p_bta_ag_cfg->chld_val_ecc, 0);
971 bta_ag_send_result(p_scb, BTA_AG_RES_CHLD, p_bta_ag_cfg->chld_val, 0);
974 bta_ag_send_ok(p_scb);
977 bta_ag_svc_conn_open(p_scb, NULL);
982 val.idx = bta_ag_parse_chld(p_scb, val.str);
987 bta_ag_send_error(p_scb, BTA_AG_ERR_OP_NOT_SUPPORTED);
990 if(val.idx && !((p_scb->features & BTA_AG_FEAT_ECC) && (p_scb->peer_features & BTA_AG_PEER_FEAT_ECC)))
994 bta_ag_send_error(p_scb, BTA_AG_ERR_OP_NOT_SUPPORTED);
1018 /* bta_ag_send_ok(p_scb); */
1029 bta_ag_send_result(p_scb, BTA_AG_RES_CIND, p_bta_ag_cfg->cind_info, 0);
1030 p_scb);
1036 p_scb->clip_enabled = (BOOLEAN) int_arg;
1037 bta_ag_send_ok(p_scb);
1042 if (bta_ag_parse_cmer(p_arg, &p_scb->cmer_enabled))
1044 bta_ag_send_ok(p_scb);
1049 if (!p_scb->svc_conn &&
1050 !((p_scb->features & BTA_AG_FEAT_3WAY) && (p_scb->peer_features & BTA_AG_PEER_FEAT_3WAY)))
1052 bta_ag_svc_conn_open(p_scb, NULL);
1057 bta_ag_send_error(p_scb, BTA_AG_ERR_INV_CHAR_IN_TSTR);
1065 bta_ag_send_ok(p_scb);
1070 bta_ag_send_error(p_scb, BTA_AG_ERR_INV_CHAR_IN_TSTR);
1076 if (!(p_scb->features & BTA_AG_FEAT_VTAG))
1079 bta_ag_send_error(p_scb, BTA_AG_ERR_OP_NOT_SUPPORTED);
1085 if (!(p_scb->features & BTA_AG_FEAT_VREC))
1088 bta_ag_send_error(p_scb, BTA_AG_ERR_OP_NOT_SUPPORTED);
1094 p_scb->peer_features = (UINT16) int_arg;
1097 bta_ag_send_result(p_scb, BTA_AG_RES_BRSF, NULL,
1098 (INT16) (p_scb->features & BTA_AG_BSRF_FEAT_SPEC));
1099 bta_ag_send_ok(p_scb);
1104 if (p_scb->features & BTA_AG_FEAT_ECNR)
1106 bta_ag_send_ok(p_scb);
1111 bta_ag_send_error(p_scb, BTA_AG_ERR_OP_NOT_SUPPORTED);
1117 if (p_scb->features & BTA_AG_FEAT_BTRH)
1129 bta_ag_send_ok(p_scb);
1139 bta_ag_send_error(p_scb, BTA_AG_ERR_OP_NOT_SUPPORTED);
1150 bta_ag_send_ok(p_scb);
1155 if (p_scb->features & BTA_AG_FEAT_EXTERR)
1158 p_scb->cmee_enabled = (BOOLEAN) int_arg;
1161 bta_ag_send_ok(p_scb);
1165 bta_ag_send_error(p_scb, BTA_AG_ERR_OP_NOT_SUPPORTED);
1175 bia_masked_out = p_scb->bia_masked_out;
1196 p_scb->bia_masked_out = bia_masked_out;
1197 bta_ag_send_ok (p_scb);
1200 bta_ag_send_error (p_scb, BTA_AG_ERR_INVALID_INDEX);
1206 if(!(p_scb->features & BTA_AG_FEAT_ECS))
1209 bta_ag_send_error(p_scb, BTA_AG_ERR_OP_NOT_SUPPORTED);
1215 bta_ag_send_ok(p_scb);
1218 if((p_scb->peer_features & BTA_AG_PEER_FEAT_CODEC) && (p_scb->features & BTA_AG_FEAT_CODEC))
1220 p_scb->peer_codecs = bta_ag_parse_bac(p_scb, p_arg);
1221 p_scb->codec_updated = TRUE;
1223 if (p_scb->peer_codecs & BTA_AG_CODEC_MSBC)
1225 p_scb->sco_codec = UUID_CODEC_MSBC;
1230 p_scb->sco_codec = UUID_CODEC_CVSD;
1236 val.num = p_scb->peer_codecs;
1238 if ((bta_ag_cb.sco.state == BTA_AG_SCO_CODEC_ST) && (bta_ag_cb.sco.p_curr_scb == p_scb))
1240 bta_ag_codec_negotiate (p_scb);
1245 p_scb->peer_codecs = BTA_AG_CODEC_NONE;
1251 bta_ag_send_ok(p_scb);
1254 bta_sys_stop_timer(&p_scb->cn_timer);
1266 if (p_scb->codec_fallback)
1269 codec_sent = p_scb->sco_codec;
1272 bta_ag_sco_codec_nego(p_scb, TRUE);
1274 bta_ag_sco_codec_nego(p_scb, FALSE);
1281 bta_ag_send_ok(p_scb);
1282 bta_ag_sco_open(p_scb, NULL);
1287 bta_ag_send_error(p_scb, BTA_AG_ERR_OP_NOT_SUPPORTED);
1308 void bta_ag_at_err_cback(tBTA_AG_SCB *p_scb, BOOLEAN unknown, char *p_arg)
1315 bta_ag_send_ok(p_scb);
1320 if (unknown && (p_scb->features & BTA_AG_FEAT_UNAT))
1322 val.hdr.handle = bta_ag_scb_to_idx(p_scb);
1323 val.hdr.app_id = p_scb->app_id;
1331 bta_ag_send_error(p_scb, BTA_AG_ERR_OP_NOT_SUPPORTED);
1345 void bta_ag_hsp_result(tBTA_AG_SCB *p_scb, tBTA_AG_API_RESULT *p_result)
1355 bta_ag_send_result(p_scb, code, NULL, p_result->data.num);
1360 bta_sys_sco_use(BTA_ID_AG, p_scb->app_id, p_scb->peer_addr);
1363 if (bta_ag_sco_is_open(p_scb) || !bta_ag_inband_enabled(p_scb) ||
1364 (p_scb->features & BTA_AG_FEAT_NOSCO))
1366 bta_ag_send_ring(p_scb, (tBTA_AG_DATA *) p_result);
1372 if (p_scb->hsp_version >= HSP_VERSION_1_2)
1373 p_scb->post_sco = BTA_AG_POST_SCO_NONE;
1375 p_scb->post_sco = BTA_AG_POST_SCO_RING;
1377 bta_ag_sco_open(p_scb, (tBTA_AG_DATA *) p_result);
1386 bta_sys_stop_timer(&p_scb->act_timer);
1389 if (!(p_scb->features & BTA_AG_FEAT_NOSCO))
1392 if (p_result->data.audio_handle == bta_ag_scb_to_idx(p_scb))
1394 bta_ag_sco_open(p_scb, (tBTA_AG_DATA *) p_result);
1399 bta_ag_sco_close(p_scb, (tBTA_AG_DATA *) p_result);
1406 bta_sys_stop_timer(&p_scb->act_timer);
1409 if ((bta_ag_sco_is_open(p_scb) || bta_ag_sco_is_opening(p_scb)) && !(p_scb->features & BTA_AG_FEAT_NOSCO))
1411 bta_ag_sco_close(p_scb, (tBTA_AG_DATA *) p_result);
1416 bta_sys_sco_unuse(BTA_ID_AG, p_scb->app_id, p_scb->peer_addr);
1421 p_scb->inband_enabled = p_result->data.state;
1422 APPL_TRACE_DEBUG("inband_enabled set to %d", p_scb->inband_enabled);
1430 bta_ag_send_result(p_scb, code, p_result->data.str, 0);
1434 bta_ag_send_ok(p_scb);
1438 bta_ag_send_error(p_scb, BTA_AG_ERR_INV_CHAR_IN_TSTR);
1458 void bta_ag_hfp_result(tBTA_AG_SCB *p_scb, tBTA_AG_API_RESULT *p_result)
1468 bta_ag_send_result(p_scb, code, NULL, p_result->data.num);
1473 bta_sys_sco_use(BTA_ID_AG, p_scb->app_id, p_scb->peer_addr);
1486 p_scb->clip[0] = 0;
1488 snprintf(p_scb->clip, sizeof(p_scb->clip), "%s,%d", p_result->data.str, p_result->data.num);
1491 if (p_scb->post_sco == BTA_AG_POST_SCO_CALL_END)
1494 p_scb->post_sco = BTA_AG_POST_SCO_CALL_END_INCALL;
1498 bta_ag_send_call_inds(p_scb, p_result->result);
1501 if (bta_ag_sco_is_open(p_scb) || !bta_ag_inband_enabled(p_scb) ||
1502 (p_scb->features & BTA_AG_FEAT_NOSCO))
1504 bta_ag_send_ring(p_scb, (tBTA_AG_DATA *) p_result);
1509 p_scb->post_sco = BTA_AG_POST_SCO_RING;
1510 bta_ag_sco_open(p_scb, (tBTA_AG_DATA *) p_result);
1517 bta_sys_stop_timer(&p_scb->act_timer);
1522 bta_ag_send_call_inds(p_scb, p_result->result);
1524 if (!(p_scb->features & BTA_AG_FEAT_NOSCO))
1526 if (p_result->data.audio_handle == bta_ag_scb_to_idx(p_scb))
1528 bta_ag_sco_open(p_scb, (tBTA_AG_DATA *) p_result);
1531 bta_ag_sco_is_open(p_scb))
1533 bta_ag_sco_close(p_scb, (tBTA_AG_DATA *) p_result);
1540 bta_sys_stop_timer(&p_scb->act_timer);
1542 bta_ag_send_call_inds(p_scb, p_result->result);
1547 bta_ag_send_call_inds(p_scb, p_result->result);
1548 if (p_result->data.audio_handle == bta_ag_scb_to_idx(p_scb) &&
1549 !(p_scb->features & BTA_AG_FEAT_NOSCO))
1551 bta_ag_sco_open(p_scb, (tBTA_AG_DATA *) p_result);
1557 bta_ag_send_call_inds(p_scb, p_result->result);
1558 if (p_result->data.audio_handle == bta_ag_scb_to_idx(p_scb) &&
1559 !(p_scb->features & BTA_AG_FEAT_NOSCO))
1561 bta_ag_sco_open(p_scb, (tBTA_AG_DATA *) p_result);
1568 if (!(p_scb->features & BTA_AG_FEAT_NOSCO))
1570 if (p_result->data.audio_handle == bta_ag_scb_to_idx(p_scb))
1571 bta_ag_sco_open(p_scb, (tBTA_AG_DATA *) p_result);
1573 bta_ag_sco_close(p_scb, (tBTA_AG_DATA *) p_result);
1579 bta_ag_send_call_inds(p_scb, p_result->result);
1582 if (!(p_scb->features & BTA_AG_FEAT_NOSCO))
1584 if (p_result->data.audio_handle == bta_ag_scb_to_idx(p_scb))
1586 bta_ag_sco_open(p_scb, (tBTA_AG_DATA *) p_result);
1590 bta_ag_sco_close(p_scb, (tBTA_AG_DATA *) p_result);
1597 bta_ag_send_call_inds(p_scb, p_result->result);
1602 bta_sys_stop_timer(&p_scb->act_timer);
1605 if ((bta_ag_sco_is_open(p_scb) || bta_ag_sco_is_opening(p_scb)) && !(p_scb->features & BTA_AG_FEAT_NOSCO))
1607 p_scb->post_sco = BTA_AG_POST_SCO_CALL_END;
1608 bta_ag_sco_close(p_scb, (tBTA_AG_DATA *) p_result);
1610 else if (p_scb->post_sco == BTA_AG_POST_SCO_CALL_END_INCALL)
1614 p_scb->post_sco = BTA_AG_POST_SCO_CALL_END;
1618 bta_ag_send_call_inds(p_scb, p_result->result);
1621 bta_sys_sco_unuse(BTA_ID_AG, p_scb->app_id, p_scb->peer_addr);
1626 p_scb->inband_enabled = p_result->data.state;
1627 APPL_TRACE_DEBUG("inband_enabled set to %d", p_scb->inband_enabled);
1628 bta_ag_send_result(p_scb, code, NULL, p_result->data.state);
1633 p_scb->call_ind = p_result->data.str[0] - '0';
1634 p_scb->callsetup_ind = p_result->data.str[2] - '0';
1635 p_scb->service_ind = p_result->data.str[4] - '0';
1636 p_scb->signal_ind = p_result->data.str[6] - '0';
1637 p_scb->roam_ind = p_result->data.str[8] - '0';
1638 p_scb->battchg_ind = p_result->data.str[10] - '0';
1639 p_scb->callheld_ind = p_result->data.str[12] - '0';
1640 APPL_TRACE_DEBUG("cind call:%d callsetup:%d", p_scb->call_ind, p_scb->callsetup_ind);
1642 bta_ag_send_result(p_scb, code, p_result->data.str, 0);
1643 bta_ag_send_ok(p_scb);
1654 bta_ag_send_result(p_scb, code, p_result->data.str, 0);
1658 bta_ag_send_ok(p_scb);
1662 bta_ag_send_error(p_scb, p_result->data.errcode);
1674 bta_ag_send_result(p_scb, code, p_result->data.str, 0);
1678 bta_ag_send_ok(p_scb);
1682 bta_ag_send_error(p_scb, p_result->data.errcode);
1687 if (p_scb->ccwa_enabled)
1689 bta_ag_send_result(p_scb, code, p_result->data.str, 0);
1691 bta_ag_send_call_inds(p_scb, p_result->result);
1695 bta_ag_send_ind(p_scb, p_result->data.ind.id, p_result->data.ind.value, FALSE);
1699 bta_ag_send_result(p_scb, code, NULL, p_result->data.state);
1708 bta_ag_send_result(p_scb, code, NULL, p_result->data.num);
1713 bta_ag_send_ok(p_scb);
1717 bta_ag_send_error(p_scb, p_result->data.errcode);
1737 void bta_ag_result(tBTA_AG_SCB *p_scb, tBTA_AG_DATA *p_data)
1739 if (p_scb->conn_service == BTA_AG_HSP)
1741 bta_ag_hsp_result(p_scb, &p_data->api_result);
1745 bta_ag_hfp_result(p_scb, &p_data->api_result);
1759 void bta_ag_send_bcs(tBTA_AG_SCB *p_scb, tBTA_AG_DATA *p_data)
1763 if (p_scb->codec_fallback)
1769 switch(p_scb->sco_codec)
1775 APPL_TRACE_ERROR("bta_ag_send_bcs: unknown codec %d, use CVSD", p_scb->sco_codec);
1783 bta_ag_send_result(p_scb, BTA_AG_RES_BCS, NULL, codec_uuid);
1798 void bta_ag_send_ring(tBTA_AG_SCB *p_scb, tBTA_AG_DATA *p_data)
1805 if (p_scb->conn_service == BTA_AG_HFP && p_scb->clip_enabled && p_scb->clip[0] != 0)
1811 AT_SET_RES_CB(m_res_cb.res_cb[1], BTA_AG_RES_CLIP, p_scb->clip, 0)
1813 bta_ag_send_multi_result(p_scb, &m_res_cb);
1818 bta_ag_send_result(p_scb, BTA_AG_RES_RING, NULL, 0);
1822 bta_ag_send_result(p_scb, BTA_AG_RES_RING, NULL, 0);
1825 if (p_scb->conn_service == BTA_AG_HFP && p_scb->clip_enabled && p_scb->clip[0] != 0)
1827 bta_ag_send_result(p_scb, BTA_AG_RES_CLIP, p_scb->clip, 0);
1832 bta_sys_start_timer(&p_scb->act_timer, BTA_AG_RING_TOUT_EVT, BTA_AG_RING_TOUT);