comparison gsm-fw/g23m-aci/aci/ati_cc.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 Interpreter: Call Control related commands.
18 +-----------------------------------------------------------------------------
19 */
20 #ifndef ATI_CC_C
21 #define ATI_CC_C
22
23 #undef DUMMY_ATI_STRINGS
24
25 #include "aci_all.h"
26
27 #include "aci_cmh.h"
28 #include "ati_cmd.h"
29 #include "aci_io.h"
30 #include "aci_cmd.h"
31 #include "l4_tim.h"
32 #include "aci_lst.h"
33
34 #include "aci_cmh.h"
35 #include "ati_cmd.h"
36 #include "aci_io.h"
37 #include "aci_cmd.h"
38
39 #include "aci.h"
40 #include "l4_tim.h"
41 #include "aci_mem.h"
42 #include "aci_prs.h"
43
44 #include "aci_lst.h"
45 #include "ati_int.h"
46
47 #ifdef FF_ATI_BAT
48
49 #include "typedefs.h"
50 #include "gdd.h"
51 #include "bat.h"
52
53 #include "ati_bat.h"
54
55 #endif /* FF_ATI_BAT */
56
57 /*
58 +--------------------------------------------------------------------+
59 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD |
60 | STATE : code ROUTINE : cleanDialStr |
61 +--------------------------------------------------------------------+
62
63 PURPOSE : This function removes all invalid or unsupported characters
64 from the null terminated dial string.
65
66 */
67
68 LOCAL void cleanDialStr( CHAR * dialStr )
69 {
70 USHORT i,j,k = 0;
71 USHORT dialLen, charLen;
72 CHAR *valChrs = "0123456789*#+-ABCDPpWw";
73 UBYTE match = FALSE;
74
75 dialLen = strlen(dialStr );
76 charLen = strlen(valChrs );
77
78 for (i=0;i<dialLen;i++)
79 {
80 match=FALSE;
81
82 for (j=0;j<charLen;j++)
83 {
84 if (dialStr[i] EQ valChrs[j])
85 {
86 match = TRUE;
87 break;
88 }
89 }
90
91 if (match)
92 {
93 dialStr[k] = dialStr[i];
94 k++;
95 }
96 }
97
98 dialStr[k] = 0x0;
99 }
100
101 /*
102 +--------------------------------------------------------------------+
103 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD |
104 | STATE : code ROUTINE : |
105 +--------------------------------------------------------------------+
106
107 PURPOSE : D (dial command)
108 */
109
110 #define NAME_BUF_LEN 32
111 #define DIAL_BUF_LEN (MAX_DIAL_LEN-1)
112
113 GLOBAL T_ATI_RSLT atD (char *cl, UBYTE srcId)
114 {
115 T_ACI_RETURN ret = AT_FAIL;
116 char alpha [NAME_BUF_LEN] = {'\0'};
117 USHORT lenAlpha = 0;
118 char cvtdAlpha[NAME_BUF_LEN] = {'\0'};
119 USHORT lenCvtdAlpha = 0;
120 char t [DIAL_BUF_LEN] = {'\0'};
121 char* t_p = NULL;
122 USHORT pos = 0;
123 SHORT index = -1;
124
125 T_ACI_PB_STOR mem_stor = PB_STOR_NotPresent;
126 T_ACI_D_CLIR_OVRD clir_ovrd = D_CLIR_OVRD_Default;
127 T_ACI_D_CUG_CTRL cug_ctrl = D_CUG_CTRL_NotPresent;
128 T_ACI_D_TOC call_type = D_TOC_Data;
129 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id);
130
131 src_params->curAtCmd = AT_CMD_D;
132
133 #ifdef FF_ATI_BAT
134 {
135 T_BAT_cmd_send cmd;
136 T_BAT_cmd_at_d bat_dial;
137
138 cmd.ctrl_params = BAT_CMD_AT_D;
139 cmd.params.ptr_at_d = &bat_dial;
140
141 #pragma message(__TODO__"atD(): check for UCS2 dial string before bat_send()")
142
143 bat_dial.c_dial_string = strlen(cl);
144 if (bat_dial.c_dial_string)
145 {
146 memcpy (bat_dial.dial_string, (U8 *)cl, bat_dial.c_dial_string);
147
148 TRACE_FUNCTION("atD() calls bat_send() <=== as APPLICATION");
149
150 bat_send(ati_bat_get_client(srcId), &cmd);
151 cmdErrStr = NULL;
152 srcId_cb = srcId;
153 rCI_PlusCCWV (CCWV_CHRG_NotPresent);
154 return (ATI_EXCT); /* executing, because response is passed by callback function */
155 }
156 else
157 {
158 cmdCmeError(CME_ERR_OpNotAllow);
159 return (ATI_FAIL);
160 }
161 }
162 #else /* no FF_ATI_BAT */
163 {
164 BOOL Book_Dial;
165 U16 i;
166 #ifdef NO_ASCIIZ
167 T_ACI_PB_TEXT pbText;
168 #endif
169
170 TRACE_FUNCTION("atD()");
171
172 t_p=t;
173 if (*cl EQ '>') /*call from Phonebook*/
174 {
175 Book_Dial=TRUE;
176 cl++;
177 if(*cl EQ '"') /*origin call to name given by string */
178 {
179 cl=parse(cl,"z",
180 (LONG)NAME_BUF_LEN,
181 strlen(cl),
182 cl,
183 &lenAlpha,
184 alpha);
185 if (cl EQ NULL)
186 {
187 cmdCmeError(CME_ERR_OpNotAllow);
188 return (ATI_FAIL);
189 }
190 else if (strcspn(cl,"iIgG;") NEQ 0)
191 {
192 cmdCmeError(CME_ERR_OpNotAllow);
193 return (ATI_FAIL);
194 }
195 srcId_cb = srcId;
196 #ifdef NO_ASCIIZ
197 utl_chsetToSim ( (UBYTE*)alpha,
198 lenAlpha,
199 (UBYTE*)cvtdAlpha,
200 &lenCvtdAlpha,
201 GSM_ALPHA_Def );
202 #else /* #ifdef NO_ASCIIZ */
203 utl_chsetToGsm ( (UBYTE*)alpha,
204 lenAlpha,
205 (UBYTE*)cvtdAlpha,
206 &lenCvtdAlpha,
207 #ifdef REL99
208 sizeof(cvtdAlpha),
209 #endif
210 GSM_ALPHA_Int);
211 #endif /* #ifdef NO_ASCIIZ */
212 t_p = cvtdAlpha;
213 }
214 else
215 {
216 /* call using phonebook with pb specified*/
217 if ((toupper(*cl)) >= 65 AND (toupper(*cl)) <= 90)
218 {
219 for (i=0;phb_mem_names[i].name != 0;i++)
220 {
221 strupper(cl);
222 if (strncmp(cl,phb_mem_names[i].name,2) EQ 0)
223 {
224 mem_stor=phb_mem_names[i].stor;
225 break;
226 }
227 else mem_stor=PB_STOR_NotPresent;
228 }
229 if (mem_stor < 0)
230 {
231 cmdCmeError(CME_ERR_OpNotAllow);
232 return (ATI_FAIL);
233 }
234 cl=cl+2;
235 }
236 pos=strcspn(cl,"iIgG;"); /* determine index */
237 if (pos EQ 0 OR pos >= DIAL_BUF_LEN)
238 {
239 TRACE_EVENT("incorrect strspn");
240 cmdCmeError(CME_ERR_OpNotAllow);
241 return (ATI_FAIL);
242 }
243 strncpy(t,cl,pos);
244 cl=cl+pos;
245 index =(SHORT)atoi(t);
246
247 if(!index OR index > 300)
248 {
249 cmdCmeError(CME_ERR_OpNotAllow);
250 return (ATI_FAIL);
251 }
252 t_p = NULL;
253 }
254 }
255 else
256 {
257 Book_Dial=FALSE;
258 pos=strcspn(cl,"iIgG;");
259 if(pos >= DIAL_BUF_LEN)
260 {
261 cmdCmeError(CME_ERR_OpNotAllow);
262 return (ATI_FAIL);
263 }
264 if (pos)
265 {
266 strncpy(t,cl,pos);
267 cl=cl+pos;
268 t[pos]='\0';
269 }
270 else
271 {
272 if(strlen(cl) >= DIAL_BUF_LEN)
273 {
274 cmdCmeError(CME_ERR_OpNotAllow);
275 return (ATI_FAIL);
276 }
277 strcpy(t,cl);
278 }
279
280 cleanDialStr(t);
281 if (t[0] EQ '\0')
282 t_p=NULL;
283 }
284
285 if (*cl EQ 'i')
286 {
287 clir_ovrd=D_CLIR_OVRD_Supp;
288 cl++;
289 }
290 if (*cl EQ 'I')
291 {
292 clir_ovrd=D_CLIR_OVRD_Invoc;
293 cl++;
294 }
295 if (*cl EQ 'g'OR *cl EQ 'G')
296 {
297 cug_ctrl=D_CUG_CTRL_Present;
298 cl++;
299 }
300 if (*cl EQ ';')
301 {
302 call_type=D_TOC_Voice;
303 cl++;
304 }
305 if (*cl NEQ '\0')
306 {
307 cmdCmeError(CME_ERR_InvDialChar);
308 return (ATI_FAIL);
309 }
310
311 if(Book_Dial)
312 {
313 #ifdef NO_ASCIIZ
314 if ( t_p NEQ NULL )
315 {
316 pbText.cs = CS_Sim;
317 pbText.len = (UBYTE)lenCvtdAlpha;
318 memcpy( pbText.data, t_p, pbText.len );
319 }
320 else
321 {
322 pbText.cs = CS_NotPresent;
323 pbText.len = 0;
324 }
325 ret = sAT_Dm( (T_ACI_CMD_SRC)srcId, &pbText, mem_stor, index, clir_ovrd,
326 cug_ctrl, call_type );
327 #else /* #ifdef NO_ASCIIZ */
328 ret = sAT_Dm( srcId, t_p, mem_stor, index, clir_ovrd,
329 cug_ctrl, call_type );
330 #endif /* #ifdef NO_ASCIIZ */
331 }
332 else
333 {
334 ret=sAT_Dn((T_ACI_CMD_SRC)srcId,t_p,clir_ovrd,cug_ctrl,call_type);
335 }
336
337 if (ret EQ AT_EXCT)
338 {
339 if (call_type EQ D_TOC_Voice AND
340 at.flags.COLP_stat NEQ 1 )
341 {
342 cmdErrStr = NULL;
343 }
344 else
345 {
346 src_params->curAtCmd = AT_CMD_D;
347 }
348 srcId_cb = srcId;
349 rCI_PlusCCWV ( CCWV_CHRG_NotPresent );
350
351 return (ATI_EXCT);
352 }
353 else if( ret EQ AT_CMPL )
354 {
355 srcId_cb = srcId;
356 rCI_OK (AT_CMD_D);
357 return (ATI_CMPL_NO_OUTPUT);
358 }
359 else
360 {
361 cmdCmeError(CME_ERR_Unknown);
362 return (ATI_FAIL);
363 }
364 }
365 #endif /* no FF_ATI_BAT */
366 }
367
368
369 /*
370 +--------------------------------------------------------------------+
371 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD |
372 | STATE : code ROUTINE : atA |
373 +--------------------------------------------------------------------+
374
375 PURPOSE : A command (Answer a call)
376 */
377
378 GLOBAL T_ATI_RSLT atA(char *cl, UBYTE srcId)
379 {
380 T_ACI_RETURN ret = AT_FAIL;
381 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id);
382
383 #ifdef FF_ATI_BAT
384 T_BAT_cmd_send cmd;
385 T_BAT_no_parameter dummy;
386
387 TRACE_FUNCTION("atA() calls bat_send() <=== as APPLICATION");
388
389 cmd.ctrl_params = BAT_CMD_AT_A;
390 dummy.bat_dummy = 0xFF;
391 cmd.params.ptr_at_a = &dummy;
392
393 if( at.rngPrms.isRng EQ TRUE )
394 {
395 ati_stop_ring();
396 }
397 src_params->curAtCmd = AT_CMD_A;
398
399 bat_send(ati_bat_get_client(srcId), &cmd);
400
401 return (ATI_EXCT); /* executing, because response is passed by callback function */
402
403 #else /* no FF_ATI_BAT */
404
405 TRACE_FUNCTION("atA()");
406
407 if(*cl NEQ '\0')
408 {
409 cmdAtError(atError);
410 }
411 else
412 {
413 ret=sAT_A((T_ACI_CMD_SRC)srcId);
414 if (ret EQ AT_EXCT)
415 {
416 if( at.rngPrms.isRng EQ TRUE )
417 {
418 ati_stop_ring();
419 }
420 src_params->curAtCmd = AT_CMD_A;
421 }
422 else
423 {
424 cmdAtError(atError);
425 }
426 }
427 return (map_aci_2_ati_rslt(ret));
428
429 #endif /* no FF_ATI_BAT */
430 }
431
432 /*
433 +--------------------------------------------------------------------+
434 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD |
435 | STATE : code ROUTINE : atH |
436 +--------------------------------------------------------------------+
437
438 PURPOSE : H command (Hangs up single mode call)
439 */
440 GLOBAL T_ATI_RSLT atH(char *cl, UBYTE srcId)
441 {
442 T_ACI_RETURN ret = AT_FAIL;
443 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id);
444
445 #ifdef FF_ATI_BAT
446 T_BAT_cmd_send cmd;
447 T_BAT_no_parameter dummy;
448 cmd.ctrl_params = BAT_CMD_AT_H;
449 dummy.bat_dummy = 0xFF;
450 cmd.params.ptr_at_h = &dummy;
451
452 TRACE_FUNCTION("atH() calls bat_send() <=== as APPLICATION");
453
454 if( at.rngPrms.isRng EQ TRUE )
455 {
456 ati_stop_ring();
457 }
458 src_params->curAtCmd = AT_CMD_H;
459
460 bat_send(ati_bat_get_client(srcId), &cmd);
461
462 return (ATI_EXCT); /* executing, because response is passed by callback function */
463 #else /* no FF_ATI_BAT */
464
465 TRACE_FUNCTION("atH()");
466
467 if (*cl EQ '0' OR *cl EQ '\0')
468 {
469 if (*cl EQ '0')
470 {
471 cl++;
472 }
473
474 ret=sAT_H((T_ACI_CMD_SRC)srcId);
475 if (ret EQ AT_EXCT)
476 {
477 if( at.rngPrms.isRng EQ TRUE )
478 {
479 ati_stop_ring();
480 }
481 src_params->curAtCmd = AT_CMD_H;
482 }
483 else
484 {
485 cmdAtError(atError);
486 }
487 }
488 else
489 {
490 cmdAtError(atError);
491 }
492 return (map_aci_2_ati_rslt(ret));
493
494 #endif /* no FF_ATI_BAT */
495 }
496
497 #ifdef FAX_AND_DATA
498 /*
499 +--------------------------------------------------------------------+
500 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD |
501 | STATE : code ROUTINE : atPlusCBST |
502 +--------------------------------------------------------------------+
503
504 PURPOSE : +CBST command (Select Bearer Service Type)
505 */
506
507 GLOBAL T_ATI_RSLT setatPlusCBST(char *cl, UBYTE srcId)
508 {
509 T_ACI_BS_SPEED speed = BS_SPEED_NotPresent;
510 T_ACI_CBST_NAM name = CBST_NAM_NotPresent;
511 T_ACI_CBST_CE ce = CBST_CE_NotPresent;
512 T_ACI_RETURN ret = AT_FAIL;
513
514 cl = parse(cl, "ddd", &speed, &name, &ce);
515 if(!cl )
516 {
517 cmdCmeError(CME_ERR_OpNotAllow);
518 return (ATI_FAIL);
519 }
520
521 #ifdef FF_ATI_BAT
522 {
523 T_BAT_cmd_send cmd;
524 T_BAT_cmd_set_plus_cbst my_bat_set_plus_cbst;
525
526 TRACE_FUNCTION("setatPlusCBST() calls bat_send() <=== as APPLICATION");
527
528 memset(&my_bat_set_plus_cbst, 0, sizeof(my_bat_set_plus_cbst));
529 cmd.ctrl_params = BAT_CMD_SET_PLUS_CBST;
530 cmd.params.ptr_set_plus_cbst = &my_bat_set_plus_cbst;
531
532 my_bat_set_plus_cbst.speed = speed;
533 my_bat_set_plus_cbst.name = name;
534 my_bat_set_plus_cbst.ce = ce;
535 bat_send(ati_bat_get_client(srcId), &cmd);
536
537 return ATI_EXCT; /* executing, because response is passed by callback function */
538 }
539 #else /* OLD FUNCTION BODY */
540
541 TRACE_FUNCTION("atPLusCBST()");
542 {
543 ret = sAT_PlusCBST((T_ACI_CMD_SRC)srcId,speed,name,ce);
544 }
545 if (ret EQ AT_FAIL)
546 {
547 cmdCmeError(CME_ERR_OpNotAllow);
548 return (ATI_FAIL);
549 }
550 return (ATI_CMPL);
551
552 #endif /* no FF_ATI_BAT*/
553 }
554
555 GLOBAL T_ATI_RSLT queatPlusCBST(char *cl, UBYTE srcId)
556 {
557 T_ACI_BS_SPEED speed = BS_SPEED_NotPresent;
558 T_ACI_CBST_NAM name = CBST_NAM_NotPresent;
559 T_ACI_CBST_CE ce = CBST_CE_NotPresent;
560 T_ACI_RETURN ret = AT_FAIL;
561
562 TRACE_FUNCTION("atPLusCBST()");
563
564 ret = qAT_PlusCBST((T_ACI_CMD_SRC)srcId,&speed,&name,&ce);
565 if (ret EQ AT_CMPL)
566 {
567 resp_disp(srcId, cl,"eee",&speed,&name,&ce);
568 }
569 else
570 {
571 cmdCmeError(CME_ERR_OpNotAllow); /* AT_FAIL, AT_EXCT, AT_BUSY ??? */
572 return (ATI_FAIL);
573 }
574 return (ATI_CMPL);
575
576 }
577 #endif /* FAX_AND_DATA */
578
579 /*
580 PURPOSE : Change some AT interface output configuration
581 (+CRC +CR +CLIP +COLP)
582 */
583 GLOBAL T_ATI_RSLT GenAtCR_C( CHAR *cl, UBYTE srcId, T_ACI_AT_CMD cmd )
584 {
585 UBYTE x = 0;
586
587 switch(*cl)
588 {
589 case('0'):
590 case('1'):
591 /* value ok */
592 break;
593 default:
594 cmdCmeError(CME_ERR_OpNotAllow);
595 return (ATI_FAIL);
596 }
597
598 x = *cl - '0';
599 cl++;
600
601 switch(cmd)
602 {
603 case( AT_CMD_CRC ):
604 ati_user_output_cfg[srcId].CRC_stat = x;
605 return (ATI_CMPL);
606 case( AT_CMD_CR ):
607 ati_user_output_cfg[srcId].CR_stat = x;
608 return (ATI_CMPL);
609 case( AT_CMD_CLIP ):
610 ati_user_output_cfg[srcId].CLIP_stat = x;
611 return (ATI_CMPL);
612 case( AT_CMD_CDIP ):
613 ati_user_output_cfg[srcId].CDIP_stat = x;
614 return (ATI_CMPL);
615 case( AT_CMD_COLP ):
616 at.flags.COLP_stat = x;
617 return (ATI_CMPL);
618 }
619
620 cmdCmeError(CME_ERR_OpNotAllow);
621 return (ATI_FAIL);
622 }
623
624 #ifdef FF_TTY
625 /*
626 +--------------------------------------------------------------------+
627 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD |
628 | STATE : code ROUTINE : atPercentCTTY |
629 +--------------------------------------------------------------------+
630
631 PURPOSE : %CTTY command (handle CTM/TTY service)
632 */
633
634 GLOBAL T_ATI_RSLT setatPercentCTTY (char *cl, UBYTE srcId)
635 {
636 T_ACI_CTTY_MOD mode = CTTY_MOD_NotPresent;
637 T_ACI_CTTY_REQ req = CTTY_REQ_NotPresent;
638
639 cl = parse (cl, "dd", &mode, &req);
640
641 if (!cl)
642 {
643 cmdCmeError(CME_ERR_OpNotAllow);
644 return (ATI_FAIL);
645 }
646
647 #ifdef FF_ATI_BAT
648 {
649 T_BAT_cmd_send cmd;
650 T_BAT_cmd_set_percent_ctty my_bat_set_percent_ctty;
651
652 TRACE_FUNCTION("setatPercentCTTY() calls bat_send() <=== as APPLICATION");
653
654 memset(&my_bat_set_percent_ctty, 0, sizeof(my_bat_set_percent_ctty));
655 cmd.ctrl_params = BAT_CMD_SET_PERCENT_CTTY;
656 cmd.params.ptr_set_percent_ctty = &my_bat_set_percent_ctty;
657
658 my_bat_set_percent_ctty.req = req;
659
660 bat_send(ati_bat_get_client(srcId), &cmd);
661
662 return ATI_EXCT; /* executing, because response is passed by callback function */
663 }
664 #else /* OLD FUNCTION BODY */
665 {
666 T_ACI_RETURN ret;
667
668 TRACE_FUNCTION("setatPercentCTTY()");
669
670 ret = sAT_PercentCTTY ((T_ACI_CMD_SRC)srcId, mode, req);
671 switch (ret)
672 {
673 case (AT_CMPL): /* operation completed */
674 break;
675 case (AT_EXCT): /* not valid */
676 ret = AT_CMPL;
677 break;
678 default:
679 cmdCmeError(CME_ERR_NotPresent); /* Command failed */
680 break;
681 }
682 return (map_aci_2_ati_rslt(ret));
683 }
684 #endif /* no FF_ATI_BAT*/
685 }
686
687 GLOBAL T_ATI_RSLT queatPercentCTTY (char *cl, UBYTE srcId)
688 {
689 T_ACI_RETURN ret;
690 T_ACI_CTTY_MOD mode;
691 T_ACI_CTTY_REQ req;
692 T_ACI_CTTY_STAT state;
693 T_ACI_CTTY_TRX trx;
694
695 TRACE_FUNCTION("queatPercentCTTY()");
696
697 ret = qAT_PercentCTTY ((T_ACI_CMD_SRC)srcId, &mode, &req, &state, &trx);
698
699 if (ret EQ AT_CMPL)
700 {
701 if (trx EQ CTTY_TRX_Unknown)
702 resp_disp (srcId, cl,"eee",&mode, &req, &state);
703 else
704 resp_disp (srcId, cl,"eeee",&mode, &req, &state, &trx);
705 return ATI_CMPL;
706 }
707 else
708 cmdCmeError (CME_ERR_Unknown);
709
710 return ATI_FAIL;
711 }
712 #endif /* FF_TTY */
713
714 /*
715 +--------------------------------------------------------------------+
716 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD |
717 | STATE : code ROUTINE : atPlusCRC |
718 +--------------------------------------------------------------------+
719
720 PURPOSE : +CRC command (Select extended incoming call report)
721 */
722
723 GLOBAL T_ATI_RSLT setatPlusCRC (char *cl, UBYTE srcId)
724 {
725 TRACE_FUNCTION("setatPlusCRC()");
726
727 return(GenAtCR_C( cl, srcId, AT_CMD_CRC ));
728 }
729
730 GLOBAL T_ATI_RSLT queatPlusCRC (char *cl, UBYTE srcId)
731 {
732 TRACE_FUNCTION("queatPlusCRC()");
733
734 resp_disp(srcId, cl,"b",&ati_user_output_cfg[srcId].CRC_stat);
735 return (ATI_CMPL);
736 }
737
738 /*>
739 +--------------------------------------------------------------------+
740 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD |
741 | STATE : code ROUTINE : atPlusCSTA |
742 +--------------------------------------------------------------------+
743
744 PURPOSE : +CSTA command (Select type of address)
745 */
746
747 GLOBAL T_ATI_RSLT setatPlusCSTA(char *cl, UBYTE srcId)
748 {
749 SHORT toa_val=0;
750 T_ACI_TOA type;
751 #ifdef FF_ATI_BAT
752 T_ACI_TOA *p_type=NULL;
753 #endif /* FF_ATI_BAT */
754 T_ACI_RETURN ret = AT_FAIL;
755
756 cl = parse(cl, "r", &toa_val);
757 if (!cl)
758 {
759 cmdCmeError(CME_ERR_OpNotAllow);
760 return (ATI_FAIL);
761 }
762 #ifdef FF_ATI_BAT
763 p_type = &type;
764 if (toa_val EQ 0)
765 p_type = NULL;
766 else
767 #endif /* FF_ATI_BAT */
768 {
769 type=toa_demerge(toa_val);
770 if (type.ton < 0 OR type.npi < 0)
771 {
772 cmdCmeError(CME_ERR_OpNotAllow);
773 return (ATI_FAIL);
774 }
775 }
776
777 #ifdef FF_ATI_BAT
778 {
779 T_BAT_cmd_send cmd;
780 T_BAT_cmd_set_plus_csta my_bat_set_plus_csta;
781
782 TRACE_FUNCTION("setatPlusCSTA() calls bat_send() <=== as APPLICATION");
783
784 memset(&my_bat_set_plus_csta, 0, sizeof(my_bat_set_plus_csta));
785 cmd.ctrl_params = BAT_CMD_SET_PLUS_CSTA;
786 cmd.params.ptr_set_plus_csta = &my_bat_set_plus_csta;
787
788 my_bat_set_plus_csta.type = (S16)p_type;
789
790 bat_send(ati_bat_get_client(srcId), &cmd);
791
792 return ATI_EXCT; /* executing, because response is passed by callback function */
793 }
794 #else /* OLD FUNCTION BODY */
795
796 TRACE_FUNCTION("setatPLusCSTA()");
797
798 ret = sAT_PlusCSTA((T_ACI_CMD_SRC)srcId, &type);
799
800 return (map_aci_2_ati_rslt (ret));
801
802 #endif /* no FF_ATI_BAT*/
803 }
804
805 GLOBAL T_ATI_RSLT queatPlusCSTA(char *cl, UBYTE srcId)
806 {
807 T_ACI_RETURN ret = AT_FAIL;
808 T_ACI_TOA type;
809 SHORT toa_val = 0;
810
811 TRACE_FUNCTION("queatPLusCSTA()");
812
813 ret = qAT_PlusCSTA((T_ACI_CMD_SRC)srcId,&type);
814 toa_val = toa_merge (type);
815 if (ret EQ AT_CMPL)
816 {
817 resp_disp(srcId, cl,"s",&toa_val);
818 }
819 else
820 {
821 cmdCmeError(CME_ERR_Unknown);
822 }
823 return (map_aci_2_ati_rslt (ret));
824 }
825
826 /*
827 +--------------------------------------------------------------------+
828 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD |
829 | STATE : code ROUTINE : atPlusCHLD |
830 +--------------------------------------------------------------------+
831
832 PURPOSE : common function for +/%CHLD command
833 */
834 LOCAL T_ATI_RSLT setatPlus_PercentCHLD(char *cl, UBYTE srcId, T_ACI_CHLD_CMD cmdType)
835 {
836 T_ACI_RETURN ret = AT_FAIL;
837 T_ACI_CHLD_MOD mode = CHLD_MOD_NotPresent;
838 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id);
839 CHAR CHLD_type = '\0';
840 CHAR X_prm[2];
841
842 X_prm[0] = (CHAR)NOT_PRESENT_8BIT;
843
844 /* check first parameter of CHLD */
845 CHLD_type = *cl;
846 ++cl;
847
848 /* check for special PERCENT command */
849 if((CHLD_type EQ '6') AND (cmdType NEQ CHLD_PercentCmd))
850 {
851 cmdCmeError(CME_ERR_OpNotAllow);
852 return (ATI_FAIL);
853 }
854
855 /* check for rest of parameter if necessary (only for AT+CHLD=1 / 2 / or 4) */
856 if( CHLD_type EQ '1'
857 OR CHLD_type EQ '2'
858 OR CHLD_type EQ '4'
859 OR CHLD_type EQ '6'
860 OR CHLD_type EQ '7' )
861 {
862 /* possibility of an X or directory parameter */
863 if (*cl EQ 0 OR *cl EQ ';') /* end of command */
864 {
865 X_prm[0] = (CHAR)NOT_PRESENT_8BIT;
866 }
867 else
868 {
869 if( *cl < '0' OR *cl > '9')
870 {
871 cmdCmeError(CME_ERR_OpNotAllow);
872 return (ATI_FAIL);
873 }
874 else
875 {
876 X_prm[0] = *cl;
877 X_prm[1] = '\0';
878 cl++;
879 }
880 }
881 }
882
883 switch(CHLD_type)
884 {
885 case ('0'):
886 mode = CHLD_MOD_RelHldOrUdub;
887 break;
888
889 case ('1'):
890 if ( X_prm[0] EQ (CHAR)NOT_PRESENT_8BIT )
891 {
892 mode = CHLD_MOD_RelActAndAcpt;
893 }
894 else
895 {
896 mode = CHLD_MOD_RelActSpec;
897 }
898 break;
899
900 case('2'):
901 if ( X_prm[0] EQ (CHAR)NOT_PRESENT_8BIT )
902 {
903 mode = CHLD_MOD_HldActAndAcpt;
904 }
905 else
906 {
907 mode = CHLD_MOD_HldActExc;
908 }
909 break;
910
911 case('3'):
912 mode = CHLD_MOD_AddHld;
913 break;
914
915 case('4'):
916 mode = CHLD_MOD_Ect;
917 break;
918
919 case('5'):
920 mode = CHLD_MOD_Ccbs;
921 break;
922
923 case('6'):
924 /* S60/Symbian requires an extra mode in %CHLD only:
925 retrieving of an [specific] hold call
926 without affecting of an waiting call */
927 if ( X_prm[0] EQ (CHAR)NOT_PRESENT_8BIT )
928 {
929 mode = CHLD_MOD_RetrieveHoldCall;
930 }
931 else
932 {
933 mode = CHLD_MOD_RetrieveHoldCallSpec;
934 }
935 break;
936
937 case('7'):
938 /* BMI requires an extra mode in %CHLD only:
939 releasing of an [specific] hold call of any type */
940 if ( X_prm[0] EQ (CHAR)NOT_PRESENT_8BIT )
941 {
942 cmdCmeError(CME_ERR_OpNotAllow);
943 return (ATI_FAIL);
944 }
945 else
946 {
947 mode = CHLD_MOD_RelAnySpec;
948 }
949 break;
950
951 case('h'):
952 case('H'):
953 /* FTA requires an extra mode: Put on hold (without
954 accepting automatically waiting or held calls) */
955 mode = CHLD_MOD_OnlyHold;
956 break;
957
958 case('i'):
959 case('I'):
960 /* Release dialing call, without dropping current call. */
961 mode = CHLD_MOD_RelDialCall;
962 break;
963
964 default:
965 cmdCmeError(CME_ERR_OpNotAllow);
966 return (ATI_FAIL);
967 }
968
969 #ifdef FF_ATI_BAT
970 {
971 T_BAT_cmd_send cmd;
972 T_BAT_cmd_set_percent_chld my_bat_set_percent_chld;
973
974 TRACE_FUNCTION("setatPlus_PercentCHLD() calls bat_send() <=== as APPLICATION");
975
976 memset(&my_bat_set_percent_chld, 0, sizeof(my_bat_set_percent_chld));
977 cmd.ctrl_params = BAT_CMD_SET_PERCENT_CHLD;
978 cmd.params.ptr_set_percent_chld = &my_bat_set_percent_chld;
979
980 my_bat_set_percent_chld.n = mode;
981 my_bat_set_percent_chld.x = (S16)&X_prm;
982 src_params->curAtCmd = AT_CMD_CHLD;
983 bat_send(ati_bat_get_client(srcId), &cmd);
984
985 return ATI_EXCT; /* executing, because response is passed by callback function */
986 }
987 #else /* OLD FUNCTION BODY */
988
989 TRACE_FUNCTION("setatPlus_PercentCHLD()");
990
991 if( X_prm[0] NEQ (CHAR)NOT_PRESENT_8BIT )
992 {
993 if(cmdType EQ CHLD_PercentCmd)
994 {
995 ret = sAT_PercentCHLD( (T_ACI_CMD_SRC)srcId, mode, X_prm );
996 }
997 else
998 {
999 ret = sAT_PlusCHLD( (T_ACI_CMD_SRC)srcId, mode, X_prm );
1000 }
1001 }
1002 else
1003 {
1004 if(cmdType EQ CHLD_PercentCmd)
1005 {
1006 ret = sAT_PercentCHLD( (T_ACI_CMD_SRC)srcId, mode, NULL );
1007 }
1008 else
1009 {
1010 ret = sAT_PlusCHLD( (T_ACI_CMD_SRC)srcId, mode, NULL );
1011 }
1012 }
1013
1014 switch( ret )
1015 {
1016 case AT_CMPL:
1017 break;
1018
1019 case AT_EXCT:
1020 src_params->curAtCmd = AT_CMD_CHLD;
1021 break;
1022
1023 case AT_BUSY:
1024 cmdCmeError(CME_ERR_OpNotAllow);
1025 break;
1026
1027 default:
1028 cmdCmeError(CME_ERR_Unknown);
1029 break;
1030 }
1031 return (map_aci_2_ati_rslt (ret));
1032
1033 #endif /* no FF_ATI_BAT*/
1034 }
1035
1036 /*
1037 +--------------------------------------------------------------------+
1038 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD |
1039 | STATE : code ROUTINE : atPlusCHLD |
1040 +--------------------------------------------------------------------+
1041
1042 PURPOSE : +CHLD command
1043 */
1044
1045 GLOBAL T_ATI_RSLT setatPlusCHLD(char *cl, UBYTE srcId)
1046 {
1047 TRACE_FUNCTION("setatPlusCHLD()");
1048
1049 return( setatPlus_PercentCHLD(cl, srcId, CHLD_PlusCmd) );
1050 }
1051
1052 /*
1053 +--------------------------------------------------------------------+
1054 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD |
1055 | STATE : code ROUTINE : atPercentCHLD |
1056 +--------------------------------------------------------------------+
1057
1058 PURPOSE : %CHLD command (same as +CHLD but custom specific)
1059 */
1060
1061 GLOBAL T_ATI_RSLT setatPercentCHLD(char *cl, UBYTE srcId)
1062 {
1063 TRACE_FUNCTION("setatPercentCHLD()");
1064
1065 return( setatPlus_PercentCHLD(cl, srcId, CHLD_PercentCmd) );
1066 }
1067
1068
1069 /*
1070 +--------------------------------------------------------------------+
1071 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD |
1072 | STATE : code ROUTINE : atPlusCHUP |
1073 +--------------------------------------------------------------------+
1074
1075 PURPOSE : +CHUP command (Hangs up call)
1076 */
1077 GLOBAL T_ATI_RSLT setatPlusCHUP (char *cl, UBYTE srcId)
1078 {
1079 T_ACI_RETURN ret = AT_FAIL;
1080 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id);
1081
1082 TRACE_FUNCTION("setatPlusCHUP()");
1083
1084 if (*cl EQ ';' OR *cl EQ 0)
1085 {
1086 #ifdef FF_ATI_BAT
1087 {
1088 T_BAT_cmd_send cmd;
1089 T_BAT_no_parameter dummy;
1090 cmd.ctrl_params = BAT_CMD_SET_PLUS_CHUP;
1091 dummy.bat_dummy = 0xFF;
1092 cmd.params.ptr_set_plus_chup = &dummy;
1093
1094 TRACE_FUNCTION("setatPlusCHUP() calls bat_send() <=== as APPLICATION");
1095
1096 if( at.rngPrms.isRng EQ TRUE )
1097 {
1098 ati_stop_ring();
1099 }
1100 src_params->curAtCmd = AT_CMD_CHUP;
1101
1102 bat_send(ati_bat_get_client(srcId), &cmd);
1103
1104 return (ATI_EXCT); /* executing, because response is passed by callback function */
1105 }
1106 #else /* OLD FUNCTION BODY */
1107 ret=sAT_PlusCHUP((T_ACI_CMD_SRC)srcId);
1108 if (ret EQ AT_CMPL)
1109 {
1110 return (ATI_CMPL);
1111 }
1112
1113 else if (ret EQ AT_EXCT)
1114 {
1115 if( at.rngPrms.isRng EQ TRUE )
1116 {
1117 ati_stop_ring();
1118 }
1119 src_params->curAtCmd = AT_CMD_CHUP;
1120 }
1121 else
1122 {
1123 cmdCmeError(CME_ERR_Unknown);
1124 }
1125 #endif
1126 }
1127 else
1128 {
1129 cmdCmeError(CME_ERR_OpNotAllow);
1130 }
1131 return (map_aci_2_ati_rslt (ret));
1132 }
1133
1134
1135 /*
1136 +--------------------------------------------------------------------+
1137 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD |
1138 | STATE : code ROUTINE : atPlusCLIP |
1139 +--------------------------------------------------------------------+
1140
1141 PURPOSE : +CLIP command (calling line identification presentation)
1142 */
1143 GLOBAL T_ATI_RSLT setatPlusCLIP (char *cl, UBYTE srcId)
1144 {
1145 TRACE_FUNCTION("setatPlusCLIP()");
1146
1147 return(GenAtCR_C( cl, srcId, AT_CMD_CLIP ));
1148 }
1149
1150 GLOBAL T_ATI_RSLT queatPlusCLIP (char *cl, UBYTE srcId)
1151 {
1152 T_ACI_RETURN ret = AT_FAIL;
1153 T_ACI_CLIP_STAT stat = CLIP_STAT_NotPresent;
1154 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id);
1155
1156 TRACE_FUNCTION("queatPlusCLIP()");
1157
1158 #ifdef FF_ATI_BAT
1159 {
1160 T_BAT_cmd_send cmd;
1161 T_BAT_no_parameter dummy;
1162
1163 cmd.ctrl_params=BAT_CMD_QUE_PLUS_CLIP;
1164 dummy.bat_dummy = 0xFF;
1165 cmd.params.ptr_que_plus_clip = &dummy;
1166 src_params->curAtCmd = AT_CMD_CLIP;
1167 bat_send(ati_bat_get_client(srcId), &cmd);
1168 return(ATI_EXCT);
1169 }
1170 #else /* no FF_ATI_BAT */
1171
1172 ret = qAT_PlusCLIP((T_ACI_CMD_SRC)srcId,&stat);
1173
1174 if (ret EQ AT_CMPL)
1175 {
1176 resp_disp(srcId, cl,"be",&ati_user_output_cfg[srcId].CLIP_stat,&stat);
1177 }
1178 else if (ret EQ AT_EXCT)
1179 {
1180 src_params->curAtCmd = AT_CMD_CLIP;
1181 }
1182 else if (ret EQ AT_FAIL)
1183 {
1184 cmdCmeError(CME_ERR_Unknown);
1185 }
1186 return (map_aci_2_ati_rslt (ret));
1187
1188 #endif /* no FF_ATI_BAT */
1189 }
1190
1191 /*
1192 +--------------------------------------------------------------------+
1193 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD |
1194 | STATE : code ROUTINE : atPlusCDIP |
1195 +--------------------------------------------------------------------+
1196
1197 PURPOSE : +CDIP command (calling line identification presentation)
1198 */
1199 GLOBAL T_ATI_RSLT setatPlusCDIP (char *cl, UBYTE srcId)
1200 {
1201 TRACE_FUNCTION("setatPlusCDIP()");
1202
1203 return(GenAtCR_C( cl, srcId, AT_CMD_CDIP ));
1204 }
1205
1206 /*
1207 +--------------------------------------------------------------------+
1208 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD |
1209 | STATE : code ROUTINE : queatPlusCDIP |
1210 +--------------------------------------------------------------------+
1211
1212 PURPOSE : +CDIP command (calling line identification presentation)
1213 */
1214 GLOBAL T_ATI_RSLT queatPlusCDIP (char *cl, UBYTE srcId)
1215 {
1216 T_ACI_RETURN ret = AT_CMPL;
1217 T_ACI_CDIP_STAT stat = CDIP_STAT_Unknown; /* Return this for XT6 - No Network Interrogation */
1218 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id);
1219
1220 #ifdef FF_ATI_BAT
1221 {
1222 T_BAT_cmd_send cmd;
1223 T_BAT_no_parameter dummy;
1224
1225 cmd.ctrl_params=BAT_CMD_QUE_PLUS_CDIP;
1226 dummy.bat_dummy = 0xFF;
1227 cmd.params.ptr_que_plus_cdip = &dummy;
1228 src_params->curAtCmd = AT_CMD_CDIP;
1229 bat_send(ati_bat_get_client(srcId), &cmd);
1230 return(ATI_EXCT);
1231 }
1232 #else /* no FF_ATI_BAT */
1233 TRACE_FUNCTION("queatPlusCDIP()");
1234
1235 resp_disp(srcId, cl,"be",&ati_user_output_cfg[srcId].CDIP_stat,&stat);
1236
1237 return (map_aci_2_ati_rslt (ret));
1238 #endif /* FF_ATI_BAT */
1239 }
1240
1241 /*
1242 +--------------------------------------------------------------------+
1243 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD |
1244 | STATE : code ROUTINE : atPlusCOLP |
1245 +--------------------------------------------------------------------+
1246
1247 PURPOSE : +COLP command (connected line identification presentation)
1248 */
1249
1250 GLOBAL T_ATI_RSLT setatPlusCOLP (char *cl, UBYTE srcId)
1251 {
1252 TRACE_FUNCTION("setatPlusCOLP()");
1253
1254 return(GenAtCR_C( cl, srcId, AT_CMD_COLP ));
1255 }
1256
1257 GLOBAL T_ATI_RSLT queatPlusCOLP (char *cl, UBYTE srcId)
1258 {
1259 T_ACI_COLP_STAT stat = COLP_STAT_NotPresent;
1260 T_ACI_RETURN ret = AT_FAIL;
1261 UBYTE x = 0;
1262 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id);
1263
1264 TRACE_FUNCTION("queatPlusCOLP()");
1265
1266 ret = qAT_PlusCOLP((T_ACI_CMD_SRC)srcId,&stat);
1267 if (ret EQ AT_CMPL)
1268 {
1269 x = (at.flags.COLP_stat?1:0);
1270 resp_disp(srcId, cl,"be",&x,&stat);
1271 }
1272 else if (ret EQ AT_EXCT)
1273 {
1274 src_params->curAtCmd = AT_CMD_COLP;
1275 }
1276 else if (ret EQ AT_FAIL)
1277 {
1278 cmdCmeError(CME_ERR_Unknown);
1279 }
1280 return (map_aci_2_ati_rslt (ret));
1281 }
1282
1283
1284 /*
1285 +--------------------------------------------------------------------+
1286 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD |
1287 | STATE : code ROUTINE : atPlusCLIR |
1288 +--------------------------------------------------------------------+
1289
1290 PURPOSE : +CLIR command (connected line identification restriction)
1291 */
1292
1293 GLOBAL T_ATI_RSLT setatPlusCLIR (char *cl, UBYTE srcId)
1294 {
1295 T_ACI_RETURN ret = AT_FAIL;
1296 T_ACI_CLIR_MOD mode = CLIR_MOD_NotPresent;
1297
1298
1299 switch(*cl)
1300 {
1301 case('0'):
1302 {
1303 mode=CLIR_MOD_Subscript;
1304 cl++;
1305 break;
1306 }
1307 case('1'):
1308 {
1309 mode=CLIR_MOD_Invoc;
1310 cl++;
1311 break;
1312 }
1313 case('2'):
1314 {
1315 mode=CLIR_MOD_Supp;
1316 cl++;
1317 break;
1318 }
1319 case('\0'):
1320 {
1321 break;
1322 }
1323 default:
1324 {
1325 cmdCmeError(CME_ERR_OpNotAllow);
1326 return (ATI_FAIL);
1327 }
1328 }
1329
1330 if (!(*cl EQ 0 OR *cl EQ ';'))
1331 {
1332 cmdCmeError(CME_ERR_OpNotAllow);
1333 return (ATI_FAIL);
1334 }
1335
1336 #ifdef FF_ATI_BAT
1337 {
1338 T_BAT_cmd_send cmd;
1339 T_BAT_cmd_set_plus_clir my_bat_set_plus_clir;
1340
1341 TRACE_FUNCTION("setatPLusCLIR() calls bat_send() <=== as APPLICATION");
1342
1343 memset(&my_bat_set_plus_clir, 0, sizeof(my_bat_set_plus_clir));
1344 cmd.ctrl_params = BAT_CMD_SET_PLUS_CLIR;
1345 cmd.params.ptr_set_plus_clir = &my_bat_set_plus_clir;
1346
1347 my_bat_set_plus_clir.n = mode;
1348
1349 bat_send(ati_bat_get_client(srcId), &cmd);
1350
1351 return ATI_EXCT; /* executing, because response is passed by callback function */
1352 }
1353 #else /* OLD FUNCTION BODY */
1354
1355 TRACE_FUNCTION("setatPLusCLIR()");
1356
1357 ret = sAT_PlusCLIR((T_ACI_CMD_SRC)srcId,mode);
1358 return (map_aci_2_ati_rslt (ret));
1359
1360 #endif /* no FF_ATI_BAT*/
1361 }
1362
1363 GLOBAL T_ATI_RSLT queatPlusCLIR (char *cl, UBYTE srcId)
1364 {
1365 T_ACI_RETURN ret = AT_FAIL;
1366 T_ACI_CLIR_STAT stat = CLIR_STAT_NotPresent;
1367 T_ACI_CLIR_MOD mode = CLIR_MOD_NotPresent;
1368 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id);
1369
1370 TRACE_FUNCTION("queatPLusCLIR()");
1371
1372 #ifdef FF_ATI_BAT
1373 {
1374 T_BAT_cmd_send cmd;
1375 T_BAT_no_parameter dummy;
1376
1377 cmd.ctrl_params=BAT_CMD_QUE_PLUS_CLIR;
1378 dummy.bat_dummy = 0xFF;
1379 cmd.params.ptr_que_plus_clir = &dummy;
1380 src_params->curAtCmd = AT_CMD_CLIR;
1381 bat_send(ati_bat_get_client(srcId), &cmd);
1382 return(ATI_EXCT);
1383 }
1384 #else /* OLD FUNCTION BODY */
1385
1386 ret = qAT_PlusCLIR ((T_ACI_CMD_SRC)srcId,&mode,&stat);
1387 switch (ret)
1388 {
1389 /* case AT_CMPL:
1390 {
1391 sprintf(sa,"%s%d,%d",me,mode,stat);
1392 io_sendMessage(sa, ATI_NORMAL_OUTPUT);
1393 break;
1394 } */ /* never happens as far as I know */
1395 case AT_EXCT:
1396 {
1397 src_params->curAtCmd = AT_CMD_CLIR;
1398 break;
1399 }
1400 case AT_FAIL:
1401 {
1402 cmdCmeError (CME_ERR_Unknown);
1403 break;
1404 }
1405 }
1406 return (map_aci_2_ati_rslt (ret));
1407 #endif /* FF_ATI_BAT */
1408 }
1409
1410
1411 /*
1412 +--------------------------------------------------------------------+
1413 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD |
1414 | STATE : code ROUTINE : atPlusCCUG |
1415 +--------------------------------------------------------------------+
1416
1417 PURPOSE : +CCUG command (closed useg group settings)
1418 */
1419 GLOBAL T_ATI_RSLT setatPlusCCUG (char * cl, UBYTE srcId)
1420 {
1421 T_ACI_RETURN ret = AT_FAIL;
1422 T_ACI_CCUG_MOD mode = CCUG_MOD_NotPresent;
1423 T_ACI_CCUG_IDX idx = CCUG_IDX_NotPresent;
1424 T_ACI_CCUG_INFO info = CCUG_INFO_NotPresent;
1425
1426 cl = parse(cl, "ddd", &mode, &idx, &info);
1427 if (!cl)
1428 {
1429 cmdCmeError (CME_ERR_OpNotAllow);
1430 return (ATI_FAIL);
1431 }
1432
1433 #ifdef FF_ATI_BAT
1434 {
1435 T_BAT_cmd_send cmd;
1436 T_BAT_cmd_set_plus_ccug my_bat_set_plus_ccug;
1437
1438 TRACE_FUNCTION("setatPlusCCUG() calls bat_send() <=== as APPLICATION");
1439
1440 memset(&my_bat_set_plus_ccug, 0, sizeof(my_bat_set_plus_ccug));
1441 cmd.ctrl_params = BAT_CMD_SET_PLUS_CCUG;
1442 cmd.params.ptr_set_plus_ccug = &my_bat_set_plus_ccug;
1443
1444 my_bat_set_plus_ccug.n = mode;
1445 my_bat_set_plus_ccug.index = idx;
1446 my_bat_set_plus_ccug.info = info;
1447
1448 bat_send(ati_bat_get_client(srcId), &cmd);
1449
1450 return ATI_EXCT; /* executing, because response is passed by callback function */
1451 }
1452 #else /* OLD FUNCTION BODY */
1453
1454 TRACE_FUNCTION("setatPlusCCUG()");
1455
1456 ret = sAT_PlusCCUG((T_ACI_CMD_SRC)srcId,mode,idx,info);
1457 if (ret EQ AT_FAIL)
1458 {
1459 cmdCmeError (CME_ERR_Unknown);
1460 }
1461 return (map_aci_2_ati_rslt (ret));
1462
1463 #endif /* no FF_ATI_BAT*/
1464 }
1465
1466 GLOBAL T_ATI_RSLT queatPlusCCUG (char * cl, UBYTE srcId)
1467 {
1468 T_ACI_RETURN ret = AT_FAIL;
1469 T_ACI_CCUG_MOD mode = CCUG_MOD_NotPresent;
1470 T_ACI_CCUG_IDX idx = CCUG_IDX_NotPresent;
1471 T_ACI_CCUG_INFO info = CCUG_INFO_NotPresent;
1472
1473 TRACE_FUNCTION("queatPlusCCUG()");
1474
1475 ret = qAT_PlusCCUG ((T_ACI_CMD_SRC)srcId,&mode,&idx,&info);
1476 switch (ret)
1477 {
1478 case AT_CMPL:
1479 {
1480 resp_disp (srcId, cl,"eee",&mode,&idx,&info);
1481 break;
1482 }
1483 case AT_FAIL:
1484 {
1485 cmdCmeError (CME_ERR_Unknown);
1486 break;
1487 }
1488 }
1489 return (map_aci_2_ati_rslt (ret));
1490 }
1491
1492 /*
1493 +--------------------------------------------------------------------+
1494 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD |
1495 | STATE : code ROUTINE : atPlusCMOD |
1496 +--------------------------------------------------------------------+
1497
1498 PURPOSE : +CMOD command (call mode)
1499 */
1500
1501 GLOBAL T_ATI_RSLT setatPlusCMOD (char *cl, UBYTE srcId)
1502 {
1503 T_ACI_RETURN ret = AT_FAIL;
1504 T_ACI_CMOD_MOD mode = CMOD_MOD_NotPresent;
1505
1506 cl = parse(cl, "d", &mode);
1507 if (!cl)
1508 {
1509 cmdCmeError (CME_ERR_OpNotAllow);
1510 return (ATI_FAIL);
1511 }
1512
1513 #ifdef FF_ATI_BAT
1514 {
1515 T_BAT_cmd_send cmd;
1516 T_BAT_cmd_set_plus_cmod my_bat_set_plus_cmod;
1517
1518 TRACE_FUNCTION("setatPLusCMOD() calls bat_send() <=== as APPLICATION");
1519
1520 memset(&my_bat_set_plus_cmod, 0, sizeof(my_bat_set_plus_cmod));
1521 cmd.ctrl_params = BAT_CMD_SET_PLUS_CMOD;
1522 cmd.params.ptr_set_plus_cmod = &my_bat_set_plus_cmod;
1523
1524 my_bat_set_plus_cmod.mode = mode;
1525
1526 bat_send(ati_bat_get_client(srcId), &cmd);
1527
1528 return ATI_EXCT; /* executing, because response is passed by callback function */
1529 }
1530 #else /* OLD FUNCTION BODY */
1531
1532 TRACE_FUNCTION("setatPLusCMOD()");
1533
1534 ret = sAT_PlusCMOD ((T_ACI_CMD_SRC)srcId,mode);
1535 switch (ret)
1536 {
1537 case AT_FAIL:
1538 cmdCmeError (CME_ERR_Unknown);
1539 break;
1540
1541 default:
1542 break;
1543 }
1544 return (map_aci_2_ati_rslt (ret));
1545
1546 #endif /* no FF_ATI_BAT*/
1547 }
1548
1549
1550 GLOBAL T_ATI_RSLT queatPlusCMOD (char *cl, UBYTE srcId)
1551 {
1552 T_ACI_RETURN ret = AT_FAIL;
1553 T_ACI_CMOD_MOD mode = CMOD_MOD_NotPresent;
1554
1555 TRACE_FUNCTION("queatPLusCMOD()");
1556
1557 ret = qAT_PlusCMOD ((T_ACI_CMD_SRC)srcId,&mode);
1558
1559 switch (ret)
1560 {
1561 case AT_CMPL:
1562 {
1563 resp_disp (srcId, cl, "e",&mode);
1564 break;
1565 }
1566 case AT_FAIL:
1567 {
1568 cmdCmeError (CME_ERR_OpNotAllow);
1569 break;
1570 }
1571 }
1572 return (map_aci_2_ati_rslt (ret));
1573 }
1574
1575 /*
1576 +--------------------------------------------------------------------+
1577 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD |
1578 | STATE : code ROUTINE : atPlusCR |
1579 +--------------------------------------------------------------------+
1580
1581 PURPOSE : +CR command (Service reporting control)
1582 */
1583
1584 GLOBAL T_ATI_RSLT setatPlusCR (char *cl, UBYTE srcId)
1585 {
1586 TRACE_FUNCTION("setatPlusCR()");
1587
1588 return (GenAtCR_C( cl, srcId, AT_CMD_CR ));
1589 }
1590
1591 GLOBAL T_ATI_RSLT queatPlusCR (char *cl, UBYTE srcId)
1592 {
1593 UBYTE x = 0;
1594
1595 TRACE_FUNCTION("queatPlusCR()");
1596
1597 x = (ati_user_output_cfg[srcId].CR_stat?1:0);
1598
1599 resp_disp (srcId, cl, "b", &x);
1600
1601 return (ATI_CMPL);
1602 }
1603
1604 /*
1605 +--------------------------------------------------------------------+
1606 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD |
1607 | STATE : code ROUTINE : atPlusCAOC |
1608 +--------------------------------------------------------------------+
1609
1610 PURPOSE : +CAOC command (Advice of Charge)
1611 */
1612 GLOBAL T_ATI_RSLT setatPlusCAOC (char* cl, UBYTE srcId)
1613 {
1614 LONG ccm = 0L;
1615 SHORT mode = 0;
1616 T_ACI_RETURN ret = AT_FAIL;
1617
1618 switch ( *cl )
1619 {
1620 case('\0'):
1621 break;
1622
1623 default:
1624 {
1625 cl = parse(cl, "d", &mode);
1626 if (!cl)
1627 {
1628 cmdCmeError (CME_ERR_OpNotAllow);
1629 return (ATI_FAIL);
1630 }
1631
1632 switch(mode)
1633 {
1634 case (0):
1635 /*
1636 * AT+CAOC=0 queries the actual ccm value
1637 */
1638 cl++;
1639 break;
1640
1641 case (1):
1642 /*
1643 * AT+CAOC=1 deactivates the unsolicited report mode
1644 */
1645 ati_user_output_cfg[srcId].CAOC_stat=0;
1646 return (ATI_CMPL);
1647
1648 case (2):
1649 /*
1650 * AT+CAOC=2 activates the unsolicited report mode
1651 */
1652 ati_user_output_cfg[srcId].CAOC_stat=1;
1653 return (ATI_CMPL);
1654
1655 default:
1656 cmdCmeError (CME_ERR_OpNotAllow);
1657 return (ATI_FAIL);
1658 }
1659 break;
1660 }
1661 }
1662
1663 #ifdef FF_ATI_BAT
1664 {
1665 T_BAT_cmd_send cmd;
1666 T_BAT_cmd_set_plus_caoc my_bat_set_plus_caoc;
1667
1668 TRACE_FUNCTION("setatPLusCAOC() calls bat_send() <=== as APPLICATION");
1669
1670 memset(&my_bat_set_plus_caoc, 0, sizeof(my_bat_set_plus_caoc));
1671 cmd.ctrl_params = BAT_CMD_SET_PLUS_CAOC;
1672 cmd.params.ptr_set_plus_caoc = &my_bat_set_plus_caoc;
1673
1674 my_bat_set_plus_caoc.mode = mode;
1675
1676 bat_send(ati_bat_get_client(srcId), &cmd);
1677
1678 return ATI_EXCT; /* executing, because response is passed by callback function */
1679 }
1680 #else /* OLD FUNCTION BODY */
1681
1682 TRACE_FUNCTION("setatPLusCAOC()");
1683
1684 ret = qAT_PlusCAOC((T_ACI_CMD_SRC)srcId,&ccm);
1685 sprintf (g_sa,"+CAOC: \"%06X\"", ccm);
1686 io_sendMessage (srcId, g_sa, ATI_NORMAL_OUTPUT);
1687 return (map_aci_2_ati_rslt (ret));
1688
1689 #endif /* no FF_ATI_BAT*/
1690 }
1691
1692
1693 GLOBAL T_ATI_RSLT queatPlusCAOC (char* cl, UBYTE srcId)
1694 {
1695 UBYTE x = 0;
1696
1697 TRACE_FUNCTION("queatPLusCAOC()");
1698
1699 /*
1700 * AT+CAOC? requests the actual mode
1701 */
1702 x = ati_user_output_cfg[srcId].CAOC_stat + 1;
1703
1704 resp_disp(srcId, cl,"b",&x);
1705
1706 return (ATI_CMPL);
1707 }
1708
1709 /*
1710 +--------------------------------------------------------------------+
1711 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD |
1712 | STATE : code ROUTINE : setatPlusCACM |
1713 +--------------------------------------------------------------------+
1714
1715 PURPOSE : +CACM command (Advice of Charge, Accumulated Call Meter)
1716 */
1717 GLOBAL T_ATI_RSLT setatPlusCACM (char* cl, UBYTE srcId)
1718 {
1719 char pin2 [MAX_PWD_LENGTH] = {0} ;
1720 T_ACI_RETURN ret = AT_FAIL;
1721 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id);
1722
1723 cl = parse(cl, "n", (LONG)MAX_PWD_LENGTH, &pin2);
1724 if ( !cl )
1725 {
1726 cmdCmeError(CME_ERR_OpNotAllow);
1727 return (ATI_FAIL);
1728 }
1729
1730 #ifdef FF_ATI_BAT
1731 {
1732 T_BAT_cmd_send cmd;
1733 T_BAT_cmd_set_plus_cacm my_bat_set_plus_cacm;
1734
1735 TRACE_FUNCTION("setatPLusCACM() calls bat_send() <=== as APPLICATION");
1736
1737 memset(&my_bat_set_plus_cacm, 0, sizeof(my_bat_set_plus_cacm));
1738 cmd.ctrl_params = BAT_CMD_SET_PLUS_CACM;
1739 cmd.params.ptr_set_plus_cacm = &my_bat_set_plus_cacm;
1740
1741 my_bat_set_plus_cacm.c_passwd = strlen(pin2);
1742 memcpy(my_bat_set_plus_cacm.passwd, pin2, my_bat_set_plus_cacm.c_passwd);
1743 src_params->curAtCmd = AT_CMD_CACM;
1744 bat_send(ati_bat_get_client(srcId), &cmd);
1745
1746 return ATI_EXCT; /* executing, because response is passed by callback function */
1747 }
1748 #else /* OLD FUNCTION BODY */
1749
1750 TRACE_FUNCTION("setatPLusCACM()");
1751
1752 ret = sAT_PlusCACM((T_ACI_CMD_SRC)srcId,pin2);
1753
1754 switch (ret)
1755 {
1756 case AT_EXCT:
1757 {
1758 src_params->curAtCmd = AT_CMD_CACM;
1759 break;
1760 }
1761 case AT_BUSY:
1762 {
1763 cmdCmeError (CME_ERR_SimBusy);
1764 break;
1765 }
1766 case AT_FAIL:
1767 {
1768 cmdCmeError (CME_ERR_OpNotAllow);
1769 break;
1770 }
1771 }
1772 return (map_aci_2_ati_rslt (ret));
1773
1774 #endif /* no FF_ATI_BAT*/
1775 }
1776
1777
1778 GLOBAL T_ATI_RSLT queatPlusCACM (char* cl, UBYTE srcId)
1779 {
1780 LONG acm = 0L;
1781 T_ACI_RETURN ret = AT_FAIL;
1782
1783 TRACE_FUNCTION("queatPLusCACM()");
1784
1785 /*
1786 * +AT+CACM? requests the actual value
1787 */
1788 ret = qAT_PlusCACM((T_ACI_CMD_SRC)srcId,&acm);
1789 if( ret NEQ AT_CMPL )
1790 {
1791 cmdCmeError(CME_ERR_Unknown);
1792 }
1793 else
1794 {
1795 sprintf(g_sa,"+CACM: \"%06X\"", acm);
1796 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT);
1797 }
1798 return (map_aci_2_ati_rslt (ret));
1799 }
1800
1801
1802
1803 /*
1804 +--------------------------------------------------------------------+
1805 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD |
1806 | STATE : code ROUTINE : atPlusCAMM |
1807 +--------------------------------------------------------------------+
1808
1809 PURPOSE : +CAMM command (Advice of Charge,
1810 Accumulated Call Meter Maximum)
1811 */
1812 GLOBAL T_ATI_RSLT setatPlusCAMM (char* cl, UBYTE srcId)
1813 {
1814 char pin2 [MAX_PWD_LENGTH] = {0};
1815 char new_acmmax [MAX_CM_LENGTH] = {0};
1816 char *pNewAcmMax = new_acmmax;
1817 LONG acmmax = 0L;
1818 T_ACI_RETURN ret = AT_FAIL;
1819 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id);
1820
1821 cl = parse(cl,"sn",(LONG)MAX_CM_LENGTH, &new_acmmax,
1822 (LONG)MAX_PWD_LENGTH, &pin2);
1823
1824 if ( !cl OR *new_acmmax EQ '\0' )
1825 {
1826 cmdCmeError(CME_ERR_OpNotAllow);
1827 return (ATI_FAIL);
1828 }
1829
1830 pNewAcmMax = parse(pNewAcmMax, "y", &acmmax);
1831 if ( !pNewAcmMax )
1832 {
1833 cmdCmeError(CME_ERR_OpNotAllow);
1834 return (ATI_FAIL);
1835 }
1836
1837 #ifdef FF_ATI_BAT
1838 {
1839 T_BAT_cmd_send cmd;
1840 T_BAT_cmd_set_plus_camm my_bat_set_plus_camm;
1841
1842 TRACE_FUNCTION("setatPLusCAMM() calls bat_send() <=== as APPLICATION");
1843
1844 memset(&my_bat_set_plus_camm, 0, sizeof(my_bat_set_plus_camm));
1845 cmd.ctrl_params = BAT_CMD_SET_PLUS_CAMM;
1846 cmd.params.ptr_set_plus_camm = &my_bat_set_plus_camm;
1847
1848 my_bat_set_plus_camm.acmmax = (S32)acmmax;
1849 my_bat_set_plus_camm.c_passwd = strlen(pin2);
1850 memcpy(my_bat_set_plus_camm.passwd, pin2, my_bat_set_plus_camm.c_passwd);
1851 src_params->curAtCmd = AT_CMD_CAMM;
1852 bat_send(ati_bat_get_client(srcId), &cmd);
1853
1854 return ATI_EXCT; /* executing, because response is passed by callback function */
1855 }
1856 #else /* OLD FUNCTION BODY */
1857
1858 TRACE_FUNCTION("setatPLusCAMM()");
1859
1860 ret = sAT_PlusCAMM((T_ACI_CMD_SRC)srcId, acmmax, pin2);
1861
1862 switch (ret)
1863 {
1864 case AT_EXCT:
1865 {
1866 src_params->curAtCmd = AT_CMD_CAMM;
1867 break;
1868 }
1869 case AT_BUSY:
1870 {
1871 cmdCmeError (CME_ERR_SimBusy);
1872 break;
1873 }
1874 default:
1875 {
1876 cmdCmeError (CME_ERR_OpNotAllow);
1877 break;
1878 }
1879 }
1880 return (map_aci_2_ati_rslt (ret));
1881
1882 #endif /* no FF_ATI_BAT*/
1883 }
1884
1885
1886 GLOBAL T_ATI_RSLT queatPlusCAMM (char* cl, UBYTE srcId)
1887 {
1888 LONG acmmax = 0L;
1889 T_ACI_RETURN ret = AT_FAIL;
1890
1891 TRACE_FUNCTION("queatPLusCAMM()");
1892
1893 /*
1894 * +AT+CAMM? requests the actual value
1895 */
1896 ret = qAT_PlusCAMM((T_ACI_CMD_SRC)srcId,&acmmax);
1897 if( ret NEQ AT_CMPL )
1898 {
1899 cmdCmeError(CME_ERR_Unknown);
1900 return (ATI_FAIL);
1901 }
1902
1903 sprintf (g_sa,"+CAMM: \"%06X\"", acmmax);
1904 io_sendMessage (srcId, g_sa, ATI_NORMAL_OUTPUT);
1905 return (map_aci_2_ati_rslt (ret));
1906 }
1907
1908 /*
1909 +--------------------------------------------------------------------+
1910 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD |
1911 | STATE : code ROUTINE : atPlusCPUC |
1912 +--------------------------------------------------------------------+
1913
1914 PURPOSE : +CPUC command (Advice of Charge,
1915 Price per unit and currency)
1916 */
1917 GLOBAL T_ATI_RSLT setatPlusCPUC (char* cl, UBYTE srcId)
1918 {
1919 char currency [MAX_CUR_LEN] = {0x00};
1920 char cvtdCurrency [2*MAX_CUR_LEN] = {0x00};
1921 USHORT lenCurrency = 0;
1922 USHORT lenCvtdCurrency = 0;
1923 char ppu [MAX_PPU_LENGTH] = {0x00};
1924 char pin2 [MAX_PWD_LENGTH] = {0x00};
1925 T_ACI_RETURN ret = AT_FAIL;
1926 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id);
1927
1928 /*
1929 * AT+CPUC=currency, ppu, pw sets the PUCT with or without password.
1930 */
1931 cl = parse(cl,"zsn",
1932 (LONG)MAX_CUR_LEN,
1933 strlen(cl),
1934 cl,
1935 &lenCurrency,
1936 currency,
1937 (LONG)MAX_PPU_LENGTH,
1938 ppu,
1939 (LONG)MAX_PWD_LENGTH,
1940 pin2);
1941
1942 if ( !cl OR *ppu EQ '\0' )
1943 {
1944 cmdCmeError(CME_ERR_OpNotAllow);
1945 return (ATI_FAIL);
1946 }
1947
1948 srcId_cb = srcId;
1949 utl_chsetToGsm ((UBYTE*)currency,
1950 lenCurrency,
1951 (UBYTE*)cvtdCurrency,
1952 &lenCvtdCurrency,
1953 #ifdef REL99
1954 sizeof(cvtdCurrency),
1955 #endif
1956 GSM_ALPHA_Int);
1957
1958 #ifdef FF_ATI_BAT
1959 {
1960 T_BAT_cmd_send cmd;
1961 T_BAT_cmd_set_plus_cpuc my_bat_set_plus_cpuc;
1962
1963 TRACE_FUNCTION("setatPLusCPUC() calls bat_send() <=== as APPLICATION");
1964
1965 memset(&my_bat_set_plus_cpuc, 0, sizeof(my_bat_set_plus_cpuc));
1966 cmd.ctrl_params = BAT_CMD_SET_PLUS_CPUC;
1967 cmd.params.ptr_set_plus_cpuc = &my_bat_set_plus_cpuc;
1968
1969 my_bat_set_plus_cpuc.c_currency = (U8)lenCurrency;
1970 memcpy(my_bat_set_plus_cpuc.currency, currency, lenCurrency);
1971 my_bat_set_plus_cpuc.c_ppu = strlen(ppu);
1972 memcpy(my_bat_set_plus_cpuc.ppu, ppu, my_bat_set_plus_cpuc.c_ppu);
1973 my_bat_set_plus_cpuc.c_passwd = strlen(pin2);
1974 my_bat_set_plus_cpuc.v_passwd = my_bat_set_plus_cpuc.c_passwd ? TRUE : FALSE;
1975 memcpy(my_bat_set_plus_cpuc.passwd, pin2, my_bat_set_plus_cpuc.c_passwd);
1976 src_params->curAtCmd = AT_CMD_CPUC;
1977 bat_send(ati_bat_get_client(srcId), &cmd);
1978
1979 return ATI_EXCT; /* executing, because response is passed by callback function */
1980 }
1981 #else /* OLD FUNCTION BODY */
1982
1983 TRACE_FUNCTION("setatPLusCPUC()");
1984
1985 ret = sAT_PlusCPUC((T_ACI_CMD_SRC)srcId,cvtdCurrency,ppu,pin2);
1986
1987 switch (ret)
1988 {
1989 case AT_EXCT:
1990 {
1991 src_params->curAtCmd = AT_CMD_CPUC;
1992 break;
1993 }
1994 case AT_BUSY:
1995 {
1996 cmdCmeError (CME_ERR_SimBusy);
1997 break;
1998 }
1999 default:
2000 {
2001 cmdCmeError (CME_ERR_OpNotAllow);
2002 break;
2003 }
2004 }
2005 return (map_aci_2_ati_rslt (ret));
2006
2007 #endif /* no FF_ATI_BAT*/
2008 }
2009
2010
2011 GLOBAL T_ATI_RSLT queatPlusCPUC (char* cl, UBYTE srcId)
2012 {
2013 char currency [MAX_CUR_LEN] = {0x00};
2014 char cvtdCurrency [2*MAX_CUR_LEN] = {0x00};
2015 USHORT lenCvtdCurrency = 0;
2016 USHORT pos = 0;
2017 char ppu [MAX_PPU_LENGTH] = {0x00};
2018 T_ACI_RETURN ret = AT_FAIL;
2019
2020
2021 TRACE_FUNCTION("queatPLusCPUC()");
2022
2023 /*
2024 * +AT+CPUC? requests the actual value
2025 */
2026 ret = qAT_PlusCPUC((T_ACI_CMD_SRC)srcId,currency, ppu);
2027
2028 if( ret NEQ AT_CMPL )
2029 {
2030 cmdCmeError(CME_ERR_Unknown);
2031 return (ATI_FAIL);
2032 }
2033
2034
2035 pos = sprintf(g_sa,"+CPUC: ");
2036
2037 srcId_cb = srcId;
2038 utl_chsetFromGsm((UBYTE*)currency,
2039 (USHORT)strlen(currency),
2040 (UBYTE*)cvtdCurrency,
2041 sizeof(cvtdCurrency),
2042 &lenCvtdCurrency,
2043 GSM_ALPHA_Def);
2044 pos += sprints(g_sa+pos,cvtdCurrency,lenCvtdCurrency);
2045 pos += sprintf(g_sa+pos,",\"%s\"",ppu);
2046 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT);
2047
2048 return (map_aci_2_ati_rslt (ret));
2049 }
2050
2051 /*
2052 +--------------------------------------------------------------------+
2053 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD |
2054 | STATE : code ROUTINE : atPlusCLCC |
2055 +--------------------------------------------------------------------+
2056
2057 PURPOSE : +CLCCcommand (list current calls)
2058 */
2059 GLOBAL T_ATI_RSLT setatPlusCLCC(char *cl, UBYTE srcId)
2060 {
2061 #ifdef FF_ATI_BAT
2062
2063 T_BAT_cmd_send cmd;
2064 T_BAT_no_parameter dummy;
2065 cmd.ctrl_params = BAT_CMD_QUE_PLUS_CLCC;
2066 dummy.bat_dummy = 0xFF;
2067 cmd.params.ptr_que_plus_clcc = &dummy;
2068
2069 TRACE_FUNCTION("setatPlusCLCC() calls bat_send() <=== as APPLICATION");
2070
2071 bat_send(ati_bat_get_client(srcId), &cmd);
2072
2073 return (ATI_EXCT); /* executing, because response is passed by callback function */
2074
2075 #else /* no FF_ATI_BAT */
2076
2077 char *me = "+CLCC: ";
2078 T_ACI_CLCC_CALDESC *calLst = NULL;
2079 UBYTE lstIdx = 0;
2080 SHORT pos = 0;
2081 USHORT lenCvtdAlpha = 0;
2082 UBYTE type = 0;
2083
2084 CHAR cvtdAlpha[2*MAX_ALPHA_LEN];
2085
2086 TRACE_FUNCTION("setatPlusCLCC()");
2087
2088 srcId_cb = srcId; /* For utl_chsetFromGsm() */
2089 switch (*cl)
2090 {
2091 case(';'):
2092 case(0x0):
2093 {
2094 /* Check if we have enough RAM for the following ACI_MALLOC */
2095 USHORT free, alloc;
2096 int ret;
2097 ret = vsi_m_status ( hCommACI,
2098 MAX_CALL_NR * sizeof (T_ACI_CLCC_CALDESC),
2099 PRIM_POOL_PARTITION,
2100 &free,
2101 &alloc );
2102 if (ret EQ VSI_ERROR || free EQ 0)
2103 {
2104 cmdCmeError(CME_ERR_MemFull);
2105 return (ATI_FAIL);
2106 }
2107 }
2108 ACI_MALLOC (calLst, MAX_CALL_NR * sizeof (T_ACI_CLCC_CALDESC));
2109 (void)qAT_PlusCLCC((T_ACI_CMD_SRC)srcId, calLst); /* Always returns AT_CMPL */
2110
2111 /* 20 is approximatly the amount of extra characters (like ",") */
2112
2113 for( lstIdx = 0; lstIdx < MAX_CALL_NR; lstIdx++ )
2114 {
2115 if( calLst[lstIdx].idx EQ ACI_NumParmNotPresent )
2116 break;
2117
2118 pos = sprintf(g_sa,"%s%d",me,calLst[lstIdx].idx);
2119
2120 if (calLst[lstIdx].dir NEQ CLCC_DIR_NotPresent)
2121 pos += sprintf(g_sa+pos,",%d",calLst[lstIdx].dir);
2122 else
2123 pos += sprintf(g_sa+pos,",");
2124 if (calLst[lstIdx].stat NEQ CLCC_STAT_NotPresent)
2125 pos += sprintf(g_sa+pos,",%d",calLst[lstIdx].stat);
2126 else
2127 pos += sprintf(g_sa+pos,",");
2128 if (calLst[lstIdx].mode NEQ CLCC_MODE_NotPresent)
2129 pos += sprintf(g_sa+pos,",%d",calLst[lstIdx].mode);
2130 else
2131 pos += sprintf(g_sa+pos,",");
2132 if (calLst[lstIdx].mpty NEQ CLCC_MPTY_NotPresent)
2133 pos += sprintf(g_sa+pos,",%d",calLst[lstIdx].mpty);
2134 else
2135 pos += sprintf(g_sa+pos,",");
2136
2137 if (calLst[lstIdx].number[0] NEQ 0x0)
2138 {
2139 pos += sprintf(g_sa+pos,",\"%s\"",calLst[lstIdx].number);
2140 if (calLst[lstIdx].type.ton NEQ TON_NotPresent)
2141 {
2142 type = toa_merge(calLst[lstIdx].type);
2143 pos += sprintf(g_sa+pos,",%d",(int)type);
2144 }
2145 #ifdef NO_ASCIIZ
2146 if (calLst[lstIdx].alpha.len NEQ 0x0)
2147 {
2148 pos += sprintf(g_sa+pos,",");
2149 utl_chsetFromGsm ( calLst[lstIdx].alpha.data,
2150 calLst[lstIdx].alpha.len,
2151 (UBYTE*)cvtdAlpha,
2152 sizeof(cvtdAlpha),
2153 &lenCvtdAlpha,
2154 GSM_ALPHA_Def );
2155 pos += sprints ( g_sa + pos, cvtdAlpha, lenCvtdAlpha );
2156 }
2157 #else /* #ifdef NO_ASCIIZ */
2158 if (calLst[lstIdx].alpha[0] NEQ 0x0)
2159 {
2160 pos += sprintf(g_sa+pos,",");
2161 utl_chsetFromGsm ( (UBYTE*)calLst[lstIdx].alpha,
2162 0,
2163 (UBYTE*)cvtdAlpha,
2164 sizeof(cvtdAlpha),
2165 &lenCvtdAlpha,
2166 GSM_ALPHA_Int );
2167 pos += sprints ( g_sa + pos, cvtdAlpha, lenCvtdAlpha );
2168 }
2169 #endif /* #ifdef NO_ASCIIZ */
2170 }
2171
2172 ci_remTrailCom(g_sa, pos);
2173 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT);
2174 }
2175 ACI_MFREE (calLst);
2176 break;
2177 default:
2178 cmdCmeError(CME_ERR_Unknown);
2179 return (ATI_FAIL);
2180 }
2181 return (ATI_CMPL);
2182
2183 #endif /* no FF_ATI_BAT */
2184 }
2185
2186 /*
2187 +--------------------------------------------------------------------+
2188 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD |
2189 | STATE : code ROUTINE : atPercentCLCC |
2190 +--------------------------------------------------------------------+
2191
2192 PURPOSE : %CLCCcommand (list current calls)
2193 */
2194 GLOBAL T_ATI_RSLT setatPercentCLCC(char *cl, UBYTE srcId)
2195 {
2196 char *me = "%CLCC: ";
2197 T_ACI_CLCC_CALDESC *calLst = NULL;
2198 UBYTE lstIdx = 0;
2199 SHORT pos = 0;
2200 USHORT lenCvtdAlpha = 0;
2201 UBYTE type = 0;
2202 CHAR cvtdAlpha[2*MAX_ALPHA_LEN];
2203
2204 TRACE_FUNCTION("setatPercentCLCC()");
2205
2206 srcId_cb = srcId; /* For utl_chsetFromGsm() */
2207
2208 switch (*cl)
2209 {
2210 case(';'):
2211 case(0x0):
2212 ACI_MALLOC (calLst, MAX_CALL_NR * sizeof (T_ACI_CLCC_CALDESC));
2213 memset(calLst, 0 , MAX_CALL_NR * sizeof (T_ACI_CLCC_CALDESC));
2214 (void)qAT_PlusCLCC((T_ACI_CMD_SRC)srcId, calLst); /* Always returns AT_CMPL */
2215
2216 /* 20 is approximatly the amount of extra characters (like ",") */
2217
2218 for( lstIdx = 0; lstIdx < MAX_CALL_NR; lstIdx++ )
2219 {
2220 if( calLst[lstIdx].idx EQ ACI_NumParmNotPresent )
2221 break;
2222
2223 pos = sprintf(g_sa,"%s%d",me,calLst[lstIdx].idx);
2224
2225 if (calLst[lstIdx].dir NEQ CLCC_DIR_NotPresent)
2226 pos += sprintf(g_sa+pos,",%d",calLst[lstIdx].dir);
2227 else
2228 pos += sprintf(g_sa+pos,",");
2229 if (calLst[lstIdx].stat NEQ CLCC_STAT_NotPresent)
2230 pos += sprintf(g_sa+pos,",%d",calLst[lstIdx].stat);
2231 else
2232 pos += sprintf(g_sa+pos,",");
2233 if (calLst[lstIdx].mode NEQ CLCC_MODE_NotPresent)
2234 pos += sprintf(g_sa+pos,",%d",calLst[lstIdx].mode);
2235 else
2236 pos += sprintf(g_sa+pos,",");
2237 if (calLst[lstIdx].mpty NEQ CLCC_MPTY_NotPresent)
2238 pos += sprintf(g_sa+pos,",%d",calLst[lstIdx].mpty);
2239 else
2240 pos += sprintf(g_sa+pos,",");
2241 if (calLst[lstIdx].class_type NEQ CLCC_CLASS_NotPresent)
2242 pos += sprintf(g_sa+pos,",%d",calLst[lstIdx].class_type);
2243 else
2244 pos += sprintf(g_sa+pos,",");
2245
2246 if (calLst[lstIdx].number[0] NEQ 0x0)
2247 {
2248 pos += sprintf(g_sa+pos,",\"%s\"",calLst[lstIdx].number);
2249 if (calLst[lstIdx].type.ton NEQ TON_NotPresent)
2250 {
2251 type = toa_merge(calLst[lstIdx].type);
2252 pos += sprintf(g_sa+pos,",%d",(int)type);
2253 }
2254 #ifdef NO_ASCIIZ
2255 if (calLst[lstIdx].alpha.len NEQ 0x0)
2256 {
2257 pos += sprintf(g_sa+pos,",");
2258 utl_chsetFromGsm ( calLst[lstIdx].alpha.data,
2259 calLst[lstIdx].alpha.len,
2260 (UBYTE*)cvtdAlpha,
2261 sizeof(cvtdAlpha),
2262 &lenCvtdAlpha,
2263 GSM_ALPHA_Def );
2264 pos += sprints ( g_sa + pos, cvtdAlpha, lenCvtdAlpha );
2265 }
2266 #else /* #ifdef NO_ASCIIZ */
2267 if (calLst[lstIdx].alpha[0] NEQ 0x0)
2268 {
2269 pos += sprintf(g_sa+pos,",");
2270 utl_chsetFromGsm ( (UBYTE*)calLst[lstIdx].alpha,
2271 0,
2272 (UBYTE*)cvtdAlpha,
2273 sizeof(cvtdAlpha),
2274 &lenCvtdAlpha,
2275 GSM_ALPHA_Int );
2276 pos += sprints ( g_sa + pos, cvtdAlpha, lenCvtdAlpha );
2277 }
2278 #endif /* #ifdef NO_ASCIIZ */
2279 }
2280
2281 ci_remTrailCom(g_sa, pos);
2282 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT);
2283 }
2284 ACI_MFREE (calLst);
2285 break;
2286 default:
2287 cmdCmeError(CME_ERR_Unknown);
2288 return (ATI_FAIL);
2289 }
2290 return (ATI_CMPL);
2291 }
2292
2293 /*
2294 +--------------------------------------------------------------------+
2295 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD |
2296 | STATE : code ROUTINE : atPlusCCWA |
2297 +--------------------------------------------------------------------+
2298
2299 PURPOSE : +CCWA command (Call Waiting Managment)
2300 */
2301 GLOBAL T_ATI_RSLT setatPlusCCWA (char *cl, UBYTE srcId)
2302 {
2303 T_ACI_RETURN ret = AT_FAIL;
2304 T_ACI_CCWA_MOD mode = CCWA_MOD_NotInterrogate;
2305 T_ACI_CLASS class_type = CLASS_NotPresent;
2306 SHORT val = -1;
2307 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id);
2308
2309 cl = parse(cl, "rdd", &val, &mode, &class_type);
2310 if (!cl OR val > 1 )
2311 {
2312 cmdCmeError (CME_ERR_OpNotAllow);
2313 return (ATI_FAIL);
2314 }
2315
2316 if (val >= 0)
2317 {
2318 at.flags.CCWA_stat=(UBYTE) val;
2319 }
2320
2321 #ifdef FF_ATI_BAT
2322 {
2323 T_BAT_cmd_send cmd;
2324 T_BAT_cmd_set_plus_ccwa my_bat_set_plus_ccwa;
2325
2326 TRACE_FUNCTION("setatPLusCCWA() calls bat_send() <=== as APPLICATION");
2327
2328 memset(&my_bat_set_plus_ccwa, 0, sizeof(my_bat_set_plus_ccwa));
2329 cmd.ctrl_params = BAT_CMD_SET_PLUS_CCWA;
2330 cmd.params.ptr_set_plus_ccwa = &my_bat_set_plus_ccwa;
2331
2332 my_bat_set_plus_ccwa.mode = mode;
2333 my_bat_set_plus_ccwa.bearer_class = class_type;
2334 src_params->curAtCmd = AT_CMD_CCWA;
2335 bat_send(ati_bat_get_client(srcId), &cmd);
2336
2337 return ATI_EXCT; /* executing, because response is passed by callback function */
2338 }
2339 #else /* OLD FUNCTION BODY */
2340
2341 TRACE_FUNCTION("setatPLusCCWA()");
2342
2343 if (mode EQ CCWA_MOD_Query) /*query mode*/
2344 {
2345 ret = qAT_PlusCCWA ((T_ACI_CMD_SRC)srcId,class_type);
2346 switch (ret)
2347 {
2348 case AT_EXCT:
2349 src_params->curAtCmd = AT_CMD_CCWA;
2350 break;
2351
2352 default:
2353 cmdCmeError(CME_ERR_Unknown);
2354 break;
2355 }
2356 }
2357 else /*set mode*/
2358 {
2359 ret = sAT_PlusCCWA ((T_ACI_CMD_SRC)srcId,mode,class_type);
2360 switch (ret)
2361 {
2362 case AT_EXCT:
2363 break;
2364
2365 case AT_FAIL:
2366 case AT_BUSY:
2367 cmdCmeError (CME_ERR_Unknown);
2368 break;
2369 }
2370 }
2371 return (map_aci_2_ati_rslt (ret));
2372
2373 #endif /* no FF_ATI_BAT*/
2374 }
2375
2376
2377 GLOBAL T_ATI_RSLT queatPlusCCWA (CHAR *cl, UBYTE srcId)
2378 {
2379 TRACE_FUNCTION("queatPLusCCWA()");
2380
2381 resp_disp (srcId, cl,"b",&at.flags.CCWA_stat);
2382 return (ATI_CMPL);
2383 }
2384
2385 /*
2386 +--------------------------------------------------------------------+
2387 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD |
2388 | STATE : code ROUTINE : atPlusVTS |
2389 +--------------------------------------------------------------------+
2390
2391 PURPOSE : +VTS command (send DTMF)
2392 */
2393 GLOBAL T_ATI_RSLT setatPlusVTS (char * cl, UBYTE srcId)
2394 {
2395 T_ACI_RETURN ret = AT_FAIL;
2396 SHORT duration = ACI_NumParmNotPresent;
2397 CHAR dtmf = '\0';
2398 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id);
2399
2400 if( *cl EQ '\0' )
2401 {
2402 cmdCmeError(CME_ERR_OpNotAllow);
2403 return (ATI_FAIL);
2404 }
2405
2406 cl = parse (cl, "ar", (ULONG)1, &dtmf, &duration);
2407 if (!cl)
2408 {
2409 cmdCmeError(CME_ERR_OpNotAllow);
2410 return (ATI_FAIL);
2411 }
2412
2413 #ifdef FF_ATI_BAT
2414 {
2415 T_BAT_cmd_send cmd;
2416 T_BAT_cmd_set_plus_vts my_bat_set_plus_vts;
2417
2418 TRACE_FUNCTION("setatPlusVTS() calls bat_send() <=== as APPLICATION");
2419
2420 memset(&my_bat_set_plus_vts, 0, sizeof(my_bat_set_plus_vts));
2421 cmd.ctrl_params = BAT_CMD_SET_PLUS_VTS;
2422 cmd.params.ptr_set_plus_vts = &my_bat_set_plus_vts;
2423
2424 my_bat_set_plus_vts.dtmf = dtmf;
2425 src_params->curAtCmd = AT_CMD_VTS;
2426 bat_send(ati_bat_get_client(srcId), &cmd);
2427
2428 return ATI_EXCT; /* executing, because response is passed by callback function */
2429 }
2430 #else /* OLD FUNCTION BODY */
2431
2432 TRACE_FUNCTION("setatPlusVTS()");
2433
2434 ret = sAT_PlusVTS((T_ACI_CMD_SRC)srcId,dtmf,VTS_MOD_Auto);
2435
2436 switch (ret)
2437 {
2438 case AT_EXCT:
2439 src_params->curAtCmd = AT_CMD_VTS;
2440 break;
2441
2442 case AT_FAIL:
2443 case AT_BUSY:
2444 cmdCmeError (CME_ERR_Unknown);
2445 break;
2446 }
2447 return (map_aci_2_ati_rslt (ret));
2448
2449 #endif /* no FF_ATI_BAT*/
2450 }
2451
2452 /*
2453 +--------------------------------------------------------------------+
2454 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD |
2455 | STATE : code ROUTINE : setatPercentRDL |
2456 +--------------------------------------------------------------------+
2457
2458 PURPOSE : %RDL command (set redial mode)
2459 */
2460
2461 GLOBAL T_ATI_RSLT setatPercentRDL (char* cl, UBYTE srcId)
2462 {
2463 T_ACI_CC_REDIAL_MODE rdlmode = AUTOM_REP_NOT_PRESENT;
2464 T_ACI_CC_REDIAL_NOTIF usr_notif = NOTIF_NO_PRESENT;
2465 T_ACI_RETURN ret = AT_FAIL;
2466
2467 cl = parse(cl, "dd", &rdlmode, &usr_notif);
2468 if(!cl)
2469 {
2470 cmdCmeError(CME_ERR_OpNotAllow);
2471 return (ATI_FAIL);
2472 }
2473
2474 #ifdef FF_ATI_BAT
2475 {
2476 T_BAT_cmd_send cmd;
2477 T_BAT_cmd_set_percent_rdl my_bat_set_percent_rdl;
2478
2479 TRACE_FUNCTION("setatPercentRDL() calls bat_send() <=== as APPLICATION");
2480
2481 memset(&my_bat_set_percent_rdl, 0, sizeof(my_bat_set_percent_rdl));
2482 cmd.ctrl_params = BAT_CMD_SET_PERCENT_RDL;
2483 cmd.params.ptr_set_percent_rdl = &my_bat_set_percent_rdl;
2484
2485 my_bat_set_percent_rdl.mode = (T_BAT_percent_rdl_mode)&rdlmode;
2486
2487 bat_send(ati_bat_get_client(srcId), &cmd);
2488
2489 return ATI_EXCT; /* executing, because response is passed by callback function */
2490 }
2491 #else /* OLD FUNCTION BODY */
2492
2493 TRACE_FUNCTION("setatPercentRDL()");
2494
2495 ret = sAT_PercentRDL ((T_ACI_CMD_SRC)srcId, rdlmode, usr_notif);
2496
2497 if (ret NEQ AT_CMPL)
2498 {
2499 cmdCmeError(CME_ERR_OpNotAllow);
2500 }
2501 return (map_aci_2_ati_rslt (ret));
2502
2503 #endif /* no FF_ATI_BAT*/
2504 }
2505
2506 /*
2507 +--------------------------------------------------------------------+
2508 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD |
2509 | STATE : code ROUTINE : queatPercentRDL |
2510 +--------------------------------------------------------------------+
2511
2512 PURPOSE : %RDL command (query redial mode)
2513 */
2514
2515 GLOBAL T_ATI_RSLT queatPercentRDL (char* cl, UBYTE srcId)
2516 {
2517 T_ACI_CC_REDIAL_MODE rdlmode = AUTOM_REP_NOT_PRESENT;
2518 T_ACI_CC_REDIAL_NOTIF usr_notif = NOTIF_NO_PRESENT;
2519 T_ACI_RETURN ret = AT_FAIL;
2520
2521 TRACE_FUNCTION("queatPercentRDL()");
2522
2523 ret = qAT_PercentRDL ((T_ACI_CMD_SRC)srcId,&rdlmode, &usr_notif);
2524
2525 if(ret EQ AT_CMPL)
2526 {
2527 resp_disp (srcId, cl,"bb",&rdlmode, &usr_notif);
2528 }
2529 else
2530 {
2531 cmdCmeError (CME_ERR_Unknown);
2532 }
2533 return (map_aci_2_ati_rslt (ret));
2534 }
2535
2536 #ifdef TI_PS_FF_AT_P_CMD_RDLB
2537 /*
2538 +--------------------------------------------------------------------+
2539 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD |
2540 | STATE : code ROUTINE : setatPercentRDLB |
2541 +--------------------------------------------------------------------+
2542
2543 PURPOSE : %RDLB command (delete black list of redialling phone
2544 numbers)
2545 */
2546
2547 GLOBAL T_ATI_RSLT setatPercentRDLB (char* cl, UBYTE srcId)
2548 {
2549 T_ACI_RETURN ret = AT_FAIL;
2550 T_ACI_CC_REDIAL_NOTIF usr_notif = NOTIF_NO_PRESENT;
2551 T_ACI_CC_REDIAL_BLMODE blmode = BLMODE_NO_PRESENT;
2552
2553 cl = parse(cl, "dd", &blmode, &usr_notif);
2554 if(!cl)
2555 {
2556 cmdCmeError(CME_ERR_OpNotAllow);
2557 return (ATI_FAIL);
2558 }
2559
2560 #ifdef FF_ATI_BAT
2561 {
2562 T_BAT_cmd_send cmd;
2563 T_BAT_cmd_set_percent_rdlb my_bat_set_percent_rdlb;
2564
2565 TRACE_FUNCTION("setatPercentRDLB() calls bat_send() <=== as APPLICATION");
2566
2567 memset(&my_bat_set_percent_rdlb, 0, sizeof(my_bat_set_percent_rdlb));
2568 cmd.ctrl_params = BAT_CMD_SET_PERCENT_RDLB;
2569 cmd.params.ptr_set_percent_rdlb = &my_bat_set_percent_rdlb;
2570
2571 my_bat_set_percent_rdlb.mode = (T_BAT_percent_rdlb_mode)&blmode;
2572
2573 bat_send(ati_bat_get_client(srcId), &cmd);
2574
2575 return ATI_EXCT; /* executing, because response is passed by callback function */
2576 }
2577 #else /* OLD FUNCTION BODY */
2578
2579 TRACE_FUNCTION("setatPercentRDLB()");
2580
2581 ret = sAT_PercentRDLB((T_ACI_CMD_SRC)srcId, blmode, usr_notif);
2582
2583 if (ret NEQ AT_CMPL)
2584 {
2585 cmdCmeError(CME_ERR_OpNotAllow);
2586 }
2587 return (map_aci_2_ati_rslt (ret));
2588
2589 #endif /* no FF_ATI_BAT*/
2590 }
2591
2592 /*
2593 +--------------------------------------------------------------------+
2594 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD |
2595 | STATE : code ROUTINE : queatPercentRDLB |
2596 +--------------------------------------------------------------------+
2597
2598 PURPOSE : %RDLB command (query black list of redialling phone
2599 numbers)
2600 */
2601
2602 GLOBAL T_ATI_RSLT queatPercentRDLB (char* cl, UBYTE srcId)
2603 {
2604 T_ACI_RETURN ret = AT_FAIL;
2605 T_ACI_CC_REDIAL_BLACKL blackl;
2606 T_ACI_CC_REDIAL_NOTIF usr_notif= NOTIF_NO_PRESENT;
2607 UBYTE i,j;
2608 UBYTE type;
2609
2610 TRACE_FUNCTION("queatPercentRDLB()");
2611
2612 memset(&blackl, 0, sizeof(T_ACI_CC_REDIAL_BLACKL));
2613
2614 ret = qAT_PercentRDLB ((T_ACI_CMD_SRC)srcId,&blackl,&usr_notif);
2615
2616 if(ret EQ AT_CMPL)
2617 {
2618 resp_disp (srcId, cl,"b", &usr_notif); /* output user notification state */
2619 for(i=0; i<blackl.blCount; i++) /* output black list */
2620 {
2621 type = (UBYTE)toa_merge(blackl.blNum[i].type);
2622 for(j=0; j<blackl.blNum[i].numb_len; j++)
2623 {
2624 blackl.blNum[i].number[j] = (blackl.blNum[i].number[j] | 0x30);
2625 }
2626 sprintf(g_sa,"%s:\"%s\",%d","%RDLB",blackl.blNum[i].number,
2627 (int)type);
2628 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT);
2629 }
2630 }
2631 else
2632 {
2633 cmdCmeError (CME_ERR_Unknown);
2634 }
2635 return (map_aci_2_ati_rslt (ret));
2636 }
2637 #endif /* TI_PS_FF_AT_P_CMD_RDLB */
2638 /*
2639 +--------------------------------------------------------------------+
2640 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD |
2641 | STATE : code ROUTINE : atPercentVTS |
2642 +--------------------------------------------------------------------+
2643
2644 PURPOSE : %VTS command (send DTMF)
2645 */
2646 GLOBAL T_ATI_RSLT setatPercentVTS (char * cl, UBYTE srcId)
2647 {
2648 T_ACI_RETURN ret = AT_FAIL;
2649 CHAR dtmf = 0x0;
2650 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id);
2651 T_ACI_VTS_MOD mode = VTS_MOD_Auto;
2652
2653 if( *cl EQ '\0' )
2654 {
2655 cmdCmeError(CME_ERR_OpNotAllow);
2656 return (ATI_FAIL);
2657 }
2658
2659 cl = parse (cl, "ar", (ULONG)1, &dtmf, &mode);
2660
2661 if (!cl)
2662 {
2663 cmdCmeError(CME_ERR_OpNotAllow);
2664 return (ATI_FAIL);
2665 }
2666
2667 if (mode EQ VTS_MOD_NotPresent)
2668 {
2669 mode = VTS_MOD_Auto;
2670 }
2671
2672 #ifdef FF_ATI_BAT
2673 {
2674 T_BAT_cmd_send cmd;
2675 T_BAT_cmd_set_percent_vts my_bat_set_percent_vts;
2676
2677 TRACE_FUNCTION("setatPercentVTS() calls bat_send() <=== as APPLICATION");
2678
2679 memset(&my_bat_set_percent_vts, 0, sizeof(my_bat_set_percent_vts));
2680 cmd.ctrl_params = BAT_CMD_SET_PERCENT_VTS;
2681 cmd.params.ptr_set_percent_vts = &my_bat_set_percent_vts;
2682
2683 my_bat_set_percent_vts.dtmf = dtmf;
2684 my_bat_set_percent_vts.mode = mode;
2685 src_params->curAtCmd = AT_CMD_VTS;
2686 bat_send(ati_bat_get_client(srcId), &cmd);
2687
2688 return ATI_EXCT; /* executing, because response is passed by callback function */
2689 }
2690 #else /* OLD FUNCTION BODY */
2691
2692 TRACE_FUNCTION("setatPercentVTS()");
2693
2694 ret = sAT_PlusVTS((T_ACI_CMD_SRC)srcId,dtmf,mode);
2695
2696 switch (ret)
2697 {
2698 case AT_EXCT:
2699 {
2700 src_params->curAtCmd = AT_CMD_VTS;
2701 break;
2702 }
2703 case AT_FAIL:
2704 case AT_BUSY:
2705 {
2706 cmdCmeError (CME_ERR_Unknown);
2707 break;
2708 }
2709 }
2710
2711 return (map_aci_2_ati_rslt (ret));
2712
2713 #endif /* no FF_ATI_BAT*/
2714 }
2715
2716
2717 /*
2718 +--------------------------------------------------------------------+
2719 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD |
2720 | STATE : code ROUTINE : atPlusCSNS |
2721 +--------------------------------------------------------------------+
2722
2723 PURPOSE : +CSNS command (single numbering scheme)
2724 */
2725 GLOBAL T_ATI_RSLT setatPlusCSNS (char* cl, UBYTE srcId)
2726 {
2727 T_ACI_CSNS_MOD mode = CSNS_MOD_NotPresent;
2728 T_ACI_RETURN ret = AT_FAIL;
2729
2730 cl= parse (cl, "d", &mode);
2731 if (!cl)
2732 {
2733 cmdCmeError(CME_ERR_OpNotAllow);
2734 return (ATI_FAIL);
2735 }
2736
2737 #ifdef FF_ATI_BAT
2738 {
2739 T_BAT_cmd_send cmd;
2740 T_BAT_cmd_set_plus_csns my_bat_set_plus_csns;
2741
2742 TRACE_FUNCTION("setatPlusCSNS() calls bat_send() <=== as APPLICATION");
2743
2744 memset(&my_bat_set_plus_csns, 0, sizeof(my_bat_set_plus_csns));
2745 cmd.ctrl_params = BAT_CMD_SET_PLUS_CSNS;
2746 cmd.params.ptr_set_plus_csns = &my_bat_set_plus_csns;
2747
2748 my_bat_set_plus_csns.mode = mode;
2749
2750 bat_send(ati_bat_get_client(srcId), &cmd);
2751
2752 return ATI_EXCT; /* executing, because response is passed by callback function */
2753 }
2754 #else /* OLD FUNCTION BODY */
2755
2756 TRACE_FUNCTION("setatPlusCSNS()");
2757
2758 ret = sAT_PlusCSNS ((T_ACI_CMD_SRC)srcId, mode);
2759 if (ret NEQ AT_CMPL)
2760 {
2761 cmdCmeError(CME_ERR_OpNotAllow);
2762 }
2763 return (map_aci_2_ati_rslt (ret));
2764
2765 #endif /* no FF_ATI_BAT*/
2766 }
2767
2768 GLOBAL T_ATI_RSLT queatPlusCSNS (char* cl, UBYTE srcId)
2769 {
2770 T_ACI_CSNS_MOD mode = CSNS_MOD_NotPresent;
2771 T_ACI_RETURN ret = AT_FAIL;
2772
2773 TRACE_FUNCTION("queatPlusCSNS()");
2774
2775 ret = qAT_PlusCSNS ((T_ACI_CMD_SRC)srcId,&mode);
2776
2777 if(ret EQ AT_CMPL)
2778 {
2779 resp_disp (srcId, cl,"e",&mode);
2780 }
2781 else
2782 {
2783 cmdCmeError (CME_ERR_Unknown);
2784 }
2785 return (map_aci_2_ati_rslt (ret));
2786 }
2787 #ifdef TI_PS_FF_AT_CMD_P_ECC
2788 /*
2789 +--------------------------------------------------------------------+
2790 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD |
2791 | STATE : code ROUTINE : setatPercentECC |
2792 +--------------------------------------------------------------------+
2793
2794 PURPOSE : %ECC command (set additional ECC numbers)
2795 */
2796
2797 GLOBAL T_ATI_RSLT setatPercentECC (char* cl, UBYTE srcId)
2798 {
2799 T_ACI_RETURN ret = AT_FAIL;
2800 U8 index;
2801 char ecc_number[ADDITIONAL_ECC_NUMBER_LENGTH+1]; /* +1 for '\0' */
2802 UBYTE idx;
2803 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id);
2804
2805 TRACE_FUNCTION("setatPercentECC()");
2806
2807 memset(ecc_number,0,sizeof(ecc_number));
2808
2809 cl = parse(cl,"ds",
2810 &index,
2811 (LONG)sizeof(ecc_number),
2812 ecc_number);
2813
2814 if (cl EQ NULL)
2815 {
2816 idx = get_parse_index(); /* get the problematic component */
2817 TRACE_EVENT_P1("index %d",idx);
2818 switch (idx)
2819 {
2820 case 1:
2821 cmdCmeError(CME_ERR_InvIdx);
2822 break;
2823 case 2:
2824 cmdCmeError(CME_ERR_TxtToLong);
2825 break;
2826 default:
2827 cmdCmeError(CME_ERR_OpNotAllow);
2828 break;
2829 }
2830 return ATI_FAIL;
2831 }
2832
2833 #ifdef FF_ATI_BAT
2834 {
2835 T_BAT_cmd_send cmd;
2836 T_BAT_cmd_set_percent_ecc ecc;
2837
2838 memset(&ecc, 0, sizeof(ecc));
2839 cmd.ctrl_params = BAT_CMD_SET_PERCENT_ECC;
2840 cmd.params.ptr_set_percent_ecc = &ecc;
2841 ecc.index = index;
2842 ecc.c_number = (U8)strlen(ecc_number);
2843 memcpy(ecc.number, ecc_number, ecc.c_number);
2844 src_params->curAtCmd = AT_CMD_P_ECC;
2845 bat_send(ati_bat_get_client(srcId), &cmd);
2846
2847 return ATI_EXCT;
2848 }
2849 #else
2850 ret = sAT_PercentECC((T_ACI_CMD_SRC)srcId, index, ecc_number);
2851
2852 return (map_aci_2_ati_rslt(ret));
2853 #endif
2854 }
2855 #endif /* TI_PS_FF_AT_CMD_P_ECC */
2856
2857 /*
2858 +--------------------------------------------------------------------+
2859 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD |
2860 | STATE : code ROUTINE : setatPlusCVHU |
2861 +--------------------------------------------------------------------+
2862
2863 PURPOSE : +CVHU command (set voice hangup control)
2864 */
2865 GLOBAL T_ATI_RSLT setatPlusCVHU (char* cl, UBYTE srcId)
2866 {
2867 T_ACI_CVHU_MODE mode = CVHU_DropDTR_IGNORED;
2868 T_ACI_RETURN ret = AT_FAIL;
2869 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id);
2870
2871 TRACE_FUNCTION("setatPlusCVHU()");
2872
2873 cl= parse (cl,"d",&mode);
2874 if(!cl)
2875 {
2876 cmdCmeError(CME_ERR_OpNotAllow);
2877 return (ATI_FAIL);
2878 }
2879 #ifdef FF_ATI_BAT
2880 {
2881 T_BAT_cmd_send cmd;
2882 T_BAT_cmd_set_plus_cvhu cvhu;
2883
2884 memset(&cvhu, 0, sizeof(cvhu));
2885 cmd.ctrl_params = BAT_CMD_SET_PLUS_CVHU;
2886 cmd.params.ptr_set_plus_cvhu = &cvhu;
2887 cvhu.cvhu_mode = mode;
2888 src_params->curAtCmd = AT_CMD_CVHU;
2889 bat_send(ati_bat_get_client(srcId), &cmd);
2890
2891 return ATI_EXCT;
2892 }
2893 #else
2894 ret= sAT_PlusCVHU ((T_ACI_CMD_SRC)srcId, mode);
2895 if (ret NEQ AT_CMPL)
2896 {
2897 cmdCmeError(CME_ERR_OpNotAllow);
2898 }
2899 return (map_aci_2_ati_rslt (ret));
2900 #endif
2901 }
2902
2903 /*
2904 +--------------------------------------------------------------------+
2905 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD |
2906 | STATE : code ROUTINE : queatPlusCVHU |
2907 +--------------------------------------------------------------------+
2908
2909 PURPOSE : +CVHU command (query voice hangup control)
2910 */
2911 GLOBAL T_ATI_RSLT queatPlusCVHU (char* cl, UBYTE srcId)
2912 {
2913 T_ACI_CVHU_MODE mode = CVHU_DropDTR_IGNORED;
2914 T_ACI_RETURN ret = AT_FAIL;
2915 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id);
2916
2917 TRACE_FUNCTION("queatPlusCVHU()");
2918
2919 #ifdef FF_ATI_BAT
2920 {
2921 T_BAT_cmd_send cmd;
2922 T_BAT_no_parameter dummy;
2923
2924 TRACE_FUNCTION("queatPlusCVHU() calls bat_send() <=== as APPLICATION");
2925
2926 cmd.ctrl_params = BAT_CMD_QUE_PLUS_CVHU;
2927 dummy.bat_dummy = 0xFF;
2928 cmd.params.ptr_que_plus_cvhu = &dummy;
2929 src_params->curAtCmd = AT_CMD_CVHU;
2930 bat_send(ati_bat_get_client(srcId), &cmd);
2931 return ATI_EXCT; /* executing, because response is passed by callback function */
2932 }
2933 #else /* no FF_ATI_BAT */
2934 ret = qAT_PlusCVHU ((T_ACI_CMD_SRC)srcId, &mode);
2935
2936 if(ret EQ AT_CMPL)
2937 {
2938 resp_disp (srcId, cl, "e", &mode);
2939 }
2940 else
2941 {
2942 cmdCmeError (CME_ERR_Unknown);
2943 }
2944 return (map_aci_2_ati_rslt (ret));
2945 #endif /* FF_ATI_BAT */
2946 }
2947 #endif /* ATI_CC_C */
2948