1 /******************************************************************************
2  *
3  *  Copyright (c) 2014 The Android Open Source Project
4  *  Copyright (C) 2003-2012 Broadcom Corporation
5  *
6  *  Licensed under the Apache License, Version 2.0 (the "License");
7  *  you may not use this file except in compliance with the License.
8  *  You may obtain a copy of the License at:
9  *
10  *  http://www.apache.org/licenses/LICENSE-2.0
11  *
12  *  Unless required by applicable law or agreed to in writing, software
13  *  distributed under the License is distributed on an "AS IS" BASIS,
14  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  *  See the License for the specific language governing permissions and
16  *  limitations under the License.
17  *
18  ******************************************************************************/
19 
20 #include "bta_hf_client_int.h"
21 #include "stdio.h"
22 
bta_hf_client_send_at_cmd(tBTA_HF_CLIENT_DATA * p_data)23 void bta_hf_client_send_at_cmd(tBTA_HF_CLIENT_DATA *p_data)
24 {
25     tBTA_HF_CLIENT_DATA_VAL *p_val = (tBTA_HF_CLIENT_DATA_VAL *)p_data;
26     char buf[BTA_HF_CLIENT_AT_MAX_LEN];
27 
28     switch(p_val->uint8_val)
29     {
30         case BTA_HF_CLIENT_AT_CMD_VTS:
31             bta_hf_client_send_at_vts((char)p_val->uint32_val1);
32             break;
33         case BTA_HF_CLIENT_AT_CMD_BTRH:
34             bta_hf_client_send_at_btrh(FALSE, p_val->uint32_val1);
35             break;
36         case BTA_HF_CLIENT_AT_CMD_CHUP:
37             bta_hf_client_send_at_chup();
38             break;
39         case BTA_HF_CLIENT_AT_CMD_CHLD:
40             /* expects ascii code for command */
41             bta_hf_client_send_at_chld('0' + p_val->uint32_val1, p_val->uint32_val2);
42             break;
43         case BTA_HF_CLIENT_AT_CMD_BCC:
44             bta_hf_client_send_at_bcc();
45             break;
46         case BTA_HF_CLIENT_AT_CMD_CNUM:
47             bta_hf_client_send_at_cnum();
48             break;
49         case BTA_HF_CLIENT_AT_CMD_ATA:
50             bta_hf_client_send_at_ata();
51             break;
52         case BTA_HF_CLIENT_AT_CMD_COPS:
53             bta_hf_client_send_at_cops(TRUE);
54             break;
55         case BTA_HF_CLIENT_AT_CMD_ATD:
56             bta_hf_client_send_at_atd(p_val->str, p_val->uint32_val1);
57             break;
58         case BTA_HF_CLIENT_AT_CMD_VGM:
59             bta_hf_client_send_at_vgm(p_val->uint32_val1);
60             break;
61         case BTA_HF_CLIENT_AT_CMD_VGS:
62             bta_hf_client_send_at_vgs(p_val->uint32_val1);
63             break;
64         case BTA_HF_CLIENT_AT_CMD_BVRA:
65             bta_hf_client_send_at_bvra(p_val->uint32_val1 == 0 ? FALSE : TRUE);
66             break;
67         case BTA_HF_CLIENT_AT_CMD_CLCC:
68             bta_hf_client_send_at_clcc();
69             break;
70         case BTA_HF_CLIENT_AT_CMD_BINP:
71             bta_hf_client_send_at_binp(p_val->uint32_val1);
72             break;
73         case BTA_HF_CLIENT_AT_CMD_BLDN:
74             bta_hf_client_send_at_bldn();
75             break;
76         case BTA_HF_CLIENT_AT_CMD_NREC:
77             bta_hf_client_send_at_nrec();
78             break;
79         default:
80             APPL_TRACE_ERROR("Default case");
81             snprintf(buf,BTA_HF_CLIENT_AT_MAX_LEN,
82                 "Cmd %d 1st arg %u 2nd arg %u string arg %s",
83                 p_val->uint8_val, p_val->uint32_val1,
84                 p_val->uint32_val2, p_val->str);
85             APPL_TRACE_ERROR("%s ", buf);
86             break;
87     }
88 }
89