FreeCalypso > hg > fc-tourmaline
comparison src/g23m-fad/app/app_bat_atcmds.c @ 1:fa8dc04885d8
src/g23m-*: import from Magnetite
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Fri, 16 Oct 2020 06:25:50 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
0:4e78acac3d88 | 1:fa8dc04885d8 |
---|---|
1 /* | |
2 +------------------------------------------------------------------------------ | |
3 | File: app_bat_atcmds.c | |
4 +------------------------------------------------------------------------------ | |
5 | Copyright 2004 Texas Instruments Berlin, AG | |
6 | All rights reserved. | |
7 | | |
8 | This file is confidential and a trade secret of Texas | |
9 | Instruments Berlin, AG | |
10 | The receipt of or possession of this file does not convey | |
11 | any rights to reproduce or disclose its contents or to | |
12 | manufacture, use, or sell anything it may describe, in | |
13 | whole, or in part, without the specific written consent of | |
14 | Texas Instruments Berlin, AG. | |
15 +----------------------------------------------------------------------------- | |
16 | Purpose : Example application for BAT -- at command command parser. | |
17 +----------------------------------------------------------------------------- | |
18 */ | |
19 | |
20 #include <string.h> /* String functions, e. g. strncpy(). */ | |
21 | |
22 #include "app_util.h" | |
23 #include "p_bat.h" | |
24 #include "typedefs.h" | |
25 #include "vsi.h" | |
26 #include "gdd.h" | |
27 #include "bat.h" | |
28 #include "bat_ctrl.h" | |
29 #include "bat_intern.h" | |
30 | |
31 #ifdef FF_GPF_TCPIP | |
32 #include "socket_api.h" | |
33 #endif | |
34 | |
35 #include "app.h" | |
36 | |
37 | |
38 /* | |
39 * #define CO_FST_BAT_DEBUG | |
40 * #ifdef CO_FST_BAT_DEBUG | |
41 * LOCAL T_BAT_return bat_send (T_BAT_client clnt_hndl, T_BAT_cmd_send *cmd) | |
42 * { TRACE_EVENT("bat_send()"); return BAT_OK; } | |
43 * #else | |
44 * EXTERN T_BAT_return bat_send (T_BAT_client clnt_hndl, T_BAT_cmd_send *cmd); | |
45 * #endif | |
46 */ | |
47 | |
48 | |
49 EXTERN T_BAT_client clnt_table[][BAT_MAX_TEST_CLNT_NUM+1]; | |
50 | |
51 static char *handle_atcmd(app_cmd_entry_t *, char *,char *, char *, core_func_t ); | |
52 static char *atcmd_help(app_cmd_entry_t *, char *,char *, char *, core_func_t ); | |
53 static void exec_at_cmd(int at_cmd, char* param1, char* param2); | |
54 | |
55 static app_cmd_entry_t app_bat_atcmds_table[] = { | |
56 { "at_bat_cmd", handle_atcmd, exec_at_cmd, "at_cmd [param]" }, | |
57 { "at_bat_help", atcmd_help, 0, "" }, | |
58 {0,0,0,0} | |
59 }; | |
60 | |
61 /* | |
62 ** Add all the BAT parameters into a union ... if each is defined in there own case statement the compiler | |
63 ** adds them ALL individually onto the stack and takes up a LOT of space ... Oooops! | |
64 */ | |
65 static union | |
66 { | |
67 T_BAT_cmd_set_percent_als percent_als; /*< 0: 4> pointer to The set command structure of the %ALS command. */ | |
68 T_BAT_cmd_set_percent_band percent_band; /*< 0: 4> pointer to The set command structure of the %BAND command. */ | |
69 T_BAT_cmd_andc andc; /*< 0: 4> pointer to The set command structure of the &C command. */ | |
70 T_BAT_cmd_set_plus_cacm plus_cacm; /*< 0: 4> pointer to The set command structure of the +CACM command. */ | |
71 T_BAT_cmd_set_plus_camm plus_camm; /*< 0: 4> pointer to The set command structure of the +CAMM command. */ | |
72 T_BAT_cmd_set_plus_caoc plus_caoc; /*< 0: 4> pointer to The set command structure of the +CAOC command. */ | |
73 T_BAT_cmd_set_percent_cbhz percent_cbhz; /*< 0: 4> pointer to The set command structure of the %CBHZ command. */ | |
74 T_BAT_cmd_set_plus_cbst plus_cbst; /*< 0: 4> pointer to The set command structure of the +CBST command. */ | |
75 T_BAT_cmd_set_percent_ccbs percent_ccbs; /*< 0: 4> pointer to The set command structure of the %CCBS command. */ | |
76 T_BAT_cmd_set_plus_ccfc plus_ccfc; /*< 0: 4> pointer to The set command structure of the +CCFC command. */ | |
77 T_BAT_cmd_set_plus_cclk plus_cclk; /*< 0: 4> pointer to The set command structure of the +CCLK command. */ | |
78 T_BAT_cmd_set_plus_ccug plus_ccug; /*< 0: 4> pointer to The set command structure of the +CCUG command. */ | |
79 T_BAT_cmd_set_plus_ccwa plus_ccwa; /*< 0: 4> pointer to The set command structure of the +CCWA command. */ | |
80 T_BAT_cmd_set_plus_ccwa_w plus_ccwa_w; /*< 0: 4> pointer to The set command structure of the +CCWA_W command. */ | |
81 T_BAT_cmd_set_plus_cfun plus_cfun; /*< 0: 4> pointer to The set command structure of the +CFUN command. */ | |
82 T_BAT_cmd_set_percent_cgaatt percent_cgaatt; /*< 0: 4> pointer to The set command structure of the %CGAATT command. */ | |
83 T_BAT_cmd_set_plus_cgact plus_cgact; /*< 0: 4> pointer to The set command structure of the +CGACT command. */ | |
84 T_BAT_cmd_set_plus_cgans plus_cgans; /*< 0: 4> pointer to The set command structure of the +CGANS command. */ | |
85 T_BAT_cmd_set_plus_cgatt plus_cgatt; /*< 0: 4> pointer to The set command structure of the +CGATT command. */ | |
86 T_BAT_cmd_set_percent_cgclass percent_cgclass; /*< 0: 4> pointer to The set command structure of the %CGCLASS command. */ | |
87 T_BAT_cmd_set_plus_cgclass plus_cgclass; /*< 0: 4> pointer to The set command structure of the +CGCLASS command. */ | |
88 T_BAT_cmd_set_plus_cgdata plus_cgdata; /*< 0: 4> pointer to The set command structure of the +CGDATA command. */ | |
89 T_BAT_cmd_set_plus_cgdcont plus_cgdcont; /*< 0: 4> pointer to The set command structure of the +CGDCONT command. */ | |
90 T_BAT_cmd_set_percent_cgmm percent_cgmm; /*< 0: 4> pointer to The set command structure of the %CGMM command. */ | |
91 T_BAT_cmd_set_plus_cgpaddr plus_cgpaddr; /*< 0: 4> pointer to The set command structure of the +CGPADDR command. */ | |
92 T_BAT_cmd_set_percent_cgpco percent_cgpco; /*< 0: 4> pointer to The set command structure of the %CGPCO command. */ | |
93 T_BAT_cmd_set_percent_cgppp percent_cgppp; /*< 0: 4> pointer to The set command structure of the %CGPPP command. */ | |
94 T_BAT_cmd_set_plus_cgqmin plus_cgqmin; /*< 0: 4> pointer to The set command structure of the +CGQMIN command. */ | |
95 T_BAT_cmd_set_plus_cgqreq plus_cgqreq; /*< 0: 4> pointer to The set command structure of the +CGQREQ command. */ | |
96 T_BAT_cmd_set_plus_cgsms plus_cgsms; /*< 0: 4> pointer to The set command structure of the +CGSMS command. */ | |
97 T_BAT_cmd_set_percent_chld percent_chld; /*< 0: 4> pointer to The set command structure of the %CHLD command. */ | |
98 T_BAT_cmd_set_percent_chpl percent_chpl; /*< 0: 4> pointer to The set command structure of the %CHPL command. */ | |
99 T_BAT_cmd_set_percent_chpl_w percent_chpl_w; /*< 0: 4> pointer to The set command structure of the %CHPL_W command. */ | |
100 T_BAT_cmd_set_plus_cind plus_cind; /*< 0: 4> pointer to The set command structure of the +CIND command. */ | |
101 T_BAT_cmd_set_plus_clan plus_clan; /*< 0: 4> pointer to The set command structure of the +CLAN command. */ | |
102 T_BAT_cmd_set_plus_clck plus_clck; /*< 0: 4> pointer to The set command structure of the +CLCK command. */ | |
103 T_BAT_cmd_set_plus_clir plus_clir; /*< 0: 4> pointer to The set command structure of the +CLIR command. */ | |
104 T_BAT_cmd_set_plus_clvl plus_clvl; /*< 0: 4> pointer to The set command structure of the +CLVL command. */ | |
105 T_BAT_cmd_set_plus_cmer plus_cmer; /*< 0: 4> pointer to The set command structure of the +CMER command. */ | |
106 T_BAT_cmd_set_plus_cmgc plus_cmgc; /*< 0: 4> pointer to The set command structure of the +CMGC command. */ | |
107 T_BAT_cmd_set_plus_cmgd plus_cmgd; /*< 0: 4> pointer to The set command structure of the +CMGD command. */ | |
108 T_BAT_cmd_set_plus_cmgl plus_cmgl; /*< 0: 4> pointer to The set command structure of the +CMGL command. */ | |
109 T_BAT_cmd_set_plus_cmgl_w plus_cmgl_w; /*< 0: 4> pointer to The set command structure of the +CMGL_W command. */ | |
110 T_BAT_cmd_set_plus_cmgr plus_cmgr; /*< 0: 4> pointer to The set command structure of the +CMGR command. */ | |
111 T_BAT_cmd_set_plus_cmgr_w plus_cmgr_w; /*< 0: 4> pointer to The set command structure of the +CMGR_W command. */ | |
112 T_BAT_cmd_set_plus_cmgs plus_cmgs; /*< 0: 4> pointer to The set command structure of the +CMGS command. */ | |
113 T_BAT_cmd_set_plus_cmgw plus_cmgw; /*< 0: 4> pointer to The set command structure of the +CMGW command. */ | |
114 T_BAT_cmd_set_plus_cmod plus_cmod; /*< 0: 4> pointer to The set command structure of the +CMOD command. */ | |
115 T_BAT_cmd_set_plus_cmss plus_cmss; /*< 0: 4> pointer to The set command structure of the +CMSS command. */ | |
116 T_BAT_cmd_set_plus_cmut plus_cmut; /*< 0: 4> pointer to The set command structure of the +CMUT command. */ | |
117 T_BAT_cmd_set_plus_cmux plus_cmux; /*< 0: 4> pointer to The set command structure of the +CMUX command. */ | |
118 T_BAT_cmd_set_plus_cnma plus_cnma; /*< 0: 4> pointer to The set command structure of the +CNMA command. */ | |
119 T_BAT_cmd_set_plus_cnmi plus_cnmi; /*< 0: 4> pointer to The set command structure of the +CNMI command. */ | |
120 T_BAT_cmd_set_percent_cops percent_cops; /*< 0: 4> pointer to The set command structure of the %COPS command. */ | |
121 T_BAT_cmd_set_plus_cops plus_cops; /*< 0: 4> pointer to The set command structure of the +COPS command. */ | |
122 T_BAT_cmd_set_percent_cops_w percent_cops_w; /*< 0: 4> pointer to The set command structure of the %COPS_W command. */ | |
123 T_BAT_cmd_set_percent_cpals percent_cpals; /*< 0: 4> pointer to The set command structure of the %CPALS command. */ | |
124 T_BAT_cmd_set_percent_cpals_w percent_cpals_w; /*< 0: 4> pointer to The set command structure of the %CPALS_W command. */ | |
125 T_BAT_cmd_set_plus_cpbf plus_cpbf; /*< 0: 4> pointer to The set command structure of the +CPBF command. */ | |
126 T_BAT_cmd_set_plus_cpbf_w plus_cpbf_w; /*< 0: 4> pointer to The set command structure of the +CPBF_W command. */ | |
127 T_BAT_cmd_set_plus_cpbr plus_cpbr; /*< 0: 4> pointer to The set command structure of the +CPBR command. */ | |
128 T_BAT_cmd_set_plus_cpbr_w plus_cpbr_w; /*< 0: 4> pointer to The set command structure of the +CPBR_W command. */ | |
129 T_BAT_cmd_set_plus_cpbs plus_cpbs; /*< 0: 4> pointer to The set command structure of the +CPBS command. */ | |
130 T_BAT_cmd_set_plus_cpbw plus_cpbw; /*< 0: 4> pointer to The set command structure of the +CPBW command. */ | |
131 T_BAT_cmd_set_plus_cpbw_w plus_cpbw_w; /*< 0: 4> pointer to The set command structure of the +CPBW_W command. */ | |
132 T_BAT_cmd_set_percent_cpcfu percent_cpcfu; /*< 0: 4> pointer to The set command structure of the %CPCFU command. */ | |
133 T_BAT_cmd_set_percent_cphs percent_cphs; /*< 0: 4> pointer to The set command structure of the %CPHS command. */ | |
134 T_BAT_cmd_set_plus_cpin plus_cpin; /*< 0: 4> pointer to The set command structure of the +CPIN command. */ | |
135 T_BAT_cmd_set_percent_cpmb percent_cpmb; /*< 0: 4> pointer to The set command structure of the %CPMB command. */ | |
136 T_BAT_cmd_set_percent_cpmbw percent_cpmbw; /*< 0: 4> pointer to The set command structure of the %CPMBW command. */ | |
137 T_BAT_cmd_set_percent_cpmbw_w percent_cpmbw_w; /*< 0: 4> pointer to The set command structure of the %CPMBW_W command. */ | |
138 T_BAT_cmd_set_percent_cpmb_w percent_cpmb_w; /*< 0: 4> pointer to The set command structure of the %CPMB_W command. */ | |
139 T_BAT_cmd_set_plus_cpms plus_cpms; /*< 0: 4> pointer to The set command structure of the +CPMS command. */ | |
140 T_BAT_cmd_set_percent_cpnums percent_cpnums; /*< 0: 4> pointer to The set command structure of the %CPNUMS command. */ | |
141 T_BAT_cmd_set_percent_cpnums_w percent_cpnums_w; /*< 0: 4> pointer to The set command structure of the %CPNUMS_W command. */ | |
142 T_BAT_cmd_set_plus_cpol plus_cpol; /*< 0: 4> pointer to The set command structure of the +CPOL command. */ | |
143 T_BAT_cmd_set_plus_cpol_w plus_cpol_w; /*< 0: 4> pointer to The set command structure of the +CPOL_W command. */ | |
144 T_BAT_cmd_set_percent_cprsm percent_cprsm; /*< 0: 4> pointer to The set command structure of the %CPRSM command. */ | |
145 T_BAT_cmd_set_plus_cpuc plus_cpuc; /*< 0: 4> pointer to The set command structure of the +CPUC command. */ | |
146 T_BAT_cmd_set_plus_cpuc_w plus_cpuc_w; /*< 0: 4> pointer to The set command structure of the +CPUC_W command. */ | |
147 T_BAT_cmd_set_percent_cpvwi percent_cpvwi; /*< 0: 4> pointer to The set command structure of the %CPVWI command. */ | |
148 T_BAT_cmd_set_plus_cpwd plus_cpwd; /*< 0: 4> pointer to The set command structure of the +CPWD command. */ | |
149 T_BAT_cmd_set_plus_cres plus_cres; /*< 0: 4> pointer to The set command structure of the +CRES command. */ | |
150 T_BAT_cmd_set_plus_crlp plus_crlp; /*< 0: 4> pointer to The set command structure of the +CRLP command. */ | |
151 T_BAT_cmd_set_plus_crsm plus_crsm; /*< 0: 4> pointer to The set command structure of the +CRSM command. */ | |
152 T_BAT_cmd_set_plus_csas plus_csas; /*< 0: 4> pointer to The set command structure of the +CSAS command. */ | |
153 T_BAT_cmd_set_plus_csca plus_csca; /*< 0: 4> pointer to The set command structure of the +CSCA command. */ | |
154 T_BAT_cmd_set_plus_cscb plus_cscb; /*< 0: 4> pointer to The set command structure of the +CSCB command. */ | |
155 T_BAT_cmd_set_plus_cscs plus_cscs; /*< 0: 4> pointer to The set command structure of the +CSCS command. */ | |
156 T_BAT_cmd_set_plus_csim plus_csim; /*< 0: 4> pointer to The set command structure of the +CSIM command. */ | |
157 T_BAT_cmd_set_plus_csms plus_csms; /*< 0: 4> pointer to The set command structure of the +CSMS command. */ | |
158 T_BAT_cmd_set_plus_csns plus_csns; /*< 0: 4> pointer to The set command structure of the +CSNS command. */ | |
159 T_BAT_cmd_set_plus_csta plus_csta; /*< 0: 4> pointer to The set command structure of the +CSTA command. */ | |
160 T_BAT_cmd_set_plus_csvm plus_csvm; /*< 0: 4> pointer to The set command structure of the +CSVM command. */ | |
161 T_BAT_cmd_set_plus_ctfr plus_ctfr; /*< 0: 4> pointer to The set command structure of the +CTFR command. */ | |
162 T_BAT_cmd_set_percent_ctty percent_ctty; /*< 0: 4> pointer to The set command structure of the %CTTY command. */ | |
163 T_BAT_cmd_set_plus_ctzu plus_ctzu; /*< 0: 4> pointer to The set command structure of the +CTZU command. */ | |
164 T_BAT_cmd_set_plus_cusd plus_cusd; /*< 0: 4> pointer to The set command structure of the +CUSD command. */ | |
165 T_BAT_cmd_set_plus_cusd_w plus_cusd_w; /*< 0: 4> pointer to The set command structure of the +CUSD_W command. */ | |
166 T_BAT_cmd_set_percent_cust percent_cust; /*< 0: 4> pointer to The set command structure of the %CUST command. */ | |
167 T_BAT_cmd_set_percent_cwup percent_cwup; /*< 0: 4> pointer to The set command structure of the %CWUP command. */ | |
168 T_BAT_cmd_at_d at_d; /*< 0: 4> pointer to The set command structure of the D command. */ | |
169 T_BAT_cmd_set_percent_data percent_data; /*< 0: 4> pointer to The set command structure of the %DATA command. */ | |
170 T_BAT_cmd_set_percent_dinf percent_dinf; /*< 0: 4> pointer to The set command structure of the %DINF command. */ | |
171 T_BAT_cmd_set_plus_ds plus_ds; /*< 0: 4> pointer to The set command structure of the +DS command. */ | |
172 T_BAT_cmd_at_d_w at_d_w; /*< 0: 4> pointer to The set command structure of the D_W command. */ | |
173 T_BAT_cmd_set_percent_em percent_em; /*< 0: 4> pointer to The set command structure of the %EM command. */ | |
174 T_BAT_cmd_set_plus_fap plus_fap; /*< 0: 4> pointer to The set command structure of the +FAP command. */ | |
175 T_BAT_cmd_set_plus_fbo plus_fbo; /*< 0: 4> pointer to The set command structure of the +FBO command. */ | |
176 T_BAT_cmd_set_plus_fbu plus_fbu; /*< 0: 4> pointer to The set command structure of the +FBU command. */ | |
177 T_BAT_cmd_set_plus_fcc plus_fcc; /*< 0: 4> pointer to The set command structure of the +FCC command. */ | |
178 T_BAT_cmd_set_plus_fclass plus_fclass; /*< 0: 4> pointer to The set command structure of the +FCLASS command. */ | |
179 T_BAT_cmd_set_plus_fcq plus_fcq; /*< 0: 4> pointer to The set command structure of the +FCQ command. */ | |
180 T_BAT_cmd_set_plus_fcr plus_fcr; /*< 0: 4> pointer to The set command structure of the +FCR command. */ | |
181 T_BAT_cmd_set_plus_fct plus_fct; /*< 0: 4> pointer to The set command structure of the +FCT command. */ | |
182 T_BAT_cmd_set_plus_fea plus_fea; /*< 0: 4> pointer to The set command structure of the +FEA command. */ | |
183 T_BAT_cmd_set_plus_ffc plus_ffc; /*< 0: 4> pointer to The set command structure of the +FFC command. */ | |
184 T_BAT_cmd_set_plus_fie plus_fie; /*< 0: 4> pointer to The set command structure of the +FIE command. */ | |
185 T_BAT_cmd_set_plus_fis plus_fis; /*< 0: 4> pointer to The set command structure of the +FIS command. */ | |
186 T_BAT_cmd_set_plus_fit plus_fit; /*< 0: 4> pointer to The set command structure of the +FIT command. */ | |
187 T_BAT_cmd_set_plus_fli plus_fli; /*< 0: 4> pointer to The set command structure of the +FLI command. */ | |
188 T_BAT_cmd_set_plus_flo plus_flo; /*< 0: 4> pointer to The set command structure of the +FLO command. */ | |
189 T_BAT_cmd_set_plus_flp plus_flp; /*< 0: 4> pointer to The set command structure of the +FLP command. */ | |
190 T_BAT_cmd_set_plus_fms plus_fms; /*< 0: 4> pointer to The set command structure of the +FMS command. */ | |
191 T_BAT_cmd_set_plus_fns plus_fns; /*< 0: 4> pointer to The set command structure of the +FNS command. */ | |
192 T_BAT_cmd_set_plus_fpa plus_fpa; /*< 0: 4> pointer to The set command structure of the +FPA command. */ | |
193 T_BAT_cmd_set_plus_fpi plus_fpi; /*< 0: 4> pointer to The set command structure of the +FPI command. */ | |
194 T_BAT_cmd_set_plus_fps plus_fps; /*< 0: 4> pointer to The set command structure of the +FPS command. */ | |
195 T_BAT_cmd_set_plus_fpw plus_fpw; /*< 0: 4> pointer to The set command structure of the +FPW command. */ | |
196 T_BAT_cmd_set_plus_frq plus_frq; /*< 0: 4> pointer to The set command structure of the +FRQ command. */ | |
197 T_BAT_cmd_set_plus_fsa plus_fsa; /*< 0: 4> pointer to The set command structure of the +FSA command. */ | |
198 T_BAT_cmd_set_plus_fsp plus_fsp; /*< 0: 4> pointer to The set command structure of the +FSP command. */ | |
199 T_BAT_cmd_set_plus_icf plus_icf; /*< 0: 4> pointer to The set command structure of the +ICF command. */ | |
200 T_BAT_cmd_set_plus_ifc plus_ifc; /*< 0: 4> pointer to The set command structure of the +IFC command. */ | |
201 T_BAT_cmd_set_plus_ipr plus_ipr; /*< 0: 4> pointer to The set command structure of the +IPR command. */ | |
202 T_BAT_cmd_set_percent_ppp percent_ppp; /*< 0: 4> pointer to The set command structure of the %PPP command. */ | |
203 T_BAT_cmd_set_percent_pvrf percent_pvrf; /*< 0: 4> pointer to The set command structure of the %PVRF command. */ | |
204 T_BAT_cmd_set_percent_rdl percent_rdl; /*< 0: 4> pointer to The set command structure of the %RDL command. */ | |
205 T_BAT_cmd_set_percent_rdlb percent_rdlb; /*< 0: 4> pointer to The set command structure of the %RDLB command. */ | |
206 T_BAT_cmd_set_percent_satc percent_satc; /*< 0: 4> pointer to The set command structure of the %SATC command. */ | |
207 T_BAT_cmd_set_percent_sate percent_sate; /*< 0: 4> pointer to The set command structure of the %SATE command. */ | |
208 T_BAT_cmd_set_percent_satr percent_satr; /*< 0: 4> pointer to The set command structure of the %SATR command. */ | |
209 T_BAT_cmd_set_percent_satt percent_satt; /*< 0: 4> pointer to The set command structure of the %SATT command. */ | |
210 T_BAT_cmd_set_percent_sncnt percent_sncnt; /*< 0: 4> pointer to The set command structure of the %SNCNT command. */ | |
211 T_BAT_cmd_set_percent_vts percent_vts; /*< 0: 4> pointer to The set command structure of the %VTS command. */ | |
212 T_BAT_cmd_set_plus_vts plus_vts; /*< 0: 4> pointer to The set command structure of the +VTS command. */ | |
213 T_BAT_cmd_set_plus_ws46 plus_ws46; /*< 0: 4> pointer to The set command structure of the +WS46 command. */ | |
214 T_BAT_cmd_set_percent_cniv percent_cniv; /*< 0: 4> pointer to The set command structure of the %CNIV command. */ | |
215 T_BAT_no_parameter no_param; /*< 0: 4> pointer to Dummy structure */ | |
216 } bat_params; | |
217 | |
218 | |
219 static char *atcmd_help(app_cmd_entry_t *cmd_entry_ptr, | |
220 char *param1, char *param2, char *param3, core_func_t core_func) | |
221 { | |
222 TRACE_EVENT("Available commands:"); | |
223 TRACE_EVENT("at_bat_cmd atd [dialstring]"); | |
224 TRACE_EVENT("at_bat_cmd ata"); | |
225 TRACE_EVENT("at_bat_cmd at+clir"); | |
226 // TRACE_EVENT("at_bat_cmd at+colp"); | |
227 TRACE_EVENT("at_bat_cmd at+ceer"); | |
228 // TRACE_EVENT("at_bat_cmd at+crc"); | |
229 TRACE_EVENT("at_bat_cmd at+cmgs"); | |
230 TRACE_EVENT("at_bat_cmd at+cpbs"); | |
231 TRACE_EVENT("at_bat_cmd at+cpbr"); | |
232 TRACE_EVENT("at_bat_cmd at+cfun"); | |
233 TRACE_EVENT("at_bat_cmd at+cpbw"); | |
234 TRACE_EVENT("at_bat_cmd at+cscs"); | |
235 TRACE_EVENT("at_bat_cmd at+cusd"); | |
236 TRACE_EVENT("at_bat_cmd at+ccfc"); | |
237 TRACE_EVENT("at_bat_cmd at+cbst"); | |
238 TRACE_EVENT("at_bat_help"); | |
239 TRACE_EVENT("--------------------------------------"); | |
240 | |
241 return 0 ; | |
242 } | |
243 | |
244 | |
245 static char *handle_atcmd(app_cmd_entry_t *cmd_entry_ptr, char *param1, | |
246 char *param2, char *param3, core_func_t core_func) | |
247 { | |
248 T_BAT_ctrl_params at_cmd; | |
249 | |
250 TRACE_FUNCTION("handle_atcmd()"); | |
251 | |
252 TRACE_ASSERT(param1 NEQ NULL); | |
253 param1 = string_to_lower(param1); | |
254 | |
255 if (strcmp(param1, "atd") EQ 0 ) at_cmd = BAT_CMD_AT_D; | |
256 else if (strcmp(param1, "ata") EQ 0 ) at_cmd = BAT_CMD_AT_A; | |
257 else if (strcmp(param1, "ath") EQ 0 ) at_cmd = BAT_CMD_AT_H; | |
258 else if (strcmp(param1, "at+clir") EQ 0 ) at_cmd = BAT_CMD_SET_PLUS_CLIR; | |
259 // else if (strcmp(param1, "at+colp") EQ 0 ) at_cmd = BAT_CMD_SET_PLUS_COLP; | |
260 else if (strcmp(param1, "at+ceer") EQ 0 ) at_cmd = BAT_CMD_SET_PLUS_CEER; | |
261 // else if (strcmp(param1, "at+crc") EQ 0 ) at_cmd = BAT_CMD_SET_PLUS_CRC; | |
262 else if (strcmp(param1, "at+cmgs") EQ 0 ) at_cmd = BAT_CMD_SET_PLUS_CMGS; | |
263 else if (strcmp(param1, "at+cpbs") EQ 0 ) at_cmd = BAT_CMD_SET_PLUS_CPBS; | |
264 else if (strcmp(param1, "at+cpbr") EQ 0 ) at_cmd = BAT_CMD_SET_PLUS_CPBR; | |
265 else if (strcmp(param1, "at+cfun") EQ 0 ) at_cmd = BAT_CMD_SET_PLUS_CFUN; | |
266 else if (strcmp(param1, "at+cpbw") EQ 0 ) at_cmd = BAT_CMD_SET_PLUS_CPBW; | |
267 else if (strcmp(param1, "at+cscs") EQ 0 ) at_cmd = BAT_CMD_SET_PLUS_CSCS; | |
268 else if (strcmp(param1, "at+cusd") EQ 0 ) at_cmd = BAT_CMD_SET_PLUS_CUSD; | |
269 else if (strcmp(param1, "at+ccfc") EQ 0 ) at_cmd = BAT_CMD_SET_PLUS_CCFC; | |
270 else if (strcmp(param1, "at+cbst") EQ 0 ) at_cmd = BAT_CMD_SET_PLUS_CBST; | |
271 else if (strcmp(param1, "at+cops") EQ 0 ) at_cmd = BAT_CMD_SET_PLUS_COPS; | |
272 else if (strcmp(param1, "at%cniv") EQ 0 ) at_cmd = BAT_CMD_SET_PERCENT_CNIV; | |
273 else | |
274 { | |
275 return("Not supported AT cmd"); | |
276 } | |
277 core_func(at_cmd, param2, param3); | |
278 return 0; | |
279 } | |
280 | |
281 | |
282 GLOBAL void exec_at_cmd(int at_cmd, char* param1, char* param2) | |
283 { | |
284 T_BAT_cmd_send send_cmd; | |
285 T_BAT_return ret = BAT_ERROR; | |
286 T_BAT_client client = BAT_CONTROL_CHANNEL; | |
287 U8 clnt_hndl_upper = 0; | |
288 U8 clnt_hndl_lower = 0; | |
289 | |
290 bat_params.no_param.bat_dummy = 0; | |
291 | |
292 TRACE_FUNCTION("exec_at_cmd()"); | |
293 | |
294 client = get_item(param1, 0, FALSE); | |
295 | |
296 clnt_hndl_upper = (U8)((0xff00&client)>>8); | |
297 clnt_hndl_lower = (U8)(0x00ff&client); | |
298 | |
299 if((clnt_hndl_lower >= BAT_MAX_TEST_CLNT_NUM) OR (clnt_hndl_upper >= BAT_MAX_TEST_INST_NUM)) | |
300 { | |
301 TRACE_ERROR("Input client out of bounds"); | |
302 return; | |
303 } | |
304 | |
305 if(clnt_table[clnt_hndl_upper][clnt_hndl_lower] EQ 0) | |
306 { | |
307 TRACE_ERROR("client handle not valid - no client handle"); | |
308 return; | |
309 } | |
310 | |
311 #if 0 | |
312 client = clnt_table[0][0]; | |
313 #ifndef CO_FST_BAT_DEBUG | |
314 assert(client != 0); | |
315 #endif | |
316 | |
317 #endif | |
318 | |
319 send_cmd.ctrl_params = (T_BAT_ctrl_params)at_cmd; | |
320 | |
321 switch(at_cmd) | |
322 { | |
323 case BAT_CMD_AT_D: | |
324 { | |
325 char number[] = "+493039831178;"; | |
326 if (param1[0] == 0) | |
327 { | |
328 strcpy((char *)&(bat_params.at_d.dial_string), (const char *)param1); | |
329 bat_params.at_d.c_dial_string = strlen(param1); | |
330 } | |
331 else | |
332 { | |
333 strcpy((char *)&(bat_params.at_d.dial_string), (const char *)number); | |
334 bat_params.at_d.c_dial_string = strlen(number); | |
335 } | |
336 send_cmd.params.ptr_at_d = &bat_params.at_d; | |
337 ret = bat_send(client, &send_cmd); | |
338 break; | |
339 } | |
340 | |
341 case BAT_CMD_AT_A: | |
342 { | |
343 send_cmd.params.ptr_at_a = &bat_params.no_param; | |
344 ret = bat_send(client, &send_cmd); | |
345 break; | |
346 } | |
347 | |
348 case BAT_CMD_AT_H: | |
349 { | |
350 send_cmd.params.ptr_at_h = &bat_params.no_param; | |
351 ret = bat_send(client, &send_cmd); | |
352 break; | |
353 } | |
354 | |
355 case BAT_CMD_SET_PLUS_CLIR: | |
356 { | |
357 if (param1[0] == '0') bat_params.plus_clir.n = BAT_CLIR_N_SUBSCRIPTION; | |
358 else if (param1[0] == '1') bat_params.plus_clir.n = BAT_CLIR_N_INVOCATION; | |
359 else if (param1[0] == '2') bat_params.plus_clir.n = BAT_CLIR_N_SUPPRESSION; | |
360 else bat_params.plus_clir.n = BAT_CLIR_N_SUPPRESSION; /* No, or an Invalid, Parameter was passed in */ | |
361 | |
362 send_cmd.params.ptr_set_plus_clir = &bat_params.plus_clir; | |
363 ret = bat_send(client, &send_cmd); | |
364 break; | |
365 } | |
366 #ifdef _SIMULATION_ | |
367 #pragma message( __TODO__"BAT_CMD_SET_PLUS_COLP not defined !" ) | |
368 #endif | |
369 /* | |
370 case BAT_CMD_SET_PLUS_COLP: | |
371 { | |
372 ret = bat_send(client, &send_cmd); | |
373 break; | |
374 } | |
375 */ | |
376 case BAT_CMD_SET_PLUS_CEER: | |
377 { | |
378 /* T_BAT_cmd_set_plus_ceer ceer; */ | |
379 #ifdef _SIMULATION_ | |
380 #pragma message( __TODO__"T_BAT_cmd_set_plus_ceer not defined !" ) | |
381 #endif | |
382 /* ceer. | |
383 send_cmd.params.ptr_set_plus_ceer = &ceer; */ | |
384 TRACE_ASSERT(0); | |
385 ret = bat_send(client, &send_cmd); | |
386 break; | |
387 } | |
388 #ifdef _SIMULATION_ | |
389 #pragma message( __TODO__"BAT_CMD_SET_PLUS_CRC not defined !" ) | |
390 #endif | |
391 /* | |
392 case BAT_CMD_SET_PLUS_CRC: | |
393 { | |
394 ret = bat_send(client, &send_cmd); | |
395 break; | |
396 } | |
397 */ | |
398 case BAT_CMD_SET_PLUS_CMGS: | |
399 { | |
400 U8 pdu[] = "0891941067000044F301000D91941097614246F8000011C8329BFD06098354103B2D9687E579"; | |
401 strcpy((char *)&(bat_params.plus_cmgs.pdu), (const char *)pdu); | |
402 bat_params.plus_cmgs.length = strlen((const char *)pdu); /* total length */ | |
403 bat_params.plus_cmgs.c_pdu = bat_params.plus_cmgs.length - 9; /* length without SCA */ | |
404 send_cmd.params.ptr_set_plus_cmgs = &bat_params.plus_cmgs; | |
405 ret = bat_send(client, &send_cmd); | |
406 break; | |
407 } | |
408 | |
409 case BAT_CMD_SET_PLUS_CPBS: | |
410 { | |
411 bat_params.plus_cpbs.storage = BAT_STORAGE_AD; | |
412 send_cmd.params.ptr_set_plus_cpbs = &bat_params.plus_cpbs; | |
413 ret = bat_send(client, &send_cmd); | |
414 break; | |
415 } | |
416 | |
417 case BAT_CMD_SET_PLUS_CPBR: | |
418 { | |
419 bat_params.plus_cpbr.index1 = 1; | |
420 bat_params.plus_cpbr.index2 = 2; | |
421 send_cmd.params.ptr_set_plus_cpbr = &bat_params.plus_cpbr; | |
422 ret = bat_send(client, &send_cmd); | |
423 break; | |
424 } | |
425 | |
426 case BAT_CMD_SET_PLUS_CFUN: | |
427 { | |
428 bat_params.plus_cfun.fun = BAT_CFUN_FUN_FULL; | |
429 bat_params.plus_cfun.rst = BAT_CFUN_RST_NOT_PRESENT; | |
430 send_cmd.params.ptr_set_plus_cfun = &bat_params.plus_cfun; | |
431 ret = bat_send(client, &send_cmd); | |
432 break; | |
433 } | |
434 | |
435 case BAT_CMD_SET_PLUS_CPBW: | |
436 { | |
437 U8 number[] ="03076903367"; | |
438 U8 text[] = "Hello World"; | |
439 bat_params.plus_cpbw.index = 2; | |
440 bat_params.plus_cpbw.v_number = TRUE; | |
441 strcpy((char *)&(bat_params.plus_cpbw.number), (const char *)number); | |
442 bat_params.plus_cpbw.c_number = strlen((const char *)number); | |
443 bat_params.plus_cpbw.v_text = TRUE; | |
444 strcpy((char *)&(bat_params.plus_cpbw.text), (const char *)text); | |
445 bat_params.plus_cpbw.c_text = strlen((const char *)text); | |
446 bat_params.plus_cpbw.type = 129; | |
447 send_cmd.params.ptr_set_plus_cpbw = &bat_params.plus_cpbw; | |
448 ret = bat_send(client, &send_cmd); | |
449 break; | |
450 } | |
451 case BAT_CMD_SET_PLUS_CSCS: | |
452 { | |
453 bat_params.plus_cscs.cs = BAT_CSCS_CS_UCS2; | |
454 send_cmd.params.ptr_set_plus_cscs = &bat_params.plus_cscs; | |
455 ret = bat_send(client, &send_cmd); | |
456 break; | |
457 } | |
458 case BAT_CMD_SET_PLUS_CUSD: | |
459 { | |
460 U8 string[] = "00230031003100310023"; | |
461 bat_params.plus_cusd.n = (T_BAT_plus_cusd_n)1; | |
462 #ifdef _SIMULATION_ | |
463 #pragma message( __TODO__"T_BAT_VAL_plus_cusd_n: two values are missing in (0,1)" ) | |
464 #endif | |
465 bat_params.plus_cusd.v_str = (U8)TRUE; | |
466 strcpy((char *)&(bat_params.plus_cusd.str), (const char *)string); | |
467 bat_params.plus_cusd.c_str = strlen((const char *)string); | |
468 bat_params.plus_cusd.dcs = 15; | |
469 send_cmd.params.ptr_set_plus_cusd = &bat_params.plus_cusd; | |
470 ret = bat_send(client, &send_cmd); | |
471 break; | |
472 } | |
473 case BAT_CMD_SET_PLUS_CCFC: | |
474 { | |
475 bat_params.plus_ccfc.reason = BAT_CCFC_REASON_CFU; | |
476 bat_params.plus_ccfc.mode = BAT_CCFC_MODE_ERASURE; | |
477 bat_params.plus_ccfc.v_number = (U8)FALSE; | |
478 bat_params.plus_ccfc.type = (S16)BAT_PARAMETER_NOT_PRESENT; | |
479 bat_params.plus_ccfc.bearer_class = BAT_CCFC_CLASS_VCEDATFAX; /* default */ | |
480 bat_params.plus_ccfc.v_subaddr = (U8)FALSE; | |
481 bat_params.plus_ccfc.satype = (S16)BAT_PARAMETER_NOT_PRESENT; | |
482 bat_params.plus_ccfc.time = (T_BAT_plus_ccfc_time)BAT_CCFC_TIME_NOT_PRESENT; | |
483 send_cmd.params.ptr_set_plus_ccfc = &bat_params.plus_ccfc; | |
484 ret = bat_send(client, &send_cmd); | |
485 break; | |
486 } | |
487 case BAT_CMD_SET_PLUS_CBST: | |
488 { | |
489 bat_params.plus_cbst.speed = BAT_CBST_SPD_9600_V110; | |
490 bat_params.plus_cbst.name = BAT_CBST_NAM_CBST_NAM_ASYNCH; | |
491 bat_params.plus_cbst.ce = BAT_CBST_CE_CBST_CE_NONTRANSPARENT; | |
492 send_cmd.params.ptr_set_plus_cbst= &bat_params.plus_cbst; | |
493 ret = bat_send(client, &send_cmd); | |
494 break; | |
495 } | |
496 | |
497 case BAT_CMD_SET_PLUS_COPS: | |
498 { | |
499 bat_params.plus_cops.mode = BAT_COPS_MODE_AUTO; | |
500 bat_params.plus_cops.format = BAT_COPS_FORMAT_NOT_PRESENT; | |
501 bat_params.plus_cops.v_oper = FALSE; | |
502 bat_params.plus_cops.c_oper = 0; | |
503 send_cmd.params.ptr_set_plus_cops = &bat_params.plus_cops; | |
504 ret = bat_send(client, &send_cmd); | |
505 break; | |
506 } | |
507 | |
508 case BAT_CMD_SET_PERCENT_CNIV: | |
509 { | |
510 bat_params.percent_cniv.mode = BAT_CNIV_MODE_ON; | |
511 send_cmd.params.ptr_set_percent_cniv= &bat_params.percent_cniv; | |
512 ret = bat_send(client, &send_cmd); | |
513 break; | |
514 } | |
515 | |
516 default: | |
517 TRACE_ASSERT(0); | |
518 return; | |
519 } | |
520 | |
521 TRACE_ASSERT(ret == BAT_OK); | |
522 | |
523 } | |
524 | |
525 | |
526 char *app_handle_at_command(char *command) | |
527 { | |
528 return app_handle_command(command, app_bat_atcmds_table); | |
529 } | |
530 | |
531 | |
532 /* EOF */ |