comparison src/g23m-aci/aci/ati_phb.c @ 1:fa8dc04885d8

src/g23m-*: import from Magnetite
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 16 Oct 2020 06:25:50 +0000
parents
children
comparison
equal deleted inserted replaced
0:4e78acac3d88 1:fa8dc04885d8
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 commands related to phonebook.
18 +-----------------------------------------------------------------------------
19 */
20
21 #ifndef ATI_PHB_C
22 #define ATI_PHB_C
23
24 #undef DUMMY_ATI_STRINGS
25
26 #include "aci_all.h"
27
28 #include "aci_lst.h"
29 #include "aci_cmh.h"
30 #include "ati_cmd.h"
31 #include "aci_io.h"
32 #include "aci_cmd.h"
33 #include "l4_tim.h"
34 #include "phb.h"
35
36 #ifdef FAX_AND_DATA
37 #include "aci_fd.h"
38 #endif /* of #ifdef FAX_AND_DATA */
39
40 #include "aci_mem.h"
41 #include "psa.h"
42 #include "cmh.h"
43 #include "pcm.h"
44 #include "aci_prs.h"
45
46 #include "ati_int.h"
47
48 #ifdef FF_ATI_BAT
49
50 #include "typedefs.h"
51 #include "gdd.h"
52 #include "bat.h"
53
54 #include "ati_bat.h"
55
56 #endif /* FF_ATI_BAT */
57
58 /* Global variables for reading PHB entries */
59 LOCAL SHORT phb_start_idx, phb_stop_idx;
60
61 /*
62 +--------------------------------------------------------------------+
63 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD |
64 | STATE : code ROUTINE : atPlusCPBS |
65 +--------------------------------------------------------------------+
66
67 PURPOSE : +CPBS (Select Phonebook memory storage)
68 */
69
70 GLOBAL T_ATI_RSLT setatPlusCPBS(char *cl, UBYTE srcId)
71 {
72 T_ACI_RETURN ret = AT_FAIL;
73 T_ACI_PB_STOR stor = PB_STOR_NotPresent;
74 CHAR pin2[MAX_PWD_LENGTH] = {0};
75 CHAR sto_str[3]={0};
76 SHORT i;
77
78 TRACE_FUNCTION("setatPlusCPBS()");
79
80 cl = parse(cl,"sn",(LONG)3,sto_str,(LONG)MAX_PWD_LENGTH,pin2);
81 if(!cl OR *sto_str EQ '\0')
82 {
83 cmdCmeError(CME_ERR_OpNotAllow);
84 return ATI_FAIL;
85 }
86 strupper(sto_str);
87 for(i=0;phb_mem_names[i].name NEQ 0;i++)
88 {
89 if (!strcmp(phb_mem_names[i].name,sto_str) )
90 {
91 stor=phb_mem_names[i].stor;
92 break;
93 }
94 }
95 if(phb_mem_names[i].name EQ 0)
96 {
97 cmdCmeError(CME_ERR_OpNotAllow);
98 return ATI_FAIL;
99 }
100 #ifdef FF_ATI_BAT
101 {
102 T_BAT_cmd_send cmd;
103 T_BAT_cmd_set_plus_cpbs my_bat_set_plus_cpbs = {0};
104 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id);
105
106 TRACE_FUNCTION("setatPlusCPBS() calls bat_send() <=== as APPLICATION");
107
108 cmd.ctrl_params = BAT_CMD_SET_PLUS_CPBS;
109 cmd.params.ptr_set_plus_cpbs = &my_bat_set_plus_cpbs;
110
111 my_bat_set_plus_cpbs.storage = (T_BAT_storage)stor;
112
113 src_params->curAtCmd = AT_CMD_CPBS;
114 srcId_cb = srcId;
115 bat_send(ati_bat_get_client(srcId), &cmd);
116 srcId_cb = srcId;
117 return ATI_EXCT; /* executing, because response is passed by callback function */
118 }
119 #else /* no FF_ATI_BAT */
120 ret = sAT_PlusCPBS((T_ACI_CMD_SRC)srcId,stor,pin2);
121 if (ret EQ AT_FAIL)
122 {
123 cmdCmeError(CME_ERR_Unknown);
124 }
125
126 return (map_aci_2_ati_rslt(ret));
127 #endif /* no FF_ATI_BAT */
128 }
129
130
131 GLOBAL T_ATI_RSLT queatPlusCPBS(char *cl, UBYTE srcId)
132 {
133 #ifdef FF_ATI_BAT
134 {
135 T_BAT_cmd_send cmd;
136 T_BAT_no_parameter dummy;
137
138 TRACE_FUNCTION("queatPlusCPBS() calls bat_send() <=== as APPLICATION");
139
140 cmd.ctrl_params = BAT_CMD_QUE_PLUS_CPBS;
141 dummy.bat_dummy = 0xFF;
142 cmd.params.ptr_que_plus_cpbs = &dummy;
143 bat_send(ati_bat_get_client(srcId), &cmd);
144 return ATI_EXCT; /* executing, because response is passed by callback function */
145 }
146 #else /* no FF_ATI_BAT */
147
148 T_ACI_RETURN ret = AT_FAIL;
149 T_ACI_PB_STOR stor;
150 SHORT used;
151 SHORT total;
152 SHORT i;
153
154 TRACE_FUNCTION("queatPlusCPBS()");
155
156 ret = qAT_PlusCPBS((T_ACI_CMD_SRC)srcId,&stor,&used,&total);
157 if (ret EQ AT_CMPL)
158 {
159 for(i=0;phb_mem_names[i].name NEQ NULL;i++)
160 {
161 if (phb_mem_names[i].stor EQ stor)
162 {
163 sprintf(g_sa,"+CPBS: \"%s\",%d,%d",phb_mem_names[i].name,used,total);
164 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT);
165 break;
166 }
167 }
168 }
169 else if (ret EQ AT_FAIL)
170 {
171 cmdCmeError(CME_ERR_Unknown);
172 }
173 return (map_aci_2_ati_rslt(ret));
174 #endif /* no FF_ATI_BAT */
175 }
176
177 /*
178 +--------------------------------------------------------------------+
179 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD |
180 | STATE : code ROUTINE : queatPercentCPBS |
181 +--------------------------------------------------------------------+
182
183 PURPOSE : %CPBS (Phonebook memory storage)
184 */
185 GLOBAL T_ATI_RSLT queatPercentCPBS(char *cl, UBYTE srcId)
186 {
187 #ifdef FF_ATI_BAT
188
189 T_BAT_cmd_send cmd;
190 T_BAT_no_parameter dummy;
191
192 TRACE_FUNCTION("queatPercentCPBS() calls bat_send() <=== as APPLICATION");
193
194 cmd.ctrl_params=BAT_CMD_QUE_PERCENT_CPBS;
195 dummy.bat_dummy=0xFF;
196 cmd.params.ptr_que_percent_cpbs=&dummy;
197
198 bat_send(ati_bat_get_client(srcId),&cmd);
199
200 /*
201 * Return value indicates executing, the response will come via
202 * the callback function.
203 */
204 return(ATI_EXCT);
205
206 #else /* FF_ATI_BAT */
207
208 char *me="%CPBS: ";
209 T_ACI_RETURN ret;
210 T_ACI_PB_STOR stor;
211 SHORT used,total,first,i;
212 SHORT used_ext, total_ext;
213
214 TRACE_FUNCTION("queatPercentCPBS()");
215
216 /*
217 * Call the corresponding ACI function.
218 */
219 ret=qAT_PercentCPBS ((T_ACI_CMD_SRC)srcId,
220 &stor,
221 &used, &total,
222 &first,
223 &used_ext, &total_ext);
224
225 /*
226 * If the query completes successfully, build and send the
227 * answer.
228 */
229 if (ret EQ AT_CMPL)
230 {
231 /*
232 * Run through the list of names to get the name of the
233 * currently selected phonebook.
234 */
235 for(i=0;phb_mem_names[i].name NEQ NULL;i++)
236 {
237 if (phb_mem_names[i].stor EQ stor)
238 {
239 sprintf (g_sa,"%s\"%s\",%d,%d,%d,%d,%d", me, phb_mem_names[i].name,
240 used, total,
241 first,
242 used_ext, total_ext);
243 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT);
244 break;
245 }
246 }
247 }
248
249 return (map_aci_2_ati_rslt(ret));
250
251 #endif /* FF_ATI_BAT */
252 }
253
254 /*
255 +--------------------------------------------------------------------+
256 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD |
257 | STATE : code ROUTINE : atPlusCPBW |
258 +--------------------------------------------------------------------+
259
260 PURPOSE : +CPBW (Write Phonebook entry)
261 */
262 GLOBAL T_ATI_RSLT setatPlusCPBW(char *cl, UBYTE srcId)
263 {
264
265 UBYTE pb_status;
266 T_ACI_RETURN ret = AT_FAIL;
267 CHAR *p_number = NULL;
268 CHAR text [MAX_ALPHA_LEN * 4] = {0x00};
269 USHORT lenText = 0;
270 T_ACI_TOA *p_toa = NULL,
271 type;
272
273 SHORT toa_val = 0,
274 index = -1;
275 #ifndef FF_ATI_BAT
276 T_ACI_PB_TEXT *p_text = NULL;
277 T_ACI_PB_TEXT cvtdText;
278 USHORT lenCvtd = 0;
279 T_ACI_VP_ABS dmyDateTime;
280 #endif /* !FF_ATI_BAT */
281
282 T_ACI_PB_STOR stor;
283 SHORT used;
284 SHORT total;
285 CHAR numBuf[MAX_PHB_NUM_LEN];
286 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id);
287
288 memset( numBuf, 0, sizeof(numBuf));
289
290 TRACE_FUNCTION("setatPlusCPBW()");
291
292
293 ret = qAT_PlusCPBS((T_ACI_CMD_SRC)srcId,&stor,&used,&total);
294 TRACE_EVENT_P1("Current phonebook storage: %d", stor);
295
296 #ifdef TI_PS_FFS_PHB
297 if (ret EQ AT_FAIL)
298 {
299 cmdCmeError(CME_ERR_Unknown);
300 return ATI_FAIL;
301 }
302 #endif
303
304 if (ret EQ AT_CMPL AND
305 stor EQ PB_STOR_Ed)
306 {
307 cmdCmeError(CME_ERR_OpNotAllow);
308 return ATI_FAIL;
309 }
310
311 if ( ati_user_output_cfg[srcId].cscsChset EQ CSCS_CHSET_Gsm)
312 {
313 cl=parse(cl,"rsrz",
314 &index,
315 (LONG)MAX_PHB_NUM_LEN,
316 numBuf,
317 &toa_val,
318 (LONG)MAX_ALPHA_LEN,
319 strlen(cl),
320 cl,
321 &lenText,
322 text);
323 }
324 else
325 {
326 cl=parse(cl,"rsrz",
327 &index,
328 (LONG)MAX_PHB_NUM_LEN,
329 numBuf,
330 &toa_val,
331 (LONG)MAX_ALPHA_LEN * 4,
332 strlen(cl),
333 cl,
334 &lenText,
335 text);
336 }
337
338 if(!cl)
339 {
340 TRACE_ERROR("ERROR: parsing failed !!!");
341 index = get_parse_index(); /* get the problematic component */
342 switch (index)
343 {
344 case 2: /* component 2 is the number */
345 cmdCmeError(CME_ERR_DialToLong);
346 break;
347 case 4: /* component 4 is the alpha tag */
348 cmdCmeError(CME_ERR_TxtToLong);
349 break;
350 default:
351 cmdCmeError(CME_ERR_OpNotAllow);
352 break;
353 }
354 return ATI_FAIL;
355 }
356
357 /* If the phonebook status is not PHB_READY then SIM BUSY error is indicated to the user.*/
358 pb_status_req(&pb_status); /* get phone book status */
359
360 TRACE_EVENT_P1("Current phonebook status: %d", pb_status);
361 if (pb_status NEQ PHB_READY)
362 {
363 if(pb_status EQ PHB_BUSY)
364 {
365 TRACE_EVENT("Error: Phonebook is busy accessing the SIM");
366 cmdCmeError(CME_ERR_SimBusy);
367 }
368 else if(pb_status EQ PHB_UNKNOWN)
369 {
370 TRACE_EVENT("Error: Phonebook status unknown");
371 cmdCmeError(CME_ERR_Unknown);
372 }
373 return ATI_FAIL;
374 }
375
376 if( index > total) /* phonebook index is greater than max. */
377 { /* possible index of SIM */
378 TRACE_EVENT("Error: phonebook index is greater than max possible index of SIM");
379 cmdCmeError(CME_ERR_InvIdx);
380 return ATI_FAIL;
381 }
382
383 if (toa_val > 0)
384 {
385 type=toa_demerge(toa_val);
386 p_toa=&type;
387 }
388 else
389 p_toa=NULL;
390
391 if (numBuf[0] EQ '\0')
392 p_number=NULL;
393 else
394 p_number=numBuf;
395
396 #ifdef FF_ATI_BAT
397 {
398 T_BAT_cmd_send cmd;
399 T_BAT_cmd_set_plus_cpbw my_bat_set_plus_cpbw = {0};
400 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id);
401
402 TRACE_FUNCTION("setatPlusCPBW() calls bat_send() <=== as APPLICATION");
403
404 cmd.ctrl_params = BAT_CMD_SET_PLUS_CPBW;
405 cmd.params.ptr_set_plus_cpbw = &my_bat_set_plus_cpbw;
406
407 my_bat_set_plus_cpbw.index = (S16)index;
408
409 /* Load the phone number in BAT struct - if there is one */
410 if (p_number)
411 {
412 if (strlen(p_number)>BAT_MAX_CPBW_NUMBER_LEN)
413 {
414 /*
415 * If the number is too big for the BAT structure we can't do
416 * anything meaningful, so get out now.
417 */
418 cmdCmeError(CME_ERR_Unknown);
419 return ATI_FAIL;
420 }
421
422 my_bat_set_plus_cpbw.c_number = strlen(p_number);
423 my_bat_set_plus_cpbw.v_number = TRUE;
424 memcpy(my_bat_set_plus_cpbw.number, p_number,BAT_MAX_CPBW_NUMBER_LEN);
425 }
426 else
427 {
428 my_bat_set_plus_cpbw.v_number = FALSE;
429 }
430
431 /*
432 * Load the associated text in BAT struct - if there is any
433 */
434 if ((lenText EQ 0) AND (p_number EQ NULL))
435 {
436 my_bat_set_plus_cpbw.v_text = FALSE;
437 }
438 else
439 {
440 /*
441 * If the associated text is too big for the BAT structure it
442 * will be truncated.
443 */
444 if (lenText>BAT_MAX_CPBW_TEXT_LEN)
445 my_bat_set_plus_cpbw.c_text = BAT_MAX_CPBW_TEXT_LEN;
446 else
447 my_bat_set_plus_cpbw.c_text = (U8)lenText;
448
449 my_bat_set_plus_cpbw.v_text = TRUE;
450 memcpy(my_bat_set_plus_cpbw.text, text, BAT_MAX_CPBW_TEXT_LEN);
451 }
452
453 /* Load type as string input */
454 if (p_toa)
455 my_bat_set_plus_cpbw.type = (S16)toa_val;
456 else
457 my_bat_set_plus_cpbw.type = (S16)-1;
458
459 src_params->curAtCmd = AT_CMD_CPBW;
460 srcId_cb = srcId;
461 bat_send(ati_bat_get_client(srcId), &cmd);
462
463 return ATI_EXCT; /* executing, because response is passed by callback function */
464 }
465
466 #else /* no FF_ATI_BAT */
467
468 if( lenText NEQ 0 )
469 {
470 srcId_cb = srcId;
471 utl_chsetToSim ((UBYTE*)text, lenText, (UBYTE*)cvtdText.data,
472 &lenCvtd, GSM_ALPHA_Def);
473 }
474 cvtdText.cs = CS_Sim;
475
476 /* when the text and the number are both empty, set p_text to NULL */
477 if (lenCvtd EQ 0 AND p_number EQ NULL)
478 {
479 p_text = NULL;
480 }
481 else
482 {
483 p_text = &cvtdText;
484 cvtdText.len = (UBYTE)lenCvtd;
485 }
486
487 ret = sAT_PlusCPBW((T_ACI_CMD_SRC)srcId, index, p_number, p_toa, p_text, &dmyDateTime);
488 switch (ret)
489 {
490 case AT_FAIL:
491 switch (ACI_ERR_DESC_CLASS( aciErrDesc ))
492 {
493 case ACI_ERR_CLASS_Cme:
494 cmdCmeError( (T_ACI_CME_ERR)ACI_ERR_DESC_NR( aciErrDesc ) );
495 break;
496 case ACI_ERR_CLASS_Cms:
497 case ACI_ERR_CLASS_Ceer:
498 case ACI_ERR_CLASS_Ext:
499 default:
500 cmdCmeError(CME_ERR_Unknown);
501 break;
502 }
503 break;
504 case AT_EXCT:
505 src_params->curAtCmd = AT_CMD_CPBW;
506 break;
507
508 case AT_BUSY:
509 cmdCmeError(CME_ERR_SimBusy);
510 break;
511 }
512 return (map_aci_2_ati_rslt(ret));
513 #endif /* no FF_ATI_BAT */
514 }
515
516 GLOBAL T_ATI_RSLT tesatPlusCPBW(char *cl, UBYTE srcId)
517 {
518 #ifdef FF_ATI_BAT
519
520 T_BAT_cmd_send cmd;
521 T_BAT_no_parameter dummy;
522
523 TRACE_FUNCTION("queatPlusCPBW() calls bat_send() <=== as APPLICATION");
524
525 cmd.ctrl_params = BAT_CMD_TST_PLUS_CPBW;
526 dummy.bat_dummy = 0xFF;
527 cmd.params.ptr_tst_plus_cpbw = &dummy;
528
529 bat_send(ati_bat_get_client(srcId), &cmd);
530
531 return ATI_EXCT; /* executing, because response is passed by callback function */
532
533 #else /* no FF_ATI_BAT */
534
535 char *me = "+CPBW: ";
536 T_ACI_RETURN ret = AT_FAIL;
537
538 SHORT first_idx,
539 last_idx;
540 UBYTE nlength,
541 tlength;
542 CHAR numBuf[MAX_PHB_NUM_LEN];
543
544 memset( numBuf, 0, sizeof(numBuf));
545
546 TRACE_FUNCTION("tesatPlusCPBW()");
547
548 ret = tAT_PlusCPBW((T_ACI_CMD_SRC)srcId,&first_idx,&last_idx,&nlength,&tlength);
549 if(ret EQ AT_CMPL)
550 {
551 sprintf(g_sa,"%s(%d-%d),%d,%s,%d",me,first_idx,last_idx,nlength,"(128-201)",tlength);
552 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT);
553 }
554 else
555 {
556 cmdCmeError(CME_ERR_Unknown);
557 }
558 return (map_aci_2_ati_rslt(ret));
559 #endif /* no FF_ATI_BAT */
560 }
561
562 /*
563 +-------------------------------------------------------------------+
564 | PROJECT : GSM-PS (6147) MODULE : ACI_CMD |
565 | STATE : code ROUTINE : cmd_readCPBRBlock |
566 +-------------------------------------------------------------------+
567
568 PURPOSE : This is the functional counterpart of the +CPBR
569 AT command which is responsible for reading phonebook
570 entries from memory, 5 at a time.
571
572 */
573 GLOBAL T_ACI_RETURN cmd_readCPBRBlock ( UBYTE srcId)
574 {
575 CHAR cvtdText[4*MAX_ALPHA_LEN] = {0x00}; /* need enough space for UCS2 strings */
576 USHORT lenCvtdText = 0;
577 USHORT pos = 0;
578 SHORT last_idx = ACI_NumParmNotPresent;
579 SHORT i;
580 T_ACI_PB_LST pblst;
581 UBYTE type;
582 T_ACI_RETURN ret = AT_FAIL;
583
584 TRACE_FUNCTION ("cmd_readCPBRBlock ()");
585
586 ret = sAT_PlusCPBR((T_ACI_CMD_SRC) srcId,phb_start_idx,phb_stop_idx,&last_idx,pblst);
587
588 if (ret EQ AT_CMPL)
589 {
590 for ( i = 0;
591 i < MAX_PB_ENTR;
592 i++ )
593 {
594 if(pblst[i].index EQ ACI_NumParmNotPresent)
595 {
596 break; /* All entries are read */
597 }
598
599 type = toa_merge(pblst[i].type);
600
601 pos=sprintf(g_sa,"+CPBR: %d,\"%s\",%d,",
602 pblst[i].index,
603 pblst[i].number,
604 type);
605
606 srcId_cb = srcId;
607 utl_chsetFromSim((UBYTE*)pblst[i].text.data,
608 pblst[i].text.len,
609 (UBYTE*)cvtdText,
610 sizeof(cvtdText),
611 &lenCvtdText,
612 GSM_ALPHA_Def);
613
614 pos+=sprints(g_sa+pos,cvtdText,lenCvtdText);
615 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT);
616 }
617
618 phb_start_idx = last_idx;
619
620 /* To read next entry */
621 phb_start_idx++;
622
623 if(phb_start_idx EQ (phb_stop_idx + 1))
624 {
625 return AT_CMPL;
626 }
627 else
628 {
629 /* Still entries to read */
630 return AT_EXCT;
631 }
632 }
633 else
634 {
635 cmdCmeError(CME_ERR_Unknown);
636 return AT_FAIL;
637 }
638 }
639
640 /*
641 +-------------------------------------------------------------------+
642 | PROJECT : GSM-PS (6147) MODULE : ACI_CMD |
643 | STATE : code ROUTINE : cmd_PlusCPBR_CB |
644 +-------------------------------------------------------------------+
645
646 PURPOSE : This is the functional counterpart of the +CPBR
647 AT command which is responsible for reading phonebook
648 entries from memory.
649
650 This is a callback function for reading remaining
651 phonebook entries called from sap_dti.c.
652 This function reads 5 entries from where the last
653 reading had stopped.
654 */
655 GLOBAL void cmd_PlusCPBR_CB ( UBYTE srcId)
656 {
657 T_ACI_RETURN ret;
658
659 TRACE_FUNCTION ("cmd_PlusCPBR_CB()");
660
661 /* Call cmd_readCPBRBlock()
662 when still entries are to be read */
663 if(phb_stop_idx >= phb_start_idx)
664 {
665 ret = cmd_readCPBRBlock(srcId);
666
667 switch(ret)
668 {
669 case AT_EXCT:
670 /* Still entries to read */
671 return;
672
673 case AT_CMPL:
674 /* All the entries are read */
675 R_AT( RAT_OK, (T_ACI_CMD_SRC) srcId )
676 (AT_CMD_CPBR);
677 break;
678
679 default:
680 /* Failed to read entries */
681 R_AT( RAT_CME, (T_ACI_CMD_SRC) srcId )
682 ( AT_CMD_CPBR, CME_ERR_Unknown);
683 }
684 }
685 }
686 /*
687 +--------------------------------------------------------------------+
688 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD |
689 | STATE : code ROUTINE : atPlusCPBR |
690 +--------------------------------------------------------------------+
691
692 PURPOSE : +CPBR (Read Phonebook Entry)
693 */
694
695 GLOBAL T_ATI_RSLT setatPlusCPBR(char *cl, UBYTE srcId)
696 {
697 T_ACI_RETURN ret;
698
699 TRACE_FUNCTION("setatPlusCPBR()");
700
701 phb_start_idx = ACI_NumParmNotPresent;
702 phb_stop_idx = ACI_NumParmNotPresent;
703
704 cl = parse(cl,"rr",&phb_start_idx,&phb_stop_idx);
705 if(!cl OR phb_start_idx > MAX_PB_INDEX OR phb_start_idx < 0 OR phb_stop_idx > MAX_PB_INDEX)
706 {
707 cmdCmeError(CME_ERR_OpNotAllow);
708 return ATI_FAIL;
709 }
710 if(phb_stop_idx EQ ACI_NumParmNotPresent)
711 {
712 phb_stop_idx=phb_start_idx;
713 }
714
715 #ifdef FF_ATI_BAT
716 {
717 T_BAT_cmd_send cmd;
718 T_BAT_cmd_set_plus_cpbr my_bat_set_plus_cpbr = {0};
719 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id);
720
721 TRACE_FUNCTION("setatPlusCPBR() calls bat_send() <=== as APPLICATION");
722
723 cmd.ctrl_params = BAT_CMD_SET_PLUS_CPBR;
724 cmd.params.ptr_set_plus_cpbr = &my_bat_set_plus_cpbr;
725
726 my_bat_set_plus_cpbr.index1 = (U8) phb_start_idx;
727 my_bat_set_plus_cpbr.index2 = (S16) phb_stop_idx;
728
729 src_params->curAtCmd = AT_CMD_CPBR;
730 srcId_cb = srcId;
731 bat_send(ati_bat_get_client(srcId), &cmd);
732
733 return ATI_EXCT; /* executing, because response is passed by callback function */
734 }
735 #else /* no FF_ATI_BAT */
736
737 /* Read 5 entries at a time */
738 ret = cmd_readCPBRBlock(srcId);
739
740 #endif /* no FF_ATI_BAT */
741
742 return (map_aci_2_ati_rslt(ret));
743 }
744
745 GLOBAL T_ATI_RSLT tesatPlusCPBR(char *cl, UBYTE srcId)
746 {
747 #ifdef FF_ATI_BAT
748
749 T_BAT_cmd_send cmd;
750 T_BAT_no_parameter dummy;
751
752 TRACE_FUNCTION("tesatPlusCPBR() calls bat_send() <=== as APPLICATION");
753
754 cmd.ctrl_params = BAT_CMD_TST_PLUS_CPBR;
755 dummy.bat_dummy = 0xFF;
756 cmd.params.ptr_tst_plus_cpbr = &dummy;
757
758 bat_send(ati_bat_get_client(srcId), &cmd);
759
760 return ATI_EXCT; /* executing, because response is passed by callback function */
761
762 #else /* no FF_ATI_BAT */
763
764 T_ACI_RETURN ret = AT_FAIL;
765 SHORT first_idx,
766 last_idx = ACI_NumParmNotPresent;
767 UBYTE nlength,
768 tlength;
769
770 TRACE_FUNCTION("tesatPlusCPBR()");
771
772 ret = tAT_PlusCPBR((T_ACI_CMD_SRC)srcId,&first_idx,&last_idx,&nlength,&tlength);
773 if(ret EQ AT_CMPL)
774 {
775 sprintf(g_sa,"+CPBR: (%d-%d),%d,%d",first_idx,last_idx,nlength,tlength);
776 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT);
777 }
778 else
779 {
780 cmdCmeError(CME_ERR_Unknown);
781 }
782 return (map_aci_2_ati_rslt(ret));
783
784 #endif /* no FF_ATI_BAT */
785 }
786
787 /*
788 +--------------------------------------------------------------------+
789 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD |
790 | STATE : code ROUTINE : atPlusCPBF |
791 +--------------------------------------------------------------------+
792
793 PURPOSE : +CPBF (Find Text in Phonebook)
794 */
795
796 GLOBAL T_ATI_RSLT setatPlusCPBF(char *cl, UBYTE srcId)
797 {
798 #ifndef FF_ATI_BAT
799 T_ACI_RETURN ret = AT_FAIL;
800 #ifndef NO_ASCIIZ
801 CHAR cvtdFindstr[MAX_ALPHA_LEN] = {0x00};
802 #endif
803 USHORT lenCvtdFindstr = 0;
804 CHAR cvtdText [2*MAX_ALPHA_LEN] = {0x00};
805 USHORT lenCvtdText = 0;
806 USHORT pos = 0;
807
808 SHORT i,
809 j;
810 SHORT found;
811 T_ACI_PB_LST pblst;
812 UBYTE type;
813
814 #ifdef NO_ASCIIZ
815 T_ACI_PB_TEXT pbText;
816 #endif /* #ifdef NO_ASCIIZ */
817
818 #endif /* FF_ATI_BAT */
819
820 CHAR findstr [MAX_ALPHA_LEN] = {0x00};
821 USHORT lenFindstr = 0;
822
823 TRACE_FUNCTION("setatPlusCPBF()");
824
825 cl=parse(cl,"z",
826 (LONG)MAX_ALPHA_LEN,
827 strlen(cl),
828 cl,
829 &lenFindstr,
830 findstr);
831 if(!cl OR lenFindstr EQ 0)
832 {
833 cmdCmeError(CME_ERR_OpNotAllow);
834 return ATI_FAIL;
835 }
836 srcId_cb = srcId;
837
838 #ifdef FF_ATI_BAT
839 {
840 T_BAT_cmd_send cmd;
841 T_BAT_cmd_set_plus_cpbf cpbf;
842
843 cmd.ctrl_params = BAT_CMD_SET_PLUS_CPBF;
844 cmd.params.ptr_set_plus_cpbf=&cpbf;
845
846 /*
847 * Check that the string isn't too long for the BAT message.
848 */
849 if (lenFindstr>BAT_MAX_CPBF_FIND_TEXT_LEN)
850 {
851 cmdCmeError(CME_ERR_Unknown);
852 return ATI_FAIL;
853 }
854
855 cpbf.c_findtext=(U8)lenFindstr;
856 memcpy(cpbf.findtext,findstr,lenFindstr);
857
858 bat_send(ati_bat_get_client(srcId), &cmd);
859 return(ATI_EXCT);
860 }
861 #else /* no FF_ATI_BAT */
862
863 #ifdef NO_ASCIIZ
864 utl_chsetToSim ( (UBYTE*)findstr,
865 lenFindstr,
866 pbText.data,
867 &lenCvtdFindstr,
868 GSM_ALPHA_Def );
869
870 pbText.cs = CS_Sim;
871 pbText.len = (UBYTE)lenCvtdFindstr;
872
873 ret = sAT_PlusCPBF( (T_ACI_CMD_SRC)srcId, &pbText, CPBF_MOD_NewSearch,
874 &found, &pblst[0] );
875 #else /* #ifdef NO_ASCIIZ */
876 utl_chsetToGsm ( (UBYTE*)findstr,
877 lenFindstr,
878 (UBYTE*)cvtdFindstr,
879 &lenCvtdFindstr,
880 #ifdef REL99
881 sizeof(cvtdFindstr),
882 #endif /* REL99 */
883 GSM_ALPHA_Int );
884
885 ret = sAT_PlusCPBF( srcId, cvtdFindstr, CPBF_MOD_NewSearch,
886 &found, &pblst[0] );
887 #endif /* #ifdef NO_ASCIIZ */
888 if (ret EQ AT_CMPL)
889 {
890 i=0;
891 while(i<MAX_PB_ENTR AND i < found)
892 {
893 type = toa_merge(pblst[i].type);
894
895 pos=sprintf(g_sa,"+CPBF: %d,\"%s\",%d,",
896 pblst[i].index,
897 pblst[i].number,
898 type);
899 utl_chsetFromSim((UBYTE*)pblst[i].text.data,
900 pblst[i].text.len,
901 (UBYTE*)cvtdText,
902 sizeof(cvtdText),
903 &lenCvtdText,
904 GSM_ALPHA_Def);
905 pos+=sprints(g_sa+pos,cvtdText,lenCvtdText);
906 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT);
907 i++;
908 }
909 if (found > MAX_PB_ENTR)
910 {
911 while(i < found)
912 {
913 #ifdef NO_ASCIIZ
914 ret = sAT_PlusCPBF( (T_ACI_CMD_SRC)srcId, &pbText,
915 CPBF_MOD_NextSearch, &found, &pblst[0] );
916 #else /* #ifdef NO_ASCIIZ */
917 ret = sAT_PlusCPBF( srcId, cvtdFindstr,
918 CPBF_MOD_NextSearch, &found, &pblst[0] );
919 #endif /* #ifdef NO_ASCIIZ */
920 if (ret EQ AT_CMPL)
921 {
922 for(j=0;j < MAX_PB_ENTR AND i < found;j++)
923 {
924 type = toa_merge(pblst[j].type);
925
926 pos=sprintf(g_sa,"+CPBF: %d,\"%s\",%d,",
927 pblst[j].index,
928 pblst[j].number,
929 type);
930 utl_chsetFromGsm((UBYTE*)pblst[j].text.data,
931 pblst[j].text.len,
932 (UBYTE*)cvtdText,
933 sizeof(cvtdText),
934 &lenCvtdText,
935 GSM_ALPHA_Def);
936 pos+=sprints(g_sa+pos,cvtdText,lenCvtdText);
937 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT);
938 i++;
939 }
940 }
941 else
942 {
943 i = found; /* Ensure at least termination of loop */
944 }
945 }
946 }
947 }
948 else
949 {
950 cmdCmeError(CME_ERR_Unknown);
951 }
952 return (map_aci_2_ati_rslt(ret));
953
954 #endif /* no FF_ATI_BAT */
955 }
956
957 GLOBAL T_ATI_RSLT tesatPlusCPBF(char *cl, UBYTE srcId)
958 {
959 #ifndef FF_ATI_BAT
960 T_ACI_RETURN ret = AT_FAIL;
961 UBYTE nlength,
962 tlength;
963 #endif
964
965 TRACE_FUNCTION("tesatPlusCPBF()");
966
967 #ifdef FF_ATI_BAT
968 {
969 T_BAT_cmd_send cmd;
970 T_BAT_no_parameter dummy;
971
972 cmd.ctrl_params = BAT_CMD_TST_PLUS_CPBF;
973 dummy.bat_dummy = 0xFF;
974 cmd.params.ptr_tst_plus_cpbf = &dummy;
975 bat_send(ati_bat_get_client(srcId), &cmd);
976 return(ATI_EXCT);
977 }
978 #else /* no FF_ATI_BAT */
979
980 ret = tAT_PlusCPBF((T_ACI_CMD_SRC)srcId,&nlength,&tlength);
981 if(ret EQ AT_CMPL)
982 {
983 resp_disp(srcId, cl,"bb",&nlength,&tlength);
984 }
985 else
986 {
987 cmdCmeError(CME_ERR_Unknown);
988 }
989 return (map_aci_2_ati_rslt(ret));
990
991 #endif /* no FF_ATI_BAT */
992 }
993
994 /*
995 +--------------------------------------------------------------------+
996 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD |
997 | STATE : code ROUTINE : atPlusCSVM |
998 +--------------------------------------------------------------------+
999
1000 PURPOSE : +CSVM command (Set Voice Mail Number )
1001 */
1002
1003 GLOBAL T_ATI_RSLT setatPlusCSVM (char *cl, UBYTE srcId)
1004 {
1005
1006 T_ACI_CSVM_MOD mode = CSVM_MOD_NotPresent;
1007 T_ACI_RETURN ret = AT_FAIL;
1008 T_ACI_TOA type;
1009 SHORT toa_val=0;
1010 CHAR numBuf[MAX_CC_ORIG_NUM_LEN];
1011
1012 TRACE_FUNCTION("setatPlusCSVM()");
1013
1014 memset( numBuf, 0, sizeof(numBuf));
1015
1016 cl=parse(cl,"dsr",&mode,(LONG)MAX_CC_ORIG_NUM_LEN,
1017 numBuf,&toa_val);
1018
1019 if(!cl)
1020 {
1021 cmdCmeError(CME_ERR_OpNotAllow);
1022 return ATI_FAIL;
1023 }
1024 if ( mode EQ CSVM_MOD_Enable AND
1025 numBuf[0] EQ '\0' OR
1026 toa_val < 0)
1027 {
1028 cmdCmeError(CME_ERR_OpNotAllow);
1029 return ATI_FAIL;
1030 }
1031 if(toa_val NEQ 0)
1032 {
1033 type=toa_demerge(toa_val);
1034 }
1035 else
1036 {
1037 cmh_setToaDef(numBuf,&type);
1038 }
1039
1040
1041 #ifdef FF_ATI_BAT
1042
1043 {
1044 T_BAT_cmd_send cmd;
1045 T_BAT_cmd_set_plus_csvm csvm;
1046 UBYTE len;
1047
1048 cmd.ctrl_params = BAT_CMD_SET_PLUS_CSVM;
1049 cmd.params.ptr_set_plus_csvm=&csvm;
1050
1051 len=strlen(numBuf);
1052
1053 csvm.mode=(T_BAT_plus_csvm_mode)mode;
1054
1055 if ((len) AND (len<=BAT_MAX_CSVM_NUMBER_LEN))
1056 {
1057 csvm.v_number=TRUE;
1058 csvm.c_number=(U8)len;
1059 memcpy(csvm.number,numBuf,len);
1060 }
1061 else
1062 {
1063 csvm.v_number=FALSE;
1064 }
1065 csvm.type=(S16)toa_val;
1066 bat_send(ati_bat_get_client(srcId), &cmd);
1067 return(ATI_EXCT);
1068 }
1069
1070 #else /* no FF_ATI_BAT */
1071
1072 ret = sAT_PlusCSVM((T_ACI_CMD_SRC)srcId, mode, numBuf, (UBYTE)strlen(numBuf), &type);
1073
1074 if (ret EQ AT_FAIL)
1075 {
1076 cmdCmeError(CME_ERR_Unknown);
1077 }
1078 return (map_aci_2_ati_rslt(ret));
1079
1080 #endif /* no FF_ATI_BAT */
1081 }
1082
1083 GLOBAL T_ATI_RSLT queatPlusCSVM (char *cl, UBYTE srcId)
1084 {
1085 T_ACI_CSVM_MOD mode=CSVM_MOD_NotPresent;
1086 T_ACI_RETURN ret = AT_FAIL;
1087 SHORT toa_val=0;
1088 CHAR numBuf[MAX_CC_ORIG_NUM_LEN];
1089
1090 TRACE_FUNCTION("queatPlusCSVM()");
1091
1092 memset( numBuf, 0, sizeof(numBuf));
1093
1094 #ifdef FF_ATI_BAT
1095 {
1096 T_BAT_cmd_send cmd;
1097 T_BAT_no_parameter dummy;
1098
1099 cmd.ctrl_params = BAT_CMD_QUE_PLUS_CSVM;
1100 dummy.bat_dummy = 0xFF;
1101 cmd.params.ptr_que_plus_csvm = &dummy;
1102 bat_send(ati_bat_get_client(srcId), &cmd);
1103 return(ATI_EXCT);
1104 }
1105 #else /* no FF_ATI_BAT */
1106
1107 ret = qAT_PlusCSVM((T_ACI_CMD_SRC)srcId, &mode, numBuf, sizeof(numBuf), &toa_val);
1108 if (ret EQ AT_FAIL)
1109 {
1110 cmdCmeError(CME_ERR_Unknown);
1111 }
1112 else
1113 {
1114 sprintf(g_sa,"+CSVM: %d,\"%s\",%d",mode,numBuf,toa_val);
1115 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT);
1116 }
1117
1118 return (map_aci_2_ati_rslt(ret));
1119
1120 #endif /* no FF_ATI_BAT */
1121 }
1122
1123 /*
1124 +--------------------------------------------------------------------+
1125 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD |
1126 | STATE : code ROUTINE : atPlusCLAN |
1127 +--------------------------------------------------------------------+
1128
1129 PURPOSE : +CLAN command (Set language)
1130 */
1131
1132 GLOBAL T_ATI_RSLT setatPlusCLAN (CHAR *cl, UBYTE srcId)
1133 {
1134 T_ACI_RETURN ret = AT_FAIL;
1135 CHAR lng_str[CLAN_CODE_LEN+1]={0};
1136 SHORT i;
1137 T_ACI_LAN_SUP lngCde;
1138 CHAR *auptr="au";
1139 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id);
1140
1141 TRACE_FUNCTION("setatPlusCLAN()");
1142
1143 cl = parse(cl,"s",(LONG)3,lng_str);
1144 if(!cl OR *lng_str EQ '\0')
1145 {
1146 cmdCmeError(CME_ERR_OpNotAllow);
1147 return ATI_FAIL;
1148 }
1149 if (strcmp(lng_str, auptr))
1150 {
1151 for(i=0;lngs[i].str NEQ 0;i++)
1152 {
1153 if (!strcmp(lngs[i].str,lng_str))
1154 {
1155 lngCde.str=lngs[i].str;
1156 lngCde.lng=lngs[i].lng;
1157 break;
1158 }
1159 }
1160 if(lngs[i].str EQ 0)
1161 {
1162 cmdCmeError(CME_ERR_OpNotSupp);
1163 return ATI_FAIL;
1164 }
1165 }
1166 else
1167 {
1168 lngCde.str = lng_str;
1169 lngCde.lng = CLAN_LNG_AUT;
1170 }
1171
1172 #ifdef FF_ATI_BAT
1173
1174 {
1175 T_BAT_cmd_send cmd;
1176 T_BAT_cmd_set_plus_clan clan;
1177 UBYTE len;
1178
1179 cmd.ctrl_params = BAT_CMD_SET_PLUS_CLAN;
1180 cmd.params.ptr_set_plus_clan=&clan;
1181
1182 len=strlen(lng_str);
1183
1184 if (len>BAT_MAX_CLAN_CODE_LEN)
1185 {
1186 cmdCmeError(CME_ERR_Unknown);
1187 return ATI_FAIL;
1188 }
1189
1190 memcpy(clan.code,lng_str,len);
1191 clan.c_code=(U8)len;
1192 bat_send(ati_bat_get_client(srcId), &cmd);
1193 src_params->curAtCmd=AT_CMD_CLAN;
1194 return(ATI_EXCT);
1195 }
1196
1197 #else /* no FF_ATI_BAT */
1198
1199 ret = sAT_PlusCLAN((T_ACI_CMD_SRC)srcId,&lngCde);
1200 if (ret EQ AT_EXCT)
1201 {
1202 src_params->curAtCmd = AT_CMD_CLAN;
1203 }
1204 else if (ret EQ AT_FAIL)
1205 {
1206 cmdCmeError(CME_ERR_Unknown);
1207 }
1208 return (map_aci_2_ati_rslt(ret));
1209
1210 #endif /* no FF_ATI_BAT */
1211 }
1212
1213 GLOBAL T_ATI_RSLT queatPlusCLAN(char *cl, UBYTE srcId)
1214 {
1215 #ifndef FF_ATI_BAT
1216 CHAR *me="+CLAN: ";
1217 T_ACI_RETURN ret = AT_FAIL;
1218 T_ACI_LAN_SUP lngCde;
1219 CHAR lang_buffer[3]; /* 2 chars for language + 0 terminated string */
1220 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id);
1221 #endif
1222
1223 TRACE_FUNCTION("queatPlusCLAN()");
1224
1225 #ifdef FF_ATI_BAT
1226 {
1227 T_BAT_cmd_send cmd;
1228 T_BAT_no_parameter dummy;
1229
1230 cmd.ctrl_params = BAT_CMD_QUE_PLUS_CLAN;
1231 dummy.bat_dummy = 0xFF;
1232 cmd.params.ptr_que_plus_clan = &dummy;
1233 bat_send(ati_bat_get_client(srcId), &cmd);
1234 return(ATI_EXCT);
1235 }
1236 #else /* no FF_ATI_BAT */
1237
1238 /* to be sure that last cipher is 0 (string)*/
1239 memset(lang_buffer, 0, sizeof(lang_buffer));
1240 lngCde.str = lang_buffer;
1241
1242 ret = qAT_PlusCLAN((T_ACI_CMD_SRC)srcId, &lngCde);
1243 switch(ret)
1244 {
1245 case(AT_CMPL):
1246 sprintf(g_sa,"%s%s", me, lngCde.str);
1247 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT);
1248 break;
1249
1250 case(AT_EXCT):
1251 src_params->curAtCmd = AT_CMD_CLAN;
1252 break;
1253
1254 case(AT_BUSY):
1255 cmdCmeError(CME_ERR_SimBusy);
1256 break;
1257
1258 default:
1259 cmdCmeError(CME_ERR_Unknown);
1260 break;
1261 }
1262 return (map_aci_2_ati_rslt(ret));
1263
1264 #endif /* no FF_ATI_BAT */
1265 }
1266
1267 GLOBAL T_ATI_RSLT tesatPlusCLAN (CHAR *cl, UBYTE srcId)
1268 {
1269 #ifndef FF_ATI_BAT
1270 char *me="+CLAN: ";
1271 T_ACI_RETURN ret = AT_FAIL;
1272 T_ACI_LAN_SUP lnglst[MAX_LAN];
1273 SHORT lastIdx;
1274 UBYTE i;
1275 SHORT pos;
1276 #endif
1277
1278 TRACE_FUNCTION("tesatPlusCLAN()");
1279
1280 #ifdef FF_ATI_BAT
1281 {
1282 T_BAT_cmd_send cmd;
1283 T_BAT_no_parameter dummy;
1284
1285 cmd.ctrl_params = BAT_CMD_TST_PLUS_CLAN;
1286 dummy.bat_dummy = 0xFF;
1287 cmd.params.ptr_tst_plus_clan = &dummy;
1288 bat_send(ati_bat_get_client(srcId), &cmd);
1289 return(ATI_EXCT);
1290 }
1291 #else /* no FF_ATI_BAT */
1292
1293 ret = tAT_PlusCLAN((T_ACI_CMD_SRC)srcId, &lastIdx, &lnglst[0] );
1294 if (ret EQ AT_FAIL)
1295 {
1296 cmdCmeError(CME_ERR_Unknown);
1297 return ATI_FAIL;
1298 }
1299
1300 pos=sprintf(g_sa,"%s",me);
1301
1302 for(i=0;i<lastIdx;i++)
1303 {
1304 pos += sprintf(g_sa+pos,"%s,",lnglst[i].str);
1305 }
1306
1307 g_sa[pos-1] = '\0';
1308 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT);
1309 return (map_aci_2_ati_rslt(ret));
1310
1311 #endif /* no FF_ATI_BAT */
1312 }
1313
1314 /*
1315 +--------------------------------------------------------------------+
1316 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD |
1317 | STATE : code ROUTINE : setatPercentPBCF |
1318 +--------------------------------------------------------------------+
1319
1320 PURPOSE : %PBCF command (Set phonebook configuration)
1321 */
1322
1323 GLOBAL T_ATI_RSLT setatPercentPBCF (CHAR *cl, UBYTE srcId)
1324 {
1325 T_ACI_PBCF_LDN ldn = PBCF_LDN_NotPresent;
1326 T_ACI_PBCF_LRN lrn = PBCF_LRN_NotPresent;
1327 T_ACI_PBCF_LMN lmn = PBCF_LMN_NotPresent;
1328 T_ACI_RETURN ret = AT_FAIL;
1329
1330 cl = parse (cl, "ddd", &ldn, &lrn, &lmn);
1331
1332 /*lint -e685 always evaluates to false*/
1333 if (!cl OR
1334 ldn < PBCF_LDN_NotPresent OR ldn > PBCF_LDN_Disable OR
1335 lrn < PBCF_LRN_NotPresent OR lrn > PBCF_LRN_Disable OR
1336 lmn < PBCF_LMN_NotPresent OR lmn > PBCF_LMN_Disable)
1337 {
1338 cmdCmeError(CME_ERR_OpNotAllow);
1339 return ATI_FAIL;
1340 }
1341
1342 #ifdef FF_ATI_BAT
1343 {
1344 T_BAT_cmd_send cmd;
1345 T_BAT_cmd_set_percent_pbcf pbcf;
1346 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id);
1347
1348 TRACE_FUNCTION("setatPercentPBCF() calls bat_send() <=== as APPLICATION");
1349
1350 cmd.ctrl_params = BAT_CMD_SET_PERCENT_PBCF;
1351 cmd.params.ptr_set_percent_pbcf=&pbcf;
1352
1353 pbcf.ldn = (T_BAT_percent_pbcf_ldn)ldn;
1354 pbcf.lrn = (T_BAT_percent_pbcf_lrn)lrn;
1355 pbcf.lmn = (T_BAT_percent_pbcf_lmn)lmn;
1356
1357 bat_send(ati_bat_get_client(srcId), &cmd);
1358 src_params->curAtCmd=AT_CMD_P_PBCF;
1359 return(ATI_EXCT);
1360 }
1361
1362 #else /* FF_ATI_BAT */
1363 TRACE_FUNCTION("setatPercentPBCF()");
1364
1365 ret = sAT_PercentPBCF((T_ACI_CMD_SRC)srcId, ldn, lrn, lmn);
1366
1367 if(ret EQ AT_FAIL)
1368 {
1369 cmdCmeError(CME_ERR_Unknown);
1370 return ATI_FAIL;
1371 }
1372
1373 return (map_aci_2_ati_rslt(ret));
1374
1375 #endif /* FF_ATI_BAT */
1376 }
1377
1378
1379 GLOBAL T_ATI_RSLT queatPercentPBCF (CHAR *cl, UBYTE srcId)
1380 {
1381 #ifdef FF_ATI_BAT
1382 {
1383 T_BAT_cmd_send cmd;
1384 T_BAT_no_parameter dummy;
1385
1386 TRACE_FUNCTION("queatPercentPBCF() calls bat_send() <=== as APPLICATION");
1387
1388 cmd.ctrl_params = BAT_CMD_QUE_PERCENT_PBCF;
1389 dummy.bat_dummy = 0xFF;
1390 cmd.params.ptr_que_percent_pbcf = &dummy;
1391 bat_send(ati_bat_get_client(srcId), &cmd);
1392 return(ATI_EXCT);
1393 }
1394
1395 #else /* FF_ATI_BAT */
1396 CHAR *me = "%PBCF: ";
1397 T_ACI_PBCF_LDN ldn = PBCF_LDN_NotPresent;
1398 T_ACI_PBCF_LRN lrn = PBCF_LRN_NotPresent;
1399 T_ACI_PBCF_LMN lmn = PBCF_LMN_NotPresent;
1400
1401 TRACE_FUNCTION("queatPercentPBCF()");
1402
1403 qAT_PercentPBCF ((T_ACI_CMD_SRC)srcId, &ldn, &lrn, &lmn);
1404
1405 sprintf (g_sa, "%s%d, %d, %d", me, ldn, lrn, lmn);
1406 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT);
1407
1408 return (ATI_CMPL);
1409 #endif /* FF_ATI_BAT */
1410 }
1411
1412 #endif /* ATI_PHB_C */