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