comparison gsm-fw/g23m-aci/aci/ati_csc.c @ 775:eedbf248bac0

gsm-fw/g23m-aci subtree: initial import from LoCosto source
author Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
date Sun, 12 Oct 2014 01:45:14 +0000
parents
children 09382de17df9
comparison
equal deleted inserted replaced
774:40a721fd9854 775:eedbf248bac0
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",&regMode,&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,&regMode,&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 #if !defined (WIN32) AND !defined(_lint)
574 EXTERN CHAR* aci_version(void);
575 EXTERN CHAR* cc_version(void);
576 //EXTERN CHAR* ccd_version(void);
577 EXTERN CHAR* dl_version(void);
578 EXTERN CHAR* mm_version(void);
579 EXTERN CHAR* rr_version(void);
580 EXTERN CHAR* sim_version(void);
581 EXTERN CHAR* sms_version(void);
582 EXTERN CHAR* ss_version(void);
583 EXTERN CHAR* l1_version(void);
584 #ifdef SMI
585 EXTERN CHAR* smi_version(void);
586 #endif
587 #ifdef MFW
588 EXTERN CHAR* bmi_version(void);
589 EXTERN CHAR* mfw_version(void);
590 #endif
591 #ifdef FAX_AND_DATA
592 EXTERN CHAR* l2r_version(void);
593 EXTERN CHAR* ra_version(void);
594 EXTERN CHAR* rlp_version(void);
595 #ifdef FF_FAX
596 EXTERN CHAR* fad_version(void);
597 EXTERN CHAR* t30_version(void);
598 #endif /* FF_FAX */
599 #endif /* FAX_AND_DATA */
600 #endif
601
602 GLOBAL T_ATI_RSLT atPercentVER (char* cl, UBYTE srcId)
603 {
604 char *me="%VER: ";
605
606 TRACE_FUNCTION("atPercentVER()");
607 #if !defined (WIN32) AND !defined(_lint)
608 sprintf(g_sa,"%s%s",me,aci_version());
609 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT);
610 sprintf(g_sa,"%s%s",me,cc_version());
611 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT);
612 //sprintf(g_sa,"%s%s",me,ccd_version());
613 //io_sendMessage(g_sa, ATI_NORMAL_OUTPUT);
614 sprintf(g_sa,"%s%s",me,dl_version());
615 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT);
616 sprintf(g_sa,"%s%s",me,mm_version());
617 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT);
618 sprintf(g_sa,"%s%s",me,rr_version());
619 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT);
620 sprintf(g_sa,"%s%s",me,sim_version());
621 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT);
622 sprintf(g_sa,"%s%s",me,sms_version());
623 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT);
624 sprintf(g_sa,"%s%s",me,ss_version());
625 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT);
626 sprintf(g_sa,"%s%s",me,l1_version());
627 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT);
628 #ifndef NEW_FRAME
629 sprintf(g_sa,"%s%s",me,comframe_version());
630 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT);
631 #endif
632 #ifdef SMI
633 sprintf(g_sa,"%s%s",me,smi_version());
634 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT);
635 #endif
636 #ifdef MFW
637 sprintf(g_sa,"%s%s",me,bmi_version());
638 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT);
639 sprintf(g_sa,"%s%s",me,mfw_version());
640 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT);
641 #endif
642
643 #ifdef FAX_AND_DATA
644 sprintf(g_sa,"%s%s",me,l2r_version());
645 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT);
646 sprintf(g_sa,"%s%s",me,ra_version());
647 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT);
648 sprintf(g_sa,"%s%s",me,rlp_version());
649 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT);
650
651 #ifdef FF_FAX
652 sprintf(g_sa,"%s%s",me,fad_version());
653 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT);
654 sprintf(g_sa,"%s%s",me,t30_version());
655 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT);
656 #endif /* FF_FAX */
657
658 #endif /* FAX_AND_DATA */
659
660 #endif
661
662 return (ATI_CMPL);
663 }
664
665 /*
666 +--------------------------------------------------------------------+
667 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD |
668 | STATE : code ROUTINE : atPercentCNAP |
669 +--------------------------------------------------------------------+
670
671 PURPOSE : %CNAP command (Calling NAme Presentation)
672 */
673
674 GLOBAL T_ATI_RSLT setatPercentCNAP(char *cl, UBYTE srcId)
675 {
676 T_ATI_CNAP_MODE cnap_mode;
677
678 TRACE_FUNCTION("setatPercentCNAP()");
679
680 cnap_mode =(T_ATI_CNAP_MODE)(*cl - '0');
681
682 switch(cnap_mode)
683 {
684 case(CNAP_DISABLED):
685 case(CNAP_ENABLED):
686 ati_user_output_cfg[srcId].cnap_mode = cnap_mode;
687 cl++;
688 return (ATI_CMPL);
689
690 default:
691 cmdCmeError(CME_ERR_OpNotAllow);
692 return (ATI_FAIL);
693 }
694 }
695
696 GLOBAL T_ATI_RSLT queatPercentCNAP(char *cl, UBYTE srcId)
697 {
698 T_ACI_RETURN ret = AT_FAIL;
699
700 TRACE_FUNCTION("queatPercentCNAP()");
701
702 ret = qAT_PercentCNAP((T_ACI_CMD_SRC)srcId);
703 if( ret NEQ AT_EXCT )
704 {
705 cmdCmeError(CME_ERR_Unknown);
706 }
707 return (map_aci_2_ati_rslt(ret));
708 }
709
710
711 /*
712 +--------------------------------------------------------------------+
713 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD |
714 | STATE : code ROUTINE : atPercentALS |
715 +--------------------------------------------------------------------+
716
717 PURPOSE : %ALS command (select the aternate line)
718 */
719
720
721 GLOBAL T_ATI_RSLT setatPercentALS ( char *cl, UBYTE srcId )
722 {
723 T_ACI_RETURN ACI_return = AT_FAIL;
724 T_ACI_ALS_MOD ALSmode;
725
726 TRACE_FUNCTION( "setatPercentALS()" );
727
728 switch( *cl )
729 {
730 case '0':
731 ALSmode = ALS_MOD_SPEECH;
732 break;
733
734 case '1':
735 ALSmode = ALS_MOD_AUX_SPEECH;
736 break;
737
738 default:
739 cmdCmeError(CME_ERR_OpNotSupp);
740 return (map_aci_2_ati_rslt(ACI_return));
741 }
742
743 #ifdef FF_ATI_BAT
744 {
745 T_BAT_cmd_send cmd;
746 T_BAT_cmd_set_percent_als my_bat_set_percent_als;
747
748 TRACE_FUNCTION("setatPercentALS() calls bat_send() <=== as APPLICATION");
749
750 memset(&my_bat_set_percent_als, 0, sizeof(my_bat_set_percent_als));
751 cmd.ctrl_params = BAT_CMD_SET_PERCENT_ALS;
752 cmd.params.ptr_set_percent_als = &my_bat_set_percent_als;
753
754 my_bat_set_percent_als.mode = ALSmode;
755
756 bat_send(ati_bat_get_client(srcId), &cmd);
757
758 return ATI_EXCT; /* executing, because response is passed by callback function */
759 }
760 #else /* OLD FUNCTION BODY */
761
762 ACI_return = sAT_PercentALS( (T_ACI_CMD_SRC)srcId, ALSmode );
763
764 if( ACI_return EQ AT_FAIL )
765 {
766 cmdCmeError(CME_ERR_Unknown);
767 }
768 return (map_aci_2_ati_rslt(ACI_return));
769
770 #endif /* no FF_ATI_BAT*/
771 }
772
773
774 GLOBAL T_ATI_RSLT tesatPercentALS ( char *cl, UBYTE srcId )
775 {
776 char *me = "%ALS";
777 T_ACI_RETURN ACI_return = AT_FAIL ;
778 T_ACI_ALS_MOD ALSmode;
779
780 TRACE_FUNCTION( "tesatPercentALS()" );
781
782 ACI_return = tAT_PercentALS((T_ACI_CMD_SRC)srcId, &ALSmode );
783
784 if ( ACI_return EQ AT_FAIL )
785 {
786 cmdCmeError(CME_ERR_Unknown);
787 return (ATI_FAIL);
788 }
789 else if ( ACI_return EQ AT_CMPL )
790 {
791 if (ALSmode EQ ALS_MOD_NOTPRESENT)
792 {
793 cmdCmeError(CME_ERR_OpNotSupp);
794 return (ATI_FAIL);
795 }
796 if (ALSmode EQ ALS_MOD_SPEECH)
797 sprintf(g_sa,"%s: (0)", me);
798 if (ALSmode EQ ALS_MOD_AUX_SPEECH)
799 sprintf(g_sa,"%s: (1)", me);
800 if (ALSmode EQ (ALS_MOD_SPEECH | ALS_MOD_AUX_SPEECH))
801 sprintf(g_sa,"%s: (0,1)", me);
802 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT);
803 }
804 return (map_aci_2_ati_rslt(ACI_return));
805 }
806
807
808 GLOBAL T_ATI_RSLT queatPercentALS ( char *cl, UBYTE srcId )
809 {
810 T_ACI_RETURN ACI_return = AT_FAIL;
811 T_ACI_ALS_MOD ALSmode;
812 UBYTE ati_ALSmode;
813
814 TRACE_FUNCTION( "queatPercentALS()" );
815
816 ACI_return = qAT_PercentALS( (T_ACI_CMD_SRC)srcId, &ALSmode );
817 if( ACI_return NEQ AT_CMPL )
818 {
819 cmdCmeError(CME_ERR_Unknown);
820 return (ATI_FAIL);
821 }
822
823 switch( ALSmode )
824 {
825 case(ALS_MOD_SPEECH):
826 ati_ALSmode = 0;
827 break;
828
829 case(ALS_MOD_AUX_SPEECH):
830 ati_ALSmode = 1;
831 break;
832
833 case(ALS_MOD_NOTPRESENT):
834 default:
835 cmdCmeError(CME_ERR_OpNotSupp);
836 return (ATI_FAIL);
837 }
838
839 resp_disp(srcId, cl,"b",&ati_ALSmode);
840 return (map_aci_2_ati_rslt(ACI_return));
841 }
842
843 /*
844 +--------------------------------------------------------------------+
845 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD |
846 | STATE : code ROUTINE : atPercentCOLR |
847 +--------------------------------------------------------------------+
848
849 PURPOSE : %COLR command
850 no parameter.
851 */
852
853 GLOBAL T_ATI_RSLT atPercentCOLR(CHAR *cl, UBYTE srcId)
854 {
855 T_ACI_RETURN ret = AT_FAIL;
856
857 TRACE_FUNCTION("atPercentCOLR()");
858
859 if( *cl NEQ '\0'
860 AND *cl NEQ ';')
861 {
862 cmdCmeError( CME_ERR_OpNotAllow );
863 return (ATI_FAIL);
864 }
865
866 ret = qAT_PercentCOLR( (T_ACI_CMD_SRC)srcId );
867
868 if( ret NEQ AT_EXCT )
869 {
870 cmdCmeError( CME_ERR_Unknown );
871 }
872 return (map_aci_2_ati_rslt(ret));
873 }
874
875 /*
876 +--------------------------------------------------------------------+
877 | PROJECT : GSM MODULE : ATI_CMD |
878 | STATE : code ROUTINE : atPercentCUNS |
879 +--------------------------------------------------------------------+
880
881 PURPOSE : %CUNS command
882 parameters: buffering_mode.
883 0: unsolicited messages may occur any time.
884 1: unsolicited messages can't happen while typing a command.
885 2: unsolicited messages can't happen between starting typing a command
886 and its final result.
887 */
888
889 GLOBAL T_ATI_RSLT setatPercentCUNS(char *cl, UBYTE srcId)
890 {
891 SHORT buffering_mode = -1;
892 T_ATI_SRC_PARAMS *src_params;
893
894 cl = parse(cl,"d",&buffering_mode);
895
896 src_params = find_element (ati_src_list, srcId, search_ati_src_id);
897
898 if( cl EQ NULL
899 OR src_params EQ NULL
900 OR buffering_mode < 0
901 OR buffering_mode > 2)
902 {
903 cmdCmeError(CME_ERR_OpNotAllow);
904 return (ATI_FAIL);
905 }
906
907 src_params->buff_uns_mode = (T_ATI_BUFF_UNS_MODE)buffering_mode;
908 return (ATI_CMPL);
909 }
910
911 GLOBAL T_ATI_RSLT queatPercentCUNS(char *cl, UBYTE srcId)
912 {
913 UBYTE buffering_mode = ((UBYTE)-1); /* adjust is UBYTE type so typecasting -1 with UBYTE */
914 T_ATI_SRC_PARAMS *src_params;
915
916 src_params = find_element (ati_src_list, srcId, search_ati_src_id);
917 if(src_params EQ NULL)
918 {
919 cmdCmeError(CME_ERR_OpNotAllow);
920 return (ATI_FAIL);
921 }
922
923 buffering_mode = (UBYTE)src_params->buff_uns_mode;
924 resp_disp(srcId, cl, "b", &buffering_mode);
925 return (ATI_CMPL);
926 }
927
928
929 /*
930 +--------------------------------------------------------------------+
931 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD |
932 | STATE : code ROUTINE : atPercentPPP |
933 +--------------------------------------------------------------------+
934
935 PURPOSE : %PPP command
936 parameters: protocol, login name, password.
937 */
938 #ifdef DTI
939 #if defined(FF_WAP) || defined(FF_PPP) || defined(FF_GPF_TCPIP) || defined(FF_SAT_E)
940 GLOBAL T_ATI_RSLT atPercentPPP (CHAR *cl, UBYTE srcId)
941 {
942 T_ACI_PPP_PROT protocol;
943 T_ACI_RETURN ret = AT_FAIL;
944 CHAR buffer_login[sizeof(pppShrdPrm.ppp_login)];
945 CHAR buffer_pwd[sizeof(pppShrdPrm.ppp_password)];
946 T_ACI_PPP_CON con_type = USE_NO_PPP_FOR_AAA;
947
948 cl=parse(cl,"dssd",&protocol, sizeof(buffer_login),
949 &buffer_login,
950 sizeof(buffer_pwd),
951 &buffer_pwd,
952 &con_type);
953 if(!cl)
954 {
955 cmdCmeError(CME_ERR_OpNotAllow);
956 return (ATI_FAIL);
957 }
958
959 #ifdef FF_ATI_BAT
960 {
961 T_BAT_cmd_send cmd;
962 T_BAT_cmd_set_percent_ppp my_bat_set_percent_ppp;
963
964 TRACE_FUNCTION("atPercentPPP() calls bat_send() <=== as APPLICATION");
965
966 memset(&my_bat_set_percent_ppp,0,sizeof(T_BAT_cmd_set_percent_ppp));
967 cmd.ctrl_params = BAT_CMD_SET_PERCENT_PPP;
968 cmd.params.ptr_set_percent_ppp = &my_bat_set_percent_ppp;
969
970 my_bat_set_percent_ppp.authprot = (T_BAT_percent_ppp_authprot)protocol;
971 if(my_bat_set_percent_ppp.c_user = strlen(buffer_login))
972 {
973 my_bat_set_percent_ppp.v_user = TRUE;
974 memcpy(my_bat_set_percent_ppp.user,buffer_login,
975 my_bat_set_percent_ppp.c_user<=BAT_MAX_PPP_USER_LEN ?
976 my_bat_set_percent_ppp.c_user : BAT_MAX_PPP_USER_LEN);
977 }
978 if(my_bat_set_percent_ppp.c_password = strlen(buffer_pwd))
979 {
980 my_bat_set_percent_ppp.v_password = TRUE;
981 memcpy(my_bat_set_percent_ppp.password,buffer_pwd,
982 my_bat_set_percent_ppp.c_password<=BAT_MAX_PPP_PASSW_LEN ?
983 my_bat_set_percent_ppp.c_password : BAT_MAX_PPP_PASSW_LEN);
984 }
985 my_bat_set_percent_ppp.conn_type = (T_BAT_percent_ppp_conn_type)con_type;
986
987 bat_send(ati_bat_get_client(srcId), &cmd);
988 return ATI_EXCT; /* executing, because response is passed by callback function */
989 }
990
991 #else /* no FF_ATI_BAT */
992
993 TRACE_FUNCTION("atPercentPPP()");
994
995 ret = sAT_PercentPPP((T_ACI_CMD_SRC)srcId,protocol,
996 buffer_login,
997 buffer_pwd,
998 con_type);
999 if (ret EQ AT_FAIL)
1000 {
1001 cmdCmeError(CME_ERR_Unknown);
1002 }
1003 return (map_aci_2_ati_rslt(ret));
1004 #endif /* FF_ATI_BAT */
1005 }
1006
1007
1008 /** Query PPP-negotiated parameters after connection setup.
1009 *
1010 */
1011 GLOBAL T_ATI_RSLT queatPercentPPP (CHAR *cl, UBYTE srcId)
1012 {
1013 ULONG ipaddr = 0 ; /* Own IP address. */
1014 ULONG dns1 = 0, dns2 = 0 ; /* Domain Name Server addresses. */
1015
1016 qAT_PercentPPP(srcId, &ipaddr, &dns1, &dns2) ;
1017
1018 /* WARNING: this is for little endian only! */
1019 #define IPADDR_BYTE(b, a) (((a) >> ((b) * 8)) & 0xff)
1020
1021 sprintf(g_sa, "%%PPP: %u.%u.%u.%u,%u.%u.%u.%u,%u.%u.%u.%u",
1022 IPADDR_BYTE(3, ipaddr),
1023 IPADDR_BYTE(2, ipaddr),
1024 IPADDR_BYTE(1, ipaddr),
1025 IPADDR_BYTE(0, ipaddr),
1026 IPADDR_BYTE(3, dns1),
1027 IPADDR_BYTE(2, dns1),
1028 IPADDR_BYTE(1, dns1),
1029 IPADDR_BYTE(0, dns1),
1030 IPADDR_BYTE(3, dns2),
1031 IPADDR_BYTE(2, dns2),
1032 IPADDR_BYTE(1, dns2),
1033 IPADDR_BYTE(0, dns2)) ;
1034 io_sendMessage (srcId, g_sa, ATI_NORMAL_OUTPUT);
1035 return ATI_CMPL ;
1036 }
1037
1038 #endif /* (FF_WAP) || (FF_PPP) || (FF_GPF_TCPIP) || (FF_SAT_E) */
1039 #endif /* DTI */
1040
1041
1042 /*
1043 +--------------------------------------------------------------------+
1044 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD |
1045 | STATE : code ROUTINE : atPercentWAP |
1046 +--------------------------------------------------------------------+
1047
1048 PURPOSE : %WAP command
1049 no parameters.
1050 */
1051
1052 #ifdef FF_WAP
1053 GLOBAL T_ATI_RSLT atPercentWAP (CHAR *cl, UBYTE srcId)
1054 {
1055 SHORT setwap_falg;
1056
1057 TRACE_FUNCTION("atPercentWAP()");
1058
1059 switch(*cl)
1060 {
1061 case('0'):
1062 case('1'):
1063 setwap_falg = ( (*cl - '0')? 1 : 0 );
1064 cl++;
1065 sAT_PercentWAP(srcId,setwap_falg);
1066 break;
1067
1068 default:
1069 cmdCmeError(CME_ERR_OpNotAllow);
1070 return (ATI_FAIL);
1071 }
1072
1073 return (ATI_CMPL);
1074 }
1075 #endif /* FF_WAP */
1076
1077
1078 /*
1079 +------------------------------------------------------------------------------
1080 | Function : SH - setatPercentMMITEST
1081 +------------------------------------------------------------------------------
1082 | Description : Test AT cmd for MMI
1083 | This command has been introduced in order to use the AT command interface for some MMI
1084 | specific testing. It shoudnt be compiled without MMI.
1085 |
1086 |
1087 | Parameters : char *cl
1088 | UBYTE srcId
1089 |
1090 | Return : ATI_CMPL
1091 +------------------------------------------------------------------------------
1092 */
1093
1094
1095 #if defined MFW AND defined TI_PS_FF_AT_P_CMD_MMITEST
1096
1097
1098 GLOBAL T_ATI_RSLT setatPercentMMITEST (char *cl, UBYTE srcId)
1099 {
1100 T_ACI_RETURN ret;
1101
1102 TRACE_FUNCTION("setatPercentMMITEST()");
1103
1104 if (*cl NEQ '=')
1105 {
1106 cmdCmeError (CME_ERR_OpNotAllow);
1107 return (ATI_FAIL);
1108 }
1109
1110 cl++;
1111
1112 ret = sAT_PercentMMITEST((T_ACI_CMD_SRC)srcId, cl);
1113
1114 switch(ret)
1115 {
1116 case AT_CMPL:
1117 return (ATI_CMPL);
1118
1119 case AT_FAIL:
1120 cmdCmeError(CME_ERR_Unknown);
1121 return (ATI_FAIL);
1122
1123 default:
1124 cmdCmeError(CME_ERR_Unknown);
1125 return (ATI_FAIL);
1126 } /* switch */
1127 } /* setatPercentEM */
1128 #endif /* MFW */
1129
1130 /*
1131 +-------------------------------------------------------------------------+
1132 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD |
1133 | STATE : code ROUTINE : setatPercentSMBS |
1134 +-------------------------------------------------------------------------+
1135
1136 PURPOSE : %SMBS command (Enable presenting of both Text and PDU formats to SMBS)
1137
1138 !!!!!!!!!! ONLY FOR TEST PURPOSES !!!!!!!!!!!!!!!!!!!!!!!!!!
1139 */
1140
1141 #if defined FF_MMI_RIV
1142 GLOBAL T_ATI_RSLT setatPercentSMBS (CHAR *cl, UBYTE srcId)
1143 {
1144 T_ACI_RETURN ret = AT_FAIL;
1145 T_ACI_PERC_SMBS_MOD mode = PERC_SMBS_MOD_NotPresent;
1146
1147 TRACE_FUNCTION("setatPercentSMBS()");
1148
1149 cl=parse(cl, "d", &mode);
1150 if (cl EQ NULL)
1151 {
1152 /* parse problems */
1153 cmdCmsError(CMS_ERR_OpNotAllowed);
1154 return (ATI_FAIL);
1155 }
1156
1157 switch (mode)
1158 {
1159 case(PERC_SMBS_MOD_DISABLE):
1160 case(PERC_SMBS_MOD_ENABLE):
1161 break;
1162
1163 default:
1164 cmdCmsError(CMS_ERR_OpNotAllowed);
1165 return (ATI_FAIL);
1166 }
1167
1168 /* Parameter is allowed then set */
1169 ret = sAT_PercentSMBS (srcId, mode);
1170 if (ret EQ AT_FAIL)
1171 {
1172 cmdCmsError(CMS_ERR_UnSpecErr);
1173 return (ATI_FAIL);
1174 }
1175 return (map_aci_2_ati_rslt(ret));
1176 }
1177
1178 /* !!!!!!!!!! ONLY FOR TEST PURPOSES !!!!!!!!!!!!!!!!!!!!!!!!!! */
1179 GLOBAL T_ATI_RSLT queatPercentSMBS (CHAR *cl, UBYTE srcId)
1180 {
1181 T_ACI_RETURN ret = AT_FAIL;
1182 T_ACI_PERC_SMBS_MOD mode = PERC_SMBS_MOD_NotPresent;
1183
1184 TRACE_FUNCTION("queatPercentSMBS()");
1185
1186 ret = qAT_PercentSMBS(srcId, &mode);
1187 if (ret EQ AT_CMPL)
1188 {
1189 sprintf(g_sa,"%s%d", "%SMBS: ", mode);
1190 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT);
1191 return (ATI_CMPL);
1192 }
1193 cmdCmsError(CMS_ERR_NotPresent); // use aciErrDesc
1194 return (ATI_FAIL);
1195 }
1196 #endif /* FF_MMI_RIV */
1197
1198
1199
1200
1201 /*
1202 +--------------------------------------------------------------------+
1203 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD |
1204 | STATE : code ROUTINE : atPercentDAR |
1205 +--------------------------------------------------------------------+
1206
1207 PURPOSE : %DAR command
1208 */
1209
1210
1211 /* the following is from os.h derived for the AT%DAR command */
1212 #define FIRST_ENTRY 0xff
1213 #define NEXT_ENTRY 0xfe
1214 #define OS_OK 0
1215
1216 GLOBAL T_ATI_RSLT setatPercentDAR (CHAR *cl, UBYTE srcId)
1217 {
1218 TRACE_FUNCTION("atPercentDAR()");
1219
1220 switch(*cl)
1221 {
1222 case('\0'):
1223 break;
1224 default:
1225 cmdCmeError(CME_ERR_OpNotAllow);
1226 return (ATI_FAIL);
1227
1228 /* this is only for internal testing of the %DAR command to force a crash of the stack */
1229 /*
1230 case('1'):
1231 // do an endless loop within ACI
1232 while (TRUE)
1233 ;
1234 break; // never reached
1235
1236 case('2'):
1237 // consume all memory within ACI
1238 while (TRUE)
1239 {
1240 char *a;
1241 ACI_MALLOC(a, 10);
1242 }
1243 break; // never reached
1244
1245 case('3'):
1246 // jump to 0x00000000;
1247 {
1248 void (*a)(void)=0x00000000;
1249 (*a)();
1250 }
1251 break; // never reached
1252
1253 case('4'):
1254 // overwrite all memory
1255 memset(0x00000000, 0, 0xffffffff);
1256 break; // never reached
1257
1258 case('5'):
1259 // send many messages to ACI
1260 while (TRUE)
1261 {
1262 PALLOC(mncc_alert_ind, MNCC_ALERT_IND);
1263 mncc_alert_ind->ti = 0;
1264 PSENDX(ACI, mncc_alert_ind);
1265 }
1266 break; // never reached
1267
1268 case('6'):
1269 // generate many traces
1270 {
1271 int i;
1272 char buf[]="54 68 65 20 71 75 69 63-6B 20 62 72 6F 77 6E 20 The quick brown";
1273 for (i=0; TRUE; i++)
1274 {
1275 TRACE_EVENT_P2 ("%08X %s", i, buf)
1276 }
1277 }
1278 break; // never reached
1279 */
1280
1281 }
1282 return (ATI_CMPL);
1283 }
1284
1285
1286
1287 /*
1288 GLOBAL T_ATI_RSLT queatPercentDAR (CHAR *cl, UBYTE srcId)
1289 {
1290 TRACE_FUNCTION("queatPercentDAR()");
1291 sprintf(g_sa, "Dummy");
1292 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT);
1293 return (ATI_CMPL);
1294 }
1295 */
1296
1297 /*
1298 +--------------------------------------------------------------------+
1299 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD |
1300 | STATE : code ROUTINE : setatPercentCSTAT |
1301 +--------------------------------------------------------------------+
1302
1303 PURPOSE : %CSTAT command (Enable/Disable unsolicited status reports
1304 from SIM processes)
1305 */
1306
1307 GLOBAL T_ATI_RSLT setatPercentCSTAT (char* cl, UBYTE srcId)
1308 {
1309 SHORT mode = ACI_NumParmNotPresent;
1310
1311 TRACE_FUNCTION("setatPercentCSTAT()");
1312
1313 cl = parse(cl,"r",&mode);
1314 if(!cl OR mode > 1 OR mode < 0)
1315 {
1316 cmdCmeError(CME_ERR_OpNotAllow);
1317 return (ATI_FAIL);
1318 }
1319
1320 ati_user_output_cfg[srcId].CSTAT_stat=(UBYTE)mode;
1321 return (ATI_CMPL);
1322 }
1323
1324 /*
1325 +--------------------------------------------------------------------+
1326 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD |
1327 | STATE : code ROUTINE : queatPercentCSTAT |
1328 +--------------------------------------------------------------------+
1329
1330 PURPOSE : %CSTAT command (query unsolicited status reports
1331 from SIM processes)
1332 */
1333
1334 GLOBAL T_ATI_RSLT queatPercentCSTAT (char* cl, UBYTE srcId)
1335 {
1336
1337 int value;
1338
1339 TRACE_FUNCTION("queatPercentCSTAT()");
1340
1341 value = (int)ati_user_output_cfg[srcId].CSTAT_stat;
1342 resp_disp(srcId, cl,"e",&value);
1343 return (ATI_CMPL);
1344
1345 }
1346
1347 /*
1348 +--------------------------------------------------------------------+
1349 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD |
1350 | STATE : code ROUTINE : tesatPercentNRG |
1351 +--------------------------------------------------------------------+
1352
1353 PURPOSE : AT%NRG=? command
1354 */
1355 GLOBAL T_ATI_RSLT tesatPercentNRG (char *cl, UBYTE srcId)
1356 {
1357 T_ACI_RETURN ret = AT_FAIL;
1358 CHAR *cmd_key = "%NRG:";
1359 CHAR testcmd_output[25];
1360 T_ACI_NRG NRG_options;
1361
1362 TRACE_FUNCTION("tesatPercentNRG()");
1363
1364 ret = tAT_PercentNRG((T_ACI_CMD_SRC)srcId, &NRG_options);
1365
1366 if(ret EQ AT_CMPL)
1367 {
1368 if(NRG_options.reg_mode)
1369 {
1370 strcpy(testcmd_output, "(");
1371 if(NRG_options.reg_mode & NRG_REG_Auto)
1372 {
1373 strcat(testcmd_output, "0");
1374 }
1375 if(NRG_options.reg_mode & NRG_REG_Manual)
1376 {
1377 strcat(testcmd_output, ",1");
1378 }
1379 if(NRG_options.reg_mode & NRG_REG_Both)
1380 {
1381 strcat(testcmd_output, ",4");
1382 }
1383 strcat(testcmd_output, ")");
1384 }
1385
1386 if(NRG_options.srv_mode)
1387 {
1388 if(NRG_options.srv_mode EQ (NRG_SRV_Full | NRG_SRV_Limited | NRG_SRV_NoSrv | NRG_SRV_SetRegModeOnly))
1389 {
1390 strcat(testcmd_output, ",(0-3)");
1391 }
1392 else
1393 {
1394 strcat(testcmd_output, ",(");
1395 if(NRG_options.srv_mode & NRG_SRV_Full)
1396 {
1397 strcat(testcmd_output, "0");
1398 }
1399 if(NRG_options.srv_mode & NRG_SRV_Limited)
1400 {
1401 strcat(testcmd_output, ",1");
1402 }
1403 if(NRG_options.srv_mode & NRG_SRV_NoSrv)
1404 {
1405 strcat(testcmd_output, ",2");
1406 }
1407 if(NRG_options.srv_mode & NRG_SRV_SetRegModeOnly)
1408 {
1409 strcat(testcmd_output, ",3");
1410 }
1411 strcat(testcmd_output, ")");
1412 }
1413
1414 }
1415
1416 if(NRG_options.opr_frmt)
1417 {
1418 if(NRG_options.opr_frmt EQ (NRG_OPR_Long | NRG_OPR_Short | NRG_OPR_Numeric))
1419 {
1420 strcat(testcmd_output, ",(0-2)");
1421 }
1422 else
1423 {
1424 strcat(testcmd_output, ",(");
1425 if(NRG_options.opr_frmt & NRG_OPR_Long)
1426 {
1427 strcat(testcmd_output, "0");
1428 }
1429 if(NRG_options.opr_frmt & NRG_OPR_Short)
1430 {
1431 strcat(testcmd_output, ",1");
1432 }
1433 if(NRG_options.opr_frmt & NRG_OPR_Numeric)
1434 {
1435 strcat(testcmd_output, ",2");
1436 }
1437 strcat(testcmd_output, ")");
1438 }
1439
1440 }
1441 sprintf(g_sa,"%s %s",cmd_key, testcmd_output);
1442 io_sendMessage (srcId, g_sa, ATI_NORMAL_OUTPUT);
1443 return(ATI_CMPL);
1444 }
1445 return(map_aci_2_ati_rslt(ret));
1446 }
1447
1448 #ifdef TI_PS_FF_AT_P_CMD_CUSCFG
1449 /*
1450 +--------------------------------------------------------------------+
1451 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD |
1452 | STATE : code ROUTINE : setatPercentCSTAT |
1453 +--------------------------------------------------------------------+
1454
1455 PURPOSE : %CUSCFG command (Enable/Disable customized handling of facilities specified)
1456 */
1457
1458 GLOBAL T_ATI_RSLT setatPercentCUSCFG (char* cl, UBYTE srcId)
1459 {
1460 #ifdef _SIMULATION_
1461 T_ACI_RETURN ret = AT_FAIL;
1462 T_ACI_CUSCFG_FAC fac_num = CUSCFG_FAC_Not_Present;
1463 T_ACI_CUSCFG_MOD mode;
1464 T_ACI_CUSCFG_STAT status;
1465 char fac_str[MAX_FAC_STR_LENGTH] = {0};
1466 char value[MAX_VALUE_LENGTH] = {0};
1467 USHORT i;
1468 SHORT pos;
1469 #endif /* _SIMULATION_ */
1470
1471 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id);
1472
1473 TRACE_FUNCTION("setatPercentCUSCFG()");
1474
1475 /*
1476 * The command being added for a customer should be blocked from other users
1477 * shall be used only for Windows simulation
1478 */
1479 #ifdef _SIMULATION_
1480
1481 cl = parse(cl,"sds",(LONG)MAX_FAC_STR_LENGTH,fac_str, &mode, (LONG)MAX_VALUE_LENGTH, value);
1482
1483 if(!cl OR *fac_str EQ 0 OR mode < 0 OR mode >2)
1484 {
1485 cmdCmeError(CME_ERR_OpNotAllow);
1486 return (ATI_FAIL);
1487 }
1488
1489 strcpy(fac_str, strupper(fac_str));
1490 for (i=0;cus_fac[i].name NEQ NULL; i++)
1491 {
1492 if (strcmp(cus_fac[i].name,fac_str) EQ 0 )
1493 {
1494 fac_num=cus_fac[i].fac; /*translates facility string in facility number */
1495 break;
1496 }
1497 }
1498
1499 if(fac_num EQ CUSCFG_FAC_Not_Present)
1500 {
1501 cmdCmeError(CME_ERR_OpNotAllow);
1502 return (ATI_FAIL);
1503 }
1504
1505 if(mode EQ CUSCFG_MOD_Query)
1506 {
1507 ret = qAT_PercentCUSCFG(srcId, fac_num, &status);
1508 if(ret EQ AT_CMPL)
1509 {
1510 pos = sprintf(g_sa,"%s: %d", "%CUSCFG", status);
1511
1512 ci_remTrailCom(g_sa, pos);
1513 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT);
1514 return (ATI_CMPL);
1515 }
1516
1517 }
1518 else
1519 {
1520 ret = sAT_PercentCUSCFG(srcId, fac_num, mode, value);
1521 }
1522
1523 if(ret NEQ AT_CMPL)
1524 {
1525 cmdCmeError(CME_ERR_Unknown);
1526 }
1527
1528 return (map_aci_2_ati_rslt(ret));
1529
1530 #else
1531 cmdCmeError(CME_ERR_OpNotAllow);
1532 return (ATI_FAIL);
1533 #endif
1534
1535 }
1536 #endif /* TI_PS_FF_AT_P_CMD_CUSCFG */
1537
1538 #ifdef TI_PS_FF_AT_P_CMD_STDR
1539 /*
1540 +--------------------------------------------------------------------+
1541 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD |
1542 | STATE : code ROUTINE : setatPercentSTDR |
1543 +--------------------------------------------------------------------+
1544
1545 PURPOSE : %STDR Read variable <std>
1546 */
1547
1548 GLOBAL T_ATI_RSLT setatPercentSTDR (CHAR *cl, UBYTE srcId)
1549 {
1550 T_ACI_RETURN ret = AT_FAIL;
1551 UBYTE rvstd;
1552
1553 TRACE_FUNCTION("setatPercentSTDR()");
1554
1555 switch (*cl)
1556 {
1557 case('\0'):
1558 /*
1559 * AT%STDR queries the value of <std> variable
1560 */
1561 ret = qAT_PercentSTDR ((T_ACI_CMD_SRC)srcId, &rvstd);
1562 if( ret NEQ AT_CMPL )
1563 {
1564 cmdCmeError(CME_ERR_Unknown);
1565 return (ATI_FAIL);
1566 }
1567 resp_disp(srcId, cl,"b",&rvstd);
1568 break;
1569
1570 default:
1571 cmdCmeError(CME_ERR_OpNotAllow);
1572 return (ATI_FAIL);
1573 }
1574 return (map_aci_2_ati_rslt(ret));
1575 }
1576 #endif /* TI_PS_FF_AT_P_CMD_STDR */
1577
1578 /*
1579 +--------------------------------------------------------------------+
1580 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD |
1581 | STATE : code ROUTINE : setatPercentCMGMDU |
1582 +--------------------------------------------------------------------+
1583
1584 PURPOSE : %CMGMDU Reset the TP-Reply path
1585 */
1586
1587 GLOBAL T_ATI_RSLT setatPercentCMGMDU (CHAR *cl, UBYTE srcId)
1588 {
1589 T_ACI_RETURN ret = AT_FAIL;
1590 SHORT idx=-1;
1591 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id);
1592
1593 TRACE_FUNCTION("setatPercentCMGMDU()");
1594
1595 cl = parse(cl,"r",&idx);
1596 if ( !cl OR idx > 255 OR idx < 0)
1597 {
1598 cmdCmsError(CMS_ERR_OpNotAllowed);
1599 return (ATI_FAIL);
1600 }
1601 #ifdef _CONC_TESTING_
1602 ret = sAT_PercentCMGMDU (srcId, (UBYTE)idx);
1603 #else
1604 ret = sAT_PercentCMGMDU_Gl((T_ACI_CMD_SRC)srcId, (UBYTE)idx, NULL);
1605 #endif
1606
1607 if (ret EQ AT_EXCT)
1608 {
1609 src_params->curAtCmd = AT_CMD_P_CMGMDU;
1610 return (ATI_EXCT);
1611 }
1612 else
1613 {
1614 cmdCmsError(CMS_ERR_NotPresent);
1615 return (ATI_FAIL);
1616 }
1617 }
1618
1619 #ifdef TI_PS_FF_AT_P_CMD_CTREG
1620 /*
1621 +--------------------------------------------------------------------+
1622 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD |
1623 | STATE : code ROUTINE : setatPercentCTREG |
1624 +--------------------------------------------------------------------+
1625
1626 PURPOSE : %CTREG Sets or Reads the any one of the two tables
1627 present in the Common shared location.
1628 present in the RR enity. Usage of %CTREG command is limited
1629 and cannot be used during loc update. The best time to update
1630 is before +CFUN=1.
1631 */
1632
1633 GLOBAL T_ATI_RSLT setatPercentCTREG (CHAR *cl, UBYTE srcId)
1634 {
1635 UBYTE table[MAX_CTREG_TAB_LEN*2 + 1];
1636 USHORT tab_len = 0;
1637 UBYTE i = 0;
1638 T_ACI_RETURN ret = AT_FAIL;
1639 T_TREG treg;
1640 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id);
1641
1642 /* initialize the local varibles */
1643 memset(table,NOT_PRESENT_8BIT,sizeof(table));
1644
1645 TRACE_FUNCTION("setatPercentCTREG()");
1646
1647 cl = parse(cl,"dds",&treg.mode,&treg.tab_id,sizeof(table),table);
1648
1649 /*
1650 * no mode & tab_id values are allowed other than 1-2
1651 */
1652 if( !cl OR (treg.mode < TREG_READ_MODE OR treg.mode > TREG_WRITE_MODE)
1653 OR (treg.tab_id < NOSERVICE_MODE_TIME OR treg.tab_id > LIMSERVICE_MODE_TIME))
1654 {
1655 cmdCmeError(CME_ERR_OpNotAllow);
1656 return (ATI_FAIL);
1657 }
1658
1659 if(treg.mode EQ TREG_READ_MODE)
1660 {
1661 /*
1662 * If User gives Table values in read mode then Error is send to the terminal.
1663 */
1664 if(*table NEQ NOT_PRESENT_8BIT)
1665 {
1666 cmdCmeError (CME_ERR_OpNotAllow);
1667 return ATI_FAIL;
1668 }
1669
1670 ret = qAT_PercentCTREG ((T_ACI_CMD_SRC)srcId,&treg);
1671
1672 i=sprintf(g_sa,"%s: %d, %d, \"","%CTREG",treg.mode, treg.tab_id);
1673 utl_binToHex(treg.tab_val,MAX_CTREG_TAB_LEN,g_sa+i);
1674 sprintf(g_sa+strlen(g_sa),"\"");
1675
1676 if(ret EQ AT_CMPL)
1677 {
1678 io_sendMessageEx(srcId, g_sa, ATI_NORMAL_OUTPUT);
1679 }
1680 else
1681 {
1682 cmdCmeError (CME_ERR_Unknown);
1683 }
1684 }
1685 else
1686 {
1687 tab_len = utl_HexStrToBin((UBYTE*)table, (MAX_CTREG_TAB_LEN*2),
1688 treg.tab_val, MAX_CTREG_TAB_LEN);
1689
1690 if(tab_len NEQ MAX_CTREG_TAB_LEN)
1691 {
1692 cmdCmeError(CME_ERR_OpNotAllow);
1693 return ATI_FAIL;
1694 }
1695
1696 ret = sAT_PercentCTREG((T_ACI_CMD_SRC)srcId,&treg);
1697
1698 if (ret NEQ AT_CMPL)
1699 {
1700 cmdCmeError (CME_ERR_Unknown);
1701 }
1702 }
1703 return (map_aci_2_ati_rslt(ret));
1704 }
1705 #endif /* TI_PS_FF_AT_P_CMD_CTREG */
1706
1707 #endif /* ATI_CSC_C */