comparison g23m/condat/ms/src/aci/aci_bat_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 : ACI_BAT
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 : This BAT wrapper modul is ...
18 |
19 +-----------------------------------------------------------------------------
20 */
21
22 #include "aci_all.h"
23 #undef FF_ATI
24 #include "aci_cmh.h"
25 #include "aci_cmd.h"
26 #include "aci.h"
27 #include "aci_bat_cmh.h" /* prototypes of sBAT_,qBAT_,tBAT_ */
28 #include "aci_bat.h"
29 #pragma message(__TODO__"aci_prs.h: EXTERN char *parse(char *b,char *f, ...); of ati_prs.c !")
30 #include "aci_prs.h"
31
32 /* implemented in aci_util.c, but prototype in ati_int.h ! Header file cleanup needed ! */
33 EXTERN CHAR *strupper (CHAR *s);
34
35 /*================== local functions prototypes =============================*/
36
37 LOCAL T_ACI_BAT_RSLT aci_bat_call_from_phonebook(T_ACI_DTI_PRC_PSI *src_infos_psi,
38 T_BAT_cmd_send *cmd);
39
40 LOCAL T_ACI_BAT_RSLT aci_bat_call_with_number (T_ACI_DTI_PRC_PSI *src_infos_psi,
41 T_BAT_cmd_send *cmd);
42
43
44 /*================== local functions ========================================*/
45
46 /*
47 * special hint:
48 * There is hard coded the definition of NO_ASCIIZ (see phb.h, aci.h and aci_cmh.h),
49 * which means it is always defined regardless what busybe configures.
50 * So, we never work with NULL terminated strings,
51 * but with character arrays, which have a length information in addition
52 * to know how many characters to process.
53 * In this code there is several times this #ifdef NO_ASCIIZ
54 * just to go with the current implementation of ACI.
55 * But NULL terminated strings are not covered !
56 */
57
58 LOCAL void aci_bat_clean_dial_str (char *dial_str, int dial_len)
59 {
60 #define VALID_CHARS "*#+-PpWw"
61 int i,j,k = 0;
62 int charLen = sizeof(VALID_CHARS);
63 char *valChrs = VALID_CHARS;
64 int match = FALSE;
65
66 for (i=0; i<dial_len; i++)
67 {
68 match = FALSE;
69 if ((dial_str[i] < '0') || (dial_str[i] > 'D'))
70 {
71 for (j=0; j<charLen; j++)
72 {
73 if (dial_str[i] == valChrs[j]) /* "*#+-PpWw" */
74 {
75 match = TRUE;
76 break;
77 }
78 }
79 }
80 else /* "0123456789ABCD" */
81 {
82 match = TRUE;
83 }
84 if (match)
85 {
86 dial_str[k] = dial_str[i];
87 k++;
88 }
89 }
90 if (k < dial_len)
91 {
92 dial_str[k] = 0x0; /* is there always 1 byte space for the '\0' ? */
93 }
94 }
95
96
97
98 LOCAL void aci_bat_check_clir_cug_type (U8 *dial_string,
99 T_ACI_D_CLIR_OVRD *clir_ovrd,
100 T_ACI_D_CUG_CTRL *cug_ctrl,
101 T_ACI_D_TOC *call_type)
102 {
103 if (*dial_string EQ 'i')
104 {
105 *clir_ovrd = D_CLIR_OVRD_Supp;
106 dial_string++;
107 }
108 if (*dial_string EQ 'I')
109 {
110 *clir_ovrd = D_CLIR_OVRD_Invoc;
111 dial_string++;
112 }
113 if (*dial_string EQ 'g'OR *dial_string EQ 'G')
114 {
115 *cug_ctrl = D_CUG_CTRL_Present;
116 dial_string++;
117 }
118 if (*dial_string EQ ';')
119 {
120 *call_type = D_TOC_Voice;
121 }
122 }
123
124 #define NAME_BUF_LEN 32
125
126 LOCAL T_ACI_BAT_RSLT aci_bat_call_from_phonebook(T_ACI_DTI_PRC_PSI *src_infos_psi,
127 T_BAT_cmd_send *cmd)
128 {
129 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL;
130 CHAR *dial_string = NULL;
131 int i;
132 S16 index = -1;
133 S16 pos;
134 char alpha[NAME_BUF_LEN] = {'\0'};
135 U16 lenAlpha = 0;
136 char cvtdAlpha[NAME_BUF_LEN] = {'\0'};
137 U16 lenCvtdAlpha = 0;
138 char t[MAX_DIAL_LEN-1] = {'\0'};
139 char *t_p = NULL;
140
141 T_ACI_PB_STOR mem_stor = PB_STOR_NotPresent;
142 T_ACI_D_CLIR_OVRD clir_ovrd = D_CLIR_OVRD_Default;
143 T_ACI_D_CUG_CTRL cug_ctrl = D_CUG_CTRL_NotPresent;
144 T_ACI_D_TOC call_type = D_TOC_Data;
145
146 #ifdef NO_ASCIIZ
147 T_ACI_PB_TEXT pbText;
148 #endif
149
150 TRACE_FUNCTION ("aci_bat_call_from_phonebook()");
151
152 dial_string = (CHAR*)cmd->params.ptr_at_d->dial_string;
153 dial_string++; /* skip the already parsed '>'; */
154
155 if (*dial_string EQ '"')
156 {
157 /* call with a given name of phonebook e.g.: ATD>"Doe Joe" */
158 dial_string = parse(dial_string,"z",
159 (LONG)NAME_BUF_LEN,
160 strlen(dial_string),
161 dial_string,
162 &lenAlpha,
163 alpha);
164 if (dial_string EQ NULL)
165 {
166 ACI_ERR_DESC( ACI_ERR_CLASS_Cme, CME_ERR_OpNotAllow);
167 return (ACI_BAT_FAIL);
168 }
169 else if (strcspn(dial_string,"iIgG;") NEQ 0)
170 {
171 ACI_ERR_DESC( ACI_ERR_CLASS_Cme, CME_ERR_OpNotAllow);
172 return (ACI_BAT_FAIL);
173 }
174 #ifdef NO_ASCIIZ
175 utl_chsetToSim ((UBYTE*)alpha, lenAlpha, (UBYTE*)cvtdAlpha, &lenCvtdAlpha, GSM_ALPHA_Def);
176 #else
177 TRACE_ERROR("NO_ASCIIZ is defined in aci.h, phb.c and aci_cmh.h, so NO support for NULL terminated strings");
178 #endif
179 t_p = cvtdAlpha;
180 }
181 else
182 {
183 /* call from a specific phonebook entry e.g.: ATD>MT7 */
184 if ((toupper(*dial_string)) >= 'A' AND (toupper(*dial_string)) <= 'Z')
185 {
186 for (i=0;phb_mem_names[i].name != 0;i++)
187 {
188 strupper(dial_string);
189 if (strncmp(dial_string,phb_mem_names[i].name,2) EQ 0)
190 {
191 mem_stor=phb_mem_names[i].stor;
192 break;
193 }
194 else mem_stor=-1;
195 }
196 if (mem_stor < 0)
197 {
198 ACI_ERR_DESC( ACI_ERR_CLASS_Cme, CME_ERR_OpNotAllow);
199 return (ACI_BAT_FAIL);
200 }
201 dial_string=dial_string+2;
202 }
203 pos=strcspn(dial_string,"iIgG;"); /* determine index */
204 if (pos EQ 0 OR pos >= (MAX_DIAL_LEN-1))
205 {
206 ACI_ERR_DESC( ACI_ERR_CLASS_Cme, CME_ERR_OpNotAllow);
207 return (ACI_BAT_FAIL);
208 }
209 strncpy(t,dial_string,pos);
210 dial_string=dial_string+pos;
211 index =(SHORT)atoi(t);
212
213 if(!index OR index > 300)
214 {
215 ACI_ERR_DESC( ACI_ERR_CLASS_Cme, CME_ERR_OpNotAllow);
216 return (ACI_BAT_FAIL);
217 }
218 t_p = NULL;
219 }
220
221 aci_bat_check_clir_cug_type ((U8*)dial_string, &clir_ovrd, &cug_ctrl, &call_type);
222
223 #ifdef NO_ASCIIZ
224 if ( t_p NEQ NULL )
225 {
226 pbText.cs = CS_Sim;
227 pbText.len = (UBYTE)lenCvtdAlpha;
228 memcpy(pbText.data, t_p, pbText.len);
229 }
230 else
231 {
232 pbText.cs = CS_NotPresent;
233 pbText.len = 0;
234 }
235 ret = (T_ACI_BAT_RSLT)sAT_Dm(src_infos_psi->srcId, &pbText, mem_stor, index, clir_ovrd, cug_ctrl, call_type);
236 #else
237 TRACE_ERROR("NO_ASCIIZ is defined in aci.h, phb.c and aci_cmh.h, so NO support for NULL terminated strings");
238 #endif
239 return (ret);
240 }
241
242 LOCAL T_ACI_BAT_RSLT aci_bat_call_with_number (T_ACI_DTI_PRC_PSI *src_infos_psi,
243 T_BAT_cmd_send *cmd)
244 {
245 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL;
246 CHAR *dial_string = NULL;
247 S16 pos;
248 char t[MAX_DIAL_LEN-1] = {'\0'};
249
250 T_ACI_D_CLIR_OVRD clir_ovrd = D_CLIR_OVRD_Default;
251 T_ACI_D_CUG_CTRL cug_ctrl = D_CUG_CTRL_NotPresent;
252 T_ACI_D_TOC call_type = D_TOC_Data;
253
254 TRACE_FUNCTION ("aci_bat_call_with_number()");
255
256 dial_string = (CHAR*)cmd->params.ptr_at_d->dial_string;
257
258 pos = strcspn(dial_string,"iIgG;"); /* CLIR, CUG and call type are passed separately to sAT_Dn */
259 if (pos >= MAX_DIAL_LEN-1)
260 {
261 ACI_ERR_DESC( ACI_ERR_CLASS_Cme, CME_ERR_OpNotAllow);
262 return (ACI_BAT_FAIL);
263 }
264 if (pos)
265 {
266 strncpy(t, dial_string, pos);
267 dial_string = dial_string + pos;
268 t[pos]='\0';
269 }
270 else
271 {
272 strcpy(t,dial_string);
273 }
274
275 aci_bat_clean_dial_str (t, sizeof(t));
276
277 aci_bat_check_clir_cug_type ((U8*)dial_string, &clir_ovrd, &cug_ctrl, &call_type);
278
279 ret = (T_ACI_BAT_RSLT)sAT_Dn(src_infos_psi->srcId, t, clir_ovrd, cug_ctrl, call_type);
280
281 return (ret);
282 }
283
284 /*================== global functions ========================================*/
285
286 /*
287 +--------------------------------------------------------------------+
288 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT |
289 | STATE : code ROUTINE : BAT_D |
290 +--------------------------------------------------------------------+
291
292 PURPOSE : dial command for voice, data or USSD
293
294 1. call from phone book ? --> ATD>"Doe Joe"
295 1.a with CUG ON/OFF and/or CLIP ? --> ATD>"Doe Joe"G
296 1.b what character set ?
297 2 call from specific phone book ? --> ATD>MT7
298 2.a with CUG ON/OFF and/or CLIP ? --> ATD>MT7I
299 3. call with number ? --> ATD1234567
300 3.a with CUG ON/OFF and/or CLIP ? --> ATD1234567g
301 4. is the call a voice call ? --> ATDxxxxxxxx; <-- semicolon ?
302
303 up to here in general voice or data call is distinguished.
304 whether the data call is CSD, GPRS or USSD (checked by ksd_xxx() within cmhCC_Dial())
305 is handled on CMH level. see cmhCC_Dial()
306
307 */
308 GLOBAL T_ACI_BAT_RSLT BAT_D (T_ACI_DTI_PRC_PSI *src_infos_psi,
309 T_BAT_cmd_send *cmd)
310 {
311 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL;
312 U8 *dial_string = NULL;
313 TRACE_FUNCTION ("BAT_D()");
314
315 if (cmd->params.ptr_at_d->c_dial_string)
316 {
317 if (cmd->params.ptr_at_d->c_dial_string > MAX_DIAL_LEN-1)
318 {
319 ACI_ERR_DESC( ACI_ERR_CLASS_Cme, CME_ERR_OpNotAllow);
320 return (ACI_BAT_FAIL);
321 }
322 dial_string = cmd->params.ptr_at_d->dial_string;
323 if (*dial_string EQ '>')
324 {
325 ret = aci_bat_call_from_phonebook(src_infos_psi, cmd);
326 }
327 else
328 {
329 ret = aci_bat_call_with_number(src_infos_psi, cmd);
330 }
331 }
332 else
333 {
334 ACI_ERR_DESC( ACI_ERR_CLASS_Cme, CME_ERR_Unknown); /* No dial string, so unknown error */
335 }
336 return(ret);
337 }
338
339 /*
340 +--------------------------------------------------------------------+
341 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT |
342 | STATE : code ROUTINE : BAT_A |
343 +--------------------------------------------------------------------+
344
345 PURPOSE : ATA on binary level there is just a cmd.ctrl_params = BAT_CMD_AT_A
346 no additional parameter needed.
347 */
348 GLOBAL T_ACI_BAT_RSLT BAT_A (T_ACI_DTI_PRC_PSI *src_infos_psi,
349 T_BAT_cmd_send *cmd)
350 {
351 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL;
352 TRACE_FUNCTION ("BAT_A()");
353 ret = (T_ACI_BAT_RSLT)sAT_A(src_infos_psi->srcId);
354 if (ret EQ ACI_BAT_FAIL)
355 {
356 if (!(ACI_BAT_VALID_ERR_DESC())) /* has sAT_A already set an error value ? */
357 {
358 ACI_ERR_DESC( ACI_ERR_CLASS_Cme, CME_ERR_Unknown); /* No, so unknown error */
359 }
360 }
361 return(ret);
362 }
363
364 /*
365 +--------------------------------------------------------------------+
366 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT |
367 | STATE : code ROUTINE : sBAT_H |
368 +--------------------------------------------------------------------+
369
370 PURPOSE :
371 */
372 GLOBAL T_ACI_BAT_RSLT BAT_H (T_ACI_DTI_PRC_PSI *src_infos_psi,
373 T_BAT_cmd_send *cmd)
374 {
375 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL;
376 TRACE_FUNCTION ("BAT_H()");
377 ret = (T_ACI_BAT_RSLT)sAT_H(src_infos_psi->srcId);
378 if (ret EQ ACI_BAT_FAIL)
379 {
380 if (!(ACI_BAT_VALID_ERR_DESC())) /* has sAT_H already set an error value ? */
381 {
382 ACI_ERR_DESC( ACI_ERR_CLASS_Cme, CME_ERR_Unknown); /* No, so unknown error */
383 }
384 }
385 return(ret);
386 }
387
388 /*
389 +--------------------------------------------------------------------+
390 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT |
391 | STATE : code ROUTINE : sBAT_PlusCBST |
392 +--------------------------------------------------------------------+
393
394 PURPOSE :
395 */
396 GLOBAL T_ACI_BAT_RSLT sBAT_PlusCBST (T_ACI_DTI_PRC_PSI *src_infos_psi,
397 T_BAT_cmd_send *cmd)
398 {
399 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL;
400
401 TRACE_FUNCTION ("sBAT_PlusCBST()");
402
403 ret = sAT_PlusCBST(src_infos_psi->srcId,cmd->params.ptr_set_plus_cbst->speed,
404 cmd->params.ptr_set_plus_cbst->name,
405 cmd->params.ptr_set_plus_cbst->ce);
406 return(ret);
407 }
408
409 /*
410 +--------------------------------------------------------------------+
411 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT |
412 | STATE : code ROUTINE : qBAT_PlusCBST |
413 +--------------------------------------------------------------------+
414
415 PURPOSE :
416 */
417 GLOBAL T_ACI_BAT_RSLT qBAT_PlusCBST (T_ACI_DTI_PRC_PSI *src_infos_psi,
418 T_BAT_cmd_send *cmd)
419 {
420 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL;
421 T_BAT_plus_cbst_speed speed = BAT_CBST_SPD_NOT_PRESENT;
422 T_BAT_plus_cbst_name name = BAT_CBST_NAM_NOT_PRESENT ;
423 T_BAT_plus_cbst_ce ce = BAT_CBST_CE_NOT_PRESENT;
424 T_BAT_cmd_response resp;
425 T_BAT_res_que_plus_cbst que_cbst_buffer;
426
427 TRACE_FUNCTION ("qBAT_PlusCBST()");
428 resp.ctrl_response = BAT_RES_QUE_PLUS_CBST;
429 resp.response.ptr_que_plus_cbst = &que_cbst_buffer;
430
431 ret = qAT_PlusCBST(src_infos_psi->srcId,(T_ACI_BS_SPEED*)&speed,(T_ACI_CBST_NAM*)&name,(T_ACI_CBST_CE*)&ce);
432 if(ret EQ AT_CMPL)
433 {
434 resp.response.ptr_que_plus_cbst->ce = ce;
435 resp.response.ptr_que_plus_cbst->speed = speed;
436 resp.response.ptr_que_plus_cbst->name = name;
437 aci_bat_send(src_infos_psi,&resp);
438 return ACI_BAT_CMPL;
439 }
440 else
441 {
442 return ACI_BAT_FAIL;
443 }
444 }
445
446 /*
447 +--------------------------------------------------------------------+
448 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT |
449 | STATE : code ROUTINE : sBAT_PercentCTTY |
450 +--------------------------------------------------------------------+
451
452 PURPOSE :
453 */
454 GLOBAL T_ACI_BAT_RSLT sBAT_PercentCTTY (T_ACI_DTI_PRC_PSI *src_infos_psi,
455 T_BAT_cmd_send *cmd)
456 {
457 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL;
458
459 TRACE_FUNCTION ("sBAT_PercentCTTY()");
460
461 ret = sAT_PercentCTTY (src_infos_psi->srcId,1, cmd->params.ptr_set_percent_ctty->req);
462 /*sending hardcoded enable mode for sAT_XXXX */
463
464 return(ret);
465 }
466
467 /*
468 +--------------------------------------------------------------------+
469 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT |
470 | STATE : code ROUTINE : qBAT_PercentCTTY |
471 +--------------------------------------------------------------------+
472
473 PURPOSE :
474 */
475 GLOBAL T_ACI_BAT_RSLT qBAT_PercentCTTY (T_ACI_DTI_PRC_PSI *src_infos_psi,
476 T_BAT_cmd_send *cmd)
477 {
478 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL;
479 T_BAT_percent_ctty_req req ;
480 UBYTE mode;
481 T_BAT_cmd_response resp;
482 T_BAT_res_que_percent_ctty que_tty_buffer;
483 T_BAT_trx trx;
484 T_BAT_percent_ctty_m state;
485
486 TRACE_FUNCTION ("qBAT_PercentCTTY()");
487
488 resp.ctrl_response = BAT_RES_QUE_PERCENT_CTTY ;
489 resp.response.ptr_que_percent_ctty = &que_tty_buffer;
490
491 ret = qAT_PercentCTTY (src_infos_psi->srcId,(T_ACI_CTTY_MOD *)&mode,(T_ACI_CTTY_REQ *)&req,(T_ACI_CTTY_STAT *)&state,(T_ACI_CTTY_TRX *)&trx);
492 resp.response.ptr_que_percent_ctty->m= state ;
493 resp.response.ptr_que_percent_ctty->req = req;
494 resp.response.ptr_que_percent_ctty->trx = trx;
495
496 aci_bat_send(src_infos_psi,&resp);
497 return(ret);
498 }
499
500 /*
501 +--------------------------------------------------------------------+
502 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT |
503 | STATE : code ROUTINE : sBAT_PlusCSTA |
504 +--------------------------------------------------------------------+
505
506 PURPOSE :
507 */
508 GLOBAL T_ACI_BAT_RSLT sBAT_PlusCSTA (T_ACI_DTI_PRC_PSI *src_infos_psi,
509 T_BAT_cmd_send *cmd)
510 {
511 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL;
512 T_ACI_TOA type,
513 *p_type;
514
515 TRACE_FUNCTION ("sBAT_PlusCSTA()");
516
517 p_type=&type;
518 if (cmd->params.ptr_set_plus_csta->type EQ BAT_PARAMETER_NOT_PRESENT)
519 {
520 p_type = NULL;
521 }
522 else
523 {
524 type = toa_demerge(cmd->params.ptr_set_plus_csta->type);
525 if (type.ton < 0 OR type.npi < 0)
526 {
527 ACI_ERR_DESC(ACI_ERR_CLASS_Cme,CME_ERR_OpNotAllow);
528 return (ACI_BAT_FAIL);
529 }
530 }
531 ret = sAT_PlusCSTA(src_infos_psi->srcId,p_type);
532 return(ret);
533 }
534
535 /*
536 +--------------------------------------------------------------------+
537 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT |
538 | STATE : code ROUTINE : qBAT_PlusCSTA |
539 +--------------------------------------------------------------------+
540
541 PURPOSE :
542 */
543 GLOBAL T_ACI_BAT_RSLT qBAT_PlusCSTA (T_ACI_DTI_PRC_PSI *src_infos_psi,
544 T_BAT_cmd_send *cmd)
545 {
546 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL;
547 T_ACI_TOA type;
548 T_BAT_cmd_response resp;
549 T_BAT_res_que_plus_csta que_csta_buffer;
550
551 TRACE_FUNCTION ("qBAT_PlusCSTA()");
552 resp.ctrl_response = BAT_RES_QUE_PLUS_CSTA;
553 resp.response.ptr_que_plus_csta = &que_csta_buffer;
554
555 ret = qAT_PlusCSTA(src_infos_psi->srcId,&type);
556 if (ret EQ AT_CMPL)
557 {
558 resp.response.ptr_que_plus_csta->type = toa_merge (type);
559 aci_bat_send(src_infos_psi, &resp);
560 }
561 return(ret);
562 }
563
564 /*
565 +--------------------------------------------------------------------+
566 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT |
567 | STATE : code ROUTINE : sBAT_PercentCHLD |
568 +--------------------------------------------------------------------+
569
570 PURPOSE :
571 */
572 GLOBAL T_ACI_BAT_RSLT sBAT_PercentCHLD (T_ACI_DTI_PRC_PSI *src_infos_psi,
573 T_BAT_cmd_send *cmd)
574 {
575 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL;
576 T_ACI_CHLD_MOD mode = CHLD_MOD_NotPresent;
577 CHAR X_prm[2];
578 CHAR* p_X_prm;
579
580 TRACE_FUNCTION ("sBAT_PercentCHLD()");
581
582 X_prm[0] = (CHAR)NOT_PRESENT_8BIT;
583 p_X_prm = X_prm;
584
585 mode = cmd->params.ptr_set_percent_chld->n;
586 if(cmd->params.ptr_set_percent_chld->x NEQ BAT_PARAMETER_NOT_PRESENT)
587 {
588 X_prm[0] = (char)(cmd->params.ptr_set_percent_chld->x + 0x30); /* 0x30 = '0' */
589 X_prm[1] = '\0';
590 }
591 else
592 {
593 p_X_prm = NULL;
594 }
595 ret = sAT_PercentCHLD( src_infos_psi->srcId, mode, p_X_prm );
596 return(ret);
597 }
598
599 /*
600 +--------------------------------------------------------------------+
601 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT |
602 | STATE : code ROUTINE : qBAT_PlusCLIP |
603 +--------------------------------------------------------------------+
604
605 PURPOSE :
606 */
607 GLOBAL T_ACI_BAT_RSLT qBAT_PlusCLIP (T_ACI_DTI_PRC_PSI *src_infos_psi,
608 T_BAT_cmd_send *cmd)
609 {
610 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL;
611 T_ACI_CLIP_STAT stat = CLIP_STAT_NotPresent;
612 T_BAT_cmd_response resp;
613 T_BAT_res_que_plus_clip que_clip_buffer;
614
615 TRACE_FUNCTION ("qBAT_PlusCLIP()");
616
617 resp.ctrl_response = BAT_RES_QUE_PLUS_CLIP;
618 resp.response.ptr_que_plus_clip = &que_clip_buffer;
619
620 ret = qAT_PlusCLIP(src_infos_psi->srcId,&stat);
621 if (ret EQ AT_CMPL)
622 {
623 resp.response.ptr_que_plus_clip->m = stat ;
624 aci_bat_send(src_infos_psi, &resp);
625 }
626 return(ret);
627 }
628
629 /*
630 +--------------------------------------------------------------------+
631 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT |
632 | STATE : code ROUTINE : qBAT_PlusCDIP |
633 +--------------------------------------------------------------------+
634
635 PURPOSE :
636 */
637 GLOBAL T_ACI_BAT_RSLT qBAT_PlusCDIP (T_ACI_DTI_PRC_PSI *src_infos_psi,
638 T_BAT_cmd_send *cmd)
639 {
640 T_ACI_BAT_RSLT ret = ACI_BAT_CMPL;
641 T_ACI_CDIP_STAT stat = CDIP_STAT_Unknown;
642 T_BAT_cmd_response resp;
643 T_BAT_res_que_plus_cdip que_cdip_buffer;
644
645 TRACE_FUNCTION ("qBAT_PlusCDIP()");
646
647 resp.ctrl_response = BAT_RES_QUE_PLUS_CDIP;
648 resp.response.ptr_que_plus_cdip = &que_cdip_buffer;
649
650 resp.response.ptr_que_plus_cdip->m = stat ;
651 aci_bat_send(src_infos_psi, &resp);
652
653 return(ret);
654 }
655
656 /*
657 +--------------------------------------------------------------------+
658 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT |
659 | STATE : code ROUTINE : qBAT_PlusCOLP |
660 +--------------------------------------------------------------------+
661
662 PURPOSE :
663 */
664 GLOBAL T_ACI_BAT_RSLT qBAT_PlusCOLP (T_ACI_DTI_PRC_PSI *src_infos_psi,
665 T_BAT_cmd_send *cmd)
666 {
667 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL;
668 T_ACI_COLP_STAT stat = COLP_STAT_NotPresent;
669 T_BAT_cmd_response resp;
670 T_BAT_res_que_plus_colp que_colp_buffer;
671
672 TRACE_FUNCTION ("qBAT_PlusCOLP()");
673
674 resp.ctrl_response = BAT_RES_QUE_PLUS_COLP;
675 resp.response.ptr_que_plus_colp = &que_colp_buffer;
676
677 ret = qAT_PlusCOLP(src_infos_psi->srcId,&stat);
678 if (ret EQ AT_CMPL)
679 {
680 resp.response.ptr_que_plus_colp->m = stat ;
681 aci_bat_send(src_infos_psi, &resp);
682 }
683 return(ret);
684 }
685
686 /*
687 +--------------------------------------------------------------------+
688 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT |
689 | STATE : code ROUTINE : sBAT_PlusCLIR |
690 +--------------------------------------------------------------------+
691
692 PURPOSE :
693 */
694 GLOBAL T_ACI_BAT_RSLT sBAT_PlusCLIR (T_ACI_DTI_PRC_PSI *src_infos_psi,
695 T_BAT_cmd_send *cmd)
696 {
697 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL;
698
699 TRACE_FUNCTION ("sBAT_PlusCLIR()");
700
701 ret = sAT_PlusCLIR(src_infos_psi->srcId,cmd->params.ptr_set_plus_clir->n);
702 return(ret);
703 }
704
705 /*
706 +--------------------------------------------------------------------+
707 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT |
708 | STATE : code ROUTINE : qBAT_PlusCLIR |
709 +--------------------------------------------------------------------+
710
711 PURPOSE :
712 */
713 GLOBAL T_ACI_BAT_RSLT qBAT_PlusCLIR (T_ACI_DTI_PRC_PSI *src_infos_psi,
714 T_BAT_cmd_send *cmd)
715 {
716 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL;
717 T_ACI_CLIR_STAT stat = CLIR_STAT_NotPresent;
718 T_ACI_CLIR_MOD mode = CLIR_MOD_NotPresent;
719 T_BAT_cmd_response resp;
720 T_BAT_res_que_plus_clir clir;
721
722 TRACE_FUNCTION ("qBAT_PlusCLIR()");
723
724 resp.ctrl_response = BAT_RES_QUE_PLUS_CLIR;
725 resp.response.ptr_que_plus_clir = &clir;
726
727 ret = qAT_PlusCLIR (src_infos_psi->srcId,&mode,&stat);
728
729 if(ret EQ AT_CMPL)
730 {
731 resp.response.ptr_que_plus_clir->m = (T_BAT_plus_clir_m)stat;
732 resp.response.ptr_que_plus_clir->n = (T_BAT_plus_clir_n)mode;
733 aci_bat_send(src_infos_psi,&resp);
734 }
735 return(ret);
736 }
737
738 /*
739 +--------------------------------------------------------------------+
740 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT |
741 | STATE : code ROUTINE : sBAT_PlusCCUG |
742 +--------------------------------------------------------------------+
743
744 PURPOSE :
745 */
746 GLOBAL T_ACI_BAT_RSLT sBAT_PlusCCUG (T_ACI_DTI_PRC_PSI *src_infos_psi,
747 T_BAT_cmd_send *cmd)
748 {
749 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL;
750 T_BAT_plus_ccug_n n = BAT_CCUG_N_NOT_PRESENT ;
751 T_BAT_plus_ccug_index index = BAT_CCUG_INDEX_NOT_PRESENT ;
752 T_BAT_plus_ccug_info info = BAT_CCUG_INFO_NOT_PRESENT ;
753
754 TRACE_FUNCTION ("sBAT_PlusCCUG()");
755
756 n = cmd->params.ptr_set_plus_ccug->n;
757 index = cmd->params.ptr_set_plus_ccug->index;
758 info = cmd->params.ptr_set_plus_ccug->info;
759
760 ret = sAT_PlusCCUG(src_infos_psi->srcId,n,index,info);
761 return(ret);
762 }
763
764 /*
765 +--------------------------------------------------------------------+
766 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT |
767 | STATE : code ROUTINE : qBAT_PlusCCUG |
768 +--------------------------------------------------------------------+
769
770 PURPOSE :
771 */
772 GLOBAL T_ACI_BAT_RSLT qBAT_PlusCCUG (T_ACI_DTI_PRC_PSI *src_infos_psi,
773 T_BAT_cmd_send *cmd)
774 {
775 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL;
776 T_ACI_CCUG_MOD mode = CCUG_MOD_NotPresent;
777 T_ACI_CCUG_IDX idx = CCUG_IDX_NotPresent;
778 T_ACI_CCUG_INFO info = CCUG_INFO_NotPresent;
779 T_BAT_cmd_response resp;
780 T_BAT_res_que_plus_ccug que_ccug_buffer;
781
782 TRACE_FUNCTION ("qBAT_PlusCCUG()");
783
784 resp.ctrl_response = BAT_RES_QUE_PLUS_CCUG;
785 resp.response.ptr_que_plus_ccug = &que_ccug_buffer;
786
787 ret = qAT_PlusCCUG (src_infos_psi->srcId,&mode,&idx,&info);
788 if(ret EQ AT_CMPL)
789 {
790 resp.response.ptr_que_plus_ccug->n = mode;
791 resp.response.ptr_que_plus_ccug->index = idx;
792 resp.response.ptr_que_plus_ccug->info = info;
793 aci_bat_send(src_infos_psi,&resp);
794 }
795 return(ret);
796 }
797
798 /*
799 +--------------------------------------------------------------------+
800 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT |
801 | STATE : code ROUTINE : sBAT_PlusCMOD |
802 +--------------------------------------------------------------------+
803
804 PURPOSE :
805 */
806 GLOBAL T_ACI_BAT_RSLT sBAT_PlusCMOD (T_ACI_DTI_PRC_PSI *src_infos_psi,
807 T_BAT_cmd_send *cmd)
808 {
809 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL;
810 T_BAT_plus_cmod_mode mode = BAT_CMOD_MODE_NOT_PRESENT;
811
812 TRACE_FUNCTION ("sBAT_PlusCMOD()");
813
814 mode = cmd->params.ptr_set_plus_cmod->mode;
815 ret = sAT_PlusCMOD (src_infos_psi->srcId,mode);
816
817 return(ret);
818 }
819
820 /*
821 +--------------------------------------------------------------------+
822 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT |
823 | STATE : code ROUTINE : qBAT_PlusCMOD |
824 +--------------------------------------------------------------------+
825
826 PURPOSE :
827 */
828 GLOBAL T_ACI_BAT_RSLT qBAT_PlusCMOD (T_ACI_DTI_PRC_PSI *src_infos_psi,
829 T_BAT_cmd_send *cmd)
830 {
831 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL;
832 T_ACI_CMOD_MOD mode = CMOD_MOD_NotPresent;
833 T_BAT_cmd_response resp;
834 T_BAT_res_que_plus_cmod que_cmod_buffer;
835
836 TRACE_FUNCTION ("qBAT_PlusCMOD()");
837 resp.ctrl_response = BAT_RES_QUE_PLUS_CMOD;
838 resp.response.ptr_que_plus_cmod = &que_cmod_buffer;
839
840 ret = qAT_PlusCMOD (src_infos_psi->srcId,&mode);
841 if (ret EQ AT_CMPL)
842 {
843 resp.response.ptr_que_plus_cmod->mode = mode;
844 aci_bat_send(src_infos_psi,&resp);
845 }
846 return(ret);
847 }
848
849 /*
850 +--------------------------------------------------------------------+
851 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT |
852 | STATE : code ROUTINE : sBAT_PlusCR |
853 +--------------------------------------------------------------------+
854
855 PURPOSE :
856 */
857 GLOBAL T_ACI_BAT_RSLT sBAT_PlusCR (T_ACI_DTI_PRC_PSI *src_infos_psi,
858 T_BAT_cmd_send *cmd)
859 {
860 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL;
861
862 TRACE_FUNCTION ("sBAT_PlusCR()");
863
864 return(ret);
865 }
866
867 /*
868 +--------------------------------------------------------------------+
869 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT |
870 | STATE : code ROUTINE : qBAT_PlusCR |
871 +--------------------------------------------------------------------+
872
873 PURPOSE :
874 */
875 GLOBAL T_ACI_BAT_RSLT qBAT_PlusCR (T_ACI_DTI_PRC_PSI *src_infos_psi,
876 T_BAT_cmd_send *cmd)
877 {
878 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL;
879 T_BAT_cmd_response resp;
880 T_BAT_res_uns_plus_cr cr;
881
882 TRACE_FUNCTION ("qBAT_PlusCR()");
883
884 resp.ctrl_response = BAT_RES_UNS_PLUS_CR;
885 resp.response.ptr_res_plus_cr = &cr;
886
887 memset(&cr,0x00,sizeof(T_BAT_res_uns_plus_cr));
888
889 /* Check This Out */
890 return(ret);
891 }
892
893 /*
894 +--------------------------------------------------------------------+
895 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT |
896 | STATE : code ROUTINE : sBAT_PlusCAOC |
897 +--------------------------------------------------------------------+
898
899 PURPOSE :
900 */
901 GLOBAL T_ACI_BAT_RSLT sBAT_PlusCAOC (T_ACI_DTI_PRC_PSI *src_infos_psi,
902 T_BAT_cmd_send *cmd)
903 {
904 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL;
905 LONG ccm = 0L;
906 SHORT mode = 0;
907 T_BAT_cmd_response resp;
908 T_BAT_res_set_plus_caoc caoc;
909
910 TRACE_FUNCTION ("sBAT_PlusCAOC()");
911
912 resp.ctrl_response = BAT_RES_SET_PLUS_CAOC;
913 resp.response.ptr_set_plus_caoc = &caoc;
914
915 mode = cmd->params.ptr_set_plus_caoc->mode;
916 if(mode EQ BAT_CAOC_MODE_QUERY)
917 {
918 ret = qAT_PlusCAOC(src_infos_psi->srcId,&ccm);
919 }
920 else
921 {
922 return(ACI_BAT_FAIL);
923 }
924
925 if (ret EQ AT_CMPL)
926 {
927 resp.response.ptr_set_plus_caoc->ccm = ccm;
928 aci_bat_send(src_infos_psi,&resp);
929 }
930 return(ret);
931 }
932
933 /*
934 +--------------------------------------------------------------------+
935 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT |
936 | STATE : code ROUTINE : sBAT_PlusCACM |
937 +--------------------------------------------------------------------+
938
939 PURPOSE :
940 */
941 GLOBAL T_ACI_BAT_RSLT sBAT_PlusCACM (T_ACI_DTI_PRC_PSI *src_infos_psi,
942 T_BAT_cmd_send *cmd)
943 {
944 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL;
945 char pin2 [MAX_PWD_LENGTH] = {0} ;
946
947 TRACE_FUNCTION ("sBAT_PlusCACM()");
948
949 memcpy(pin2,cmd->params.ptr_set_plus_cacm->passwd,cmd->params.ptr_set_plus_cacm->c_passwd);
950 ret = sAT_PlusCACM(src_infos_psi->srcId,pin2);
951 return(ret);
952 }
953
954 /*
955 +--------------------------------------------------------------------+
956 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT |
957 | STATE : code ROUTINE : qBAT_PlusCACM |
958 +--------------------------------------------------------------------+
959
960 PURPOSE :
961 */
962 GLOBAL T_ACI_BAT_RSLT qBAT_PlusCACM (T_ACI_DTI_PRC_PSI *src_infos_psi,
963 T_BAT_cmd_send *cmd)
964 {
965 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL;
966 LONG acm = 0L;
967 T_BAT_cmd_response resp;
968 T_BAT_res_que_plus_cacm que_cacm_buffer;
969
970 TRACE_FUNCTION ("qBAT_PlusCACM()");
971
972 resp.ctrl_response = BAT_RES_QUE_PLUS_CACM;
973 resp.response.ptr_que_plus_cacm = &que_cacm_buffer;
974
975 ret = qAT_PlusCACM(src_infos_psi->srcId,&acm);
976 if (ret EQ AT_CMPL)
977 {
978 resp.response.ptr_que_plus_cacm->acm = acm;
979 aci_bat_send(src_infos_psi,&resp);
980 }
981 return(ret);
982 }
983
984 /*
985 +--------------------------------------------------------------------+
986 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT |
987 | STATE : code ROUTINE : sBAT_PlusCAMM |
988 +--------------------------------------------------------------------+
989
990 PURPOSE :
991 */
992 GLOBAL T_ACI_BAT_RSLT sBAT_PlusCAMM (T_ACI_DTI_PRC_PSI *src_infos_psi,
993 T_BAT_cmd_send *cmd)
994 {
995 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL;
996 char pin2 [MAX_PWD_LENGTH] = {0};
997 char* p_pin2;
998
999 TRACE_FUNCTION ("sBAT_PlusCAMM()");
1000
1001 p_pin2 = pin2;
1002 if(cmd->params.ptr_set_plus_camm->v_passwd)
1003 {
1004 memcpy(pin2,cmd->params.ptr_set_plus_camm->passwd,cmd->params.ptr_set_plus_camm->c_passwd);
1005 }
1006 /* else
1007 {
1008 p_pin2 = NULL;
1009 } */
1010 ret = sAT_PlusCAMM(src_infos_psi->srcId,cmd->params.ptr_set_plus_camm->acmmax,p_pin2);
1011 switch (ret)
1012 {
1013 case AT_BUSY:
1014 {
1015 ACI_ERR_DESC(ACI_ERR_CLASS_Cme,CME_ERR_SimBusy);
1016 break;
1017 }
1018 default:
1019 {
1020 ACI_ERR_DESC(ACI_ERR_CLASS_Cme,CME_ERR_OpNotAllow);
1021 break;
1022 }
1023 }
1024 return(ret);
1025 }
1026
1027 /*
1028 +--------------------------------------------------------------------+
1029 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT |
1030 | STATE : code ROUTINE : qBAT_PlusCAMM |
1031 +--------------------------------------------------------------------+
1032
1033 PURPOSE :
1034 */
1035 GLOBAL T_ACI_BAT_RSLT qBAT_PlusCAMM (T_ACI_DTI_PRC_PSI *src_infos_psi,
1036 T_BAT_cmd_send *cmd)
1037 {
1038 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL;
1039 LONG acmmax = 0L;
1040 T_BAT_cmd_response resp;
1041 T_BAT_res_que_plus_camm que_camm_buffer;
1042
1043 TRACE_FUNCTION ("qBAT_PlusCAMM()");
1044
1045 resp.ctrl_response = BAT_RES_QUE_PLUS_CAMM;
1046 resp.response.ptr_que_plus_camm = &que_camm_buffer;
1047 ret = qAT_PlusCAMM(src_infos_psi->srcId,&acmmax);
1048 if (ret EQ AT_CMPL)
1049 {
1050 resp.response.ptr_que_plus_camm->acmmax = acmmax;
1051 aci_bat_send(src_infos_psi,&resp);
1052 }
1053 return(ret);
1054 }
1055
1056
1057 /*
1058 +--------------------------------------------------------------------+
1059 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT |
1060 | STATE : code ROUTINE : sBAT_PlusCPUC |
1061 +--------------------------------------------------------------------+
1062
1063 PURPOSE :
1064 */
1065 GLOBAL T_ACI_BAT_RSLT sBAT_PlusCPUC (T_ACI_DTI_PRC_PSI *src_infos_psi,
1066 T_BAT_cmd_send *cmd)
1067 {
1068 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL;
1069 char currency [MAX_CUR_LEN] = {0x00};
1070 char cvtdCurrency [2*MAX_CUR_LEN] = {0x00};
1071 USHORT lenCvtdCurrency = 0;
1072 char ppu [MAX_PPU_LENGTH] = {0x00};
1073 char pin2 [MAX_PWD_LENGTH] = {0x00};
1074 char* p_pin2;
1075
1076 TRACE_FUNCTION ("sBAT_PlusCPUC()");
1077
1078 p_pin2 = pin2;
1079
1080 memcpy(currency,cmd->params.ptr_set_plus_cpuc->currency,cmd->params.ptr_set_plus_cpuc->c_currency);
1081 memcpy(ppu,cmd->params.ptr_set_plus_cpuc->ppu,cmd->params.ptr_set_plus_cpuc->c_ppu);
1082 if(cmd->params.ptr_set_plus_cpuc->v_passwd)
1083 {
1084 memcpy(pin2,cmd->params.ptr_set_plus_cpuc->passwd,cmd->params.ptr_set_plus_cpuc->c_passwd);
1085 }
1086 else
1087 {
1088 p_pin2 = NULL;
1089 }
1090 utl_chsetToGsm ((UBYTE*)currency,
1091 cmd->params.ptr_set_plus_cpuc->c_currency,
1092 (UBYTE*)cvtdCurrency,
1093 &lenCvtdCurrency,
1094 GSM_ALPHA_Int);
1095 ret = sAT_PlusCPUC(src_infos_psi->srcId,cvtdCurrency,ppu,p_pin2);
1096 switch (ret)
1097 {
1098 case AT_BUSY:
1099 {
1100 ACI_ERR_DESC(ACI_ERR_CLASS_Cme,CME_ERR_SimBusy);
1101 break;
1102 }
1103 default:
1104 {
1105 ACI_ERR_DESC(ACI_ERR_CLASS_Cme,CME_ERR_OpNotAllow);
1106 break;
1107 }
1108 }
1109 return(ret);
1110 }
1111
1112 /*
1113 +--------------------------------------------------------------------+
1114 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT |
1115 | STATE : code ROUTINE : qBAT_PlusCPUC |
1116 +--------------------------------------------------------------------+
1117
1118 PURPOSE :
1119 */
1120 GLOBAL T_ACI_BAT_RSLT qBAT_PlusCPUC (T_ACI_DTI_PRC_PSI *src_infos_psi,
1121 T_BAT_cmd_send *cmd)
1122 {
1123 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL;
1124 char currency [MAX_CUR_LEN] = {0x00};
1125 char cvtdCurrency [2*MAX_CUR_LEN] = {0x00};
1126 USHORT lenCvtdCurrency = 0;
1127 char ppu [MAX_PPU_LENGTH] = {0x00};
1128 T_BAT_cmd_response resp;
1129 T_BAT_res_que_plus_cpuc que_cpuc_buffer;
1130
1131
1132 TRACE_FUNCTION ("qBAT_PlusCPUC()");
1133 resp.ctrl_response = BAT_RES_QUE_PLUS_CPUC;
1134 resp.response.ptr_que_plus_cpuc = &que_cpuc_buffer;
1135
1136 ret = qAT_PlusCPUC(src_infos_psi->srcId,currency, ppu);
1137 if( ret NEQ AT_CMPL )
1138 {
1139 return (ACI_BAT_FAIL);
1140 }
1141 utl_chsetFromGsm((UBYTE*)currency,
1142 (USHORT)strlen(currency),
1143 (UBYTE*)cvtdCurrency,
1144 sizeof(cvtdCurrency),
1145 &lenCvtdCurrency,
1146 GSM_ALPHA_Def);
1147
1148 resp.response.ptr_que_plus_cpuc->c_currency = (U8)lenCvtdCurrency;
1149 resp.response.ptr_que_plus_cpuc->c_ppu = strlen(ppu);
1150 memcpy(resp.response.ptr_que_plus_cpuc->currency,cvtdCurrency,lenCvtdCurrency);
1151 memcpy(resp.response.ptr_que_plus_cpuc->ppu,ppu,strlen(ppu));
1152 aci_bat_send(src_infos_psi,&resp);
1153 return(ret);
1154 }
1155
1156 /*
1157 +--------------------------------------------------------------------+
1158 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT |
1159 | STATE : code ROUTINE : qBAT_PlusCLCC |
1160 +--------------------------------------------------------------------+
1161
1162 PURPOSE :
1163 */
1164 GLOBAL T_ACI_BAT_RSLT qBAT_PlusCLCC (T_ACI_DTI_PRC_PSI *src_infos_psi,
1165 T_BAT_cmd_send *cmd)
1166 {
1167 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL;
1168 T_ACI_CLCC_CALDESC *calLst = NULL;
1169 UBYTE lstIdx = 0;
1170 T_BAT_cmd_response resp;
1171 T_BAT_res_que_plus_clcc que_clcc_buffer;
1172
1173
1174 TRACE_FUNCTION ("qBAT_PlusCLCC()");
1175 resp.ctrl_response = BAT_RES_QUE_PLUS_CLCC;
1176 resp.response.ptr_que_plus_clcc = &que_clcc_buffer;
1177
1178 MALLOC (calLst, MAX_CALL_NR * sizeof (T_ACI_CLCC_CALDESC));
1179 ret = qAT_PlusCLCC(src_infos_psi->srcId, calLst);
1180
1181 if( ret NEQ AT_CMPL )
1182 {
1183 return (ACI_BAT_FAIL);
1184 }
1185
1186 /* BAT has only one instance of this, so send one call info at a time */
1187 for( lstIdx = 0; lstIdx < MAX_CALL_NR; lstIdx++ )
1188 {
1189 if( calLst[lstIdx].idx EQ ACI_NumParmNotPresent )
1190 break;
1191
1192 resp.response.ptr_que_plus_clcc->idx = (S16)calLst[lstIdx].idx;
1193 resp.response.ptr_que_plus_clcc->dir = (T_BAT_plus_clcc_dir)calLst[lstIdx].dir;
1194 resp.response.ptr_que_plus_clcc->stat = (T_BAT_plus_clcc_stat)calLst[lstIdx].stat;
1195 resp.response.ptr_que_plus_clcc->mode = (T_BAT_plus_clcc_mode)calLst[lstIdx].mode;
1196 resp.response.ptr_que_plus_clcc->mpty = (T_BAT_plus_clcc_mpty)calLst[lstIdx].mpty;
1197
1198 if (calLst[lstIdx].number[0] NEQ 0x0)
1199 {
1200 resp.response.ptr_que_plus_clcc->v_number = TRUE;
1201 resp.response.ptr_que_plus_clcc->c_number = strlen(calLst[lstIdx].number);
1202
1203 if (resp.response.ptr_que_plus_clcc->c_number > BAT_MAX_CLCC_NUMBER_LEN)
1204 resp.response.ptr_que_plus_clcc->c_number = (BAT_MAX_CLCC_NUMBER_LEN - 1);
1205
1206 memcpy(resp.response.ptr_que_plus_clcc->number,
1207 calLst[lstIdx].number,
1208 resp.response.ptr_que_plus_clcc->c_number + 1); /* Include Null terminator */
1209
1210 if (calLst[lstIdx].type.ton NEQ TON_NotPresent)
1211 {
1212 S16 type = toa_merge(calLst[lstIdx].type);
1213 resp.response.ptr_que_plus_clcc->type = type;
1214 }
1215 #ifdef NO_ASCIIZ
1216 if (calLst[lstIdx].alpha.len NEQ 0x0)
1217 {
1218 resp.response.ptr_que_plus_clcc->v_alpha = TRUE;
1219 resp.response.ptr_que_plus_clcc->c_alpha = (U8)calLst[lstIdx].alpha.len;
1220
1221 /* Limit alpha length to BAT size */
1222 if (resp.response.ptr_que_plus_clcc->c_alpha > BAT_MAX_PHB_NUM_LEN)
1223 resp.response.ptr_que_plus_clcc->c_alpha = BAT_MAX_PHB_NUM_LEN;
1224
1225 memcpy(resp.response.ptr_que_plus_clcc->alpha,
1226 calLst[lstIdx].alpha.data,
1227 resp.response.ptr_que_plus_clcc->c_alpha);
1228 }
1229 #else /* #ifdef NO_ASCIIZ */
1230 if (calLst[lstIdx].alpha[0] NEQ 0x0)
1231 {
1232 resp.response.ptr_que_plus_clcc->v_alpha = TRUE;
1233
1234 /* Limit alpha length to BAT size */
1235 resp.response.ptr_que_plus_clcc->c_alpha = strlen(calLst[lstIdx].alpha);
1236 if (resp.response.ptr_que_plus_clcc->c_alpha > MAX_ALPHA_LEN) /* Has to be BAT_MAX..*/
1237 resp.response.ptr_que_plus_clcc->c_alpha = (MAX_ALPHA_LEN - 1);
1238
1239 memcpy(resp.response.ptr_que_plus_clcc->alpha,
1240 calLst[lstIdx].alpha,
1241 (resp.response.ptr_que_plus_clcc->c_alpha)+1); /* Include the NULL terminator */
1242 }
1243 #endif /* #ifdef NO_ASCIIZ */
1244 }
1245
1246 aci_bat_send(src_infos_psi,&resp);
1247 }
1248
1249 MFREE (calLst);
1250 return(ret);
1251 }
1252
1253 /*
1254 +--------------------------------------------------------------------+
1255 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT |
1256 | STATE : code ROUTINE : sBAT_PlusCCWA |
1257 +--------------------------------------------------------------------+
1258
1259 PURPOSE :
1260 */
1261 GLOBAL T_ACI_BAT_RSLT sBAT_PlusCCWA (T_ACI_DTI_PRC_PSI *src_infos_psi,
1262 T_BAT_cmd_send *cmd)
1263 {
1264 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL;
1265 T_BAT_plus_ccwa_mode mode = BAT_CCWA_MODE_NOT_PRESENT ;
1266 T_ACI_CLASS class_type = CLASS_NotPresent;
1267
1268 TRACE_FUNCTION ("sBAT_PlusCCWA()");
1269
1270 mode = cmd->params.ptr_set_plus_ccwa->mode;
1271 class_type = cmd->params.ptr_set_plus_ccwa->bearer_class;
1272 if (mode EQ BAT_CCWA_MODE_QUERY)
1273 {
1274 ret = qAT_PlusCCWA (src_infos_psi->srcId,class_type);
1275 }
1276 else
1277 {
1278 ret = sAT_PlusCCWA (src_infos_psi->srcId,mode,class_type);
1279 }
1280
1281 return(ret);
1282 }
1283
1284 /*
1285 +--------------------------------------------------------------------+
1286 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT |
1287 | STATE : code ROUTINE : sBAT_PlusVTS |
1288 +--------------------------------------------------------------------+
1289
1290 PURPOSE :
1291 */
1292 GLOBAL T_ACI_BAT_RSLT sBAT_PlusVTS (T_ACI_DTI_PRC_PSI *src_infos_psi,
1293 T_BAT_cmd_send *cmd)
1294 {
1295 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL;
1296 CHAR dtmf = '\0';
1297
1298 TRACE_FUNCTION ("sBAT_PlusVTS()");
1299
1300 dtmf = cmd->params.ptr_set_plus_vts->dtmf;
1301 ret = sAT_PlusVTS(src_infos_psi->srcId,dtmf,VTS_MOD_Auto);
1302 return(ret);
1303 }
1304
1305 /*
1306 +--------------------------------------------------------------------+
1307 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT |
1308 | STATE : code ROUTINE : sBAT_PercentRDL |
1309 +--------------------------------------------------------------------+
1310
1311 PURPOSE :
1312 */
1313 GLOBAL T_ACI_BAT_RSLT sBAT_PercentRDL (T_ACI_DTI_PRC_PSI *src_infos_psi,
1314 T_BAT_cmd_send *cmd)
1315 {
1316 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL;
1317 T_BAT_percent_rdl_mode rdlmode = BAT_P_RDL_MODE_NOT_PRESENT ;
1318
1319 TRACE_FUNCTION ("sBAT_PercentRDL()");
1320
1321 rdlmode = cmd->params.ptr_set_percent_rdl->mode;
1322 ret = sAT_PercentRDL (src_infos_psi->srcId, rdlmode, NOTIF_USER);
1323 return(ret);
1324 }
1325
1326 /*
1327 +--------------------------------------------------------------------+
1328 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT |
1329 | STATE : code ROUTINE : qBAT_PercentRDL |
1330 +--------------------------------------------------------------------+
1331
1332 PURPOSE :
1333 */
1334 GLOBAL T_ACI_BAT_RSLT qBAT_PercentRDL (T_ACI_DTI_PRC_PSI *src_infos_psi,
1335 T_BAT_cmd_send *cmd)
1336 {
1337 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL;
1338 T_ACI_CC_REDIAL_MODE rdlmode = AUTOM_REP_NOT_PRESENT;
1339 T_ACI_CC_REDIAL_NOTIF usr_notif = NOTIF_NO_PRESENT;
1340 T_BAT_cmd_response resp;
1341 T_BAT_res_que_percent_rdl que_rdl_buffer;
1342
1343 TRACE_FUNCTION ("qBAT_PercentRDL()");
1344
1345 resp.ctrl_response = BAT_RES_QUE_PERCENT_RDL;
1346 resp.response.ptr_que_percent_rdl = &que_rdl_buffer;
1347 ret = qAT_PercentRDL (src_infos_psi->srcId,&rdlmode, &usr_notif);
1348 if(ret EQ AT_CMPL)
1349 {
1350 resp.response.ptr_que_percent_rdl->mode = rdlmode;
1351 aci_bat_send(src_infos_psi,&resp);
1352 }
1353 return(ret);
1354 }
1355
1356 /*
1357 +--------------------------------------------------------------------+
1358 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT |
1359 | STATE : code ROUTINE : sBAT_PercentRDLB |
1360 +--------------------------------------------------------------------+
1361
1362 PURPOSE :
1363 */
1364 GLOBAL T_ACI_BAT_RSLT sBAT_PercentRDLB (T_ACI_DTI_PRC_PSI *src_infos_psi,
1365 T_BAT_cmd_send *cmd)
1366 {
1367 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL;
1368 T_BAT_percent_rdlb_mode rdlmode = BAT_P_RDLB_MODE_NOT_PRESENT ;
1369
1370 TRACE_FUNCTION ("sBAT_PercentRDLB()");
1371
1372 rdlmode = cmd->params.ptr_set_percent_rdlb->mode;
1373 ret = sAT_PercentRDLB(src_infos_psi->srcId,rdlmode,NOTIF_USER);
1374 return(ret);
1375 }
1376
1377 /*
1378 +--------------------------------------------------------------------+
1379 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT |
1380 | STATE : code ROUTINE : qBAT_PercentRDLB |
1381 +--------------------------------------------------------------------+
1382
1383 PURPOSE :
1384 */
1385 GLOBAL T_ACI_BAT_RSLT qBAT_PercentRDLB (T_ACI_DTI_PRC_PSI *src_infos_psi,
1386 T_BAT_cmd_send *cmd)
1387 {
1388 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL;
1389 T_ACI_CC_REDIAL_BLACKL blackl;
1390 T_ACI_CC_REDIAL_NOTIF usr_notif= NOTIF_NO_PRESENT;
1391 UBYTE i,j;
1392 T_BAT_cmd_response resp;
1393 T_BAT_res_que_percent_rdlb que_rdlb_buffer;
1394
1395 TRACE_FUNCTION ("qBAT_PercentRDLB()");
1396
1397 memset(&blackl, 0, sizeof(T_ACI_CC_REDIAL_BLACKL));
1398 resp.ctrl_response = BAT_RES_QUE_PERCENT_RDLB;
1399 resp.response.ptr_que_percent_rdlb = &que_rdlb_buffer;
1400
1401 ret = qAT_PercentRDLB (src_infos_psi->srcId,&blackl,&usr_notif);
1402 if(ret EQ AT_CMPL)
1403 {
1404 for(i=0; i<blackl.blCount; i++) /* output black list */
1405 {
1406 memset(resp.response.ptr_que_percent_rdlb->number,0,BAT_MAX_RDLB_NUMBER_LEN);
1407 resp.response.ptr_que_percent_rdlb->type = (UBYTE)toa_merge(blackl.blNum[i].type);
1408 resp.response.ptr_que_percent_rdlb->c_number = blackl.blNum[i].numb_len;
1409 for(j=0; j<blackl.blNum[i].numb_len; j++)
1410 {
1411 blackl.blNum[i].number[j] = (blackl.blNum[i].number[j] | 0x30);
1412 /* dont know why we do this ! */
1413 }
1414 memcpy(resp.response.ptr_que_percent_rdlb->number,blackl.blNum[i].number,blackl.blNum[i].numb_len);
1415 aci_bat_send(src_infos_psi,&resp);
1416 }
1417 }
1418 return(ret);
1419 }
1420
1421 /*
1422 +--------------------------------------------------------------------+
1423 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT |
1424 | STATE : code ROUTINE : sBAT_PercentVTS |
1425 +--------------------------------------------------------------------+
1426
1427 PURPOSE :
1428 */
1429 GLOBAL T_ACI_BAT_RSLT sBAT_PercentVTS (T_ACI_DTI_PRC_PSI *src_infos_psi,
1430 T_BAT_cmd_send *cmd)
1431 {
1432 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL;
1433 T_BAT_dtmf dtmf;
1434 T_BAT_percent_vts_mode mode;
1435
1436 TRACE_FUNCTION ("sBAT_PercentVTS()");
1437
1438 dtmf = cmd->params.ptr_set_percent_vts->dtmf;
1439 mode = cmd->params.ptr_set_percent_vts->mode;
1440 if (mode EQ VTS_MOD_NotPresent)
1441 {
1442 mode = VTS_MOD_Auto;
1443 }
1444 ret = sAT_PlusVTS((T_ACI_CMD_SRC)src_infos_psi->srcId,(char)dtmf,(T_ACI_VTS_MOD)mode);
1445 return(ret);
1446 }
1447
1448 /*
1449 +--------------------------------------------------------------------+
1450 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT |
1451 | STATE : code ROUTINE : sBAT_PlusCSNS |
1452 +--------------------------------------------------------------------+
1453
1454 PURPOSE :
1455 */
1456 GLOBAL T_ACI_BAT_RSLT sBAT_PlusCSNS (T_ACI_DTI_PRC_PSI *src_infos_psi,
1457 T_BAT_cmd_send *cmd)
1458 {
1459 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL;
1460 T_BAT_plus_csns_mode mode ;
1461
1462 TRACE_FUNCTION ("sBAT_PlusCSNS()");
1463
1464 mode = cmd->params.ptr_set_plus_csns->mode;
1465 ret = sAT_PlusCSNS (src_infos_psi->srcId, mode);
1466 return(ret);
1467 }
1468
1469 /*
1470 +--------------------------------------------------------------------+
1471 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT |
1472 | STATE : code ROUTINE : qBAT_PlusCSNS |
1473 +--------------------------------------------------------------------+
1474
1475 PURPOSE :
1476 */
1477 GLOBAL T_ACI_BAT_RSLT qBAT_PlusCSNS (T_ACI_DTI_PRC_PSI *src_infos_psi,
1478 T_BAT_cmd_send *cmd)
1479 {
1480 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL;
1481 T_ACI_CSNS_MOD mode = CSNS_MOD_NotPresent;
1482 T_BAT_cmd_response resp;
1483 T_BAT_res_que_plus_csns que_csns_buffer;
1484
1485 TRACE_FUNCTION ("qBAT_PlusCSNS()");
1486
1487 resp.ctrl_response = BAT_RES_QUE_PLUS_CSNS;
1488 resp.response.ptr_que_plus_csns = &que_csns_buffer;
1489
1490 ret = qAT_PlusCSNS (src_infos_psi->srcId,&mode);
1491 if(ret EQ AT_CMPL)
1492 {
1493 resp.response.ptr_que_plus_csns->mode = mode;
1494 aci_bat_send(src_infos_psi,&resp);
1495 }
1496 return(ret);
1497 }
1498