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