FreeCalypso > hg > fc-tourmaline
comparison src/g23m-aci/aci/ati_csc.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 | Project : GSM-F&D (8411) | |
4 | Modul : ATI | |
5 +----------------------------------------------------------------------------- | |
6 | Copyright 2002 Texas Instruments Berlin, AG | |
7 | All rights reserved. | |
8 | | |
9 | This file is confidential and a trade secret of Texas | |
10 | Instruments Berlin, AG | |
11 | The receipt of or possession of this file does not convey | |
12 | any rights to reproduce or disclose its contents or to | |
13 | manufacture, use, or sell anything it may describe, in | |
14 | whole, or in part, without the specific written consent of | |
15 | Texas Instruments Berlin, AG. | |
16 +----------------------------------------------------------------------------- | |
17 | Purpose : AT Command: CONDAT specific commands. | |
18 +----------------------------------------------------------------------------- | |
19 */ | |
20 | |
21 #ifndef ATI_CSC_C | |
22 #define ATI_CSC_C | |
23 | |
24 #undef DUMMY_ATI_STRINGS | |
25 | |
26 #include "aci_all.h" | |
27 | |
28 #include "aci_cmh.h" | |
29 #include "ati_cmd.h" | |
30 #include "aci_io.h" | |
31 #include "aci_cmd.h" | |
32 #include "l4_tim.h" | |
33 | |
34 #if defined(FF_WAP) || defined(FF_PPP) || defined(FF_GPF_TCPIP) || defined (FF_SAT_E) | |
35 #include "dti.h" /* functionality of the dti library */ | |
36 #include "dti_conn_mng.h" | |
37 #include "wap_aci.h" | |
38 #include "psa_ppp_w.h" | |
39 #endif /* FF_WAP || FF_PPP || FF_GPF_TCPIP || FF_SAT_E */ | |
40 | |
41 #include "aci_mem.h" | |
42 #include "ati_cmd.h" | |
43 #include "aci_lst.h" | |
44 #include "aci_prs.h" | |
45 | |
46 #include "psa_mmi.h" | |
47 | |
48 #include "ati_int.h" | |
49 | |
50 /* only needed for testing AT%DAR=5 */ | |
51 /* | |
52 #include "aci.h" | |
53 */ | |
54 | |
55 #ifdef FF_ATI_BAT | |
56 | |
57 #include "typedefs.h" | |
58 #include "gdd.h" | |
59 #include "bat.h" | |
60 | |
61 #include "ati_bat.h" | |
62 | |
63 #endif /* FF_ATI_BAT */ | |
64 EXTERN UBYTE std; | |
65 | |
66 typedef struct | |
67 { | |
68 char *name; | |
69 T_ACI_CUSCFG_FAC fac; | |
70 } cuscfg_fac; | |
71 | |
72 const cuscfg_fac cus_fac[] = | |
73 { | |
74 {"CCMOSM", CUSCFG_FAC_MO_SM_Control}, | |
75 {"CCMOC", CUSCFG_FAC_MO_Call_Control}, | |
76 {"CCMOSS", CUSCFG_FAC_MO_SS_Control}, | |
77 {"CCMOUSSD", CUSCFG_FAC_MO_USSD_Control}, | |
78 {"2BDIAL", CUSCFG_FAC_2_Digit_Call}, | |
79 {"EUSSDR", CUSCFG_FAC_Ext_USSD_Res}, | |
80 {"ETMOBEONSR", CUSCFG_FAC_T_MOBILE_Eons}, | |
81 {"USSDASMOC", CUSCFG_FAC_USSD_As_MO_Call}, | |
82 {0, CUSCFG_FAC_Not_Present} | |
83 }; | |
84 | |
85 #define MAX_FAC_STR_LENGTH 20 | |
86 #define MAX_VALUE_LENGTH MAX_FAC_STR_LENGTH | |
87 | |
88 | |
89 /* | |
90 +--------------------------------------------------------------------+ | |
91 | PROJECT : GSM-PS MODULE : CMH_MMIS | | |
92 | STATE : code ROUTINE : atPercentCPRIM | | |
93 +--------------------------------------------------------------------+ | |
94 | |
95 PURPOSE : This is the functional counterpart to the %CPRIM AT command | |
96 which is used to send a system primitive (CONFIG PRIMITIVE) | |
97 to a entity or frame. | |
98 */ | |
99 | |
100 GLOBAL T_ATI_RSLT atPercentCPRIM (char *cl, UBYTE srcId) | |
101 { | |
102 char receiver_name[10]; | |
103 char config_str[80]; | |
104 T_HANDLE receiver_handle; | |
105 | |
106 TRACE_FUNCTION ("atPercentCPRIM()"); | |
107 | |
108 *receiver_name = '\0'; | |
109 *config_str = '\0'; | |
110 | |
111 cl = parse(cl, "ss", (LONG)sizeof (receiver_name), receiver_name, | |
112 (LONG)sizeof (config_str), config_str); | |
113 | |
114 if(!cl) | |
115 { | |
116 cmdCmeError(CME_ERR_OpNotAllow); | |
117 TRACE_EVENT ("atPercentCPRIM(): parse error"); | |
118 return (ATI_FAIL); | |
119 } | |
120 | |
121 receiver_handle = vsi_c_open (VSI_CALLER receiver_name); | |
122 if (receiver_handle < VSI_OK) | |
123 { | |
124 cmdCmeError(CME_ERR_OpNotAllow); | |
125 TRACE_EVENT_P1 ("atPercentCPRIM(): wrong entity [%s]", receiver_name); | |
126 return (ATI_FAIL); | |
127 } | |
128 | |
129 psaMMI_ConfigPrim (receiver_handle, config_str); | |
130 | |
131 vsi_c_close (VSI_CALLER receiver_handle); | |
132 | |
133 return (ATI_CMPL); | |
134 } | |
135 | |
136 /* | |
137 +--------------------------------------------------------------------+ | |
138 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
139 | STATE : code ROUTINE : atPercentBAND | | |
140 +--------------------------------------------------------------------+ | |
141 | |
142 PURPOSE : %BAND multiband configuration command | |
143 */ | |
144 | |
145 GLOBAL T_ATI_RSLT setatPercentBAND (CHAR *cl, UBYTE srcId) | |
146 { | |
147 T_ACI_BAND_MODE bandMode; | |
148 USHORT ushort_bandType = 0xFFFF; /* ushort because of parser **##!!## */ | |
149 T_ACI_RETURN ret = AT_FAIL; | |
150 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id); | |
151 | |
152 src_params->curAtCmd = AT_CMD_BAND; | |
153 | |
154 cl = parse(cl,"dr",&bandMode,&ushort_bandType); | |
155 if (cl EQ NULL) | |
156 { | |
157 cmdCmeError(CME_ERR_OpNotAllow); | |
158 return (ATI_FAIL); | |
159 } | |
160 | |
161 /* prechecking: only place where consistence can be checked (whether | |
162 bandType parameter is present or not) */ | |
163 if( bandMode EQ BAND_MODE_Manual AND | |
164 ( (ushort_bandType & 0xFF00) NEQ 0x0000) ) | |
165 { | |
166 TRACE_EVENT("Error: AT%%BAND manual mode but no bands chosen"); | |
167 cmdCmeError(CME_ERR_OpNotAllow); | |
168 return (ATI_FAIL); | |
169 } | |
170 else if( bandMode EQ BAND_MODE_Auto AND | |
171 ushort_bandType NEQ 0xFFFF ) | |
172 { | |
173 TRACE_EVENT("Error: AT%%BAND auto mode but band type has been given: inconsistent"); | |
174 cmdCmeError(CME_ERR_OpNotAllow); | |
175 return (ATI_FAIL); | |
176 } | |
177 | |
178 TRACE_EVENT_P1("ushort_bandType: %04X", ushort_bandType); | |
179 TRACE_EVENT_P1("bandMode: %d", bandMode); | |
180 | |
181 #ifdef FF_ATI_BAT | |
182 { | |
183 T_BAT_cmd_send cmd; | |
184 T_BAT_cmd_set_percent_band my_bat_set_percent_band; | |
185 | |
186 TRACE_FUNCTION("setatPercentBAND() calls bat_send() <=== as APPLICATION"); | |
187 | |
188 memset(&my_bat_set_percent_band, 0, sizeof(my_bat_set_percent_band)); | |
189 cmd.ctrl_params = BAT_CMD_SET_PERCENT_BAND; | |
190 cmd.params.ptr_set_percent_band = &my_bat_set_percent_band; | |
191 | |
192 my_bat_set_percent_band.mode = bandMode; | |
193 my_bat_set_percent_band.band = ushort_bandType; | |
194 | |
195 bat_send(ati_bat_get_client(srcId), &cmd); | |
196 | |
197 return ATI_EXCT; /* executing, because response is passed by callback function */ | |
198 } | |
199 #else /* OLD FUNCTION BODY */ | |
200 | |
201 TRACE_FUNCTION("setatPercentBAND()"); | |
202 | |
203 ret = sAT_PercentBAND((T_ACI_CMD_SRC)srcId, bandMode, (UBYTE)ushort_bandType); | |
204 | |
205 switch (ret) | |
206 { | |
207 case (AT_CMPL): | |
208 break; | |
209 | |
210 case (AT_EXCT): | |
211 break; | |
212 | |
213 default: | |
214 cmdCmeError(CME_ERR_Unknown); | |
215 break; | |
216 } | |
217 return (map_aci_2_ati_rslt(ret)); | |
218 | |
219 #endif /* no FF_ATI_BAT*/ | |
220 } | |
221 | |
222 /* at the moment 5 levels of bands are supported */ | |
223 /* BITS: | 5 | 4 | 3 | 2 | 1 | | |
224 | GSM850 | E_GSM | GSM1900 | GSM1800 | GSM900 | */ | |
225 #define HIGHEST_BAND_SUPPORTED (0x1F) | |
226 | |
227 GLOBAL T_ATI_RSLT tesatPercentBAND (CHAR *cl, UBYTE srcId) | |
228 { | |
229 T_ACI_BAND_MODE MaxBandMode; | |
230 UBYTE bands_bitfield; | |
231 T_ACI_RETURN ret = AT_FAIL; | |
232 UBYTE c_set_bit = 0; | |
233 USHORT pos = 0; | |
234 UBYTE i, tested_filter_byte, highest_set_bit_only=0; | |
235 | |
236 TRACE_FUNCTION("tesatPercentBAND()"); | |
237 | |
238 | |
239 ret = tAT_PercentBAND( (T_ACI_CMD_SRC)srcId, | |
240 &MaxBandMode, | |
241 &bands_bitfield); | |
242 | |
243 if( ret NEQ AT_CMPL ) | |
244 { | |
245 cmdCmeError(CME_ERR_Unknown); | |
246 return (ATI_CMPL); | |
247 } | |
248 | |
249 /* initialization of the string */ | |
250 pos += sprintf(g_sa, "%s: (0-%d)", "%BAND", MaxBandMode); | |
251 pos += sprintf( g_sa+pos, ",(" ); | |
252 | |
253 if(bands_bitfield EQ 0x00) | |
254 { | |
255 /* no particular settings from manufacturer */ | |
256 pos += sprintf( g_sa+pos, "1-%d)", HIGHEST_BAND_SUPPORTED ); | |
257 } | |
258 else | |
259 { | |
260 /* search holes between highest bit and lowest bit */ | |
261 for( i=0; i<8 ; i++ ) | |
262 { | |
263 tested_filter_byte = 0x01 << i; | |
264 | |
265 if( (bands_bitfield & tested_filter_byte) ) | |
266 { | |
267 highest_set_bit_only = tested_filter_byte; | |
268 c_set_bit++; | |
269 } | |
270 } | |
271 | |
272 if(c_set_bit) /* alignment at the end */ | |
273 { | |
274 c_set_bit--; | |
275 } | |
276 | |
277 if( highest_set_bit_only EQ (0x01 << c_set_bit) ) | |
278 { | |
279 /* there is no hole in the supported values, form 1 to max_value */ | |
280 pos += sprintf( g_sa+pos, "1-%d)", bands_bitfield ); | |
281 } | |
282 else | |
283 { | |
284 for(i=1 ; i<=bands_bitfield; i++) /* bands_bitfield is obviously the highest possible value */ | |
285 { | |
286 if( (i & bands_bitfield) EQ i ) | |
287 { | |
288 pos += sprintf( g_sa+pos, "%d,", i); | |
289 } | |
290 if(pos>MAX_CMD_LEN-5) /* -5 to have some buffer */ | |
291 { | |
292 TRACE_EVENT("output buffer is too short !!!"); | |
293 break; | |
294 } | |
295 } | |
296 pos--; /* erase last comma */ | |
297 sprintf( g_sa+pos, ")"); | |
298 } | |
299 } | |
300 | |
301 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT); | |
302 | |
303 return (ATI_CMPL); | |
304 } | |
305 | |
306 GLOBAL T_ATI_RSLT queatPercentBAND (CHAR *cl, UBYTE srcId) | |
307 { | |
308 T_ACI_BAND_MODE bandMode; | |
309 UBYTE bandType; | |
310 T_ACI_RETURN ret = AT_FAIL; | |
311 | |
312 TRACE_FUNCTION("queatPercentBAND()"); | |
313 | |
314 ret = qAT_PercentBAND((T_ACI_CMD_SRC)srcId, &bandMode, &bandType); | |
315 | |
316 if (ret NEQ AT_CMPL) | |
317 { | |
318 cmdCmeError(CME_ERR_Unknown); | |
319 return (ATI_FAIL); | |
320 } | |
321 | |
322 if( bandType EQ 0x00 | |
323 OR bandMode EQ BAND_MODE_Auto ) | |
324 { | |
325 sprintf(g_sa, "%s: %d", "%BAND", bandMode); | |
326 } | |
327 else | |
328 { | |
329 sprintf(g_sa, "%s: %d,%d", "%BAND", bandMode, bandType); | |
330 } | |
331 | |
332 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT); | |
333 | |
334 return (ATI_CMPL); | |
335 } | |
336 | |
337 /* | |
338 +--------------------------------------------------------------------+ | |
339 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
340 | STATE : code ROUTINE : atPercentNRG | | |
341 +--------------------------------------------------------------------+ | |
342 | |
343 PURPOSE : %NRG extendet registration command | |
344 */ | |
345 | |
346 GLOBAL T_ATI_RSLT setatPercentNRG (char *cl, UBYTE srcId) | |
347 { | |
348 char op[MAX_ALPHA_OPER_LEN]={""}; | |
349 T_ACI_RETURN ret = AT_FAIL; | |
350 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id); | |
351 T_ACI_NRG_RGMD regMode = NRG_RGMD_NotPresent; | |
352 T_ACI_NRG_SVMD srvMode = NRG_SVMD_NotPresent; | |
353 T_ACI_NRG_FRMT oprFrmt = NRG_FRMT_NotPresent; | |
354 | |
355 TRACE_FUNCTION("setatPercentNRG()"); | |
356 | |
357 /* split parameter string in int,int,int,str */ | |
358 cl = parse(cl,"ddds",®Mode,&srvMode,&oprFrmt,(LONG)20,op); | |
359 if (!cl) | |
360 { | |
361 cmdCmeError(CME_ERR_OpNotAllow); | |
362 return (ATI_FAIL); | |
363 } | |
364 | |
365 ret = sAT_PercentNRG((T_ACI_CMD_SRC)srcId,regMode,srvMode,oprFrmt,op); | |
366 | |
367 switch (ret) | |
368 { | |
369 case (AT_CMPL): /*operation completed*/ | |
370 break; | |
371 case (AT_EXCT): | |
372 src_params->curAtCmd = AT_CMD_NRG; | |
373 break; | |
374 default: | |
375 cmdCmeError(CME_ERR_Unknown); /*Command failed*/ | |
376 break; | |
377 } | |
378 return (map_aci_2_ati_rslt(ret)); | |
379 } | |
380 | |
381 | |
382 GLOBAL T_ATI_RSLT queatPercentNRG (char *cl, UBYTE srcId) | |
383 { | |
384 char op[MAX_ALPHA_OPER_LEN]; | |
385 T_ACI_RETURN ret = AT_FAIL; | |
386 T_ACI_NRG_RGMD regMode= NRG_RGMD_NotPresent; | |
387 T_ACI_NRG_SVMD srvMode= NRG_SVMD_NotPresent; | |
388 T_ACI_NRG_SVMD srvStat= NRG_SVMD_NotPresent; | |
389 T_ACI_NRG_FRMT oprFrmt= NRG_FRMT_NotPresent; | |
390 | |
391 TRACE_FUNCTION("queatPercentNRG()"); | |
392 | |
393 ret = qAT_PercentNRG((T_ACI_CMD_SRC)srcId,®Mode,&srvMode, | |
394 &oprFrmt,&srvStat,op); | |
395 if (ret EQ AT_CMPL) | |
396 { | |
397 if( *op ) | |
398 sprintf(g_sa,"%s: %d,%d,%d,%d,\"%s\"", "%NRG", regMode,srvMode,oprFrmt,srvStat,op); | |
399 else | |
400 sprintf(g_sa,"%s: %d,%d,,%d", "%NRG", regMode,srvMode,srvStat); | |
401 | |
402 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT); | |
403 } | |
404 else | |
405 { | |
406 cmdCmeError(CME_ERR_Unknown); /*command failed*/ | |
407 } | |
408 return (map_aci_2_ati_rslt(ret)); | |
409 } | |
410 | |
411 | |
412 /* | |
413 +--------------------------------------------------------------------+ | |
414 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
415 | STATE : code ROUTINE : atPercentCAOC | | |
416 +--------------------------------------------------------------------+ | |
417 | |
418 PURPOSE : %CAOC / %CACM command (Advice of Charge) | |
419 */ | |
420 LOCAL T_ATI_RSLT QueryCCM_ACM(CHAR *cl,T_ACI_AT_CMD cmd, UBYTE srcId) | |
421 { | |
422 char currency [MAX_CUR_LEN] = {0x00}; | |
423 char cvtdCurrency [2*MAX_CUR_LEN] = {0x00}; | |
424 USHORT lenCvtdCurrency = 0; | |
425 USHORT pos = 0; | |
426 char ppu [MAX_PPU_LENGTH] = {0x00}; | |
427 T_ACI_RETURN ret = AT_FAIL; | |
428 | |
429 switch(cmd) | |
430 { | |
431 case(AT_CMD_CAOC ): | |
432 /* | |
433 * AT%CAOC queries the actual ccm value using PUCT | |
434 */ | |
435 ret = qAT_PercentCAOC((T_ACI_CMD_SRC)srcId, currency, ppu); | |
436 pos = sprintf(g_sa,"%s: ","%CAOC"); | |
437 break; | |
438 case(AT_CMD_CACM): | |
439 /* | |
440 * AT%CACM requests the ACM using PUCT. | |
441 */ | |
442 ret = qAT_PercentCACM((T_ACI_CMD_SRC)srcId,currency,ppu); | |
443 pos = sprintf(g_sa,"%s: ","%CACM"); | |
444 break; | |
445 } | |
446 | |
447 if( ret NEQ AT_CMPL ) | |
448 { | |
449 cmdCmeError(CME_ERR_Unknown); | |
450 return (ATI_FAIL); | |
451 } | |
452 | |
453 srcId_cb = srcId; | |
454 utl_chsetFromGsm((UBYTE*)currency, | |
455 (USHORT)strlen(currency), | |
456 (UBYTE*)cvtdCurrency, | |
457 sizeof(cvtdCurrency), | |
458 &lenCvtdCurrency, | |
459 GSM_ALPHA_Def); | |
460 pos+=sprints(g_sa+pos,cvtdCurrency,lenCvtdCurrency); | |
461 pos+=sprintf(g_sa+pos,",\"%s\"",ppu); | |
462 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT); | |
463 return (map_aci_2_ati_rslt(ret)); | |
464 } | |
465 | |
466 | |
467 GLOBAL T_ATI_RSLT atPercentCAOC (char* cl, UBYTE srcId) | |
468 { | |
469 TRACE_FUNCTION("atPercentCAOC()"); | |
470 | |
471 return(QueryCCM_ACM(cl,AT_CMD_CAOC,srcId)); | |
472 } | |
473 | |
474 /* | |
475 +--------------------------------------------------------------------+ | |
476 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
477 | STATE : code ROUTINE : atPercentCACM | | |
478 +--------------------------------------------------------------------+ | |
479 | |
480 PURPOSE : %CACM command (Advice of Charge, Accumulated Call Meter) | |
481 */ | |
482 GLOBAL T_ATI_RSLT atPercentCACM (char* cl, UBYTE srcId) | |
483 { | |
484 TRACE_FUNCTION("atPercentCACM()"); | |
485 | |
486 return(QueryCCM_ACM(cl,AT_CMD_CACM,srcId)); | |
487 } | |
488 | |
489 /* | |
490 +--------------------------------------------------------------------+ | |
491 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
492 | STATE : code ROUTINE : atPercentCTV | | |
493 +--------------------------------------------------------------------+ | |
494 | |
495 PURPOSE : %CTV command (Current Call Timer Values) | |
496 */ | |
497 GLOBAL T_ATI_RSLT atPercentCTV (char* cl, UBYTE srcId) | |
498 { | |
499 LONG ctv; | |
500 T_ACI_RETURN ret = AT_FAIL; | |
501 | |
502 TRACE_FUNCTION("atPercentCTV()"); | |
503 | |
504 switch (*cl) | |
505 { | |
506 case('\0'): | |
507 /* | |
508 * AT%CTV queries the call timer value | |
509 */ | |
510 ret = qAT_PercentCTV((T_ACI_CMD_SRC)srcId, &ctv); | |
511 if( ret NEQ AT_CMPL ) | |
512 { | |
513 cmdCmeError(CME_ERR_Unknown); | |
514 return (ATI_FAIL); | |
515 } | |
516 resp_disp(srcId, cl,"l",&ctv); | |
517 break; | |
518 | |
519 default: | |
520 cmdCmeError(CME_ERR_OpNotAllow); | |
521 return (ATI_FAIL); | |
522 } | |
523 return (map_aci_2_ati_rslt(ret)); | |
524 } | |
525 | |
526 | |
527 /* | |
528 +--------------------------------------------------------------------+ | |
529 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
530 | STATE : code ROUTINE : atPercentCPI | | |
531 +--------------------------------------------------------------------+ | |
532 | |
533 PURPOSE : %CPI command (Call proceeding indication) | |
534 */ | |
535 | |
536 GLOBAL T_ATI_RSLT setatPercentCPI(char *cl, UBYTE srcId) | |
537 { | |
538 SHORT mode = ACI_NumParmNotPresent; | |
539 | |
540 TRACE_FUNCTION("setatPercentCPI()"); | |
541 | |
542 cl = parse(cl,"r",&mode); | |
543 if(!cl OR mode > 4 OR mode < 0) | |
544 { | |
545 cmdCmeError(CME_ERR_OpNotAllow); | |
546 return (ATI_FAIL); | |
547 } | |
548 | |
549 ati_user_output_cfg[srcId].CPI_stat=(UBYTE)mode; | |
550 return (ATI_CMPL); | |
551 } | |
552 | |
553 GLOBAL T_ATI_RSLT queatPercentCPI(char *cl, UBYTE srcId) | |
554 { | |
555 int value; | |
556 | |
557 TRACE_FUNCTION("queatPercentCPI()"); | |
558 | |
559 value = (int)ati_user_output_cfg[srcId].CPI_stat; | |
560 resp_disp(srcId, cl,"e",&value); | |
561 return (ATI_CMPL); | |
562 } | |
563 | |
564 /* | |
565 +--------------------------------------------------------------------+ | |
566 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
567 | STATE : code ROUTINE : atPercentVER | | |
568 +--------------------------------------------------------------------+ | |
569 | |
570 PURPOSE : %VER displays version of entities | |
571 */ | |
572 | |
573 extern const char firmware_version_str[]; | |
574 | |
575 GLOBAL T_ATI_RSLT atPercentVER (char* cl, UBYTE srcId) | |
576 { | |
577 char *me="%VER: "; | |
578 | |
579 TRACE_FUNCTION("atPercentVER()"); | |
580 | |
581 sprintf(g_sa, "%s%s", me, firmware_version_str); | |
582 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT); | |
583 | |
584 return (ATI_CMPL); | |
585 } | |
586 | |
587 /* | |
588 +--------------------------------------------------------------------+ | |
589 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
590 | STATE : code ROUTINE : atPercentCNAP | | |
591 +--------------------------------------------------------------------+ | |
592 | |
593 PURPOSE : %CNAP command (Calling NAme Presentation) | |
594 */ | |
595 | |
596 GLOBAL T_ATI_RSLT setatPercentCNAP(char *cl, UBYTE srcId) | |
597 { | |
598 T_ATI_CNAP_MODE cnap_mode; | |
599 | |
600 TRACE_FUNCTION("setatPercentCNAP()"); | |
601 | |
602 cnap_mode =(T_ATI_CNAP_MODE)(*cl - '0'); | |
603 | |
604 switch(cnap_mode) | |
605 { | |
606 case(CNAP_DISABLED): | |
607 case(CNAP_ENABLED): | |
608 ati_user_output_cfg[srcId].cnap_mode = cnap_mode; | |
609 cl++; | |
610 return (ATI_CMPL); | |
611 | |
612 default: | |
613 cmdCmeError(CME_ERR_OpNotAllow); | |
614 return (ATI_FAIL); | |
615 } | |
616 } | |
617 | |
618 GLOBAL T_ATI_RSLT queatPercentCNAP(char *cl, UBYTE srcId) | |
619 { | |
620 T_ACI_RETURN ret = AT_FAIL; | |
621 | |
622 TRACE_FUNCTION("queatPercentCNAP()"); | |
623 | |
624 ret = qAT_PercentCNAP((T_ACI_CMD_SRC)srcId); | |
625 if( ret NEQ AT_EXCT ) | |
626 { | |
627 cmdCmeError(CME_ERR_Unknown); | |
628 } | |
629 return (map_aci_2_ati_rslt(ret)); | |
630 } | |
631 | |
632 | |
633 /* | |
634 +--------------------------------------------------------------------+ | |
635 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
636 | STATE : code ROUTINE : atPercentALS | | |
637 +--------------------------------------------------------------------+ | |
638 | |
639 PURPOSE : %ALS command (select the aternate line) | |
640 */ | |
641 | |
642 | |
643 GLOBAL T_ATI_RSLT setatPercentALS ( char *cl, UBYTE srcId ) | |
644 { | |
645 T_ACI_RETURN ACI_return = AT_FAIL; | |
646 T_ACI_ALS_MOD ALSmode; | |
647 | |
648 TRACE_FUNCTION( "setatPercentALS()" ); | |
649 | |
650 switch( *cl ) | |
651 { | |
652 case '0': | |
653 ALSmode = ALS_MOD_SPEECH; | |
654 break; | |
655 | |
656 case '1': | |
657 ALSmode = ALS_MOD_AUX_SPEECH; | |
658 break; | |
659 | |
660 default: | |
661 cmdCmeError(CME_ERR_OpNotSupp); | |
662 return (map_aci_2_ati_rslt(ACI_return)); | |
663 } | |
664 | |
665 #ifdef FF_ATI_BAT | |
666 { | |
667 T_BAT_cmd_send cmd; | |
668 T_BAT_cmd_set_percent_als my_bat_set_percent_als; | |
669 | |
670 TRACE_FUNCTION("setatPercentALS() calls bat_send() <=== as APPLICATION"); | |
671 | |
672 memset(&my_bat_set_percent_als, 0, sizeof(my_bat_set_percent_als)); | |
673 cmd.ctrl_params = BAT_CMD_SET_PERCENT_ALS; | |
674 cmd.params.ptr_set_percent_als = &my_bat_set_percent_als; | |
675 | |
676 my_bat_set_percent_als.mode = ALSmode; | |
677 | |
678 bat_send(ati_bat_get_client(srcId), &cmd); | |
679 | |
680 return ATI_EXCT; /* executing, because response is passed by callback function */ | |
681 } | |
682 #else /* OLD FUNCTION BODY */ | |
683 | |
684 ACI_return = sAT_PercentALS( (T_ACI_CMD_SRC)srcId, ALSmode ); | |
685 | |
686 if( ACI_return EQ AT_FAIL ) | |
687 { | |
688 cmdCmeError(CME_ERR_Unknown); | |
689 } | |
690 return (map_aci_2_ati_rslt(ACI_return)); | |
691 | |
692 #endif /* no FF_ATI_BAT*/ | |
693 } | |
694 | |
695 | |
696 GLOBAL T_ATI_RSLT tesatPercentALS ( char *cl, UBYTE srcId ) | |
697 { | |
698 char *me = "%ALS"; | |
699 T_ACI_RETURN ACI_return = AT_FAIL ; | |
700 T_ACI_ALS_MOD ALSmode; | |
701 | |
702 TRACE_FUNCTION( "tesatPercentALS()" ); | |
703 | |
704 ACI_return = tAT_PercentALS((T_ACI_CMD_SRC)srcId, &ALSmode ); | |
705 | |
706 if ( ACI_return EQ AT_FAIL ) | |
707 { | |
708 cmdCmeError(CME_ERR_Unknown); | |
709 return (ATI_FAIL); | |
710 } | |
711 else if ( ACI_return EQ AT_CMPL ) | |
712 { | |
713 if (ALSmode EQ ALS_MOD_NOTPRESENT) | |
714 { | |
715 cmdCmeError(CME_ERR_OpNotSupp); | |
716 return (ATI_FAIL); | |
717 } | |
718 if (ALSmode EQ ALS_MOD_SPEECH) | |
719 sprintf(g_sa,"%s: (0)", me); | |
720 if (ALSmode EQ ALS_MOD_AUX_SPEECH) | |
721 sprintf(g_sa,"%s: (1)", me); | |
722 if (ALSmode EQ (ALS_MOD_SPEECH | ALS_MOD_AUX_SPEECH)) | |
723 sprintf(g_sa,"%s: (0,1)", me); | |
724 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT); | |
725 } | |
726 return (map_aci_2_ati_rslt(ACI_return)); | |
727 } | |
728 | |
729 | |
730 GLOBAL T_ATI_RSLT queatPercentALS ( char *cl, UBYTE srcId ) | |
731 { | |
732 T_ACI_RETURN ACI_return = AT_FAIL; | |
733 T_ACI_ALS_MOD ALSmode; | |
734 UBYTE ati_ALSmode; | |
735 | |
736 TRACE_FUNCTION( "queatPercentALS()" ); | |
737 | |
738 ACI_return = qAT_PercentALS( (T_ACI_CMD_SRC)srcId, &ALSmode ); | |
739 if( ACI_return NEQ AT_CMPL ) | |
740 { | |
741 cmdCmeError(CME_ERR_Unknown); | |
742 return (ATI_FAIL); | |
743 } | |
744 | |
745 switch( ALSmode ) | |
746 { | |
747 case(ALS_MOD_SPEECH): | |
748 ati_ALSmode = 0; | |
749 break; | |
750 | |
751 case(ALS_MOD_AUX_SPEECH): | |
752 ati_ALSmode = 1; | |
753 break; | |
754 | |
755 case(ALS_MOD_NOTPRESENT): | |
756 default: | |
757 cmdCmeError(CME_ERR_OpNotSupp); | |
758 return (ATI_FAIL); | |
759 } | |
760 | |
761 resp_disp(srcId, cl,"b",&ati_ALSmode); | |
762 return (map_aci_2_ati_rslt(ACI_return)); | |
763 } | |
764 | |
765 /* | |
766 +--------------------------------------------------------------------+ | |
767 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
768 | STATE : code ROUTINE : atPercentCOLR | | |
769 +--------------------------------------------------------------------+ | |
770 | |
771 PURPOSE : %COLR command | |
772 no parameter. | |
773 */ | |
774 | |
775 GLOBAL T_ATI_RSLT atPercentCOLR(CHAR *cl, UBYTE srcId) | |
776 { | |
777 T_ACI_RETURN ret = AT_FAIL; | |
778 | |
779 TRACE_FUNCTION("atPercentCOLR()"); | |
780 | |
781 if( *cl NEQ '\0' | |
782 AND *cl NEQ ';') | |
783 { | |
784 cmdCmeError( CME_ERR_OpNotAllow ); | |
785 return (ATI_FAIL); | |
786 } | |
787 | |
788 ret = qAT_PercentCOLR( (T_ACI_CMD_SRC)srcId ); | |
789 | |
790 if( ret NEQ AT_EXCT ) | |
791 { | |
792 cmdCmeError( CME_ERR_Unknown ); | |
793 } | |
794 return (map_aci_2_ati_rslt(ret)); | |
795 } | |
796 | |
797 /* | |
798 +--------------------------------------------------------------------+ | |
799 | PROJECT : GSM MODULE : ATI_CMD | | |
800 | STATE : code ROUTINE : atPercentCUNS | | |
801 +--------------------------------------------------------------------+ | |
802 | |
803 PURPOSE : %CUNS command | |
804 parameters: buffering_mode. | |
805 0: unsolicited messages may occur any time. | |
806 1: unsolicited messages can't happen while typing a command. | |
807 2: unsolicited messages can't happen between starting typing a command | |
808 and its final result. | |
809 */ | |
810 | |
811 GLOBAL T_ATI_RSLT setatPercentCUNS(char *cl, UBYTE srcId) | |
812 { | |
813 SHORT buffering_mode = -1; | |
814 T_ATI_SRC_PARAMS *src_params; | |
815 | |
816 cl = parse(cl,"d",&buffering_mode); | |
817 | |
818 src_params = find_element (ati_src_list, srcId, search_ati_src_id); | |
819 | |
820 if( cl EQ NULL | |
821 OR src_params EQ NULL | |
822 OR buffering_mode < 0 | |
823 OR buffering_mode > 2) | |
824 { | |
825 cmdCmeError(CME_ERR_OpNotAllow); | |
826 return (ATI_FAIL); | |
827 } | |
828 | |
829 src_params->buff_uns_mode = (T_ATI_BUFF_UNS_MODE)buffering_mode; | |
830 return (ATI_CMPL); | |
831 } | |
832 | |
833 GLOBAL T_ATI_RSLT queatPercentCUNS(char *cl, UBYTE srcId) | |
834 { | |
835 UBYTE buffering_mode = ((UBYTE)-1); /* adjust is UBYTE type so typecasting -1 with UBYTE */ | |
836 T_ATI_SRC_PARAMS *src_params; | |
837 | |
838 src_params = find_element (ati_src_list, srcId, search_ati_src_id); | |
839 if(src_params EQ NULL) | |
840 { | |
841 cmdCmeError(CME_ERR_OpNotAllow); | |
842 return (ATI_FAIL); | |
843 } | |
844 | |
845 buffering_mode = (UBYTE)src_params->buff_uns_mode; | |
846 resp_disp(srcId, cl, "b", &buffering_mode); | |
847 return (ATI_CMPL); | |
848 } | |
849 | |
850 | |
851 /* | |
852 +--------------------------------------------------------------------+ | |
853 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
854 | STATE : code ROUTINE : atPercentPPP | | |
855 +--------------------------------------------------------------------+ | |
856 | |
857 PURPOSE : %PPP command | |
858 parameters: protocol, login name, password. | |
859 */ | |
860 #ifdef DTI | |
861 #if defined(FF_WAP) || defined(FF_PPP) || defined(FF_GPF_TCPIP) || defined(FF_SAT_E) | |
862 GLOBAL T_ATI_RSLT atPercentPPP (CHAR *cl, UBYTE srcId) | |
863 { | |
864 T_ACI_PPP_PROT protocol; | |
865 T_ACI_RETURN ret = AT_FAIL; | |
866 CHAR buffer_login[sizeof(pppShrdPrm.ppp_login)]; | |
867 CHAR buffer_pwd[sizeof(pppShrdPrm.ppp_password)]; | |
868 T_ACI_PPP_CON con_type = USE_NO_PPP_FOR_AAA; | |
869 | |
870 cl=parse(cl,"dssd",&protocol, sizeof(buffer_login), | |
871 &buffer_login, | |
872 sizeof(buffer_pwd), | |
873 &buffer_pwd, | |
874 &con_type); | |
875 if(!cl) | |
876 { | |
877 cmdCmeError(CME_ERR_OpNotAllow); | |
878 return (ATI_FAIL); | |
879 } | |
880 | |
881 #ifdef FF_ATI_BAT | |
882 { | |
883 T_BAT_cmd_send cmd; | |
884 T_BAT_cmd_set_percent_ppp my_bat_set_percent_ppp; | |
885 | |
886 TRACE_FUNCTION("atPercentPPP() calls bat_send() <=== as APPLICATION"); | |
887 | |
888 memset(&my_bat_set_percent_ppp,0,sizeof(T_BAT_cmd_set_percent_ppp)); | |
889 cmd.ctrl_params = BAT_CMD_SET_PERCENT_PPP; | |
890 cmd.params.ptr_set_percent_ppp = &my_bat_set_percent_ppp; | |
891 | |
892 my_bat_set_percent_ppp.authprot = (T_BAT_percent_ppp_authprot)protocol; | |
893 if(my_bat_set_percent_ppp.c_user = strlen(buffer_login)) | |
894 { | |
895 my_bat_set_percent_ppp.v_user = TRUE; | |
896 memcpy(my_bat_set_percent_ppp.user,buffer_login, | |
897 my_bat_set_percent_ppp.c_user<=BAT_MAX_PPP_USER_LEN ? | |
898 my_bat_set_percent_ppp.c_user : BAT_MAX_PPP_USER_LEN); | |
899 } | |
900 if(my_bat_set_percent_ppp.c_password = strlen(buffer_pwd)) | |
901 { | |
902 my_bat_set_percent_ppp.v_password = TRUE; | |
903 memcpy(my_bat_set_percent_ppp.password,buffer_pwd, | |
904 my_bat_set_percent_ppp.c_password<=BAT_MAX_PPP_PASSW_LEN ? | |
905 my_bat_set_percent_ppp.c_password : BAT_MAX_PPP_PASSW_LEN); | |
906 } | |
907 my_bat_set_percent_ppp.conn_type = (T_BAT_percent_ppp_conn_type)con_type; | |
908 | |
909 bat_send(ati_bat_get_client(srcId), &cmd); | |
910 return ATI_EXCT; /* executing, because response is passed by callback function */ | |
911 } | |
912 | |
913 #else /* no FF_ATI_BAT */ | |
914 | |
915 TRACE_FUNCTION("atPercentPPP()"); | |
916 | |
917 ret = sAT_PercentPPP((T_ACI_CMD_SRC)srcId,protocol, | |
918 buffer_login, | |
919 buffer_pwd, | |
920 con_type); | |
921 if (ret EQ AT_FAIL) | |
922 { | |
923 cmdCmeError(CME_ERR_Unknown); | |
924 } | |
925 return (map_aci_2_ati_rslt(ret)); | |
926 #endif /* FF_ATI_BAT */ | |
927 } | |
928 | |
929 | |
930 /** Query PPP-negotiated parameters after connection setup. | |
931 * | |
932 */ | |
933 GLOBAL T_ATI_RSLT queatPercentPPP (CHAR *cl, UBYTE srcId) | |
934 { | |
935 ULONG ipaddr = 0 ; /* Own IP address. */ | |
936 ULONG dns1 = 0, dns2 = 0 ; /* Domain Name Server addresses. */ | |
937 | |
938 qAT_PercentPPP(srcId, &ipaddr, &dns1, &dns2) ; | |
939 | |
940 /* WARNING: this is for little endian only! */ | |
941 #define IPADDR_BYTE(b, a) (((a) >> ((b) * 8)) & 0xff) | |
942 | |
943 sprintf(g_sa, "%%PPP: %u.%u.%u.%u,%u.%u.%u.%u,%u.%u.%u.%u", | |
944 IPADDR_BYTE(3, ipaddr), | |
945 IPADDR_BYTE(2, ipaddr), | |
946 IPADDR_BYTE(1, ipaddr), | |
947 IPADDR_BYTE(0, ipaddr), | |
948 IPADDR_BYTE(3, dns1), | |
949 IPADDR_BYTE(2, dns1), | |
950 IPADDR_BYTE(1, dns1), | |
951 IPADDR_BYTE(0, dns1), | |
952 IPADDR_BYTE(3, dns2), | |
953 IPADDR_BYTE(2, dns2), | |
954 IPADDR_BYTE(1, dns2), | |
955 IPADDR_BYTE(0, dns2)) ; | |
956 io_sendMessage (srcId, g_sa, ATI_NORMAL_OUTPUT); | |
957 return ATI_CMPL ; | |
958 } | |
959 | |
960 #endif /* (FF_WAP) || (FF_PPP) || (FF_GPF_TCPIP) || (FF_SAT_E) */ | |
961 #endif /* DTI */ | |
962 | |
963 | |
964 /* | |
965 +--------------------------------------------------------------------+ | |
966 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
967 | STATE : code ROUTINE : atPercentWAP | | |
968 +--------------------------------------------------------------------+ | |
969 | |
970 PURPOSE : %WAP command | |
971 no parameters. | |
972 */ | |
973 | |
974 #ifdef FF_WAP | |
975 GLOBAL T_ATI_RSLT atPercentWAP (CHAR *cl, UBYTE srcId) | |
976 { | |
977 SHORT setwap_falg; | |
978 | |
979 TRACE_FUNCTION("atPercentWAP()"); | |
980 | |
981 switch(*cl) | |
982 { | |
983 case('0'): | |
984 case('1'): | |
985 setwap_falg = ( (*cl - '0')? 1 : 0 ); | |
986 cl++; | |
987 sAT_PercentWAP(srcId,setwap_falg); | |
988 break; | |
989 | |
990 default: | |
991 cmdCmeError(CME_ERR_OpNotAllow); | |
992 return (ATI_FAIL); | |
993 } | |
994 | |
995 return (ATI_CMPL); | |
996 } | |
997 #endif /* FF_WAP */ | |
998 | |
999 | |
1000 /* | |
1001 +------------------------------------------------------------------------------ | |
1002 | Function : SH - setatPercentMMITEST | |
1003 +------------------------------------------------------------------------------ | |
1004 | Description : Test AT cmd for MMI | |
1005 | This command has been introduced in order to use the AT command interface for some MMI | |
1006 | specific testing. It shoudnt be compiled without MMI. | |
1007 | | |
1008 | | |
1009 | Parameters : char *cl | |
1010 | UBYTE srcId | |
1011 | | |
1012 | Return : ATI_CMPL | |
1013 +------------------------------------------------------------------------------ | |
1014 */ | |
1015 | |
1016 | |
1017 #if defined MFW AND defined TI_PS_FF_AT_P_CMD_MMITEST | |
1018 | |
1019 | |
1020 GLOBAL T_ATI_RSLT setatPercentMMITEST (char *cl, UBYTE srcId) | |
1021 { | |
1022 T_ACI_RETURN ret; | |
1023 | |
1024 TRACE_FUNCTION("setatPercentMMITEST()"); | |
1025 | |
1026 if (*cl NEQ '=') | |
1027 { | |
1028 cmdCmeError (CME_ERR_OpNotAllow); | |
1029 return (ATI_FAIL); | |
1030 } | |
1031 | |
1032 cl++; | |
1033 | |
1034 ret = sAT_PercentMMITEST((T_ACI_CMD_SRC)srcId, cl); | |
1035 | |
1036 switch(ret) | |
1037 { | |
1038 case AT_CMPL: | |
1039 return (ATI_CMPL); | |
1040 | |
1041 case AT_FAIL: | |
1042 cmdCmeError(CME_ERR_Unknown); | |
1043 return (ATI_FAIL); | |
1044 | |
1045 default: | |
1046 cmdCmeError(CME_ERR_Unknown); | |
1047 return (ATI_FAIL); | |
1048 } /* switch */ | |
1049 } /* setatPercentEM */ | |
1050 #endif /* MFW */ | |
1051 | |
1052 /* | |
1053 +-------------------------------------------------------------------------+ | |
1054 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
1055 | STATE : code ROUTINE : setatPercentSMBS | | |
1056 +-------------------------------------------------------------------------+ | |
1057 | |
1058 PURPOSE : %SMBS command (Enable presenting of both Text and PDU formats to SMBS) | |
1059 | |
1060 !!!!!!!!!! ONLY FOR TEST PURPOSES !!!!!!!!!!!!!!!!!!!!!!!!!! | |
1061 */ | |
1062 | |
1063 #if defined FF_MMI_RIV | |
1064 GLOBAL T_ATI_RSLT setatPercentSMBS (CHAR *cl, UBYTE srcId) | |
1065 { | |
1066 T_ACI_RETURN ret = AT_FAIL; | |
1067 T_ACI_PERC_SMBS_MOD mode = PERC_SMBS_MOD_NotPresent; | |
1068 | |
1069 TRACE_FUNCTION("setatPercentSMBS()"); | |
1070 | |
1071 cl=parse(cl, "d", &mode); | |
1072 if (cl EQ NULL) | |
1073 { | |
1074 /* parse problems */ | |
1075 cmdCmsError(CMS_ERR_OpNotAllowed); | |
1076 return (ATI_FAIL); | |
1077 } | |
1078 | |
1079 switch (mode) | |
1080 { | |
1081 case(PERC_SMBS_MOD_DISABLE): | |
1082 case(PERC_SMBS_MOD_ENABLE): | |
1083 break; | |
1084 | |
1085 default: | |
1086 cmdCmsError(CMS_ERR_OpNotAllowed); | |
1087 return (ATI_FAIL); | |
1088 } | |
1089 | |
1090 /* Parameter is allowed then set */ | |
1091 ret = sAT_PercentSMBS (srcId, mode); | |
1092 if (ret EQ AT_FAIL) | |
1093 { | |
1094 cmdCmsError(CMS_ERR_UnSpecErr); | |
1095 return (ATI_FAIL); | |
1096 } | |
1097 return (map_aci_2_ati_rslt(ret)); | |
1098 } | |
1099 | |
1100 /* !!!!!!!!!! ONLY FOR TEST PURPOSES !!!!!!!!!!!!!!!!!!!!!!!!!! */ | |
1101 GLOBAL T_ATI_RSLT queatPercentSMBS (CHAR *cl, UBYTE srcId) | |
1102 { | |
1103 T_ACI_RETURN ret = AT_FAIL; | |
1104 T_ACI_PERC_SMBS_MOD mode = PERC_SMBS_MOD_NotPresent; | |
1105 | |
1106 TRACE_FUNCTION("queatPercentSMBS()"); | |
1107 | |
1108 ret = qAT_PercentSMBS(srcId, &mode); | |
1109 if (ret EQ AT_CMPL) | |
1110 { | |
1111 sprintf(g_sa,"%s%d", "%SMBS: ", mode); | |
1112 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT); | |
1113 return (ATI_CMPL); | |
1114 } | |
1115 cmdCmsError(CMS_ERR_NotPresent); // use aciErrDesc | |
1116 return (ATI_FAIL); | |
1117 } | |
1118 #endif /* FF_MMI_RIV */ | |
1119 | |
1120 | |
1121 | |
1122 | |
1123 /* | |
1124 +--------------------------------------------------------------------+ | |
1125 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
1126 | STATE : code ROUTINE : atPercentDAR | | |
1127 +--------------------------------------------------------------------+ | |
1128 | |
1129 PURPOSE : %DAR command | |
1130 */ | |
1131 | |
1132 | |
1133 /* the following is from os.h derived for the AT%DAR command */ | |
1134 #define FIRST_ENTRY 0xff | |
1135 #define NEXT_ENTRY 0xfe | |
1136 #define OS_OK 0 | |
1137 | |
1138 GLOBAL T_ATI_RSLT setatPercentDAR (CHAR *cl, UBYTE srcId) | |
1139 { | |
1140 TRACE_FUNCTION("atPercentDAR()"); | |
1141 | |
1142 switch(*cl) | |
1143 { | |
1144 case('\0'): | |
1145 break; | |
1146 default: | |
1147 cmdCmeError(CME_ERR_OpNotAllow); | |
1148 return (ATI_FAIL); | |
1149 | |
1150 /* this is only for internal testing of the %DAR command to force a crash of the stack */ | |
1151 /* | |
1152 case('1'): | |
1153 // do an endless loop within ACI | |
1154 while (TRUE) | |
1155 ; | |
1156 break; // never reached | |
1157 | |
1158 case('2'): | |
1159 // consume all memory within ACI | |
1160 while (TRUE) | |
1161 { | |
1162 char *a; | |
1163 ACI_MALLOC(a, 10); | |
1164 } | |
1165 break; // never reached | |
1166 | |
1167 case('3'): | |
1168 // jump to 0x00000000; | |
1169 { | |
1170 void (*a)(void)=0x00000000; | |
1171 (*a)(); | |
1172 } | |
1173 break; // never reached | |
1174 | |
1175 case('4'): | |
1176 // overwrite all memory | |
1177 memset(0x00000000, 0, 0xffffffff); | |
1178 break; // never reached | |
1179 | |
1180 case('5'): | |
1181 // send many messages to ACI | |
1182 while (TRUE) | |
1183 { | |
1184 PALLOC(mncc_alert_ind, MNCC_ALERT_IND); | |
1185 mncc_alert_ind->ti = 0; | |
1186 PSENDX(ACI, mncc_alert_ind); | |
1187 } | |
1188 break; // never reached | |
1189 | |
1190 case('6'): | |
1191 // generate many traces | |
1192 { | |
1193 int i; | |
1194 char buf[]="54 68 65 20 71 75 69 63-6B 20 62 72 6F 77 6E 20 The quick brown"; | |
1195 for (i=0; TRUE; i++) | |
1196 { | |
1197 TRACE_EVENT_P2 ("%08X %s", i, buf) | |
1198 } | |
1199 } | |
1200 break; // never reached | |
1201 */ | |
1202 | |
1203 } | |
1204 return (ATI_CMPL); | |
1205 } | |
1206 | |
1207 | |
1208 | |
1209 /* | |
1210 GLOBAL T_ATI_RSLT queatPercentDAR (CHAR *cl, UBYTE srcId) | |
1211 { | |
1212 TRACE_FUNCTION("queatPercentDAR()"); | |
1213 sprintf(g_sa, "Dummy"); | |
1214 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT); | |
1215 return (ATI_CMPL); | |
1216 } | |
1217 */ | |
1218 | |
1219 /* | |
1220 +--------------------------------------------------------------------+ | |
1221 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
1222 | STATE : code ROUTINE : setatPercentCSTAT | | |
1223 +--------------------------------------------------------------------+ | |
1224 | |
1225 PURPOSE : %CSTAT command (Enable/Disable unsolicited status reports | |
1226 from SIM processes) | |
1227 */ | |
1228 | |
1229 GLOBAL T_ATI_RSLT setatPercentCSTAT (char* cl, UBYTE srcId) | |
1230 { | |
1231 SHORT mode = ACI_NumParmNotPresent; | |
1232 | |
1233 TRACE_FUNCTION("setatPercentCSTAT()"); | |
1234 | |
1235 cl = parse(cl,"r",&mode); | |
1236 if(!cl OR mode > 1 OR mode < 0) | |
1237 { | |
1238 cmdCmeError(CME_ERR_OpNotAllow); | |
1239 return (ATI_FAIL); | |
1240 } | |
1241 | |
1242 ati_user_output_cfg[srcId].CSTAT_stat=(UBYTE)mode; | |
1243 return (ATI_CMPL); | |
1244 } | |
1245 | |
1246 /* | |
1247 +--------------------------------------------------------------------+ | |
1248 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
1249 | STATE : code ROUTINE : queatPercentCSTAT | | |
1250 +--------------------------------------------------------------------+ | |
1251 | |
1252 PURPOSE : %CSTAT command (query unsolicited status reports | |
1253 from SIM processes) | |
1254 */ | |
1255 | |
1256 GLOBAL T_ATI_RSLT queatPercentCSTAT (char* cl, UBYTE srcId) | |
1257 { | |
1258 | |
1259 int value; | |
1260 | |
1261 TRACE_FUNCTION("queatPercentCSTAT()"); | |
1262 | |
1263 value = (int)ati_user_output_cfg[srcId].CSTAT_stat; | |
1264 resp_disp(srcId, cl,"e",&value); | |
1265 return (ATI_CMPL); | |
1266 | |
1267 } | |
1268 | |
1269 /* | |
1270 +--------------------------------------------------------------------+ | |
1271 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
1272 | STATE : code ROUTINE : tesatPercentNRG | | |
1273 +--------------------------------------------------------------------+ | |
1274 | |
1275 PURPOSE : AT%NRG=? command | |
1276 */ | |
1277 GLOBAL T_ATI_RSLT tesatPercentNRG (char *cl, UBYTE srcId) | |
1278 { | |
1279 T_ACI_RETURN ret = AT_FAIL; | |
1280 CHAR *cmd_key = "%NRG:"; | |
1281 CHAR testcmd_output[25]; | |
1282 T_ACI_NRG NRG_options; | |
1283 | |
1284 TRACE_FUNCTION("tesatPercentNRG()"); | |
1285 | |
1286 ret = tAT_PercentNRG((T_ACI_CMD_SRC)srcId, &NRG_options); | |
1287 | |
1288 if(ret EQ AT_CMPL) | |
1289 { | |
1290 if(NRG_options.reg_mode) | |
1291 { | |
1292 strcpy(testcmd_output, "("); | |
1293 if(NRG_options.reg_mode & NRG_REG_Auto) | |
1294 { | |
1295 strcat(testcmd_output, "0"); | |
1296 } | |
1297 if(NRG_options.reg_mode & NRG_REG_Manual) | |
1298 { | |
1299 strcat(testcmd_output, ",1"); | |
1300 } | |
1301 if(NRG_options.reg_mode & NRG_REG_Both) | |
1302 { | |
1303 strcat(testcmd_output, ",4"); | |
1304 } | |
1305 strcat(testcmd_output, ")"); | |
1306 } | |
1307 | |
1308 if(NRG_options.srv_mode) | |
1309 { | |
1310 if(NRG_options.srv_mode EQ (NRG_SRV_Full | NRG_SRV_Limited | NRG_SRV_NoSrv | NRG_SRV_SetRegModeOnly)) | |
1311 { | |
1312 strcat(testcmd_output, ",(0-3)"); | |
1313 } | |
1314 else | |
1315 { | |
1316 strcat(testcmd_output, ",("); | |
1317 if(NRG_options.srv_mode & NRG_SRV_Full) | |
1318 { | |
1319 strcat(testcmd_output, "0"); | |
1320 } | |
1321 if(NRG_options.srv_mode & NRG_SRV_Limited) | |
1322 { | |
1323 strcat(testcmd_output, ",1"); | |
1324 } | |
1325 if(NRG_options.srv_mode & NRG_SRV_NoSrv) | |
1326 { | |
1327 strcat(testcmd_output, ",2"); | |
1328 } | |
1329 if(NRG_options.srv_mode & NRG_SRV_SetRegModeOnly) | |
1330 { | |
1331 strcat(testcmd_output, ",3"); | |
1332 } | |
1333 strcat(testcmd_output, ")"); | |
1334 } | |
1335 | |
1336 } | |
1337 | |
1338 if(NRG_options.opr_frmt) | |
1339 { | |
1340 if(NRG_options.opr_frmt EQ (NRG_OPR_Long | NRG_OPR_Short | NRG_OPR_Numeric)) | |
1341 { | |
1342 strcat(testcmd_output, ",(0-2)"); | |
1343 } | |
1344 else | |
1345 { | |
1346 strcat(testcmd_output, ",("); | |
1347 if(NRG_options.opr_frmt & NRG_OPR_Long) | |
1348 { | |
1349 strcat(testcmd_output, "0"); | |
1350 } | |
1351 if(NRG_options.opr_frmt & NRG_OPR_Short) | |
1352 { | |
1353 strcat(testcmd_output, ",1"); | |
1354 } | |
1355 if(NRG_options.opr_frmt & NRG_OPR_Numeric) | |
1356 { | |
1357 strcat(testcmd_output, ",2"); | |
1358 } | |
1359 strcat(testcmd_output, ")"); | |
1360 } | |
1361 | |
1362 } | |
1363 sprintf(g_sa,"%s %s",cmd_key, testcmd_output); | |
1364 io_sendMessage (srcId, g_sa, ATI_NORMAL_OUTPUT); | |
1365 return(ATI_CMPL); | |
1366 } | |
1367 return(map_aci_2_ati_rslt(ret)); | |
1368 } | |
1369 | |
1370 #ifdef TI_PS_FF_AT_P_CMD_CUSCFG | |
1371 /* | |
1372 +--------------------------------------------------------------------+ | |
1373 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
1374 | STATE : code ROUTINE : setatPercentCSTAT | | |
1375 +--------------------------------------------------------------------+ | |
1376 | |
1377 PURPOSE : %CUSCFG command (Enable/Disable customized handling of facilities specified) | |
1378 */ | |
1379 | |
1380 GLOBAL T_ATI_RSLT setatPercentCUSCFG (char* cl, UBYTE srcId) | |
1381 { | |
1382 #ifdef _SIMULATION_ | |
1383 T_ACI_RETURN ret = AT_FAIL; | |
1384 T_ACI_CUSCFG_FAC fac_num = CUSCFG_FAC_Not_Present; | |
1385 T_ACI_CUSCFG_MOD mode; | |
1386 T_ACI_CUSCFG_STAT status; | |
1387 char fac_str[MAX_FAC_STR_LENGTH] = {0}; | |
1388 char value[MAX_VALUE_LENGTH] = {0}; | |
1389 USHORT i; | |
1390 SHORT pos; | |
1391 #endif /* _SIMULATION_ */ | |
1392 | |
1393 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id); | |
1394 | |
1395 TRACE_FUNCTION("setatPercentCUSCFG()"); | |
1396 | |
1397 /* | |
1398 * The command being added for a customer should be blocked from other users | |
1399 * shall be used only for Windows simulation | |
1400 */ | |
1401 #ifdef _SIMULATION_ | |
1402 | |
1403 cl = parse(cl,"sds",(LONG)MAX_FAC_STR_LENGTH,fac_str, &mode, (LONG)MAX_VALUE_LENGTH, value); | |
1404 | |
1405 if(!cl OR *fac_str EQ 0 OR mode < 0 OR mode >2) | |
1406 { | |
1407 cmdCmeError(CME_ERR_OpNotAllow); | |
1408 return (ATI_FAIL); | |
1409 } | |
1410 | |
1411 strcpy(fac_str, strupper(fac_str)); | |
1412 for (i=0;cus_fac[i].name NEQ NULL; i++) | |
1413 { | |
1414 if (strcmp(cus_fac[i].name,fac_str) EQ 0 ) | |
1415 { | |
1416 fac_num=cus_fac[i].fac; /*translates facility string in facility number */ | |
1417 break; | |
1418 } | |
1419 } | |
1420 | |
1421 if(fac_num EQ CUSCFG_FAC_Not_Present) | |
1422 { | |
1423 cmdCmeError(CME_ERR_OpNotAllow); | |
1424 return (ATI_FAIL); | |
1425 } | |
1426 | |
1427 if(mode EQ CUSCFG_MOD_Query) | |
1428 { | |
1429 ret = qAT_PercentCUSCFG(srcId, fac_num, &status); | |
1430 if(ret EQ AT_CMPL) | |
1431 { | |
1432 pos = sprintf(g_sa,"%s: %d", "%CUSCFG", status); | |
1433 | |
1434 ci_remTrailCom(g_sa, pos); | |
1435 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT); | |
1436 return (ATI_CMPL); | |
1437 } | |
1438 | |
1439 } | |
1440 else | |
1441 { | |
1442 ret = sAT_PercentCUSCFG(srcId, fac_num, mode, value); | |
1443 } | |
1444 | |
1445 if(ret NEQ AT_CMPL) | |
1446 { | |
1447 cmdCmeError(CME_ERR_Unknown); | |
1448 } | |
1449 | |
1450 return (map_aci_2_ati_rslt(ret)); | |
1451 | |
1452 #else | |
1453 cmdCmeError(CME_ERR_OpNotAllow); | |
1454 return (ATI_FAIL); | |
1455 #endif | |
1456 | |
1457 } | |
1458 #endif /* TI_PS_FF_AT_P_CMD_CUSCFG */ | |
1459 | |
1460 #ifdef TI_PS_FF_AT_P_CMD_STDR | |
1461 /* | |
1462 +--------------------------------------------------------------------+ | |
1463 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
1464 | STATE : code ROUTINE : setatPercentSTDR | | |
1465 +--------------------------------------------------------------------+ | |
1466 | |
1467 PURPOSE : %STDR Read variable <std> | |
1468 */ | |
1469 | |
1470 GLOBAL T_ATI_RSLT setatPercentSTDR (CHAR *cl, UBYTE srcId) | |
1471 { | |
1472 T_ACI_RETURN ret = AT_FAIL; | |
1473 UBYTE rvstd; | |
1474 | |
1475 TRACE_FUNCTION("setatPercentSTDR()"); | |
1476 | |
1477 switch (*cl) | |
1478 { | |
1479 case('\0'): | |
1480 /* | |
1481 * AT%STDR queries the value of <std> variable | |
1482 */ | |
1483 ret = qAT_PercentSTDR ((T_ACI_CMD_SRC)srcId, &rvstd); | |
1484 if( ret NEQ AT_CMPL ) | |
1485 { | |
1486 cmdCmeError(CME_ERR_Unknown); | |
1487 return (ATI_FAIL); | |
1488 } | |
1489 resp_disp(srcId, cl,"b",&rvstd); | |
1490 break; | |
1491 | |
1492 default: | |
1493 cmdCmeError(CME_ERR_OpNotAllow); | |
1494 return (ATI_FAIL); | |
1495 } | |
1496 return (map_aci_2_ati_rslt(ret)); | |
1497 } | |
1498 #endif /* TI_PS_FF_AT_P_CMD_STDR */ | |
1499 | |
1500 /* | |
1501 +--------------------------------------------------------------------+ | |
1502 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
1503 | STATE : code ROUTINE : setatPercentCMGMDU | | |
1504 +--------------------------------------------------------------------+ | |
1505 | |
1506 PURPOSE : %CMGMDU Reset the TP-Reply path | |
1507 */ | |
1508 | |
1509 GLOBAL T_ATI_RSLT setatPercentCMGMDU (CHAR *cl, UBYTE srcId) | |
1510 { | |
1511 T_ACI_RETURN ret = AT_FAIL; | |
1512 SHORT idx=-1; | |
1513 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id); | |
1514 | |
1515 TRACE_FUNCTION("setatPercentCMGMDU()"); | |
1516 | |
1517 cl = parse(cl,"r",&idx); | |
1518 if ( !cl OR idx > 255 OR idx < 0) | |
1519 { | |
1520 cmdCmsError(CMS_ERR_OpNotAllowed); | |
1521 return (ATI_FAIL); | |
1522 } | |
1523 #ifdef _CONC_TESTING_ | |
1524 ret = sAT_PercentCMGMDU (srcId, (UBYTE)idx); | |
1525 #else | |
1526 ret = sAT_PercentCMGMDU_Gl((T_ACI_CMD_SRC)srcId, (UBYTE)idx, NULL); | |
1527 #endif | |
1528 | |
1529 if (ret EQ AT_EXCT) | |
1530 { | |
1531 src_params->curAtCmd = AT_CMD_P_CMGMDU; | |
1532 return (ATI_EXCT); | |
1533 } | |
1534 else | |
1535 { | |
1536 cmdCmsError(CMS_ERR_NotPresent); | |
1537 return (ATI_FAIL); | |
1538 } | |
1539 } | |
1540 | |
1541 #ifdef TI_PS_FF_AT_P_CMD_CTREG | |
1542 /* | |
1543 +--------------------------------------------------------------------+ | |
1544 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
1545 | STATE : code ROUTINE : setatPercentCTREG | | |
1546 +--------------------------------------------------------------------+ | |
1547 | |
1548 PURPOSE : %CTREG Sets or Reads the any one of the two tables | |
1549 present in the Common shared location. | |
1550 present in the RR enity. Usage of %CTREG command is limited | |
1551 and cannot be used during loc update. The best time to update | |
1552 is before +CFUN=1. | |
1553 */ | |
1554 | |
1555 GLOBAL T_ATI_RSLT setatPercentCTREG (CHAR *cl, UBYTE srcId) | |
1556 { | |
1557 UBYTE table[MAX_CTREG_TAB_LEN*2 + 1]; | |
1558 USHORT tab_len = 0; | |
1559 UBYTE i = 0; | |
1560 T_ACI_RETURN ret = AT_FAIL; | |
1561 T_TREG treg; | |
1562 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id); | |
1563 | |
1564 /* initialize the local varibles */ | |
1565 memset(table,NOT_PRESENT_8BIT,sizeof(table)); | |
1566 | |
1567 TRACE_FUNCTION("setatPercentCTREG()"); | |
1568 | |
1569 cl = parse(cl,"dds",&treg.mode,&treg.tab_id,sizeof(table),table); | |
1570 | |
1571 /* | |
1572 * no mode & tab_id values are allowed other than 1-2 | |
1573 */ | |
1574 if( !cl OR (treg.mode < TREG_READ_MODE OR treg.mode > TREG_WRITE_MODE) | |
1575 OR (treg.tab_id < NOSERVICE_MODE_TIME OR treg.tab_id > LIMSERVICE_MODE_TIME)) | |
1576 { | |
1577 cmdCmeError(CME_ERR_OpNotAllow); | |
1578 return (ATI_FAIL); | |
1579 } | |
1580 | |
1581 if(treg.mode EQ TREG_READ_MODE) | |
1582 { | |
1583 /* | |
1584 * If User gives Table values in read mode then Error is send to the terminal. | |
1585 */ | |
1586 if(*table NEQ NOT_PRESENT_8BIT) | |
1587 { | |
1588 cmdCmeError (CME_ERR_OpNotAllow); | |
1589 return ATI_FAIL; | |
1590 } | |
1591 | |
1592 ret = qAT_PercentCTREG ((T_ACI_CMD_SRC)srcId,&treg); | |
1593 | |
1594 i=sprintf(g_sa,"%s: %d, %d, \"","%CTREG",treg.mode, treg.tab_id); | |
1595 utl_binToHex(treg.tab_val,MAX_CTREG_TAB_LEN,g_sa+i); | |
1596 sprintf(g_sa+strlen(g_sa),"\""); | |
1597 | |
1598 if(ret EQ AT_CMPL) | |
1599 { | |
1600 io_sendMessageEx(srcId, g_sa, ATI_NORMAL_OUTPUT); | |
1601 } | |
1602 else | |
1603 { | |
1604 cmdCmeError (CME_ERR_Unknown); | |
1605 } | |
1606 } | |
1607 else | |
1608 { | |
1609 tab_len = utl_HexStrToBin((UBYTE*)table, (MAX_CTREG_TAB_LEN*2), | |
1610 treg.tab_val, MAX_CTREG_TAB_LEN); | |
1611 | |
1612 if(tab_len NEQ MAX_CTREG_TAB_LEN) | |
1613 { | |
1614 cmdCmeError(CME_ERR_OpNotAllow); | |
1615 return ATI_FAIL; | |
1616 } | |
1617 | |
1618 ret = sAT_PercentCTREG((T_ACI_CMD_SRC)srcId,&treg); | |
1619 | |
1620 if (ret NEQ AT_CMPL) | |
1621 { | |
1622 cmdCmeError (CME_ERR_Unknown); | |
1623 } | |
1624 } | |
1625 return (map_aci_2_ati_rslt(ret)); | |
1626 } | |
1627 #endif /* TI_PS_FF_AT_P_CMD_CTREG */ | |
1628 | |
1629 #endif /* ATI_CSC_C */ |