comparison src/aci2/aci/ati_bas.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 dce31be2b474
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 Interpreter: basic functions.
18 +-----------------------------------------------------------------------------
19 */
20
21 #ifndef ATI_BAS_C
22 #define ATI_BAS_C
23
24 #include "aci_all.h"
25
26 #include <ctype.h>
27 #include <string.h>
28
29 #include "aci_cmh.h"
30 #include "ati_cmd.h"
31 #include "aci_cmd.h"
32 #include "aci_io.h"
33 #include "aci_cmd.h"
34 #include "l4_tim.h"
35 #include "line_edit.h"
36 #include "aci_lst.h"
37
38 #include "pcm.h"
39 #include "audio.h"
40 #include "aci.h"
41 #include "rx.h"
42 #include "pwr.h"
43 #include "l4_tim.h"
44
45
46 #ifdef GPRS
47 #ifdef DTI
48 #include "dti.h"
49 #include "dti_conn_mng.h"
50 #include "dti_cntrl_mng.h"
51 #endif /* DTI */
52 #include "gaci.h"
53 #include "gaci_cmh.h"
54 #include "gaci_cmd.h"
55 #endif /* GPRS */
56
57 #include "aci_mem.h"
58 #include "aci_prs.h"
59
60 #include "ati_int.h"
61
62 #ifndef _SIMULATION_
63 #include "ffs\ffs.h"
64 #endif
65
66 #ifdef FF_ATI_BAT
67
68 #include "typedefs.h"
69 #include "gdd.h"
70 #include "bat.h"
71
72 #include "ati_bat.h"
73
74 #endif /*FF_ATI_BAT*/
75
76 #include "fc-target.cfg"
77
78 LOCAL T_ATI_RSLT aciPrcsPlusCG (UBYTE srcId, CHAR* cl, CHAR* ef);
79 LOCAL T_ATI_RSLT setaciPrcsVolLevel ( CHAR* cl, UBYTE device );
80 LOCAL T_ATI_RSLT tesaciPrcsVolLevel ( UBYTE srcId, CHAR* cl, UBYTE device );
81 LOCAL T_ATI_RSLT queaciPrcsVolLevel ( UBYTE srcId, CHAR* cl, UBYTE device );
82
83 EXTERN T_ATI_RSLT setatPlusCLIP (char *cl, UBYTE srcId);
84 EXTERN T_ATI_RSLT setatPlusCOLP (char *cl, UBYTE srcId);
85 EXTERN T_ATI_RSLT setatPlusCREG (char *cl, UBYTE srcId);
86 EXTERN T_ATI_RSLT setatPercentCREG (char *cl, UBYTE srcId);
87 EXTERN T_ATI_RSLT setatPlusCGREG (char *cl, UBYTE srcId);
88 EXTERN T_ATI_RSLT setatPercentCGREG (char *cl, UBYTE srcId);
89 EXTERN T_ATI_RSLT setatPlusCCLK (char *cl, UBYTE srcId);
90 EXTERN T_ATI_RSLT queatPlusCCLK (char *cl, UBYTE srcId);
91
92 /* for atAndF */
93 EXTERN void ati_cmd_reset(UBYTE srcId);
94
95
96 GLOBAL const T_ACI_AT_CMD atw_cmd_list [] = {AT_CMD_CGREG, AT_CMD_CLIP, AT_CMD_CLIR,
97 AT_CMD_COLP, AT_CMD_CREG, AT_CMD_ALS, AT_CMD_CGAATT,
98 AT_CMD_P_CGREG, AT_CMD_CPI, AT_CMD_P_CREG, AT_CMD_NONE};
99
100
101 #define MAX_IDX_LTH (10)
102
103 #define MAX_ATW_STORED_PROFILE 2 /*profile number for AT&W*/
104 #define MAX_ATW_CMD_NAM_LEN 15 /*Max command name length in bytes, e.g. %CGAATT;*/
105 #define MAX_ONE_ATW_PRO_LEN 50 /*Max profile length of 1 command in bytes,so far %CGAATT has the longest
106 profile length /CmdId/Total Len/token/1st Para length/1st para/token/2nd para length/2nd para/'\0'/*/
107 #define STRING 1 /*Token: string*/
108 #define SIGNED_VALUE 2 /*Token: signed value*/
109 #define UNSIGNED_VALUE 3 /*Token: unsigned value*/
110 #define MAX_ATW_CHOSEN_CMD_NB (sizeof(atw_cmd_list)/sizeof(T_ACI_AT_CMD) -1)
111 /*Max number of AT commands can be chosen by user, -1 because the last entry is only an ending symbol*/
112
113
114 /* for profile handling ATZ and AT&W */
115 #ifdef _SIMULATION_
116 LOCAL CHAR atw_cmd_list_simu [(MAX_ATW_CMD_NAM_LEN) *( MAX_ATW_CHOSEN_CMD_NB) + 1] = {'\0'};
117 LOCAL UBYTE atw_profile_simu [MAX_ATW_STORED_PROFILE][(MAX_ATW_CHOSEN_CMD_NB) * (MAX_ONE_ATW_PRO_LEN)+1]={{'\0'},{'\0'}};
118 /* simulates the profile arrays for windows test*/
119 #endif
120 static UBYTE ATZprofile;
121
122 GLOBAL const DBG_Memory dbg_mem_names[] =
123 {
124 {"PRI", P_DBGINFO_PrimPoolPartition},
125 {"MEM", P_DBGINFO_DmemPoolPartition},
126 {"DAT", P_DBGINFO_DataPoolPartition},
127 {0, 0}
128 };
129
130 /*
131 +--------------------------------------------------------------------+
132 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD |
133 | STATE : code ROUTINE : atBW |
134 +--------------------------------------------------------------------+
135
136 PURPOSE : B command (only implemented to maintain compability)
137 W command (only implemented to maintain compability)
138 */
139
140 GLOBAL T_ATI_RSLT atBW(char *cl, UBYTE srcId)
141 {
142 SHORT i=0;
143 TRACE_FUNCTION("atB()");
144
145 while (*cl >= '0' AND *cl <= '9')
146 {
147 cl++;
148 i++;
149 if (i > 1)
150 {
151 cmdAtError(atError);
152 return ATI_FAIL;
153 }
154 }
155 return ATI_CMPL;
156 }
157
158
159
160 /*
161 +--------------------------------------------------------------------+
162 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD |
163 | STATE : code ROUTINE : atE |
164 +--------------------------------------------------------------------+
165
166 PURPOSE : E command (command echo setting)
167 F command (data echo setting)
168 L command (Speaker Volume)
169 M command (Speaker Mode)
170 Q command (result code supression)
171 V command (verbose response setting)
172 X command (Busy/Dial tone indication)
173 */
174
175 GLOBAL T_ATI_RSLT atEFLMQVX(char *cl, UBYTE srcId)
176 {
177 char *end = NULL;
178 UBYTE value = 0;
179 CHAR letter = *(cl - 1);
180 T_LEDIT line = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; /* init with values which say: do not change */
181 /* S3 S4 S5 atE smsEnd */
182 TRACE_FUNCTION("atEFLMQVX()");
183
184 TRACE_EVENT_P1 ("letter = %02X", letter);
185
186 value = (UBYTE)strtol(cl, &end, 10);
187 if(*end )
188 {
189 cmdAtError(atError);
190 return ATI_FAIL;
191 }
192
193 switch(letter)
194 {
195 case('E'):
196 if (value > 1)
197 {
198 cmdAtError(atError);
199 return ATI_FAIL;
200 }
201 ati_user_output_cfg[srcId].atE = value;
202 /*
203 * line edit need this piece of information, as well
204 */
205 line.atE = ati_user_output_cfg[srcId].atE;
206 ledit_set_config (srcId, line);
207 return ATI_CMPL; /* return to prevent non used p at the end of this function */
208 case('F'):
209 break;
210 case('L'):
211 if (value > 3)
212 {
213 cmdAtError(atError);
214 return ATI_FAIL;
215 }
216 at.s1415.atL = value;
217 break;
218 case('M'):
219 if (value > 2)
220 {
221 cmdAtError(atError);
222 return ATI_FAIL;
223 }
224 at.s1415.atM = value;
225 break;
226 case('Q'):
227 if (value > 1)
228 {
229 cmdAtError(atError);
230 return ATI_FAIL;
231 }
232 ati_user_output_cfg[srcId].atQ = value;
233 break;
234 case('V'):
235 if (value > 1)
236 {
237 cmdAtError(atError);
238 return ATI_FAIL;
239 }
240 at.s1415.atV = value;
241 break;
242 case('X'):
243 if (value > 4)
244 {
245 cmdAtError(atError);
246 return ATI_FAIL;
247 }
248 ati_user_output_cfg[srcId].atX = value;
249 break;
250 default:
251 cmdAtError(atError);
252 return ATI_FAIL;
253 }
254
255 return ATI_CMPL;
256 }
257
258 /*
259 +--------------------------------------------------------------------+
260 | PRIJECT : GSM-F&D (8411) MIDULE : ACI_CMD |
261 | STATE : code RIUTINE : atI |
262 +--------------------------------------------------------------------+
263
264 PURPOSE : I command (identification)
265 */
266
267 GLOBAL T_ATI_RSLT atI(char *cl, UBYTE srcId)
268 {
269 CHAR* ef = EF_INF0_ID;
270 pcm_FileInfo_Type fileInfo;
271 USHORT value;
272 USHORT maxRecords;
273 USHORT i;
274
275 TRACE_FUNCTION("atI()");
276
277 parse (cl, "r", &value);
278 if (!cl)
279 {
280 value = 0;
281 }
282
283 /*
284 * The switch case here is intended for values which are reserved for
285 * the protocol stack manufacturer and cannot be overridden by values
286 * in the PCM/FFS.
287 */
288 switch (value)
289 {
290 case 99:
291 io_sendMessage(srcId, "Texas Instruments", ATI_NORMAL_OUTPUT);
292 return ATI_CMPL;
293
294 default:
295 break;
296 }
297
298 if (pcm_GetFileInfo ((UBYTE*)ef, &fileInfo) NEQ DRV_OK)
299 {
300 cmdCmeError (CME_ERR_MemFail);
301 return ATI_FAIL;
302 }
303
304 if (pcm_ReadRecord ((UBYTE*)ef, (USHORT)(value + 1), fileInfo.FileSize,
305 (UBYTE*)g_sa, &fileInfo.Version, &maxRecords) NEQ DRV_OK)
306 {
307 cmdCmeError (CME_ERR_MemFail);
308 return ATI_FAIL;
309 }
310
311 i = 0;
312 while ((UBYTE)g_sa[i] NEQ 0xFF)
313 {
314 i++;
315 }
316 g_sa[i] = '\0';
317 io_sendMessage (srcId, g_sa, ATI_NORMAL_OUTPUT );
318
319 return ATI_CMPL;
320 }
321
322 /*
323 +--------------------------------------------------------------------+
324 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD |
325 | STATE : code ROUTINE : atTP |
326 +--------------------------------------------------------------------+
327
328 PURPOSE : TP command (select tone/pulse dialing < only implemented to
329 maintain compability>)
330 */
331
332 GLOBAL T_ATI_RSLT atTP(char *cl, UBYTE srcId)
333 {
334 TRACE_FUNCTION("atTP()");
335
336 if (*cl >= '0' AND *cl <= '9')
337 {
338 cmdAtError(atError);
339 return ATI_FAIL;
340 }
341 else
342 {
343 return ATI_CMPL;
344 }
345 }
346
347 /*
348 +--------------------------------------------------------------------+
349 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD |
350 | STATE : code ROUTINE : atS |
351 +--------------------------------------------------------------------+
352
353 PURPOSE : S command (S register setting)
354 */
355
356 GLOBAL T_ATI_RSLT atS(char *cl, UBYTE srcId)
357 {
358 SHORT reg_num,reg_cont,i=0;
359 char cont[4];
360 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id);
361 T_LEDIT line = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; /* init with values, which say: do not change */
362 T_ATI_RSLT retcd = ATI_CMPL;
363
364 TRACE_FUNCTION("atS()");
365
366 reg_num=0;
367 while (isdigit (*cl))
368 {
369 reg_num *= 10;
370 reg_num += *cl-'0';
371 ++cl;
372 }
373
374 switch (*cl)
375 {
376 case('?'):
377 {
378 cl++;
379 switch (reg_num)
380 {
381 case 0: /* supported registers for read access are listed here */
382 case 1:
383 case 2:
384 case 3:
385 case 4:
386 case 5:
387 case 6:
388 case 7:
389 case 8:
390 case 10: reg_cont = at.S[reg_num]; break; /* index access register */
391 case 30: reg_cont = at.S30; break; /* direct access register */
392 #ifdef GPRS
393 case 99: reg_cont = at.S99; break;
394 #endif /* GPRS */
395
396 default:
397 cmdAtError(atError);
398 return ATI_FAIL;
399 }
400
401 sprintf(g_sa,"%03d", reg_cont);
402
403 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT);
404 return ATI_CMPL;
405 }
406
407 case('='):
408 {
409 cl++;
410 if(*cl EQ '?')
411 {
412 cl++;
413
414 switch(reg_num)
415 {
416 case(0): sprintf(g_sa,"S%d:%s",reg_num,"(0-255)"); break;
417 /*case(1):*/ /* S1 register is read only !!! */
418 case(2):
419 case(3):
420 case(4):
421 case(5): sprintf(g_sa,"S%d:%s",reg_num,"(0-127)"); break;
422 case(6): sprintf(g_sa,"S%d:%s",reg_num,"(2-10)"); break;
423 case(7): sprintf(g_sa,"S%d:%s",reg_num,"(1-255)"); break;
424 case(8): sprintf(g_sa,"S%d:%s",reg_num,"(0-255)"); break;
425 case(10):
426 case(30): sprintf(g_sa,"S%d:%s",reg_num,"(1-254)"); break;
427 #ifdef GPRS
428 case(31): sprintf(g_sa,"S%d:%s",reg_num,"(0-255)"); break;
429 #endif /* GPRS */
430
431 default:
432 cmdAtError(atError);
433 return ATI_FAIL;
434 }
435 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT);
436 return ATI_CMPL;
437 }
438 else
439 {
440 while (*cl >= '0' AND *cl <= '9' AND i < 3)
441 {
442 cont[i] = (*cl);
443 i++;
444 cl++;
445 }
446 if (!i)
447 {
448 cmdAtError(atError);
449 return ATI_FAIL;
450 }
451 cont[i]='\0';
452 reg_cont=atoi(cont);
453 switch(reg_num)
454 {
455 case(0):
456 if (reg_cont<0 OR reg_cont > 255)
457 {
458 cmdAtError(atError);
459 return ATI_FAIL;
460 }
461 at.rngPrms.srcID_S0 = srcId;
462
463 #if defined (GPRS) AND defined (DTI)
464
465 /*
466 * Special case of implict attach to GACI when S0 is set to
467 * Non-zero value. GSM 7.07 version 6.4.0 10.2.2.1
468 */
469 if ( reg_cont > 0 )
470 {
471 T_CGCLASS_CLASS m_class;
472 T_ACI_RETURN ret;
473
474 if (AT_CMPL NEQ qAT_PlusCGCLASS(srcId, &m_class))
475 {
476 cmdAtError(atError);
477 return ATI_FAIL;
478 }
479 /*
480 * no GPRS attach requested if only GSM mobile
481 */
482 if ( CGCLASS_CLASS_CC NEQ m_class)
483 {
484 ret = sAT_PlusCGATT ( srcId, CGATT_STATE_ATTACHED );
485 switch (ret)
486 {
487 case (AT_CMPL): /*operation completed*/
488 break;
489 case (AT_EXCT):
490 src_params->curAtCmd = AT_CMD_CGATT;
491 retcd = ATI_EXCT;
492 break;
493 default:
494 cmdAtError(atError); /*Command failed*/
495 return ATI_FAIL;
496 }
497 }
498 }
499 #endif /* GPRS */
500 break;
501 case(2):
502 if (reg_cont<0 OR reg_cont > 127)
503 {
504 cmdAtError(atError);
505 return ATI_FAIL;
506 }
507 break;
508 case(3):
509 if (reg_cont<0 OR reg_cont > 127)
510 {
511 cmdAtError(atError);
512 return ATI_FAIL;
513 }
514 line.S3 = (UBYTE)reg_cont;
515 break;
516 case(4):
517 if (reg_cont<0 OR reg_cont > 127)
518 {
519 cmdAtError(atError);
520 return ATI_FAIL;
521 }
522 line.S4 = (UBYTE)reg_cont;
523 break;
524 case(5):
525 if (reg_cont<0 OR reg_cont > 127)
526 {
527 cmdAtError(atError);
528 return ATI_FAIL;
529 }
530 line.S5 = (UBYTE)reg_cont;
531 break;
532 case(6):
533 if (reg_cont<2 OR reg_cont > 10)
534 {
535 cmdAtError(atError);
536 return ATI_FAIL;
537 }
538 break;
539 case(7):
540 if (reg_cont<1 OR reg_cont > 255)
541 {
542 cmdAtError(atError);
543 return ATI_FAIL;
544 }
545 break;
546 case(8):
547 if (reg_cont<0 OR reg_cont > 255)
548 {
549 cmdAtError(atError);
550 return ATI_FAIL;
551 }
552 break;
553 case(10):
554 if (reg_cont<1 OR reg_cont > 254)
555 {
556 cmdAtError(atError);
557 return ATI_FAIL;
558 }
559 break;
560 case(30):
561 if (reg_cont<0 OR reg_cont > 254)
562 {
563 cmdAtError(atError);
564 return ATI_FAIL;
565 }
566 break;
567 #if defined (GPRS) AND defined (DTI)
568 case(99):
569
570 if (reg_cont<0 OR reg_cont > 255)
571 {
572 cmdAtError(atError);
573 return ATI_FAIL;
574 }
575 break;
576 #endif /* GPRS */
577
578 default:
579 cmdAtError(atError);
580 return ATI_FAIL;
581 }
582
583 switch (reg_num)
584 {
585
586 case 0: /* supported registers for write access are listed here */
587 /*case 1: Read Only */
588 case 2:
589 case 3:
590 case 4:
591 case 5:
592 case 6:
593 case 7:
594 case 8:
595 case 10: at.S[reg_num]=(UBYTE)reg_cont; break;
596
597 case 30: at.S30 =(UBYTE)reg_cont; break;
598 #if defined (GPRS) AND defined (DTI)
599 case 99: at.S99 =(UBYTE)reg_cont; break;
600 #endif
601
602 default:
603 cmdAtError(atError);
604 return ATI_FAIL;
605 }
606
607
608 /*
609 * line edit need this piece of information, as well
610 */
611 ledit_set_config (srcId, line);
612 break;
613 }
614 }
615 default:
616 cmdAtError(atError);
617 return ATI_FAIL;
618 }
619 return retcd;
620 }
621
622
623
624 /*
625 PURPOSE : this function stores the pre-chosen command list in FFS, but only for windows test.
626 */
627 #ifdef _SIMULATION_
628 LOCAL T_ATI_RSLT store_command_list (void)
629 {
630 char atw_cmd_list []= "+CGREG;+CLIP;+CLIR;+COLP;+CREG;%ALS;%CGAATT;%CGREG;%CPI;%CREG;";
631 TRACE_FUNCTION ("store_command_list()");
632
633 if ( !(strcpy (atw_cmd_list_simu, atw_cmd_list)))
634 {
635 cmdCmeError(CME_ERR_Unknown);
636 return ( ATI_FAIL);
637 }
638 return (ATI_CMPL);
639 }
640 #endif /*_SIMULATION_*/
641
642
643 /*
644 This function gets the command Id from input command name string if it is within the default listcmdList
645 */
646 LOCAL T_ACI_AT_CMD get_command_id_in_wn_list(CHAR *command_str)
647 {
648 int i;
649 T_ACI_AT_CMD command = AT_CMD_NONE;
650 TRACE_FUNCTION ("get_command_id_in_wn_list()");
651
652 command = get_command_id(command_str);
653 for (i = 0;*(atw_cmd_list+i) NEQ AT_CMD_NONE; i ++)
654 {
655 if (command EQ *(atw_cmd_list+i) )
656 {
657 return (command);
658 }
659 }
660 TRACE_EVENT_P1("AT&W: unrecognized command in the list: %s", command_str);
661 return (AT_CMD_NONE);
662 }
663
664 /*
665 PURPOSE : this function reads the pre-chosen command list in FFS and then builds a string
666 of all the command Ids according to the command list read.
667
668 Parameter:
669 cmd_id_read: To hold the list of command Ids
670 */
671
672 LOCAL T_ATI_RSLT read_command_list_from_ffs (UBYTE *cmd_id_read)
673 {
674 int i, k;
675 #ifndef _SIMULATION_
676 int val;
677 #endif /*_SIMULATION_*/
678 int j = 0;
679 CHAR *cmdList_temp;/*to hold the command name strings read from FFS*/
680 CHAR string_temp [MAX_ATW_CMD_NAM_LEN] = {'\0'};/* hold 1 command name string*/
681 T_ACI_AT_CMD command = AT_CMD_NONE;
682
683 TRACE_FUNCTION ("read_command_list_from_ffs()");
684 ACI_MALLOC (cmdList_temp, (MAX_ATW_CHOSEN_CMD_NB) *( MAX_ATW_CMD_NAM_LEN) + 1) ;
685
686 #ifndef _SIMULATION_
687 if ((val = ffs_fread ("/gsm/com/cmdList", cmdList_temp,
688 (MAX_ATW_CHOSEN_CMD_NB) *( MAX_ATW_CMD_NAM_LEN) + 1) )< 1)
689 {
690 TRACE_EVENT_P1("AT&W: Read command list from ffs fail. Returned val is %d", val);
691 #else /*!_SIMULATION_*/
692 if (!(strcpy (cmdList_temp, atw_cmd_list_simu)))
693 {
694 TRACE_EVENT("AT&W: Read command list fail. ");
695 #endif /*!_SIMULATION_*/
696 ACI_MFREE (cmdList_temp);
697 cmdCmeError(CME_ERR_Unknown);
698 return (ATI_FAIL);
699 }
700
701 /*The for loop builds the command string and then gets the corresponding command Id*/
702 for (i = 0, k = 0; *(cmdList_temp+i) NEQ '\0' AND k < (int)(MAX_ATW_CHOSEN_CMD_NB); i ++)
703 {
704 if (*(cmdList_temp+i) NEQ ';' )
705 {
706 /* No ";" is met*/
707 *(string_temp+j++) = *(cmdList_temp+i);
708 }
709 else
710 {
711 *(string_temp+j) = '\0';
712 command = get_command_id_in_wn_list (string_temp);
713 if (command NEQ AT_CMD_NONE) /* ignore it if unknown string met*/
714 {
715 *(cmd_id_read+k++) = (UBYTE)command;
716 }
717 j = 0;
718 *string_temp = '\0';
719 }
720 }
721 *(cmd_id_read+k) = (UBYTE)AT_CMD_NONE;
722 ACI_MFREE (cmdList_temp);
723 return (ATI_CMPL);
724 }
725
726 /*
727 PURPOSE : this function builds and stores the profile in FFS according to the command list read.
728 */
729 LOCAL T_ATI_RSLT store_profile_to_ffs (T_ACI_CMD_SRC srcId, SHORT nProfile)
730 {
731 int i;
732 #ifndef _SIMULATION_
733 int val;
734 #endif /*_SIMULATION_*/
735 int index = 1;
736 int command_length = 0;
737 /*to hold the content of parameters*/
738 #if defined (GPRS) AND defined (DTI)
739 T_CGAATT_ATTACH_MODE para1;
740 T_CGAATT_DETACH_MODE para2;
741 #endif /*GPRS*/
742 T_ACI_ALS_MOD para3 = ALS_MOD_NOTPRESENT;
743 T_ACI_CLIR_MOD mode = CLIR_MOD_NotPresent;
744 UBYTE *profile = NULL; /*to hold the content of profile, memory will be allocated later*/
745 UBYTE cmdIds [MAX_ATW_CHOSEN_CMD_NB +1] = {'\0'}; /*to hold the list of command Ids*/
746 char ffsAddr[] = "/gsm/com/profilex"; /*address in ffs, the x depends on which profile to save*/
747
748 TRACE_FUNCTION ("store_profile_to_ffs()");
749
750 ffsAddr[ strlen (ffsAddr) - 1] = '0' + nProfile;
751
752 /*before storing of profile read command list from FFS, cmdIds is used to hold the Ids of commands*/
753 if ( read_command_list_from_ffs (cmdIds) NEQ ATI_CMPL)
754 {
755 cmdCmeError(CME_ERR_Unknown);
756 return (ATI_FAIL);
757 }
758
759 /*command list is successfully read and now ready to build profile, allocate memory first*/
760 ACI_MALLOC (profile, (MAX_ATW_CHOSEN_CMD_NB) * (MAX_ONE_ATW_PRO_LEN) + 1);
761
762 /*this for_loop builds the profile*/
763 for (i = 0; *(cmdIds+i) NEQ AT_CMD_NONE; i ++)
764 {
765 command_length = 5;
766 TRACE_EVENT_P1 ("cmd id is: %d", *(cmdIds+i));
767 *(profile+index++) = *(cmdIds+i); /*stores command ID as the first element for each command*/
768
769 switch (*(cmdIds+i))
770 {
771 #if defined (GPRS) AND defined (DTI)
772 case AT_CMD_CGREG:
773 *(profile+index++) = command_length;/*total length in bytes for this command*/
774 *(profile+index++) = SIGNED_VALUE; /*token indicates the following parameter is signed*/
775 *(profile+index++) = sizeof (UBYTE); /*length of the following parameter*/
776 *(profile+index++) = (UBYTE)(ati_gprs_user_output_cfg[srcId].plus_cgreg.mod_lac_cid.pres_mode);
777 break;
778 case AT_CMD_P_CGREG:
779 *(profile+index++) = command_length;
780 *(profile+index++) = SIGNED_VALUE;
781 *(profile+index++) = sizeof (UBYTE);
782 *(profile+index++) = (UBYTE)(ati_gprs_user_output_cfg[srcId].percent_cgreg.mod_lac_cid.pres_mode);
783 break;
784 case AT_CMD_CGAATT:
785 qAT_PercentCGAATT(srcId, &para1, &para2);
786 command_length = 8;
787 *(profile+index++) = command_length;
788 *(profile+index++) = SIGNED_VALUE;
789 *(profile+index++) = sizeof (UBYTE);
790 *(profile+index++) = (UBYTE)para1; /*first param*/
791 *(profile+index++) = SIGNED_VALUE;
792 *(profile+index++) = sizeof (UBYTE);
793 *(profile+index++) = (UBYTE)para2; /*second param*/
794 break;
795 #endif /*GPRS*/
796 case AT_CMD_CLIP:
797 *(profile+index++) = command_length;
798 *(profile+index++) = UNSIGNED_VALUE;
799 *(profile+index++) = sizeof (UBYTE);
800 *(profile+index++) = ati_user_output_cfg[srcId].CLIP_stat;
801 break;
802 case AT_CMD_CPI:
803 *(profile+index++) = command_length;
804 *(profile+index++) = UNSIGNED_VALUE;
805 *(profile+index++) = sizeof (UBYTE);
806 *(profile+index++) = ati_user_output_cfg[srcId].CPI_stat;
807 break;
808 case AT_CMD_COLP:
809 *(profile+index++) = command_length;
810 *(profile+index++) = UNSIGNED_VALUE;
811 *(profile+index++) = sizeof (UBYTE);
812 *(profile+index++) = at.flags.COLP_stat;
813 break;
814
815 case AT_CMD_CLIR:
816 qAT_PercentCLIR (srcId, &mode);
817 *(profile+index++) = command_length;
818 *(profile+index++) = SIGNED_VALUE;
819 *(profile+index++) = sizeof (UBYTE);
820 *(profile+index++) = mode;
821 break;
822 case AT_CMD_ALS:
823 qAT_PercentALS (srcId, &para3);
824 *(profile+index++) = command_length;
825 *(profile+index++) = SIGNED_VALUE;
826 *(profile+index++) = sizeof (UBYTE);
827 *(profile+index++) = (UBYTE)para3;
828 break;
829 case AT_CMD_CREG:
830 *(profile+index++) = command_length;
831 *(profile+index++) = SIGNED_VALUE;
832 *(profile+index++) = sizeof (UBYTE);
833 *(profile+index++) = (UBYTE)ati_user_output_cfg[srcId].creg.mod_lac_cid.pres_mode;
834 break;
835 case AT_CMD_P_CREG:
836 *(profile+index++) = command_length;
837 *(profile+index++) = SIGNED_VALUE;
838 *(profile+index++) = sizeof (UBYTE);
839 *(profile+index++) = (UBYTE)(ati_user_output_cfg[srcId].percent_creg.mod_lac_cid.pres_mode);
840 break;
841
842 default:
843 TRACE_EVENT("Unknown AT command");
844 ACI_MFREE (profile);
845 cmdCmeError(CME_ERR_Unknown);
846 return (ATI_FAIL);
847 }
848 }
849
850 /*store the total length of the string in the first element, the max length of the profile should
851 not exceed 255, otherwise the stored structure in FFS should be redefined. Param <index>
852 is actually the length of the profile.
853 */
854 if (index > 255)
855 {
856 ACI_MFREE (profile);
857 TRACE_EVENT("Profile size exceed 255.");
858 cmdCmeError(CME_ERR_Unknown);
859 return (ATI_FAIL);
860 }
861 profile [0] = (UBYTE)index;
862
863 #ifndef _SIMULATION_
864 if((val = ffs_fwrite(ffsAddr, profile, index ) )NEQ EFFS_OK)
865 {
866 TRACE_EVENT_P1("Write to FFS fail. Returned value is %d", val);
867 ACI_MFREE (profile);
868 cmdCmeError(CME_ERR_Unknown);
869 return (ATI_FAIL);
870 }
871 #endif /*!_SIMULATION_*/
872
873 #ifdef _SIMULATION_
874 for (i = 0; i < index; i++)
875 {
876 atw_profile_simu[nProfile][i] = profile [i];
877 TRACE_EVENT_P2 ("index is %d, store profile is: %d", i, atw_profile_simu[nProfile][i]);
878 }
879 #endif /*_SIMULATION_*/
880 ACI_MFREE (profile);
881 return (ATI_CMPL);
882 }
883
884
885 /*
886 +--------------------------------------------------------------------+
887 | PROJECT : MODULE : |
888 | STATE : code ROUTINE : ati_wn_store_params|
889 +--------------------------------------------------------------------+
890
891 PURPOSE : This function is the implementation of of AT command AT&W
892 which stores the profile of some prechosen commands to FFS.
893 */
894
895 LOCAL T_ATI_RSLT ati_wn_store_params ( UBYTE srcId, SHORT nProfile)
896
897 {
898 TRACE_FUNCTION ("ati_wn_store_params()");
899
900 /*Stores pre-chosen AT commands. For windows test purpose only.*/
901 #ifdef _SIMULATION_
902 if (store_command_list () NEQ ATI_CMPL)
903 {
904 cmdCmeError(CME_ERR_Unknown);
905 return (ATI_FAIL) ;
906 }
907 #endif /*_SIMULATION_*/
908
909 /*Stores profile for chosen AT commands to FFS*/
910 if (store_profile_to_ffs ((T_ACI_CMD_SRC)srcId, nProfile) NEQ ATI_CMPL)
911 {
912 cmdCmeError(CME_ERR_Unknown);
913 return (ATI_FAIL) ;
914 }
915 return (ATI_CMPL);
916 }
917
918
919
920 /*
921 PURPOSE : this function reads the profile stored in FFS.
922 */
923
924 LOCAL T_ATI_RSLT read_profile_from_ffs (SHORT nProfile, UBYTE *profile_read, SHORT len_profile_read)
925 {
926 #ifndef _SIMULATION_
927 int val;
928 #endif
929 int i;
930 /*the last letter x depends on the profile to read*/
931 char ffsAddr[] = "/gsm/com/profilex";
932
933 TRACE_FUNCTION ("read_profile_from_ffs()");
934 /*build the correct address in FFS according to nProfile*/
935 ffsAddr[ strlen (ffsAddr) - 1] = '0' + nProfile;
936 TRACE_EVENT_P1 ("Read address is: %s", ffsAddr);
937
938 #ifndef _SIMULATION_
939 if ((val = ffs_fread (ffsAddr, profile_read, len_profile_read ))< 1)
940 {
941 TRACE_EVENT_P1("Read profile from FFS fail, returned val is %d", val);
942 cmdCmeError(CME_ERR_Unknown);
943 return (ATI_FAIL);
944 }
945 #endif /*_SIMULATION_*/
946
947 #ifdef _SIMULATION_
948 for (i = 0; i < atw_profile_simu[nProfile][0] ; i ++)
949 {
950 profile_read [i] = atw_profile_simu [nProfile][i];
951 TRACE_EVENT_P2 ("index %d, profile_read is: %d ", i, profile_read [i]);
952 }
953 #endif /*_SIMULATION_*/
954 return (ATI_CMPL);
955 }
956
957 /*
958 +------------------------------------------------------------------------------+
959 | PROJECT : GSM-PS (6147) MODULE : ATI_BAS |
960 | STATE : code ROUTINE : set_param_to_the_retrieved_value |
961 +------------------------------------------------------------------------------+
962
963 PURPOSE : this function handles command parameters.
964 */
965 LOCAL T_ATI_RSLT set_param_to_the_retrieved_value(UBYTE srcId, UBYTE *string)
966 {
967 int para = * (string+4); /*this is for functions with input param of type int*/
968 CHAR para1 = * (string+4); /*this is for functions with input param of type char*/
969 T_ATI_RSLT atiRet = ATI_FAIL;
970 T_ACI_RETURN aciRet = AT_FAIL;
971
972 TRACE_FUNCTION ("set_param_to_the_retrieved_value()");
973
974 /* string[2] is always the token and string[3] always the length.
975 so far we only have parameters with 1 byte length.*/
976 if ( *(string+2) EQ SIGNED_VALUE AND *(string+3) EQ sizeof (UBYTE))
977 {
978 para = ((* (string+4) > 127) ? *(string+4) -256: *(string+4));
979 }
980 para1 = (CHAR)(para + '0'); /*Transform to the corresponding inern value of the corresponding character*/
981 switch (*string)
982 {
983 case AT_CMD_CGREG:
984 #if defined (GPRS) AND defined (DTI)
985 atiRet = setatPlusCGREG ( &para1, srcId);
986 #else
987 atiRet = ATI_CMPL;
988 #endif /*GPRS*/
989 break;
990 case AT_CMD_P_CGREG:
991 #if defined (GPRS) AND defined (DTI)
992 atiRet = setatPercentCGREG (&para1, srcId);
993 #else
994 atiRet = ATI_CMPL;
995 #endif /*GPRS*/
996 break;
997 case AT_CMD_CGAATT:
998 #if defined (GPRS) AND defined (DTI)
999 aciRet = sAT_PercentCGAATT (srcId, para, (*(string+7) > 127) ? (*(string+7) - 256 ): *(string+7));
1000 #else
1001 aciRet = AT_CMPL;
1002 #endif /*GPRS*/
1003 break;
1004
1005 case AT_CMD_CLIP:
1006 atiRet = setatPlusCLIP ( &para1, srcId );
1007 break;
1008 case AT_CMD_CPI:
1009 ati_user_output_cfg[srcId].CPI_stat = string[4];
1010 atiRet = ATI_CMPL;
1011 break;
1012 case AT_CMD_COLP:
1013 atiRet = setatPlusCOLP (&para1, srcId);
1014 break;
1015 case AT_CMD_CLIR:
1016 aciRet = sAT_PlusCLIR ( (T_ACI_CMD_SRC)srcId, para);
1017 break;
1018 case AT_CMD_ALS:
1019 aciRet = sAT_PercentALS ((T_ACI_CMD_SRC)srcId, para);
1020 break;
1021 case AT_CMD_CREG:
1022 atiRet = setatPlusCREG ( &para1, srcId);
1023 break;
1024 case AT_CMD_P_CREG:
1025 atiRet = setatPercentCREG ( &para1, srcId);
1026 break;
1027 default:
1028 break;
1029 }
1030
1031 if (atiRet EQ ATI_FAIL AND aciRet EQ AT_FAIL )
1032 {
1033 TRACE_EVENT_P1("Set function fails for command id %d.", *string);
1034 cmdCmeError(CME_ERR_Unknown);
1035 return( ATI_FAIL );
1036 }
1037 return (ATI_CMPL);
1038 }
1039
1040 /*
1041 +--------------------------------------------------------------------+
1042 | PROJECT : GSM-PS (6147) MODULE : ATI_BAS |
1043 | STATE : code ROUTINE : ati_zn_retrieve_params |
1044 +--------------------------------------------------------------------+
1045
1046 PURPOSE : This is the implementation of AT command ATZn (n>0),
1047 which retrieve profile from FFS.
1048 */
1049 GLOBAL void ati_zn_retrieve_params ( UBYTE srcId )
1050 {
1051 int index = 1;
1052 UBYTE *profile_read = NULL;
1053 UBYTE *string = NULL;
1054 USHORT len_prof_read = 0;
1055
1056 TRACE_FUNCTION ("ati_zn_retrieve_params()");
1057 /*
1058 *-------------------------------------------------------------------
1059 * check parameter profile
1060 *-------------------------------------------------------------------
1061 */
1062 if( ATZprofile < 1 OR
1063 ATZprofile > MAX_ATW_STORED_PROFILE )
1064 {
1065 return;
1066 }
1067 len_prof_read = (MAX_ATW_CHOSEN_CMD_NB) * (MAX_ONE_ATW_PRO_LEN) + 1;
1068 TRACE_EVENT_P1 ("length of profile read is %d", len_prof_read);
1069 ACI_MALLOC (profile_read, len_prof_read);
1070
1071 if (read_profile_from_ffs ((SHORT)(ATZprofile - 1), profile_read, len_prof_read) NEQ ATI_CMPL)
1072 {
1073 TRACE_EVENT ("read_profile_from_ffs() fail...");
1074 ACI_MFREE (profile_read);
1075 return;
1076 }
1077 /*profile has no content*/
1078 if (*profile_read EQ 1)
1079 {
1080 ACI_MFREE (profile_read);
1081 return;
1082 }
1083 do
1084 {
1085 string = profile_read + index; /*index points to the first element of a command profile, which is command id*/
1086 index += *(profile_read+index +1);/*the second element in the profile is profile length for the command*/
1087 if (set_param_to_the_retrieved_value (srcId, string) EQ ATI_FAIL)
1088 {
1089 ACI_MFREE (profile_read);
1090 return;
1091 }
1092 }while (index < *profile_read);/*the first element of the whole profile is the total length*/
1093
1094 ACI_MFREE (profile_read);
1095 return;
1096 }
1097
1098 /*
1099 +--------------------------------------------------------------------+
1100 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD |
1101 | STATE : code ROUTINE : atAndW |
1102 +--------------------------------------------------------------------+
1103
1104 PURPOSE : &W command stores profiles to FFS
1105 */
1106
1107 GLOBAL T_ATI_RSLT atAndW (char *cl, UBYTE srcId)
1108 {
1109 long nProfile = ACI_NumParmNotPresent;
1110 char *end;
1111
1112 TRACE_FUNCTION("atAndW()");
1113
1114 nProfile = strtol(cl, &end, 10);
1115 if(*end)
1116 {
1117 cmdAtError(atError);
1118 return ATI_FAIL;
1119 }
1120 /*
1121 * Normally omitted value should be assumed as zero
1122 * but AT&W does not support profile number zero.
1123 * So an omitted profile will be assumed as 1.
1124 */
1125 if(cl EQ end)
1126 {
1127 nProfile = 1;
1128 }
1129
1130 if( nProfile < 1 OR nProfile > MAX_ATW_STORED_PROFILE )
1131 {
1132 cmdAtError(atError);
1133 return ATI_FAIL;
1134 }
1135
1136 switch (ati_wn_store_params( srcId, (SHORT) (nProfile - 1)))
1137 {
1138 case ATI_CMPL:
1139 return ATI_CMPL;
1140 default:
1141 cmdAtError(atError);
1142 return ATI_FAIL;
1143 }
1144 }
1145
1146
1147 /*
1148 +--------------------------------------------------------------------+
1149 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD |
1150 | STATE : code ROUTINE : atZ |
1151 +--------------------------------------------------------------------+
1152
1153 PURPOSE : Z command (reset DCE and terminate any call in progress)
1154 */
1155
1156 GLOBAL T_ATI_RSLT atZ(char *cl, UBYTE srcId)
1157 {
1158 char *end = NULL;
1159 UBYTE value = (UBYTE)strtol(cl, &end, 10);
1160 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id);
1161
1162 TRACE_FUNCTION("atZ()");
1163
1164 if(*end)
1165 {
1166 cmdAtError(atError);
1167 return ATI_FAIL;
1168 }
1169
1170 if( value > MAX_ATW_STORED_PROFILE )
1171 {
1172 cmdAtError(atError);
1173 return( ATI_FAIL );
1174 }
1175
1176 ATZprofile = value;
1177
1178 #ifdef FF_ATI_BAT
1179 {
1180 T_BAT_cmd_send cmd;
1181 T_BAT_no_parameter dummy;
1182 cmd.ctrl_params = BAT_CMD_AT_Z;
1183 dummy.bat_dummy = 0xFF;
1184 cmd.params.ptr_at_z = &dummy;
1185 if( at.rngPrms.isRng EQ TRUE )
1186 {
1187 ati_stop_ring();
1188 }
1189 src_params->curAtCmd = AT_CMD_Z;
1190
1191 bat_send(ati_bat_get_client(srcId), &cmd);
1192
1193 return (ATI_EXCT); /* executing, because response is passed by callback function */
1194 }
1195 #else /* no FF_ATI_BAT */
1196
1197 switch(sAT_Z( srcId, 0 ))
1198 {
1199 case AT_CMPL:
1200 return ATI_CMPL;
1201 case AT_EXCT:
1202 if( at.rngPrms.isRng EQ TRUE )
1203 {
1204 ati_stop_ring();
1205 }
1206 src_params->curAtCmd = AT_CMD_Z;
1207 return ATI_EXCT;
1208 default:
1209 cmdAtError(atError);
1210 return ATI_FAIL;
1211 }
1212
1213 #endif /* no FF_ATI_BAT */
1214 }
1215
1216 /*
1217 +--------------------------------------------------------------------+
1218 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD |
1219 | STATE : code ROUTINE : atPlusCPAS |
1220 +--------------------------------------------------------------------+
1221
1222 PURPOSE : Phone activity status
1223 */
1224 GLOBAL T_ATI_RSLT setatPlusCPAS(char *cl, UBYTE srcId)
1225 {
1226 T_ACI_CPAS_PAS pas = CPAS_PAS_NotPresent;
1227 T_ACI_RETURN ret = AT_FAIL;
1228
1229 TRACE_FUNCTION("setatPlusCPAS()");
1230
1231 if (*cl NEQ '\0' AND *cl NEQ ';')
1232 {
1233 cmdAtError(atError);
1234 return ATI_FAIL;
1235 }
1236
1237 #ifdef FF_ATI_BAT
1238 {
1239 T_BAT_cmd_send cmd;
1240 T_BAT_no_parameter my_bat_set_plus_cpas;
1241
1242 TRACE_FUNCTION("setatPlusCPAS() calls bat_send() <=== as APPLICATION");
1243
1244 ret = qAT_PlusCPAS( srcId, &pas );
1245 if (ret EQ AT_CMPL)
1246 {
1247 resp_disp(srcId, cl, "e", &pas);
1248 }
1249 else
1250 {
1251 cmdAtError(atError);
1252 return ATI_FAIL;
1253 }
1254
1255 cmd.params.ptr_set_plus_cpas = &my_bat_set_plus_cpas;
1256 bat_send(ati_bat_get_client(srcId), &cmd);
1257 return ATI_EXCT; /* executing, because response is passed by callback function */
1258 }
1259 #else /* OLD FUNCTION BODY */
1260
1261 ret = qAT_PlusCPAS( srcId, &pas );
1262 if (ret EQ AT_CMPL)
1263 {
1264 resp_disp(srcId, cl, "e", &pas);
1265 return ATI_CMPL;
1266 }
1267 else
1268 {
1269 cmdAtError(atError);
1270 return ATI_FAIL;
1271 }
1272
1273 #endif /* no FF_ATI_BAT*/
1274 }
1275 /*
1276 +--------------------------------------------------------------------+
1277 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD |
1278 | STATE : code ROUTINE : atPlusCLAE |
1279 +--------------------------------------------------------------------+
1280
1281 PURPOSE : +CLAE command (Language Event)
1282 */
1283
1284 GLOBAL T_ATI_RSLT setatPlusCLAE (char *cl, UBYTE srcId)
1285 {
1286 T_ACI_RETURN ret = AT_FAIL;
1287 T_ACI_CLAE_MOD mode = CLAE_MOD_NotPresent;
1288
1289 TRACE_FUNCTION("setatPLusCLAE()");
1290
1291 switch(*cl)
1292 {
1293 case('0'):
1294 mode=CLAE_MOD_Disable;
1295 break;
1296 case('1'):
1297 mode=CLAE_MOD_Enable;
1298 break;
1299 default:
1300 cmdCmeError(CME_ERR_OpNotAllow);
1301 return ATI_FAIL;
1302 }
1303 ret = sAT_PlusCLAE(srcId,mode);
1304 if (ret EQ AT_CMPL)
1305 return ATI_CMPL;
1306 else
1307 return ATI_FAIL;
1308 }
1309
1310 GLOBAL T_ATI_RSLT queatPlusCLAE (char *cl, UBYTE srcId)
1311 {
1312 char *me="+CLAE: ";
1313 T_ACI_RETURN ret = AT_FAIL;
1314 T_ACI_CLAE_MOD mode=CLAE_MOD_NotPresent;
1315
1316 TRACE_FUNCTION("queatPLusCLAE()");
1317
1318 ret = qAT_PlusCLAE(srcId,&mode);
1319 if(ret EQ AT_CMPL)
1320 {
1321 sprintf(g_sa,"%s%d",me,mode);
1322 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT);
1323 return ATI_CMPL;
1324 }
1325 else
1326 {
1327 cmdCmeError(CME_ERR_Unknown);
1328 return ATI_FAIL;
1329 }
1330 }
1331
1332 /*
1333 +--------------------------------------------------------------------+
1334 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD |
1335 | STATE : code ROUTINE : atAndC |
1336 +--------------------------------------------------------------------+
1337
1338 PURPOSE : &C command reset to factory default (not the final version)
1339 */
1340
1341
1342 GLOBAL T_ATI_RSLT atAndC (char *cl, UBYTE srcId)
1343 {
1344 T_ACI_DCD_MOD val;
1345
1346 TRACE_FUNCTION("atAndC()");
1347
1348 switch(*cl)
1349 {
1350 case '\0':
1351 case '0':
1352 val = DCD_ALWAYS_ON;
1353 break;
1354
1355 case '1':
1356 val = DCD_DISABLE_AFTER_CALL;
1357 break;
1358 #ifdef RMV_01_06_04
1359 case ('?'):
1360 qAT_AndC( srcId, &val );
1361 sprintf(g_sa, "&C: %d", val);
1362 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT);
1363 return (ATI_CMPL);
1364 #endif
1365 default:
1366 cmdAtError(atError);
1367 return(ATI_FAIL);
1368 }
1369
1370 #ifdef DTI
1371 if (sAT_AndC( srcId, val ) EQ AT_CMPL)
1372 {
1373 return (ATI_CMPL);
1374 }
1375 #endif
1376 cmdAtError(atError);
1377 return (ATI_FAIL);
1378 }
1379
1380 /*
1381 +--------------------------------------------------------------------+
1382 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD |
1383 | STATE : code ROUTINE : atAndD |
1384 +--------------------------------------------------------------------+
1385
1386 PURPOSE : &D command to set the DTR behaviour
1387 */
1388
1389
1390 GLOBAL T_ATI_RSLT atAndD (char *cl, UBYTE srcId)
1391 {
1392 UBYTE val;
1393
1394 TRACE_FUNCTION("atAndD()");
1395
1396 switch(*cl)
1397 {
1398 case ('\0'):
1399 case ('0'):
1400 val = 0;
1401 break;
1402 case ('1'):
1403 val = 1;
1404 break;
1405 case ('2'):
1406 val = 2;
1407 break;
1408 #ifdef RMV_01_06_04
1409 case ('?'):
1410 query = TRUE;
1411 break;
1412 #endif
1413 default:
1414 cmdAtError(atError);
1415 return ATI_FAIL;
1416 }
1417
1418 #ifdef RMV_01_06_04
1419 if (query)
1420 {
1421 ret=qAT_AndD (srcId, &val);
1422 if(ret EQ AT_CMPL)
1423 {
1424 sprintf(g_sa,"&D: %d", val);
1425 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT);
1426 return ATI_CMPL;
1427 }
1428 }
1429 else
1430 #endif
1431 {
1432 #ifdef DTI
1433 if (sAT_AndD ( srcId, val ) EQ AT_CMPL)
1434 {
1435 return ATI_CMPL;
1436 }
1437 #endif
1438 }
1439 cmdAtError(atError);
1440 return ATI_FAIL;
1441 }
1442
1443 /*
1444 +--------------------------------------------------------------------+
1445 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD |
1446 | STATE : code ROUTINE : atAndF |
1447 +--------------------------------------------------------------------+
1448
1449 PURPOSE : &F command reset to factory default (not the final version)
1450 */
1451 GLOBAL T_ATI_RSLT atAndF (char *cl, UBYTE srcId)
1452 {
1453 T_ACI_RETURN ret = AT_FAIL;
1454
1455 TRACE_FUNCTION("atAndF()");
1456
1457 switch(*cl)
1458 {
1459 case '\0':
1460 case ('0'):
1461 /* default like ATZ */
1462 ati_cmd_reset(srcId);
1463 break;
1464 case ('1'):
1465 ati_cmd_reset(srcId);
1466
1467 /*
1468 * An other manufacturer specific parameter set.
1469 *
1470 * This is different from the user specific profiles (ATZ1).
1471 *
1472 */
1473 at.flags.COLP_stat = 1;
1474 ati_user_output_cfg[srcId].CR_stat = 1;
1475 ati_user_output_cfg[srcId].CRC_stat = 1;
1476 ati_user_output_cfg[srcId].CLIP_stat = 1;
1477 ati_user_output_cfg[srcId].DR_stat = 1;
1478
1479 ati_user_output_cfg[srcId].creg.mod_lac_cid.pres_mode = CREG_MOD_ON;
1480
1481 #ifdef GPRS
1482 ati_gprs_user_output_cfg[srcId].plus_cgreg.mod_lac_cid.pres_mode = CREG_MOD_ON;
1483 ati_gprs_user_output_cfg[srcId].percent_cgreg.mod_lac_cid.pres_mode = CREG_MOD_ON;
1484 #endif
1485 break;
1486 default:
1487 cmdAtError(atError);
1488 return ATI_FAIL;
1489 }
1490
1491 /*
1492 * The function sAT_AndF will be called with value 0 -> AT&F0
1493 * because the different behavior of value 0 to 1 is only ATI
1494 * related and sAT_AndF() is only CMH-related.
1495 *
1496 * This is different from sAT_Z().
1497 */
1498 ret = sAT_AndF( srcId, 0 );
1499 if (ret EQ AT_CMPL)
1500 {
1501 return ATI_CMPL;
1502 }
1503 cmdAtError(atError);
1504 return ATI_FAIL;
1505
1506 }
1507
1508 /*
1509 +--------------------------------------------------------------------+
1510 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD |
1511 | STATE : code ROUTINE : atAndK |
1512 +--------------------------------------------------------------------+
1513
1514 PURPOSE : &K only for compatibility
1515 */
1516
1517
1518 GLOBAL T_ATI_RSLT atAndK (char *cl, UBYTE srcId)
1519 {
1520 TRACE_FUNCTION("atAndK()");
1521
1522 switch(*cl)
1523 {
1524 case ('0'):
1525 case ('1'):
1526 case ('2'):
1527 case ('3'):
1528 case ('4'):
1529 return ATI_CMPL;
1530 default:
1531 cmdAtError(atError);
1532 return ATI_FAIL;
1533 }
1534 }
1535
1536 /*
1537 +--------------------------------------------------------------------+
1538 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD |
1539 | STATE : code ROUTINE : atPlusCSQ |
1540 +--------------------------------------------------------------------+
1541
1542 PURPOSE : +CSQ, signal quality
1543 */
1544
1545 GLOBAL T_ATI_RSLT setatPlusCSQ ( char *cl, UBYTE srcId)
1546 {
1547 rx_Status_Type rxStat;
1548 UBYTE rssi;
1549 UBYTE ber;
1550
1551 TRACE_FUNCTION("setatPlusCSQ()");
1552
1553 if ( rx_GetStatus ( &rxStat ) NEQ DRV_OK )
1554 {
1555 cmdCmeError ( CME_ERR_Unknown );
1556 return ATI_FAIL;
1557 }
1558 else
1559 {
1560 if ( rxStat.gsmLevel EQ 0xFF OR rxStat.gsmLevel EQ 0 )
1561 {
1562 rssi = ACI_RSSI_FAULT;
1563 }
1564 else if ( rxStat.gsmLevel > 59 )
1565 {
1566 rssi = 31;
1567 }
1568 else
1569 {
1570 rssi = ( rxStat.gsmLevel / 2 ) + 2;
1571 }
1572
1573 if ( rxStat.rxQuality EQ RX_QUAL_UNAVAILABLE )
1574 {
1575 ber = ACI_BER_FAULT;
1576 }
1577 else
1578 {
1579 ber = rxStat.rxQuality;
1580 }
1581
1582 sprintf (g_sa, "+CSQ: %d,%d ", rssi, ber );
1583 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT);
1584 return ATI_CMPL;
1585 }
1586 }
1587
1588 GLOBAL T_ATI_RSLT tesatPlusCSQ(CHAR *cl, UBYTE srcId)
1589 {
1590 TRACE_FUNCTION("tesatPLusCSQ()");
1591
1592 sprintf (g_sa, "+CSQ: 2-31,(%d),(%d)", ACI_RSSI_FAULT, ACI_BER_FAULT );
1593 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT);
1594 return ATI_CMPL;
1595 }
1596
1597 /*
1598 +--------------------------------------------------------------------+
1599 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD |
1600 | STATE : code ROUTINE : atPlusCSQ |
1601 +--------------------------------------------------------------------+
1602
1603 PURPOSE : %CSQ, signal quality
1604
1605 Shen,Chao Juni.12th.2003
1606 */
1607
1608 GLOBAL T_ATI_RSLT setatPercentCSQ ( char *cl, UBYTE srcId)
1609 {
1610 T_ACI_CSQ_MODE CSQmode = CSQ_Disable;
1611 rx_Status_Type rxStat;
1612
1613
1614 TRACE_FUNCTION("setatPercentCSQ()");
1615
1616 if ( rx_GetStatus ( &rxStat ) NEQ DRV_OK )
1617 {
1618 cmdCmeError ( CME_ERR_Unknown );
1619 return ATI_FAIL;
1620 }
1621 else
1622 {
1623 switch( *cl )
1624 {
1625 case '0':
1626 {
1627 CSQmode = CSQ_Disable;
1628 break;
1629 }
1630
1631 case '1':
1632 {
1633 CSQmode = CSQ_Enable;
1634 break;
1635 }
1636
1637 default:
1638 {
1639 cmdCmeError(CME_ERR_Unknown);
1640 return (ATI_FAIL);
1641 }
1642 }
1643
1644 if (sAT_PercentCSQ(srcId,CSQmode) NEQ AT_CMPL)
1645 {
1646 TRACE_EVENT("setatPercentCSQ call sAT_PercentCSQ Error!!");
1647 }
1648
1649 sprintf (g_sa, "%s%d ", "%CSQ: ", CSQmode);
1650 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT);
1651 return ATI_CMPL;
1652 }
1653 }
1654
1655
1656 GLOBAL T_ATI_RSLT queatPercentCSQ(CHAR *cl, UBYTE srcId)
1657 {
1658 rx_Status_Type rxStat;
1659
1660 TRACE_FUNCTION("queatPercentCSQ()");
1661
1662 qAT_PercentCSQ(srcId,&rxStat.gsmLevel,&rxStat.rxQuality,&rxStat.actLevel);
1663
1664 sprintf (g_sa, "%s %d, %d, %d", "%CSQ: ",rxStat.gsmLevel, rxStat.rxQuality, rxStat.actLevel);
1665 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT);
1666
1667 return ATI_CMPL;
1668 }
1669
1670
1671 GLOBAL T_ATI_RSLT tesatPercentCSQ(CHAR *cl, UBYTE srcId)
1672 {
1673 TRACE_FUNCTION("tesatPercentCSQ()");
1674
1675 sprintf (g_sa, "%s (%d), (%d), 0-4", "%CSQ: ",ACI_RSSI_FAULT, ACI_BER_FAULT);
1676 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT);
1677 return ATI_CMPL;
1678 }
1679
1680 /*
1681 +--------------------------------------------------------------------+
1682 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD |
1683 | STATE : code ROUTINE : atPercentDBGINFO |
1684 +--------------------------------------------------------------------+
1685
1686 PURPOSE : %DBGINFO, query free mem pool blocks.
1687 */
1688
1689 GLOBAL T_ATI_RSLT setatPercentDBGINFO ( char *cl, UBYTE srcId)
1690 {
1691 char *me = "%DBGINFO:";
1692 ULONG param = 0;
1693 T_ACI_DBG_INFO stor = P_DBGINFO_NotPresent;
1694 CHAR type[4] = {0};
1695 USHORT free = 0, alloc = 0, i = 0;
1696
1697 TRACE_FUNCTION("queatPercentDBGINFO()");
1698
1699 cl = parse(cl,"sd",(LONG)4, type, &param);
1700 if(!cl OR *type EQ '\0')
1701 {
1702 cmdCmeError(CME_ERR_OpNotAllow);
1703 return (ATI_FAIL);
1704 }
1705 strupper(type);
1706 for(i=0;dbg_mem_names[i].name NEQ 0;i++)
1707 {
1708 if (!strcmp(dbg_mem_names[i].name, type) )
1709 {
1710 stor = dbg_mem_names[i].stor;
1711 break;
1712 }
1713 }
1714 if((dbg_mem_names[i].name EQ 0) OR (param EQ 0))
1715 {
1716 cmdCmeError(CME_ERR_OpNotAllow);
1717 return (ATI_FAIL);
1718 }
1719 if (qAT_PercentDBGINFO(srcId, param, (USHORT)stor, &free, &alloc) NEQ ATI_CMPL)
1720 {
1721 cmdCmeError(CME_ERR_Unknown);
1722 return (ATI_FAIL);
1723 }
1724 sprintf(g_sa, "%s%d", me, free);
1725 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT);
1726
1727 return (ATI_CMPL);
1728 }
1729
1730 /*
1731 +--------------------------------------------------------------------+
1732 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD |
1733 | STATE : code ROUTINE : atPlusCBC |
1734 +--------------------------------------------------------------------+
1735
1736 PURPOSE : +CBC, battery charge
1737 */
1738 #define ACI_BCS_BattPower 0
1739 #define ACI_BCS_BattCnctd 1
1740 #define ACI_BCS_NoBatt 2
1741 #define ACI_BCS_PowerFault 3
1742
1743 GLOBAL T_ATI_RSLT atPlusCBC ( char *cl, UBYTE srcId )
1744 {
1745 pwr_Status_Type powerStat;
1746 UBYTE bcs;
1747
1748 TRACE_FUNCTION("atPlusCBC()");
1749
1750 if ( pwr_GetStatus ( &powerStat ) NEQ DRV_OK )
1751 {
1752 cmdCmeError ( CME_ERR_Unknown );
1753 return ATI_FAIL;
1754 }
1755 else
1756 {
1757 switch ( powerStat.Status )
1758 {
1759 case ( PWR_EXTPOWER_ON ):
1760 bcs = ACI_BCS_NoBatt;
1761 break;
1762
1763 case ( PWR_CHARGER_ON ):
1764 bcs = ACI_BCS_BattCnctd;
1765 break;
1766
1767 default:
1768 bcs = ACI_BCS_BattPower;
1769 break;
1770 }
1771 sprintf(g_sa, "+CBC: %d,%d", bcs, powerStat.ChargeLevel );
1772 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT);
1773 return ATI_CMPL;
1774 }
1775 }
1776
1777 /*
1778 +--------------------------------------------------------------------+
1779 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD |
1780 | STATE : code ROUTINE : atPlusCLVL |
1781 +--------------------------------------------------------------------+
1782
1783 PURPOSE : +CLVL, loudspeaker volume level
1784 */
1785 GLOBAL T_ATI_RSLT setatPlusCLVL ( char *cl, UBYTE srcId )
1786 {
1787 #ifdef FF_ATI_BAT
1788 {
1789 T_BAT_cmd_send cmd;
1790 T_BAT_cmd_set_plus_clvl my_bat_set_plus_clvl;
1791 SHORT vol;
1792
1793 TRACE_FUNCTION("setatPlusCLVL() calls bat_send() <=== as APPLICATION");
1794
1795 cl = parse ( cl, "d", &vol );
1796
1797 if( !cl OR vol > 255 OR vol < 0 )
1798 {
1799 cmdCmeError ( CME_ERR_OpNotAllow );
1800 return ATI_FAIL;
1801 }
1802
1803 memset(&my_bat_set_plus_clvl, 0, sizeof(my_bat_set_plus_clvl));
1804 cmd.ctrl_params = BAT_CMD_SET_PLUS_CLVL;
1805 cmd.params.ptr_set_plus_clvl = &my_bat_set_plus_clvl;
1806
1807 my_bat_set_plus_clvl.level = (U8)vol;
1808
1809 bat_send(ati_bat_get_client(srcId), &cmd);
1810
1811 return ATI_EXCT; /* executing, because response is passed by callback function */
1812 }
1813 #else /* OLD FUNCTION BODY */
1814
1815 TRACE_FUNCTION("setatPlusCLVL()");
1816
1817 return setaciPrcsVolLevel ( cl, AUDIO_SPEAKER );
1818
1819 #endif /* no FF_ATI_BAT*/
1820 }
1821
1822 GLOBAL T_ATI_RSLT tesatPlusCLVL ( char *cl, UBYTE srcId )
1823 {
1824 TRACE_FUNCTION("tesatPlusCLVL()");
1825
1826 return tesaciPrcsVolLevel ( srcId, cl, AUDIO_SPEAKER );
1827 }
1828
1829 GLOBAL T_ATI_RSLT queatPlusCLVL ( char *cl, UBYTE srcId )
1830 {
1831 TRACE_FUNCTION("queatPlusCLVL()");
1832
1833 return queaciPrcsVolLevel ( srcId, cl, AUDIO_SPEAKER );
1834 }
1835
1836 /*
1837 +--------------------------------------------------------------------+
1838 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD |
1839 | STATE : code ROUTINE : atPlusCRSL |
1840 +--------------------------------------------------------------------+
1841
1842 PURPOSE : +CRSL, ringer sound level
1843 */
1844 GLOBAL T_ATI_RSLT setatPlusCRSL ( char *cl, UBYTE srcId )
1845 {
1846 TRACE_FUNCTION("atPlusCRSL()");
1847
1848 return setaciPrcsVolLevel ( cl, AUDIO_BUZZER );
1849 }
1850
1851 GLOBAL T_ATI_RSLT tesatPlusCRSL ( char *cl, UBYTE srcId )
1852 {
1853 TRACE_FUNCTION("tesatPlusCRSL()");
1854
1855 return tesaciPrcsVolLevel ( srcId, cl, AUDIO_BUZZER );
1856 }
1857
1858 GLOBAL T_ATI_RSLT queatPlusCRSL ( char *cl, UBYTE srcId )
1859 {
1860 TRACE_FUNCTION("queatPlusCRSL()");
1861
1862 return queaciPrcsVolLevel ( srcId, cl, AUDIO_BUZZER );
1863 }
1864
1865 /*
1866 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD |
1867 | STATE : code ROUTINE : aciPrcsVolLevel |
1868
1869 PURPOSE : +CLVL, +CRSL loudspeaker volume level
1870 */
1871 LOCAL T_ATI_RSLT setaciPrcsVolLevel ( CHAR* cl, UBYTE device )
1872 {
1873 SHORT vol;
1874
1875 cl = parse ( cl, "d", &vol );
1876
1877 if( !cl OR vol > 255 OR vol < 0 )
1878 {
1879 cmdCmeError ( CME_ERR_OpNotAllow );
1880 return ATI_FAIL;
1881 }
1882 else
1883 {
1884 if ( audio_SetAmplf( device, ( UBYTE ) vol ) NEQ DRV_OK )
1885 {
1886 cmdCmeError ( CME_ERR_Unknown );
1887 return ATI_FAIL;
1888 }
1889 }
1890 return ATI_CMPL;
1891 }
1892
1893 LOCAL T_ATI_RSLT tesaciPrcsVolLevel ( UBYTE srcId, CHAR* cl, UBYTE device )
1894 {
1895 CHAR *p_sa;
1896 audio_Status_Type audioStat;
1897
1898 switch (device)
1899 {
1900 case AUDIO_SPEAKER:
1901 p_sa = "CLVL";
1902 break;
1903 case AUDIO_BUZZER:
1904 p_sa = "CRSL";
1905 break;
1906 default:
1907 cmdCmeError ( CME_ERR_Unknown );
1908 return ATI_FAIL;
1909 }
1910
1911 if ( audio_GetStatus ( device, &audioStat ) NEQ DRV_OK )
1912 {
1913 cmdCmeError ( CME_ERR_Unknown );
1914 return ATI_FAIL;
1915 }
1916 {
1917 sprintf( g_sa, "+%s: (%d-%d)", p_sa, audioStat.min_volume, audioStat.max_volume );
1918 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT);
1919 }
1920 return ATI_CMPL;
1921 }
1922
1923
1924 LOCAL T_ATI_RSLT queaciPrcsVolLevel ( UBYTE srcId, CHAR* cl, UBYTE device )
1925 {
1926 SHORT vol;
1927 UBYTE drvVol;
1928 CHAR *p_sa;
1929
1930 switch (device)
1931 {
1932 case AUDIO_SPEAKER:
1933 p_sa = "CLVL";
1934 break;
1935 case AUDIO_BUZZER:
1936 p_sa = "CRSL";
1937 break;
1938 default:
1939 cmdCmeError ( CME_ERR_Unknown );
1940 return ATI_FAIL;
1941 }
1942
1943 if ( audio_GetAmplf ( device, &drvVol ) NEQ DRV_OK )
1944 {
1945 cmdCmeError ( CME_ERR_Unknown );
1946 return ATI_FAIL;
1947 }
1948 else
1949 {
1950 vol = drvVol;
1951 sprintf ( g_sa, "+%s: %d", p_sa, vol );
1952 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT);
1953 }
1954 return ATI_CMPL;
1955 }
1956
1957 /*
1958 +--------------------------------------------------------------------+
1959 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD |
1960 | STATE : code ROUTINE : atPlusCMUT |
1961 +--------------------------------------------------------------------+
1962
1963 PURPOSE : +CMUT, mute control
1964 */
1965 #define ACI_MUTE_OFF 0
1966 #define ACI_MUTE_ON 1
1967
1968 GLOBAL T_ATI_RSLT setatPlusCMUT(CHAR *cl, UBYTE srcId)
1969 {
1970 SHORT mute;
1971 UBYTE drvMute;
1972
1973 cl = parse ( cl, "d", &mute );
1974
1975 if( !cl OR ( mute NEQ ACI_MUTE_OFF AND mute NEQ ACI_MUTE_ON ) )
1976 {
1977 cmdCmeError ( CME_ERR_OpNotAllow );
1978 return ATI_FAIL;
1979 }
1980 if ( mute EQ ACI_MUTE_OFF )
1981 {
1982 drvMute = AUDIO_MUTING_OFF;
1983 }
1984 else
1985 {
1986 drvMute = AUDIO_MUTING_ON;
1987 }
1988 if (audio_SetMute (AUDIO_MICROPHONE, drvMute) NEQ DRV_OK)
1989 {
1990 cmdCmeError ( CME_ERR_Unknown );
1991 return ATI_FAIL;
1992 }
1993
1994 #ifdef FF_ATI_BAT
1995 {
1996 T_BAT_cmd_send cmd;
1997 T_BAT_cmd_set_plus_cmut my_bat_set_plus_cmut;
1998
1999 TRACE_FUNCTION("setatPlusCMUT() calls bat_send() <=== as APPLICATION");
2000
2001 memset(&my_bat_set_plus_cmut, 0, sizeof(my_bat_set_plus_cmut));
2002 cmd.ctrl_params = BAT_CMD_SET_PLUS_CMUT;
2003 cmd.params.ptr_set_plus_cmut = &my_bat_set_plus_cmut;
2004 my_bat_set_plus_cmut.n = (T_BAT_plus_cmut_n)drvMute;
2005 bat_send(ati_bat_get_client(srcId), &cmd);
2006 return ATI_EXCT; /* executing, because response is passed by callback function */
2007 }
2008 #else /* OLD FUNCTION BODY */
2009
2010 TRACE_FUNCTION("setatPLusCMUT()");
2011
2012 return ATI_CMPL;
2013
2014 #endif /* no FF_ATI_BAT */
2015 }
2016
2017 GLOBAL T_ATI_RSLT tesatPlusCMUT ( char *cl, UBYTE srcId )
2018 {
2019 TRACE_FUNCTION("tesatPlusCMUT()");
2020
2021 sprintf(g_sa, "+CMUT: (%d,%d)", ACI_MUTE_OFF, ACI_MUTE_ON );
2022 io_sendMessage (srcId, g_sa, ATI_NORMAL_OUTPUT);
2023 return ATI_CMPL;
2024 }
2025
2026 GLOBAL T_ATI_RSLT queatPlusCMUT(CHAR *cl, UBYTE srcId)
2027 {
2028 SHORT mute;
2029 UBYTE drvMute;
2030
2031 TRACE_FUNCTION("queatPlusCMUT()");
2032
2033 if ( audio_GetMute ( AUDIO_MICROPHONE, &drvMute ) NEQ DRV_OK )
2034 {
2035 cmdCmeError ( CME_ERR_Unknown );
2036 return ATI_FAIL;
2037 }
2038 else
2039 {
2040 if ( drvMute EQ AUDIO_MUTING_OFF )
2041 {
2042 mute = ACI_MUTE_OFF;
2043 }
2044 else
2045 {
2046 mute = ACI_MUTE_ON;
2047 }
2048
2049 sprintf ( g_sa, "+CMUT: %d", mute );
2050 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT);
2051 return ATI_CMPL;
2052 }
2053 }
2054
2055 /*
2056 +--------------------------------------------------------------------+
2057 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD |
2058 | STATE : code ROUTINE : atPlusCGMI |
2059 +--------------------------------------------------------------------+
2060
2061 PURPOSE : +CGMI, show name of manufacturer
2062 */
2063 GLOBAL T_ATI_RSLT atPlusCGMI ( char *cl, UBYTE srcId )
2064 {
2065 TRACE_FUNCTION("atPlusCGMI()");
2066
2067 return aciPrcsPlusCG (srcId, cl, EF_CGMI_ID);
2068 }
2069
2070 /*
2071 +--------------------------------------------------------------------+
2072 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD |
2073 | STATE : code ROUTINE : atPlusCGMM |
2074 +--------------------------------------------------------------------+
2075
2076 PURPOSE : +CGMM, show name of prodcut
2077 */
2078 GLOBAL T_ATI_RSLT atPlusCGMM ( char *cl, UBYTE srcId )
2079 {
2080 TRACE_FUNCTION("atPlusCGMM()");
2081
2082 return aciPrcsPlusCG (srcId, cl, EF_CGMM_ID);
2083 }
2084
2085 /*
2086 +--------------------------------------------------------------------+
2087 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD |
2088 | STATE : code ROUTINE : atPlusCGMR |
2089 +--------------------------------------------------------------------+
2090
2091 PURPOSE : +CGMR, show version of product
2092 */
2093 GLOBAL T_ATI_RSLT atPlusCGMR ( char *cl, UBYTE srcId )
2094 {
2095 TRACE_FUNCTION("atPlusCGMR()");
2096
2097 return aciPrcsPlusCG (srcId, cl, EF_CGMR_ID);
2098 }
2099
2100 /*
2101 +--------------------------------------------------------------------+
2102 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD |
2103 | STATE : code ROUTINE : atPlusCGSN |
2104 +--------------------------------------------------------------------+
2105
2106 PURPOSE : +CGSN, show serial number
2107 */
2108 GLOBAL T_ATI_RSLT atPlusCGSN ( char *cl, UBYTE srcId )
2109 {
2110 TRACE_FUNCTION("atPlusCGSN()");
2111
2112 return aciPrcsPlusCG (srcId, cl, EF_CGSN_ID);
2113 }
2114
2115 /*
2116 +--------------------------------------------------------------------+
2117 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD |
2118 | STATE : code ROUTINE : atPlusFMI |
2119 +--------------------------------------------------------------------+
2120
2121 PURPOSE : +FMI, show name of manufacturer
2122 */
2123 GLOBAL T_ATI_RSLT atPlusFMI ( char *cl, UBYTE srcId )
2124 {
2125 TRACE_FUNCTION("atPlusFMI()");
2126
2127 if ( *cl NEQ '?')
2128 {
2129 cmdCmeError ( CME_ERR_OpNotAllow );
2130 return ATI_FAIL;
2131 }
2132 return aciPrcsPlusCG (srcId, cl, EF_CGMI_ID);
2133 }
2134
2135 /*
2136 +--------------------------------------------------------------------+
2137 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD |
2138 | STATE : code ROUTINE : atPlusFMM |
2139 +--------------------------------------------------------------------+
2140
2141 PURPOSE : +FMM, show name of prodcut
2142 */
2143 GLOBAL T_ATI_RSLT atPlusFMM ( char *cl, UBYTE srcId )
2144 {
2145 TRACE_FUNCTION("atPlusFMM()");
2146
2147 if ( *cl NEQ '?')
2148 {
2149 cmdCmeError ( CME_ERR_OpNotAllow );
2150 return ATI_FAIL;
2151 }
2152 return aciPrcsPlusCG (srcId, cl, EF_CGMM_ID);
2153 }
2154
2155 /*
2156 +--------------------------------------------------------------------+
2157 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD |
2158 | STATE : code ROUTINE : atPlusFMR |
2159 +--------------------------------------------------------------------+
2160
2161 PURPOSE : +FMR, show version of product
2162 */
2163 GLOBAL T_ATI_RSLT atPlusFMR ( char *cl, UBYTE srcId )
2164 {
2165 TRACE_FUNCTION("atPlusFMR()");
2166
2167 if ( *cl NEQ '?')
2168 {
2169 cmdCmeError ( CME_ERR_OpNotAllow );
2170 return ATI_FAIL;
2171 }
2172 return aciPrcsPlusCG (srcId, cl, EF_CGMR_ID);
2173 }
2174
2175 /*
2176 +--------------------------------------------------------------------+
2177 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD |
2178 | STATE : code ROUTINE : aciPrcsPlusCG |
2179 +--------------------------------------------------------------------+
2180
2181 PURPOSE :
2182 */
2183 LOCAL T_ATI_RSLT aciPrcsPlusCG (UBYTE srcId, CHAR* cl, CHAR* ef)
2184 {
2185 pcm_FileInfo_Type fileInfo;
2186 USHORT i;
2187 char *cp;
2188
2189 TRACE_FUNCTION("aciPrcsPlusCG()");
2190
2191 if (pcm_GetFileInfo ((UBYTE* )ef, &fileInfo) NEQ DRV_OK)
2192 {
2193 cmdCmeError (CME_ERR_MemFail);
2194 return ATI_FAIL;
2195 }
2196
2197 if (pcm_ReadFile ((UBYTE*)ef, fileInfo.FileSize,
2198 (UBYTE*)g_sa, &fileInfo.Version) NEQ DRV_OK)
2199 {
2200 cmdCmeError (CME_ERR_MemFail);
2201 return ATI_FAIL;
2202 }
2203
2204 i = 0;
2205 while ((UBYTE)g_sa[i] NEQ 0xFF AND i < fileInfo.FileSize)
2206 i++;
2207 g_sa[i] = '\0';
2208
2209 #if CONFIG_MOKOFFS
2210 /*
2211 * Openmoko's FFS has a /pcm/CGMR file programmed like this:
2212 *
2213 * GTA02BV4/Moko5
2214 *
2215 * When queried for +CGMR, we would like to report the hardware revision
2216 * from FFS, but also tell the user that we are FreeCalypso and not Moko5.
2217 * Hence the following hack.
2218 */
2219 if ((cp = strchr(g_sa, '/')) && !strncmp(cp + 1, "Moko", 4))
2220 strcpy(cp + 1, "FreeCalypso");
2221 #endif
2222
2223 io_sendMessage (srcId, g_sa, ATI_NORMAL_OUTPUT );
2224
2225 return ATI_CMPL;
2226 }
2227
2228 /*
2229 +--------------------------------------------------------------------+
2230 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD |
2231 | STATE : code ROUTINE : atPlusCSCS |
2232 +--------------------------------------------------------------------+
2233
2234 PURPOSE : +CSCS command (Select TE character set)
2235 */
2236 GLOBAL T_ATI_RSLT setatPlusCSCS (char *cl, UBYTE srcId)
2237 {
2238 CHAR txtChset[10];
2239 T_ACI_CSCS_CHSET chset = CSCS_CHSET_NotPresent;
2240
2241 TRACE_FUNCTION("setatPlusCSCS()");
2242
2243 cl = parse ( cl, "s", (LONG) sizeof (txtChset), txtChset);
2244
2245 if ( strcmp ( txtChset, "GSM" ) EQ 0 )
2246 chset = CSCS_CHSET_Gsm;
2247 else if ( strcmp ( txtChset, "IRA" ) EQ 0 )
2248 chset = CSCS_CHSET_Ira;
2249 else if ( strcmp ( txtChset, "PCCP437" ) EQ 0 )
2250 chset = CSCS_CHSET_Pccp_437;
2251 else if ( strcmp ( txtChset, "PCDN" ) EQ 0 )
2252 chset = CSCS_CHSET_Pcdn;
2253 else if ( strcmp ( txtChset, "8859-1" ) EQ 0 )
2254 chset = CSCS_CHSET_8859_1;
2255 else if ( strcmp ( txtChset, "HEX" ) EQ 0 )
2256 chset = CSCS_CHSET_Hex;
2257 else if ( strcmp ( txtChset, "UCS2" ) EQ 0 )
2258 chset = CSCS_CHSET_Ucs2;
2259
2260 if ( !cl OR chset EQ CSCS_CHSET_NotPresent )
2261 {
2262 cmdCmeError ( CME_ERR_OpNotAllow );
2263 return ATI_FAIL;
2264 }
2265
2266 #ifdef FF_ATI_BAT
2267
2268 {
2269 T_BAT_cmd_send cmd;
2270 T_BAT_cmd_set_plus_cscs cscs;
2271
2272 cmd.ctrl_params=BAT_CMD_SET_PLUS_CSCS;
2273 cmd.params.ptr_set_plus_cscs=&cscs;
2274 /*
2275 * This relies on T_BAT_plus_cscs being identical to
2276 * T_ACI_CSCS_CHSET. It is, apart from the NotPresent
2277 * value, which is taken care of earlier in this
2278 * function.
2279 */
2280 cscs.cs=(T_BAT_plus_cscs_cs)chset;
2281 bat_send(ati_bat_get_client(srcId), &cmd);
2282 return(ATI_EXCT);
2283 }
2284
2285 #else
2286
2287 ati_user_output_cfg[srcId].cscsChset = chset;
2288 return ATI_CMPL;
2289
2290 #endif
2291 }
2292
2293 GLOBAL T_ATI_RSLT queatPlusCSCS (char *cl, UBYTE srcId)
2294 {
2295 TRACE_FUNCTION("queatPlusCSCS()");
2296
2297 #ifdef FF_ATI_BAT
2298 {
2299 T_BAT_cmd_send cmd;
2300 T_BAT_no_parameter dummy;
2301
2302 cmd.ctrl_params=BAT_CMD_QUE_PLUS_CSCS;
2303 dummy.bat_dummy = 0xFF;
2304 cmd.params.ptr_que_plus_cscs = &dummy;
2305 bat_send(ati_bat_get_client(srcId), &cmd);
2306 }
2307 return(ATI_EXCT);
2308
2309 #else /* no FF_ATI_BAT */
2310
2311 strcpy ( g_sa, "+CSCS: ");
2312
2313 switch ( ati_user_output_cfg[srcId].cscsChset )
2314 {
2315 case (CSCS_CHSET_Ira ): strcat (g_sa,"\"IRA\"" ); break;
2316 case (CSCS_CHSET_Pcdn ): strcat (g_sa,"\"PCDN\"" ); break;
2317 case (CSCS_CHSET_8859_1 ): strcat (g_sa,"\"8859-1\"" ); break;
2318 case (CSCS_CHSET_Pccp_437): strcat (g_sa,"\"PCCP437\""); break;
2319 case (CSCS_CHSET_Gsm ): strcat (g_sa,"\"GSM\"" ); break;
2320 case (CSCS_CHSET_Hex ): strcat (g_sa,"\"HEX\"" ); break;
2321 case (CSCS_CHSET_Ucs2 ): strcat (g_sa,"\"UCS2\"" ); break;
2322
2323 /*
2324 *-----------------------------------------------------------
2325 * This case will be prevented during settings procedure of
2326 * the TE character set ( CSCS=... )
2327 *-----------------------------------------------------------
2328 */
2329 default: cmdCmeError ( CME_ERR_Unknown ); return ATI_FAIL;
2330 }
2331
2332 io_sendMessage ( srcId, g_sa, ATI_NORMAL_OUTPUT );
2333 return ATI_CMPL;
2334
2335 #endif /* no FF_ATI_BAT */
2336 }
2337
2338 /*
2339 +--------------------------------------------------------------------+
2340 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD |
2341 | STATE : code ROUTINE : atPlusCMEE |
2342 +--------------------------------------------------------------------+
2343
2344 PURPOSE : +CMEE command (Error display mode)
2345 */
2346
2347 GLOBAL T_ATI_RSLT setatPlusCMEE(CHAR *cl, UBYTE srcId)
2348 {
2349 SHORT val;
2350
2351 TRACE_FUNCTION("setatPLusCMEE()");
2352
2353 cl=parse(cl,"r",&val);
2354 if ( !cl OR val > CMEE_MOD_Verbose OR val < CMEE_MOD_Disable )
2355 {
2356 cmdAtError(atError);
2357 return ATI_FAIL;
2358 }
2359 else
2360 {
2361 TRACE_EVENT_P2("setatPlusCMEE: srcId = %d Value = %d", srcId, val);
2362 ati_user_output_cfg[srcId].CMEE_stat = (UBYTE)val;
2363 return ATI_CMPL;
2364 }
2365 }
2366
2367
2368 /* query function */
2369
2370 GLOBAL T_ATI_RSLT queatPlusCMEE(CHAR *cl, UBYTE srcId)
2371 {
2372 TRACE_FUNCTION("queatPLusCMEE()");
2373
2374 TRACE_EVENT_P1("queatPlusCMEE: srcId = %d", srcId);
2375 resp_disp(srcId, cl,"b",&ati_user_output_cfg[srcId].CMEE_stat);
2376 return ATI_CMPL;
2377 }
2378
2379 /*
2380 +--------------------------------------------------------------------+
2381 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD |
2382 | STATE : code ROUTINE : atPlusGCAP |
2383 +--------------------------------------------------------------------+
2384
2385 PURPOSE : +GCAP command (capability information)
2386 */
2387 GLOBAL T_ATI_RSLT atPlusGCAP(char *cl, UBYTE srcId)
2388 {
2389 if (*cl EQ '\0')
2390 {
2391 #ifdef FAX_AND_DATA
2392
2393 #ifdef FF_FAX
2394
2395 #ifdef V42BIS
2396 sprintf(g_sa,"+GCAP: +CGSM,+FCLASS,+DS");
2397 #else
2398 sprintf(g_sa,"+GCAP: +CGSM,+FCLASS");
2399 #endif
2400
2401 #else /* no FAX */
2402
2403 #ifdef V42BIS
2404 sprintf(g_sa,"+GCAP: +CGSM,+DS");
2405 #else
2406 sprintf(g_sa,"+GCAP: +CGSM");
2407 #endif
2408
2409 #endif /* FF_FAX */
2410
2411 #else /* Voice only */
2412
2413 sprintf(g_sa,"+GCAP: +CGSM");
2414
2415 #endif /* FAX_AND_DATA */
2416
2417 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT);
2418 return ATI_CMPL;
2419 }
2420 else
2421 {
2422 cmdAtError(atError);
2423 return ATI_FAIL;
2424 }
2425 }
2426
2427 /*
2428 +--------------------------------------------------------------------+
2429 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD |
2430 | STATE : code ROUTINE : atPercentCCBS |
2431 +--------------------------------------------------------------------+
2432
2433 PURPOSE : %CCBS command (Call Completion to Busy Subscriber)
2434 */
2435
2436 GLOBAL T_ATI_RSLT setatPercentCCBS(char *cl, UBYTE srcId)
2437 {
2438 SHORT mode = ACI_NumParmNotPresent;
2439 SHORT idx = ACI_NumParmNotPresent;
2440 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id);
2441 T_ACI_RETURN ret = AT_FAIL;
2442
2443 TRACE_FUNCTION("setatPercentCCBS()");
2444
2445 cl = parse (cl,"rr",&mode,&idx);
2446 if(!cl OR (mode NEQ ACI_NumParmNotPresent AND (mode > 1 OR mode < 0)))
2447 {
2448 cmdCmeError (CME_ERR_OpNotAllow);
2449 return ATI_FAIL;
2450 }
2451
2452 if( mode NEQ ACI_NumParmNotPresent )
2453 at.flags.CCBS_stat=(UBYTE)mode;
2454
2455 #ifdef FF_ATI_BAT
2456
2457 if (idx != ACI_NumParmNotPresent)
2458 {
2459 T_BAT_cmd_send cmd;
2460 T_BAT_cmd_set_percent_ccbs ccbs;
2461
2462 cmd.ctrl_params=BAT_CMD_SET_PERCENT_CCBS;
2463 cmd.params.ptr_set_percent_ccbs=&ccbs;
2464 ccbs.idx=(T_BAT_percent_ccbs_idx)idx;
2465 bat_send(ati_bat_get_client(srcId), &cmd);
2466 return(ATI_EXCT);
2467 }
2468 else
2469 {
2470 return(ATI_CMPL);
2471 }
2472
2473 #else /* no FF_ATI_BAT */
2474
2475 if( idx NEQ ACI_NumParmNotPresent )
2476 {
2477 ret = sAT_PercentCCBS(srcId, idx);
2478 if( ret NEQ AT_EXCT )
2479 {
2480 cmdCmeError(CME_ERR_Unknown);
2481 return ATI_FAIL;
2482 }
2483 src_params->curAtCmd = AT_CMD_CCBS;
2484 }
2485 else
2486 {
2487 ret = AT_CMPL;
2488 }
2489 return (map_aci_2_ati_rslt(ret));
2490
2491 #endif /* no FF_ATI_BAT */
2492 }
2493
2494 GLOBAL T_ATI_RSLT queatPercentCCBS(char *cl, UBYTE srcId)
2495 {
2496 T_ACI_RETURN ret = AT_FAIL;
2497 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id);
2498
2499 TRACE_FUNCTION("queatPercentCCBS()");
2500
2501 ret = qAT_PercentCCBS(srcId);
2502
2503 if( ret NEQ AT_EXCT )
2504 {
2505 cmdCmeError(CME_ERR_Unknown);
2506 return ATI_FAIL;
2507 }
2508 src_params->curAtCmd = AT_CMD_CCBS;
2509 return (map_aci_2_ati_rslt(ret));
2510 }
2511
2512
2513 /*
2514 +--------------------------------------------------------------------+
2515 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD |
2516 | STATE : code ROUTINE : atPlusCMUX |
2517 +--------------------------------------------------------------------+
2518
2519 PURPOSE : +CMUX command (multiplexer)
2520 */
2521 GLOBAL T_ATI_RSLT setatPlusCMUX (char *cl, UBYTE srcId)
2522 {
2523 T_ACI_RETURN ret = AT_FAIL;
2524 SHORT mode = ACI_NumParmNotPresent;
2525 SHORT subset = 0; /* default value */
2526 UBYTE port_speed = NOT_PRESENT_8BIT;
2527 int N1 = 64;
2528 /* default value in advanced mode (other modes not supported */
2529 SHORT T1 = 10; /* (100 ms) */
2530 SHORT N2 = 3;
2531 SHORT T2 = 30; /* (30 ms) */
2532 SHORT T3 = 10; /* (10 s) */
2533 SHORT k = 2;
2534
2535 TRACE_FUNCTION("setatPlusCMUX()");
2536
2537 cl = parse (cl,"rrrdrrrrr",&mode,&subset,&port_speed,&N1,&T1,&N2,&T2,&T3,&k);
2538 if (!cl)
2539 {
2540 cmdCmeError(CME_ERR_OpNotAllow);
2541 return ATI_FAIL;
2542 }
2543
2544 #ifdef DTI
2545 /* values not supported */
2546 if ( mode NEQ 1
2547 OR subset NEQ 0
2548 OR ((port_speed NEQ NOT_PRESENT_8BIT)
2549 AND (convert_mux_port_speed(port_speed) EQ BD_RATE_NotPresent))
2550 OR N1 < 1 OR N1 > 32768
2551 OR T1 < 1 OR T1 > 255
2552 OR N2 < 0 OR N2 > 100
2553 OR T2 < 2 OR T2 > 255
2554 OR T3 < 1 OR T3 > 255
2555 OR k < 1 OR k > 7 )
2556 {
2557 TRACE_EVENT("at least one value is beyond capabilities");
2558 cmdCmeError(CME_ERR_OpNotAllow);
2559 return ATI_FAIL;
2560 }
2561
2562 #ifdef FF_ATI_BAT
2563
2564 {
2565 T_BAT_cmd_send cmd;
2566 T_BAT_cmd_set_plus_cmux cmux;
2567
2568 cmd.ctrl_params=BAT_CMD_SET_PLUS_CMUX;
2569 cmd.params.ptr_set_plus_cmux=&cmux;
2570
2571 cmux.mode=(T_BAT_plus_cmux_mode)mode;
2572 cmux.subset=(T_BAT_plus_cmux_subset)subset;
2573 cmux.port_speed=(T_BAT_plus_cmux_port_speed)port_speed;
2574 cmux.n1=(U16)N1;
2575 cmux.t1=(U8)T1;
2576 cmux.n2=(U8)N2;
2577 cmux.t2=(U8)T2;
2578 cmux.t3=(U8)T3;
2579 cmux.k=(S16)k;
2580
2581 bat_send(ati_bat_get_client(srcId), &cmd);
2582 return(ATI_EXCT);
2583 }
2584
2585 #else /* no FF_ATI_BAT */
2586
2587 ret = sAT_PlusCMUX(srcId,
2588 (UBYTE)mode,
2589 (UBYTE)subset,
2590 port_speed,
2591 (USHORT)N1,
2592 (UBYTE)T1,
2593 (UBYTE)N2,
2594 (UBYTE)T2,
2595 (UBYTE)T3);
2596
2597 #endif /* no FF_ATI_BAT */
2598
2599 #endif /* DTI */
2600
2601 if( ret EQ AT_FAIL )
2602 {
2603 cmdCmeError(CME_ERR_Unknown);
2604 return ATI_FAIL;
2605 }
2606 return ATI_CMPL_NO_OUTPUT;
2607 }
2608
2609 GLOBAL T_ATI_RSLT tesatPlusCMUX (char *cl, UBYTE srcId)
2610 {
2611 TRACE_FUNCTION("tesatPlusCMUX()");
2612
2613 sprintf(g_sa,"+CMUX: %s","(1),(0),(1-5),(10-100),(1-255),(0-100),(2-255),(1-255),(1-7)");
2614 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT);
2615
2616 io_sendConfirm(srcId, cmdAtError(atOk), ATI_NORMAL_OUTPUT);
2617
2618 cmdErrStr = NULL;
2619
2620 return ATI_CMPL_NO_OUTPUT;
2621 }
2622
2623 GLOBAL T_ATI_RSLT queatPlusCMUX (char *cl, UBYTE srcId)
2624 {
2625 T_ACI_RETURN ret = AT_FAIL;
2626 UBYTE mode;
2627 UBYTE subset;
2628 UBYTE port_speed;
2629 USHORT N1;
2630 UBYTE T1;
2631 UBYTE N2;
2632 UBYTE T2;
2633 UBYTE T3;
2634 SHORT k = 2;
2635
2636 TRACE_FUNCTION("queatPlusCMUX()");
2637
2638 #ifdef FF_ATI_BAT
2639 {
2640 T_BAT_cmd_send cmd;
2641 T_BAT_no_parameter dummy;
2642
2643 cmd.ctrl_params = BAT_CMD_QUE_PLUS_CMUX;
2644 dummy.bat_dummy = 0xFF;
2645 cmd.params.ptr_que_plus_cmux = &dummy;
2646 bat_send(ati_bat_get_client(srcId), &cmd);
2647 return(ATI_EXCT);
2648 }
2649 #else /* no FF_ATI_BAT */
2650
2651 #ifdef DTI
2652 ret = qAT_PlusCMUX(srcId,
2653 &mode,
2654 &subset,
2655 &port_speed,
2656 &N1,
2657 &T1,
2658 &N2,
2659 &T2,
2660 &T3);
2661 if (ret EQ AT_CMPL)
2662 {
2663 sprintf(g_sa,"+CMUX: %d,%d,%d,%d,%d,%d,%d,%d,%d", mode, subset, port_speed, N1, T1, N2, T2, T3, k);
2664 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT);
2665 return ATI_CMPL;
2666 }
2667 else if (ret EQ AT_FAIL)
2668 {
2669 cmdCmeError(CME_ERR_Unknown);
2670 }
2671 #endif /* DTI */
2672 return ATI_FAIL;
2673
2674 #endif /* no FF_ATI_BAT */
2675 }
2676
2677 /*
2678 +--------------------------------------------------------------------+
2679 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD |
2680 | STATE : code ROUTINE : atPlusIPR |
2681 +--------------------------------------------------------------------+
2682
2683 PURPOSE : +IPR command (DTE speed setting)
2684 */
2685
2686 GLOBAL T_ATI_RSLT setatPlusIPR(char *cl, UBYTE srcId)
2687 {
2688 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id);
2689 T_ACI_BD_RATE speed;
2690 char *end;
2691
2692 src_params->curAtCmd = AT_CMD_IPR;
2693
2694 switch ( strtol(cl, &end, 10) )
2695 {
2696 case 0: speed = BD_RATE_AUTO; break;
2697 case 75: speed = BD_RATE_75; break;
2698 case 150: speed = BD_RATE_150; break;
2699 case 300: speed = BD_RATE_300; break;
2700 case 600: speed = BD_RATE_600; break;
2701 case 1200: speed = BD_RATE_1200; break;
2702 case 2400: speed = BD_RATE_2400; break;
2703 case 4800: speed = BD_RATE_4800; break;
2704 case 7200: speed = BD_RATE_7200; break;
2705 case 9600: speed = BD_RATE_9600; break;
2706 case 14400: speed = BD_RATE_14400; break;
2707 case 19200: speed = BD_RATE_19200; break;
2708 case 28800: speed = BD_RATE_28800; break;
2709 case 33900: speed = BD_RATE_33900; break;
2710 case 38400: speed = BD_RATE_38400; break;
2711 case 57600: speed = BD_RATE_57600; break;
2712 case 115200: speed = BD_RATE_115200; break;
2713 case 203125: speed = BD_RATE_203125; break;
2714 case 406250: speed = BD_RATE_406250; break;
2715 case 812500: speed = BD_RATE_812500; break;
2716 default:
2717 cmdCmeError(CME_ERR_OpNotSupp);
2718 return ATI_FAIL;
2719 }
2720
2721 #ifdef FF_ATI_BAT
2722 {
2723 T_BAT_cmd_send cmd;
2724 T_BAT_cmd_set_plus_ipr my_bat_set_plus_ipr;
2725
2726 TRACE_FUNCTION("setatPlusIPR() calls bat_send() <=== as APPLICATION");
2727
2728 memset(&my_bat_set_plus_ipr, 0, sizeof(my_bat_set_plus_ipr));
2729 cmd.ctrl_params = BAT_CMD_SET_PLUS_IPR;
2730 cmd.params.ptr_set_plus_ipr = &my_bat_set_plus_ipr;
2731
2732 my_bat_set_plus_ipr.rate = (T_BAT_plus_ipr_rate)speed;
2733
2734 bat_send(ati_bat_get_client(srcId), &cmd);
2735
2736 return ATI_EXCT; /* executing, because response is passed by callback function */
2737 }
2738 #else /* OLD FUNCTION BODY */
2739
2740 TRACE_FUNCTION("setatPlusIPR()");
2741
2742 #ifdef UART
2743
2744 if(!end)
2745 {
2746 cmdCmeError(CME_ERR_OpNotSupp);
2747 return ATI_FAIL;
2748 }
2749
2750 switch ( sAT_PlusIPR(srcId, speed) )
2751 {
2752 case (AT_CMPL): /* operation completed */
2753 return ATI_CMPL_NO_OUTPUT; /* OK was already sent at old baudrate by sAT_PlusIPR,
2754 so must not be sent twice! */
2755 default:
2756 cmdCmeError(CME_ERR_NotPresent);
2757 return ATI_FAIL;
2758 }
2759 #else
2760 cmdCmeError(CME_ERR_NotPresent);
2761 return ATI_FAIL;
2762
2763 #endif /* UART */
2764
2765 #endif /* no FF_ATI_BAT*/
2766 }
2767
2768 GLOBAL T_ATI_RSLT queatPlusIPR(char *cl, UBYTE srcId)
2769 {
2770 T_ACI_BD_RATE rate;
2771 int rate_value;
2772
2773 TRACE_FUNCTION("queatPlusIPR()");
2774 #ifdef DTI
2775 if ( AT_CMPL EQ qAT_PlusIPR(srcId, &rate) )
2776 {
2777 switch ( rate )
2778 {
2779 case BD_RATE_AUTO: rate_value = 0; break;
2780 case BD_RATE_75: rate_value = 75; break;
2781 case BD_RATE_150: rate_value = 150; break;
2782 case BD_RATE_300: rate_value = 300; break;
2783 case BD_RATE_600: rate_value = 600; break;
2784 case BD_RATE_1200: rate_value = 1200; break;
2785 case BD_RATE_2400: rate_value = 2400; break;
2786 case BD_RATE_4800: rate_value = 4800; break;
2787 case BD_RATE_7200: rate_value = 7200; break;
2788 case BD_RATE_9600: rate_value = 9600; break;
2789 case BD_RATE_14400: rate_value = 14400; break;
2790 case BD_RATE_19200: rate_value = 19200; break;
2791 case BD_RATE_28800: rate_value = 28800; break;
2792 case BD_RATE_33900: rate_value = 33900; break;
2793 case BD_RATE_38400: rate_value = 38400; break;
2794 case BD_RATE_57600: rate_value = 57600; break;
2795 case BD_RATE_115200: rate_value = 115200; break;
2796 case BD_RATE_203125: rate_value = 203125; break;
2797 case BD_RATE_406250: rate_value = 406250; break;
2798 case BD_RATE_812500: rate_value = 812500; break;
2799 default: rate_value = 0; break;
2800 }
2801
2802 sprintf(g_sa,"+IPR: %d", rate_value);
2803 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT);
2804 return ATI_CMPL;
2805 }
2806 #endif
2807 cmdAtError(atError);
2808 return 0;
2809 }
2810 /*
2811 +--------------------------------------------------------------------+
2812 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD |
2813 | STATE : code ROUTINE : atPlusICF |
2814 +--------------------------------------------------------------------+
2815
2816 PURPOSE : +ICF command (DTE character frame setting)
2817 */
2818
2819 GLOBAL T_ATI_RSLT setatPlusICF(char *cl, UBYTE srcId)
2820 {
2821 T_ACI_BS_FRM format = BS_FRM_NotPresent;
2822 T_ACI_BS_PAR parity = BS_PAR_NotPresent;
2823 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id);
2824
2825 TRACE_FUNCTION("setatPlusICF()");
2826
2827 cl=parse(cl,"dd",&format,&parity);
2828
2829 if(!cl)
2830 {
2831 cmdAtError(atError);
2832 return ATI_FAIL;
2833 }
2834 #ifdef DTI
2835
2836 #ifdef FF_ATI_BAT
2837
2838 {
2839 T_BAT_cmd_send cmd;
2840 T_BAT_cmd_set_plus_icf icf;
2841
2842 cmd.ctrl_params=BAT_CMD_SET_PLUS_ICF;
2843 cmd.params.ptr_set_plus_icf=&icf;
2844
2845 /*
2846 * This relies on T_ACI_BS_FRM being identical to
2847 * T_BAT_framing_format and T_ACI_BS_PAR being identical
2848 * to T_BAT_framing_parity.
2849 */
2850 icf.framing_format=(T_BAT_framing_format)format;
2851 icf.framing_parity=(T_BAT_framing_parity)parity;
2852
2853 bat_send(ati_bat_get_client(srcId), &cmd);
2854 }
2855
2856 src_params->curAtCmd=AT_CMD_ICF;
2857
2858 return(ATI_EXCT);
2859
2860 #else /* no FF_ATI_BAT */
2861
2862 switch ( sAT_PlusICF(srcId, format, parity) )
2863 {
2864 case (AT_CMPL): /*operation completed*/
2865 return ATI_CMPL;
2866 case (AT_EXCT):
2867 src_params->curAtCmd = AT_CMD_ICF;
2868 return ATI_EXCT;
2869 default:
2870 cmdAtError(atError); /*Command failed*/
2871 return ATI_FAIL;
2872 }
2873
2874 #endif /* no FF_ATI_BAT */
2875
2876 #else
2877 cmdAtError(atError); /*Command failed*/
2878 return ATI_FAIL;
2879 #endif
2880 }
2881
2882 GLOBAL T_ATI_RSLT queatPlusICF(char *cl, UBYTE srcId)
2883 {
2884 #ifndef FF_ATI_BAT
2885 T_ACI_BS_FRM format;
2886 T_ACI_BS_PAR parity;
2887 #endif
2888
2889 TRACE_FUNCTION("queatPlusICF()");
2890
2891 #ifdef DTI
2892
2893 #ifdef FF_ATI_BAT
2894 {
2895 T_BAT_cmd_send cmd;
2896 T_BAT_no_parameter dummy;
2897
2898 cmd.ctrl_params = BAT_CMD_QUE_PLUS_ICF;
2899 dummy.bat_dummy = 0xFF;
2900 cmd.params.ptr_que_plus_icf = &dummy;
2901 bat_send(ati_bat_get_client(srcId), &cmd);
2902 return(ATI_EXCT);
2903 }
2904 #else /* no FF_ATI_BAT */
2905
2906 switch ( qAT_PlusICF(srcId,&format,&parity) )
2907 {
2908 case AT_CMPL:
2909 if (format EQ BS_FRM_Dat8_Par1_St1 || format EQ BS_FRM_Dat7_Par1_St1 )
2910 {
2911 resp_disp(srcId, cl,"ee",&format,&parity);
2912 }
2913 else
2914 {
2915 resp_disp(srcId, cl,"e",&format);
2916 }
2917 return ATI_CMPL;
2918 }
2919
2920 #endif /* no FF_ATI_BAT */
2921
2922 #endif /* DTI */
2923 cmdAtError(atError);
2924 return ATI_FAIL;
2925 }
2926
2927 GLOBAL T_ATI_RSLT setflowCntr(CHAR* cl, UBYTE srcId)
2928 {
2929 T_ACI_RX_FLOW_CTRL DCE_by_DTE = RX_FLOW_NotPresent; /* by TE: Rx flow control */
2930 T_ACI_RX_FLOW_CTRL DTE_by_DCE = TX_FLOW_NotPresent; /* by TA: Tx flow control */
2931
2932 cl = parse (cl,"dd",&DCE_by_DTE,&DTE_by_DCE);
2933
2934 if(!cl)
2935 {
2936 cmdAtError(atError);
2937 return ATI_FAIL;
2938 }
2939
2940 #ifdef DTI
2941 switch ( sAT_PlusIFC(srcId, DCE_by_DTE, DTE_by_DCE) )
2942 {
2943 case (AT_CMPL): /*operation completed*/
2944 return ATI_CMPL;
2945 case (AT_EXCT):
2946 /* ATTENTION: no setting of 'curAtCmd' allowed because the value is set before */
2947 return ATI_EXCT;
2948 default:
2949 cmdAtError(atError); /*Command failed*/
2950 return ATI_FAIL;
2951 }
2952 #else
2953 cmdAtError(atError); /*Command failed*/
2954 return ATI_FAIL;
2955 #endif
2956 }
2957
2958 /*
2959 +--------------------------------------------------------------------+
2960 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD |
2961 | STATE : code ROUTINE : atPlusIFC |
2962 +--------------------------------------------------------------------+
2963
2964 PURPOSE : +IFC command (DTE DCE / DCE DTE flow control)
2965 */
2966
2967 GLOBAL T_ATI_RSLT setatPlusIFC(char *cl, UBYTE srcId)
2968 {
2969 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id);
2970 TRACE_FUNCTION("setatPlusIFC()");
2971
2972 src_params->curAtCmd = AT_CMD_IFC;
2973 return setflowCntr(cl, srcId);
2974 }
2975
2976
2977 GLOBAL T_ATI_RSLT queflowCntr(CHAR* cl, UBYTE srcId)
2978 {
2979 T_ACI_RX_FLOW_CTRL DCE_by_DTE;
2980 T_ACI_RX_FLOW_CTRL DTE_by_DCE;
2981 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id);
2982
2983 #ifdef DTI
2984 if ( AT_CMPL EQ qAT_PlusIFC(srcId,&DCE_by_DTE,&DTE_by_DCE) )
2985 {
2986 #ifdef FF_FAX
2987 if (src_params->curAtCmd EQ AT_CMD_FLO)
2988 {
2989 sprintf(g_sa,"+FLO: %d",DCE_by_DTE);
2990 }
2991 else
2992 #endif
2993 if (src_params->curAtCmd EQ AT_CMD_IFC)
2994 {
2995 sprintf(g_sa,"+IFC: %d,%d",DCE_by_DTE,DTE_by_DCE);
2996 }
2997
2998 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT);
2999 return ATI_CMPL;
3000 }
3001 else
3002 {
3003 cmdAtError(atError);
3004 return ATI_FAIL;
3005 }
3006 #else
3007 cmdAtError(atError);
3008 return ATI_FAIL;
3009 #endif
3010 }
3011
3012 /*
3013 +--------------------------------------------------------------------+
3014 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD |
3015 | STATE : code ROUTINE : atPlusIFC |
3016 +--------------------------------------------------------------------+
3017
3018 PURPOSE : +IFC command (DTE DCE / DCE DTE flow control)
3019 */
3020
3021 GLOBAL T_ATI_RSLT queatPlusIFC(char *cl, UBYTE srcId)
3022 {
3023 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id);
3024 TRACE_FUNCTION("queatPlusIFC()");
3025
3026 src_params->curAtCmd = AT_CMD_IFC;
3027 return queflowCntr(cl, srcId);
3028 }
3029
3030 /*
3031 +--------------------------------------------------------------------+
3032 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD |
3033 | STATE : code ROUTINE : atPlusILRR |
3034 +--------------------------------------------------------------------+
3035
3036 PURPOSE : +ILRR command (display +ILRR setting)
3037 */
3038
3039 GLOBAL T_ATI_RSLT setatPlusILRR(char *cl, UBYTE srcId)
3040 {
3041 SHORT val=-1;
3042
3043 TRACE_FUNCTION("setatPLusILRR()");
3044
3045 cl = parse (cl,"r",&val);
3046 if(!cl OR val > 1 OR val < 0)
3047 {
3048 cmdAtError(atError);
3049 return ATI_FAIL;
3050 }
3051 ati_user_output_cfg[srcId].ILRR_stat=(UBYTE)val;
3052 return ATI_CMPL;
3053 }
3054
3055 GLOBAL T_ATI_RSLT queatPlusILRR(char *cl, UBYTE srcId)
3056 {
3057 TRACE_FUNCTION("queatPLusILRR()");
3058
3059 resp_disp(srcId, cl,"b",&ati_user_output_cfg[srcId].ILRR_stat);
3060 return ATI_CMPL;
3061 }
3062
3063 /*
3064 +--------------------------------------------------------------------+
3065 | PROJECT : MODULE : ACI_CMD |
3066 | STATE : code ROUTINE : setatPlusCCLK |
3067 +--------------------------------------------------------------------+
3068
3069 PURPOSE : +CCLK command (Set the real time clock of the MT)
3070 */
3071 GLOBAL T_ATI_RSLT setatPlusCCLK (char *cl, UBYTE srcId)
3072 {
3073 T_ACI_RETURN ret = AT_FAIL;
3074 T_ACI_RTC_DATE date_s;
3075 T_ACI_RTC_TIME time_s;
3076 char date_time_string[DATE_TIME_LENGTH+1]={0};
3077
3078 int days, months, items_conv;
3079 int hrs, mins, secs;
3080 int years;
3081 int timeZone = 0;
3082 char sign = '+';
3083
3084 TRACE_FUNCTION("setatPlusCCLK()");
3085
3086 cl=parse(cl,"s", DATE_TIME_LENGTH, date_time_string);
3087
3088 if(!cl )
3089 {
3090 cmdCmeError(CME_ERR_OpNotAllow);
3091 return (ATI_FAIL);
3092 }
3093
3094 TRACE_EVENT_P1("Date and time are: %s",date_time_string);
3095
3096 items_conv = sscanf( date_time_string, "%d/%d/%d,%d:%d:%d%c%d",&years,&months,&days,&hrs,&mins,&secs,&sign,&timeZone );
3097
3098 if (sign == '-')
3099 {
3100 timeZone = timeZone * (-1);
3101 }
3102
3103 TRACE_EVENT_P1("items_conv %d",items_conv);
3104 TRACE_EVENT_P1("days %d",days);
3105 TRACE_EVENT_P1("months %d",months);
3106 TRACE_EVENT_P1("years %d",years);
3107 TRACE_EVENT_P1("hours %d",hrs);
3108 TRACE_EVENT_P1("mins %d",mins);
3109 TRACE_EVENT_P1("secs %d",secs);
3110 TRACE_EVENT_P1("sign %c",sign);
3111 TRACE_EVENT_P1("timeZone %d",timeZone);
3112
3113
3114 /* If 8 data items not extracted from date_time_string then date_time_string data with TZ info is incorrect. */
3115 if ( items_conv != 8 )
3116 {
3117 cmdCmeError(CME_ERR_OpNotAllow);
3118 return (ATI_FAIL);
3119 }
3120
3121 #ifndef _SIMULATION_
3122 /* Ensure 'years' passed in from the AT command is not in 4 digit format
3123 The spec requires the years to be passed in in 2 digit format
3124 Also ensure the sign char is either a '+' or '-' */
3125 if ( (years < 0) || (years > 99 ) ||
3126 ((sign != '-') && (sign != '+')) ||
3127 (timeZone < (-48)) || (timeZone > 48)
3128 )
3129 {
3130 cmdCmeError(CME_ERR_OpNotAllow);
3131 return (ATI_FAIL);
3132 }
3133 #else /* _SIMULATION_ */
3134 /* On the target code these checks are done in the RTC code. In the simulation code-
3135 the RTC routines are not used so these checks have to be done. */
3136 if ( (years < 0) || (years > 99)
3137 || (months < 1) || (months > 12)
3138 || (days < 1) || (days > 31)
3139 || (hrs < 0) || (hrs > 23)
3140 || (mins < 0) || (mins > 59)
3141 || (secs < 0) || (secs > 59)
3142 || (timeZone < (-48)) || (timeZone > 48)
3143 )
3144 {
3145 cmdCmeError(CME_ERR_OpNotAllow);
3146 return (ATI_FAIL);
3147 }
3148 #endif /* _SIMULATION_ */
3149
3150
3151 /* Populate date time structs */
3152 date_s.day = days;
3153 date_s.month = months;
3154 date_s.year = years + 2000; /* Convert years to 4 digit format for passing to lower layer RTC function */
3155 time_s.hour = hrs;
3156 time_s.minute = mins;
3157 time_s.PM_flag = 0;
3158 time_s.second = secs;
3159 time_s.format = TIME_FORMAT_24HOUR;
3160
3161 /* Pass separated date and time and timezone info to set the clock */
3162
3163 #ifdef FF_ATI_BAT
3164
3165 {
3166 T_BAT_cmd_send cmd;
3167 T_BAT_cmd_set_plus_cclk cclk;
3168
3169 cmd.ctrl_params=BAT_CMD_SET_PLUS_CCLK;
3170 cmd.params.ptr_set_plus_cclk=&cclk;
3171
3172 cclk.year=(U8)date_s.year;
3173 cclk.month=(U8)date_s.month;
3174 cclk.day=(U8)date_s.day;
3175
3176 cclk.hour=(U8)time_s.hour;
3177
3178 cclk.minutes=(U8)time_s.minute;
3179 cclk.seconds=(U8)time_s.second;
3180
3181 cclk.time_zone=(S8)timeZone;
3182
3183 bat_send(ati_bat_get_client(srcId), &cmd);
3184 }
3185
3186 return(ATI_EXCT);
3187
3188 #else /* no FF_ATI_BAT */
3189
3190 ret = sAT_PlusCCLK ( srcId, &date_s, &time_s, timeZone);
3191
3192 TRACE_EVENT_P1("sAT_PlusCCLK ret = %d", ret);
3193
3194 /* Deal with return value */
3195
3196 switch (ret)
3197 {
3198 case (AT_CMPL): /*operation completed*/
3199 break;
3200
3201 default:
3202 cmdCmeError(CME_ERR_Unknown); /*Command failed*/
3203 break;
3204 }
3205 return (map_aci_2_ati_rslt(ret));
3206
3207 #endif /* no FF_ATI_BAT */
3208 }
3209
3210 /*
3211 +--------------------------------------------------------------------+
3212 | PROJECT : MODULE : ACI_CMD |
3213 | STATE : code ROUTINE : queatPlusCCLK |
3214 +--------------------------------------------------------------------+
3215
3216 PURPOSE : +CCLK query command (Read the real time clock of the MT)
3217 */
3218 GLOBAL T_ATI_RSLT queatPlusCCLK (char *cl, UBYTE srcId)
3219 {
3220 #ifndef FF_ATI_BAT
3221 T_ACI_RETURN ret = AT_FAIL;
3222 T_ACI_RTC_DATE date_s; /* Structures to obtain date time info */
3223 T_ACI_RTC_TIME time_s;
3224 char date_time_string[DATE_TIME_LENGTH+1]={0};
3225 UBYTE days, months;
3226 UBYTE hrs, mins, secs, count;
3227 USHORT years;
3228 char sign ;
3229 int tz ;
3230 char *me="+CCLK: ";
3231 #endif
3232
3233 TRACE_FUNCTION("queatPlusCCLK()");
3234
3235 #ifdef FF_ATI_BAT
3236 {
3237 T_BAT_cmd_send cmd;
3238 T_BAT_no_parameter dummy;
3239
3240 cmd.ctrl_params=BAT_CMD_QUE_PLUS_CCLK;
3241 dummy.bat_dummy = 0xFF;
3242 cmd.params.ptr_que_plus_cclk = &dummy;
3243 bat_send(ati_bat_get_client(srcId), &cmd);
3244 return(ATI_EXCT);
3245 }
3246 #else /* no FF_ATI_BAT */
3247
3248 ret = qAT_PlusCCLK( srcId, &date_s, &time_s, &tz);
3249
3250 if (ret EQ AT_CMPL)
3251 {
3252 /* Command completed successfully */
3253 /* convert time date struct data into string */
3254 days = date_s.day;
3255 months = date_s.month;
3256 years = date_s.year;
3257 hrs = time_s.hour;
3258 mins = time_s.minute;
3259 secs = time_s.second;
3260
3261 #ifndef _SIMULATION_
3262 #ifdef FF_TIMEZONE
3263 if ( tz < 0)
3264 {
3265 sign = '-';
3266 tz = tz * (-1);
3267 }
3268 else
3269 sign = '+';
3270 #endif /* FF_TIMEZONE */
3271 #else /* _SIMULATION_ */
3272 sign = '-';
3273 tz = tz * (-1);
3274 #endif /* _SIMULATION_ */
3275
3276 /* Convert years to 2 digit format for reporting back to user */
3277 years = years - 2000; /* Subtract 2000 years from number returned */
3278
3279 TRACE_EVENT_P3("Date -> %d - %d - %d",days,months,years);
3280 TRACE_EVENT_P3("Time -> %d - %d - %d",hrs,mins,secs);
3281 /* Not using time_s.format or time_s.PM_flag */
3282
3283 /* CONVERT DATE TIME INFO INTO STRING FOR OUTPUTTING BACK TO DISPLAY */
3284
3285 #ifndef _SIMULATION_
3286
3287 #ifndef FF_TIMEZONE
3288 count = sprintf(date_time_string, "%s\"%d/%d/%d,%d:%d:%d\"", me, years, months, days, hrs, mins, secs);
3289 #else /* FF_TIMEZONE */
3290 TRACE_EVENT_P2("TimeZone -> %c%d", sign, tz);
3291 count = sprintf(date_time_string, "%s\"%d/%d/%d,%d:%d:%d%c%d\"", me, years, months, days, hrs, mins, secs, sign, tz);
3292 #endif /* FF_TIMEZONE */
3293
3294 #else /* _SIMULATION_ */
3295 TRACE_EVENT_P2("TimeZone -> %c%d", sign, tz);
3296 count = sprintf(date_time_string, "%s\"%d/%d/%d,%d:%d:%d%c%d\"", me, years, months, days, hrs, mins, secs, sign, tz);
3297 #endif /* _SIMULATION_ */
3298
3299 /* REPORT DATE TIME INFO STRING */
3300 io_sendMessage(srcId, date_time_string, ATI_NORMAL_OUTPUT);
3301
3302 return ATI_CMPL;
3303 }
3304 else
3305 {
3306 cmdCmeError(CME_ERR_Unknown);
3307 return ATI_FAIL;
3308 }
3309
3310 #endif /* no FF_ATI_BAT */
3311
3312 }
3313 #endif /* ATI_BAS_C */
3314