comparison src/aci2/aci/ati_csc.c @ 3:93999a60b835

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