FreeCalypso > hg > fc-magnetite
comparison src/g23m-aci/aci/ati_mm.c @ 162:53929b40109c
src/g23m-aci: initial import from TCS3.2/LoCosto
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Tue, 11 Oct 2016 02:02:43 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
161:4557e2a9c18e | 162:53929b40109c |
---|---|
1 /* | |
2 +----------------------------------------------------------------------------- | |
3 | Project : GSM-F&D (8411) | |
4 | Modul : ATI | |
5 +----------------------------------------------------------------------------- | |
6 | Copyright 2002 Texas Instruments Berlin, AG | |
7 | All rights reserved. | |
8 | | |
9 | This file is confidential and a trade secret of Texas | |
10 | Instruments Berlin, AG | |
11 | The receipt of or possession of this file does not convey | |
12 | any rights to reproduce or disclose its contents or to | |
13 | manufacture, use, or sell anything it may describe, in | |
14 | whole, or in part, without the specific written consent of | |
15 | Texas Instruments Berlin, AG. | |
16 +----------------------------------------------------------------------------- | |
17 | Purpose : AT Command Interpreter: Mobility Management related functions. | |
18 +----------------------------------------------------------------------------- | |
19 */ | |
20 | |
21 #ifndef ATI_MM_C | |
22 #define ATI_MM_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 | |
35 #include "aci_mem.h" | |
36 #include "aci_prs.h" | |
37 | |
38 #include "ati_int.h" | |
39 | |
40 #ifdef UART | |
41 #include "dti.h" | |
42 #include "dti_conn_mng.h" | |
43 #endif | |
44 | |
45 #include "psa.h" | |
46 #include "cmh.h" | |
47 #include "psa_sim.h" | |
48 #include "cmh_sim.h" | |
49 #include "psa_mm.h" | |
50 | |
51 #ifdef FF_ATI_BAT | |
52 | |
53 #include "typedefs.h" | |
54 #include "gdd.h" | |
55 #include "bat.h" | |
56 | |
57 #include "ati_bat.h" | |
58 | |
59 #endif /* FF_ATI_BAT */ | |
60 | |
61 EXTERN T_ACI_CFUN_FUN CFUNfun; | |
62 EXTERN T_CIEV_SIGNAL_BUFFER asCievSignalBuf; | |
63 EXTERN T_CIEV_SMSFULL_BUFFER asCievSmsFullBuf; | |
64 | |
65 /* | |
66 +--------------------------------------------------------------------+ | |
67 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
68 | STATE : code ROUTINE : atPlusCops | | |
69 +--------------------------------------------------------------------+ | |
70 | |
71 PURPOSE : +COPS command (operator selection) | |
72 */ | |
73 | |
74 GLOBAL T_ATI_RSLT setatPlusCOPS (char *cl, UBYTE srcId) | |
75 { | |
76 CHAR op[MAX_ALPHA_OPER_LEN] = {0}; | |
77 T_ACI_RETURN ret = AT_FAIL; | |
78 T_ACI_COPS_MOD mode = COPS_MOD_NotPresent; | |
79 T_ACI_COPS_FRMT format = COPS_FRMT_NotPresent; | |
80 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id); | |
81 | |
82 TRACE_FUNCTION("setatPlusCops()"); | |
83 | |
84 if (CFUNfun NEQ CFUN_FUN_Full) | |
85 { | |
86 TRACE_EVENT_P1("+COPS error: cannot proceed Mobile has no Full CFUN: %d", CFUNfun); | |
87 cmdCmeError(CME_ERR_OpNotAllow); | |
88 return ATI_FAIL; | |
89 } | |
90 | |
91 cl = parse (cl,"dds",&mode,&format,(LONG)(MAX_ALPHA_OPER_LEN-1),op); /*split parameter string in int,int,str*/ | |
92 if (!cl OR ((mode EQ COPS_MOD_Man OR mode EQ COPS_MOD_Both) | |
93 AND op[0] EQ 0)) | |
94 { | |
95 cmdCmeError(CME_ERR_OpNotAllow); | |
96 return ATI_FAIL; | |
97 } | |
98 | |
99 #ifdef FF_ATI_BAT | |
100 { | |
101 T_BAT_cmd_send cmd; | |
102 T_BAT_cmd_set_plus_cops cops; | |
103 UBYTE len; | |
104 | |
105 len=strlen(op); | |
106 | |
107 /* | |
108 * If the operator name is too long we can't really do anything | |
109 * meaningful, so generate an error and give up. | |
110 */ | |
111 if (len>BAT_MAX_COPS_OPER_LEN) | |
112 { | |
113 cmdCmeError(CME_ERR_Unknown); | |
114 return(ATI_FAIL); | |
115 } | |
116 | |
117 cmd.ctrl_params = BAT_CMD_SET_PLUS_COPS; | |
118 cmd.params.ptr_set_plus_cops=&cops; | |
119 | |
120 /* | |
121 * This relies on T_ACI_COPS_MOD and T_BAT_plus_cops_mode being | |
122 * equivalent. | |
123 */ | |
124 cops.mode=(T_BAT_plus_cops_mode)mode; | |
125 | |
126 /* | |
127 * This relies on T_ACI_COPS_FRMT and T_BAT_plus_cops_format being | |
128 * equivalent. | |
129 */ | |
130 cops.format=(T_BAT_plus_cops_format)format; | |
131 | |
132 cops.c_oper=(U8)len; | |
133 | |
134 if (len) | |
135 { | |
136 memcpy(cops.oper,op,BAT_MAX_COPS_OPER_LEN); | |
137 cops.v_oper=TRUE; | |
138 } | |
139 else | |
140 { | |
141 cops.v_oper=FALSE; | |
142 } | |
143 bat_send(ati_bat_get_client(srcId), &cmd); | |
144 src_params->curAtCmd = AT_CMD_COPS; | |
145 return ATI_EXCT; | |
146 } | |
147 #else | |
148 | |
149 ret = sAT_PlusCOPS ((T_ACI_CMD_SRC)srcId,mode,format,op); | |
150 switch (ret) | |
151 { | |
152 case (AT_CMPL): /*operation completed*/ | |
153 break; | |
154 case (AT_EXCT): | |
155 src_params->curAtCmd = AT_CMD_COPS; | |
156 break; | |
157 default: | |
158 cmdCmeError(CME_ERR_Unknown); /*Command failed*/ | |
159 break; | |
160 } | |
161 return (map_aci_2_ati_rslt(ret)); | |
162 | |
163 #endif /*FF_ATI_BAT*/ | |
164 } | |
165 | |
166 #ifdef FF_ATI_BAT | |
167 /* | |
168 +--------------------------------------------------------------------+ | |
169 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT | | |
170 | STATE : code ROUTINE : aci_bat_HandleTestCOPS | | |
171 +--------------------------------------------------------------------+ | |
172 | |
173 PURPOSE : | |
174 */ | |
175 T_ATI_RSLT atiHandleTestCOPS(UBYTE srcId) | |
176 { | |
177 T_BAT_cmd_send cmd; | |
178 T_BAT_no_parameter dummy; | |
179 | |
180 cmd.ctrl_params = BAT_CMD_TST_PERCENT_COPS; | |
181 dummy.bat_dummy = 0xFF; | |
182 cmd.params.ptr_que_plus_cops = &dummy; | |
183 | |
184 TRACE_FUNCTION("aci_bat_HandleTestCOPS() calls bat_send() <=== as APPLICATION"); | |
185 | |
186 #ifndef FF_DUAL_SIM | |
187 if (CFUNfun NEQ CFUN_FUN_Full) | |
188 { | |
189 cmdCmeError(CME_ERR_OpNotAllow); | |
190 return ATI_FAIL; | |
191 } | |
192 #endif /*FF_DUAL_SIM*/ | |
193 | |
194 bat_send(ati_bat_get_client(srcId), &cmd); | |
195 return ATI_EXCT; /* executing, because response is passed by callback function */ | |
196 } | |
197 | |
198 #else /* no FF_ATI_BAT */ | |
199 | |
200 GLOBAL T_ATI_RSLT atiHandleTestCOPS(char *cl, UBYTE srcId) | |
201 { | |
202 T_ACI_RETURN ret = AT_FAIL; | |
203 SHORT startIdx = 0, | |
204 lastIdx = 0, | |
205 i; | |
206 T_ACI_COPS_LST operLst; | |
207 BOOL END_OF_LIST = FALSE; | |
208 | |
209 | |
210 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id); | |
211 char* outputCommand; | |
212 | |
213 | |
214 TRACE_FUNCTION("atiHandleTestCOPS()"); | |
215 | |
216 #ifndef FF_DUAL_SIM | |
217 if (CFUNfun NEQ CFUN_FUN_Full) | |
218 { | |
219 cmdCmeError(CME_ERR_OpNotAllow); | |
220 return ATI_FAIL; | |
221 } | |
222 #endif /*FF_DUAL_SIM*/ | |
223 do | |
224 { | |
225 startIdx += lastIdx; | |
226 switch (src_params->curAtCmd) | |
227 { | |
228 case AT_CMD_COPS: | |
229 ret = tAT_PlusCOPS((T_ACI_CMD_SRC)srcId,startIdx,&lastIdx,&operLst[0]); | |
230 break; | |
231 case AT_CMD_P_COPS: | |
232 ret = tAT_PercentCOPS((T_ACI_CMD_SRC)srcId,startIdx,&lastIdx,&operLst[0]); | |
233 break; | |
234 default: | |
235 cmdCmeError(CME_ERR_Unknown); | |
236 return ATI_FAIL; | |
237 } | |
238 if (ret EQ AT_CMPL) | |
239 { | |
240 for(i=0;i<lastIdx;i++) | |
241 { | |
242 if ((operLst[i].status < 0) AND (*operLst[i].numOper EQ 0)) | |
243 { | |
244 END_OF_LIST = TRUE; | |
245 break; | |
246 } | |
247 | |
248 /* What COPS command is active? */ | |
249 switch (src_params->curAtCmd) | |
250 { | |
251 case AT_CMD_COPS: | |
252 outputCommand = "+COPS"; | |
253 break; | |
254 case AT_CMD_P_COPS: | |
255 outputCommand ="%COPS"; | |
256 break; | |
257 default: | |
258 cmdCmeError(CME_ERR_Unknown); | |
259 return ATI_FAIL; | |
260 } | |
261 | |
262 sprintf(g_sa,"%s: %d,\"%s\",\"%s\",%s",outputCommand, | |
263 operLst[i].status,operLst[i].longOper, | |
264 operLst[i].shortOper,operLst[i].numOper); | |
265 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT); | |
266 | |
267 } | |
268 } | |
269 | |
270 switch(ret) | |
271 { | |
272 case AT_EXCT: | |
273 return ATI_EXCT; | |
274 | |
275 case AT_FAIL: | |
276 cmdCmeError(CME_ERR_Unknown); | |
277 return ATI_FAIL; | |
278 | |
279 case AT_BUSY: | |
280 return ATI_BUSY; | |
281 | |
282 default: | |
283 break;/* Does nothing in this case */ | |
284 } | |
285 | |
286 } | |
287 while(!END_OF_LIST); | |
288 | |
289 return ATI_CMPL; | |
290 } | |
291 | |
292 #endif /* no FF_ATI_BAT */ | |
293 | |
294 | |
295 GLOBAL T_ATI_RSLT tesatPlusCOPS (char *cl, UBYTE srcId) | |
296 { | |
297 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id); | |
298 | |
299 #ifdef FF_ATI_BAT | |
300 TRACE_FUNCTION("tesatPlusCOPS() calls bat_send() <=== as APPLICATION"); | |
301 return atiHandleTestCOPS(srcId); | |
302 | |
303 #else /* FF_ATI_BAT */ | |
304 TRACE_FUNCTION("tesatPlusCOPS()"); | |
305 return atiHandleTestCOPS(cl,srcId); | |
306 #endif /* FF_ATI_BAT */ | |
307 | |
308 } | |
309 | |
310 GLOBAL T_ATI_RSLT queatPlusCOPS (char *cl, UBYTE srcId) | |
311 { | |
312 CHAR op[MAX_ALPHA_OPER_LEN] = {0}; | |
313 T_ACI_RETURN ret = AT_FAIL; | |
314 T_ACI_COPS_MOD mode = COPS_MOD_NotPresent; | |
315 T_ACI_COPS_FRMT format = COPS_FRMT_NotPresent; | |
316 | |
317 TRACE_FUNCTION("queatPlusCops()"); | |
318 | |
319 #ifdef FF_ATI_BAT | |
320 { | |
321 T_BAT_cmd_send cmd; | |
322 T_BAT_no_parameter dummy; | |
323 | |
324 cmd.ctrl_params = BAT_CMD_QUE_PLUS_COPS; | |
325 dummy.bat_dummy = 0xFF; | |
326 cmd.params.ptr_que_plus_cops = &dummy; | |
327 bat_send(ati_bat_get_client(srcId), &cmd); | |
328 return(ATI_EXCT); | |
329 } | |
330 #else /* no FF_ATI_BAT */ | |
331 | |
332 ret = qAT_PlusCOPS((T_ACI_CMD_SRC)srcId,&mode,&format,op); | |
333 if (ret EQ AT_CMPL) | |
334 { | |
335 if (*op) | |
336 sprintf(g_sa,"+COPS: %d,%d,\"%s\"",mode,format,op); | |
337 else | |
338 sprintf(g_sa,"+COPS: %d",mode); | |
339 | |
340 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT); | |
341 } | |
342 else | |
343 { | |
344 cmdCmeError(CME_ERR_Unknown); | |
345 } | |
346 return (map_aci_2_ati_rslt(ret)); | |
347 | |
348 #endif /* no FF_ATI_BAT */ | |
349 } | |
350 | |
351 /* | |
352 +--------------------------------------------------------------------+ | |
353 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
354 | STATE : code ROUTINE : setatPercentCOPS | | |
355 +--------------------------------------------------------------------+ | |
356 | |
357 PURPOSE : %COPS command (operator selection) | |
358 */ | |
359 | |
360 GLOBAL T_ATI_RSLT setatPercentCOPS (char *cl, UBYTE srcId) | |
361 { | |
362 CHAR op[MAX_ALPHA_OPER_LEN] = {0}; | |
363 T_ACI_RETURN ret = AT_FAIL; | |
364 T_ACI_COPS_MOD mode = COPS_MOD_NotPresent; | |
365 T_ACI_COPS_FRMT format = COPS_FRMT_NotPresent; | |
366 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id); | |
367 | |
368 if (CFUNfun NEQ CFUN_FUN_Full) | |
369 { | |
370 TRACE_EVENT_P1("%COPS error: cannot proceed Mobile has no Full CFUN: %d", CFUNfun); | |
371 cmdCmeError(CME_ERR_OpNotAllow); | |
372 return ATI_FAIL; | |
373 } | |
374 cl = parse (cl,"dds",&mode,&format,(LONG)(MAX_ALPHA_OPER_LEN-1),op); /*split parameter string in int,int,str*/ | |
375 if (!cl) /*For %COPS, Manual selection without Operator parameter is allowed */ | |
376 { | |
377 cmdCmeError(CME_ERR_OpNotAllow); | |
378 return ATI_FAIL; | |
379 } | |
380 | |
381 #ifdef FF_ATI_BAT | |
382 { | |
383 T_BAT_cmd_send cmd; | |
384 T_BAT_cmd_set_percent_cops my_bat_set_percent_cops; | |
385 UBYTE OperLength = strlen(op); | |
386 | |
387 TRACE_FUNCTION("setatPercentCOPS() calls bat_send() <=== as APPLICATION"); | |
388 | |
389 memset(&my_bat_set_percent_cops, sizeof(my_bat_set_percent_cops), FALSE); | |
390 cmd.ctrl_params = BAT_CMD_SET_PERCENT_COPS; | |
391 cmd.params.ptr_set_percent_cops = &my_bat_set_percent_cops; | |
392 | |
393 my_bat_set_percent_cops.mode = (T_BAT_VAL_percent_cops_mode)mode; | |
394 my_bat_set_percent_cops.format = (T_BAT_VAL_percent_cops_format)format; | |
395 | |
396 if (OperLength NEQ 0 AND | |
397 OperLength <= BAT_MAX_COPS_LONG_OPER_LEN) | |
398 { | |
399 memcpy(&my_bat_set_percent_cops.oper, op, BAT_MAX_COPS_LONG_OPER_LEN); | |
400 } | |
401 | |
402 src_params->curAtCmd = AT_CMD_P_COPS; | |
403 | |
404 bat_send(ati_bat_get_client(srcId), &cmd); | |
405 return ATI_EXCT; /* executing, because response is passed by callback function */ | |
406 } | |
407 | |
408 #else /* no FF_ATI_BAT */ | |
409 | |
410 TRACE_FUNCTION("setatPercentCOPS()"); | |
411 ret = sAT_PercentCOPS ((T_ACI_CMD_SRC)srcId,mode,format,op); | |
412 switch (ret) | |
413 { | |
414 case (AT_CMPL): /*operation completed*/ | |
415 break; | |
416 case (AT_EXCT): | |
417 src_params->curAtCmd = AT_CMD_P_COPS; | |
418 break; | |
419 default: | |
420 cmdCmeError(CME_ERR_Unknown); /*Command failed*/ | |
421 break; | |
422 } | |
423 return (map_aci_2_ati_rslt(ret)); | |
424 | |
425 #endif /* no FF_ATI_BAT */ | |
426 } | |
427 | |
428 | |
429 /* | |
430 +--------------------------------------------------------------------+ | |
431 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
432 | STATE : code ROUTINE : tesatPercentCOPS | | |
433 +--------------------------------------------------------------------+ | |
434 | |
435 PURPOSE : %COPS command (operator test) | |
436 */ | |
437 | |
438 | |
439 GLOBAL T_ATI_RSLT tesatPercentCOPS (char *cl, UBYTE srcId) | |
440 { | |
441 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id); | |
442 | |
443 #ifdef FF_ATI_BAT | |
444 TRACE_FUNCTION("tesatPercentCOPS() calls bat_send() <=== as APPLICATION"); | |
445 return atiHandleTestCOPS(srcId); | |
446 | |
447 #else /* FF_ATI_BAT */ | |
448 TRACE_FUNCTION("tesatPercentCOPS()"); | |
449 return atiHandleTestCOPS(cl,srcId); | |
450 #endif /* FF_ATI_BAT */ | |
451 } | |
452 | |
453 /* | |
454 +--------------------------------------------------------------------+ | |
455 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
456 | STATE : code ROUTINE : queatPercentCOPS | | |
457 +--------------------------------------------------------------------+ | |
458 | |
459 PURPOSE : %COPS command (operator query) | |
460 */ | |
461 | |
462 | |
463 GLOBAL T_ATI_RSLT queatPercentCOPS (char *cl, UBYTE srcId) | |
464 { | |
465 CHAR op[MAX_ALPHA_OPER_LEN] = {0}; | |
466 T_ACI_RETURN ret = AT_FAIL; | |
467 T_ACI_COPS_MOD mode = COPS_MOD_NotPresent; | |
468 T_ACI_COPS_FRMT format = COPS_FRMT_NotPresent; | |
469 T_ACI_COPS_SVST svrStatus = COPS_SVST_NotPresent; | |
470 | |
471 #ifdef FF_ATI_BAT | |
472 { | |
473 T_BAT_cmd_send cmd; | |
474 T_BAT_no_parameter dummy; | |
475 | |
476 TRACE_FUNCTION("queatPercentCOPS() calls bat_send() <=== as APPLICATION"); | |
477 cmd.ctrl_params = BAT_CMD_QUE_PERCENT_COPS; | |
478 dummy.bat_dummy = 0xFF; | |
479 cmd.params.ptr_que_percent_cops = &dummy; | |
480 bat_send(ati_bat_get_client(srcId), &cmd); | |
481 return ATI_EXCT; /* executing, because response is passed by callback function */ | |
482 } | |
483 #else /* no FF_ATI_BAT */ | |
484 | |
485 TRACE_FUNCTION("queatPercentCOPS()"); | |
486 | |
487 ret = qAT_PercentCOPS((T_ACI_CMD_SRC)srcId,&mode,&format,&svrStatus,op); | |
488 if (ret EQ AT_CMPL) | |
489 { | |
490 /* Added an empty comma and the service Status parameter */ | |
491 sprintf(g_sa,"%s: %d,%d,\"%s\",,%d","%COPS",mode,format,op,svrStatus); | |
492 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT); | |
493 | |
494 } | |
495 else | |
496 { | |
497 cmdCmeError(CME_ERR_Unknown); /*command failed*/ | |
498 } | |
499 return (map_aci_2_ati_rslt(ret)); | |
500 | |
501 #endif /* no FF_ATI_BAT */ | |
502 } | |
503 | |
504 | |
505 | |
506 /* | |
507 +--------------------------------------------------------------------+ | |
508 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
509 | STATE : code ROUTINE : setatPercentCREG | | |
510 +--------------------------------------------------------------------+ | |
511 | |
512 PURPOSE : %CREG command (Network registration) | |
513 */ | |
514 | |
515 GLOBAL T_ATI_RSLT setatPercentCREG (char *cl, UBYTE srcId) | |
516 { | |
517 T_ATI_CREG_MOD mode=CREG_MOD_OFF; | |
518 | |
519 TRACE_FUNCTION("setatPercentCREG()"); | |
520 | |
521 cl=parse(cl,"d",&mode); | |
522 | |
523 switch(mode) | |
524 { | |
525 case CREG_MOD_OFF: | |
526 case CREG_MOD_ON: | |
527 case CREG_MOD_LOC_INF_ON: | |
528 /* user wants to set mode: reset CREG related ATI parameters */ | |
529 ati_creg_init(srcId, PercentCREG_CMD); | |
530 ati_user_output_cfg[srcId].percent_creg.mod_lac_cid.pres_mode = mode; | |
531 return ATI_CMPL; | |
532 | |
533 default: | |
534 cmdCmeError(CME_ERR_OpNotAllow); | |
535 return ATI_FAIL; | |
536 } | |
537 } | |
538 | |
539 | |
540 /* | |
541 +--------------------------------------------------------------------+ | |
542 | PROJECT : GPRS (8441) MODULE : GACI_CMD | | |
543 | STATE : code ROUTINE : queatPercentCREG | | |
544 +--------------------------------------------------------------------+ | |
545 | |
546 PURPOSE : %CREG command | |
547 */ | |
548 GLOBAL T_ATI_RSLT queatPercentCREG (char *cl, UBYTE srcId) | |
549 { | |
550 | |
551 #ifndef FF_ATI_BAT | |
552 T_ACI_CREG_STAT stat; | |
553 USHORT lac, cid; | |
554 T_ATI_CREG_MOD mode; | |
555 T_ACI_P_CREG_GPRS_IND gprs_ind; | |
556 short pos; | |
557 U8 rt; | |
558 #endif | |
559 | |
560 TRACE_FUNCTION("queatPercentCREG()"); | |
561 | |
562 #ifdef FF_ATI_BAT | |
563 { | |
564 T_BAT_cmd_send cmd; | |
565 T_BAT_no_parameter dummy; | |
566 | |
567 cmd.ctrl_params = BAT_CMD_QUE_PERCENT_CREG; | |
568 dummy.bat_dummy = 0xFF; | |
569 cmd.params.ptr_que_percent_creg = &dummy; | |
570 bat_send(ati_bat_get_client(srcId), &cmd); | |
571 return(ATI_EXCT); | |
572 } | |
573 #else /* no FF_ATI_BAT */ | |
574 | |
575 mode = ati_user_output_cfg[srcId].percent_creg.mod_lac_cid.pres_mode; | |
576 | |
577 if (qAT_PercentCREG((T_ACI_CMD_SRC)srcId, &stat, &lac, &cid, &gprs_ind, &rt) NEQ AT_CMPL) | |
578 { | |
579 cmdCmeError(CME_ERR_Unknown); | |
580 return ATI_FAIL; | |
581 } | |
582 | |
583 pos = sprintf(g_sa, "%s: %d,%d", "%CREG", mode, stat); | |
584 | |
585 if ( (mode EQ CREG_MOD_LOC_INF_ON) AND | |
586 (stat EQ CREG_STAT_Reg OR stat EQ CREG_STAT_Roam) ) | |
587 pos += sprintf(g_sa+pos, ",\"%04X\",\"%04X\"", lac, cid); | |
588 else | |
589 pos += sprintf(g_sa+pos, ",,"); | |
590 | |
591 sprintf(g_sa+pos,",%d", gprs_ind); | |
592 | |
593 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT); | |
594 return ATI_CMPL; | |
595 | |
596 #endif /* no FF_ATI_BAT */ | |
597 } | |
598 | |
599 /* | |
600 +--------------------------------------------------------------------+ | |
601 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
602 | STATE : code ROUTINE : setatPlusCREG | | |
603 +--------------------------------------------------------------------+ | |
604 | |
605 PURPOSE : +CREG command (Network registration) | |
606 */ | |
607 | |
608 GLOBAL T_ATI_RSLT setatPlusCREG (char *cl, UBYTE srcId) | |
609 { | |
610 T_ATI_CREG_MOD mode=CREG_MOD_OFF; | |
611 | |
612 TRACE_FUNCTION("setatPlusCREG()"); | |
613 | |
614 cl=parse(cl,"d",&mode); | |
615 | |
616 switch(mode) | |
617 { | |
618 case CREG_MOD_OFF: | |
619 case CREG_MOD_ON: | |
620 case CREG_MOD_LOC_INF_ON: | |
621 /* user wants to set mode: reset CREG related ATI parameters */ | |
622 ati_creg_init(srcId, CREG_CMD); | |
623 ati_user_output_cfg[srcId].creg.mod_lac_cid.pres_mode = mode; | |
624 return ATI_CMPL; | |
625 | |
626 default: | |
627 cmdCmeError(CME_ERR_OpNotAllow); | |
628 return ATI_FAIL; | |
629 } | |
630 } | |
631 | |
632 GLOBAL T_ATI_RSLT queatPlusCREG (char *cl, UBYTE srcId) | |
633 { | |
634 T_ACI_CREG_STAT stat; | |
635 USHORT lac, cid; | |
636 T_ATI_CREG_MOD mode; | |
637 short pos; | |
638 | |
639 TRACE_FUNCTION("queatPlusCREG()"); | |
640 | |
641 mode = ati_user_output_cfg[srcId].creg.mod_lac_cid.pres_mode; | |
642 | |
643 if (qAT_PlusCREG((T_ACI_CMD_SRC)srcId, &stat, &lac, &cid) NEQ AT_CMPL) | |
644 { | |
645 cmdCmeError(CME_ERR_Unknown); | |
646 return ATI_FAIL; | |
647 } | |
648 | |
649 pos = sprintf(g_sa, "+CREG: %d,%d", mode, stat); | |
650 | |
651 if (mode EQ CREG_MOD_LOC_INF_ON) | |
652 { | |
653 if (stat EQ CREG_STAT_Reg OR stat EQ CREG_STAT_Roam) | |
654 sprintf(g_sa+pos, ",\"%04X\",\"%04X\"", lac, cid); | |
655 } | |
656 | |
657 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT); | |
658 return ATI_CMPL; | |
659 } | |
660 | |
661 | |
662 | |
663 | |
664 /* | |
665 +--------------------------------------------------------------------+ | |
666 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
667 | STATE : code ROUTINE : atPlusCopn | | |
668 +--------------------------------------------------------------------+ | |
669 | |
670 PURPOSE : +COPN command (read operator names) | |
671 */ | |
672 | |
673 GLOBAL T_ATI_RSLT setatPlusCOPN (char *cl, UBYTE srcId) | |
674 { | |
675 SHORT startIdx, lastIdx; | |
676 T_ACI_COPN_LST operLst; | |
677 UBYTE idx; | |
678 BOOL loop; | |
679 BOOL ret; | |
680 | |
681 TRACE_FUNCTION("setatPlusCOPN()"); | |
682 | |
683 /* read out the PCM list */ | |
684 startIdx = 0; | |
685 loop = TRUE; | |
686 | |
687 do | |
688 { | |
689 if ( qAT_PlusCOPN((T_ACI_CMD_SRC)srcId, COPN_LID_Pcm, startIdx, | |
690 &lastIdx, operLst) EQ AT_FAIL ) | |
691 break; | |
692 | |
693 for( idx=0; idx < MAX_OPER; idx++ ) | |
694 { | |
695 if ( operLst[idx].numOper[0] EQ 0x0 ) | |
696 { | |
697 loop = FALSE; | |
698 break; | |
699 } | |
700 | |
701 sprintf(g_sa,"+COPN: \"%s\",\"%s\"",operLst[idx].numOper, | |
702 operLst[idx].alphaOper ); | |
703 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT); | |
704 } | |
705 startIdx = lastIdx+1; | |
706 } | |
707 while( loop ); | |
708 | |
709 /* read out the constant list */ | |
710 startIdx = 0; | |
711 | |
712 ret = cmd_readCOPNBlock(startIdx,srcId); | |
713 | |
714 if (ret EQ TRUE) | |
715 return ATI_CMPL; | |
716 else | |
717 return ATI_EXCT; | |
718 | |
719 } | |
720 | |
721 /* | |
722 +--------------------------------------------------------------------+ | |
723 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
724 | STATE : code ROUTINE : setatPercentCOPN | | |
725 +--------------------------------------------------------------------+ | |
726 | |
727 PURPOSE : %COPN command (get MCC and MNC, long name or short name given one of the them) | |
728 */ | |
729 | |
730 GLOBAL T_ATI_RSLT setatPercentCOPN (char *cl, UBYTE srcId) | |
731 { | |
732 T_ACI_COPS_FRMT format = COPS_FRMT_NotPresent; | |
733 CHAR op[MAX_ALPHA_OPER_LEN] = {0}; | |
734 T_ACI_OPER_NTRY * oper_ntry; | |
735 USHORT i; | |
736 | |
737 TRACE_FUNCTION ("setatPercentCOPN()"); | |
738 | |
739 cl = parse (cl,"ds", &format, (LONG)MAX_ALPHA_OPER_LEN, op); | |
740 | |
741 if ((!cl) OR (format < COPS_FRMT_Long) OR (format > COPS_FRMT_Numeric) OR *op EQ '\0') | |
742 { | |
743 cmdCmeError(CME_ERR_OpNotAllow); | |
744 return ATI_FAIL; | |
745 } | |
746 | |
747 if (format EQ COPS_FRMT_Numeric) | |
748 { | |
749 if ((strlen(op) NEQ (SIZE_MNC + SIZE_MCC -1)) AND | |
750 (strlen(op) NEQ (SIZE_MNC + SIZE_MCC))) | |
751 { | |
752 cmdCmeError(CME_ERR_OpNotAllow); | |
753 return ATI_FAIL; | |
754 } | |
755 | |
756 for (i = 0; *(op+i) NEQ '\0'; i ++) | |
757 { | |
758 if (!((*(op+i) >= '0')AND(*(op+i) <= '9'))) | |
759 { | |
760 cmdCmeError(CME_ERR_OpNotAllow); | |
761 return ATI_FAIL; | |
762 } | |
763 } | |
764 } | |
765 | |
766 ACI_MALLOC (oper_ntry, sizeof (T_ACI_OPER_NTRY)); | |
767 | |
768 if (qAT_PercentCOPN( (T_ACI_CMD_SRC)srcId, format, op, oper_ntry) EQ AT_FAIL) | |
769 { | |
770 sprintf (g_sa, "%s", "%COPN: "); | |
771 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT); | |
772 ACI_MFREE (oper_ntry); | |
773 return ATI_CMPL; | |
774 } | |
775 | |
776 if ((oper_ntry->mnc & 0x00F) EQ 0xF) | |
777 { | |
778 sprintf (g_sa, "%s\"%s\",\"%s\",\"%03X%02X\",%d", "%COPN: ", oper_ntry->longName, oper_ntry->shrtName, | |
779 oper_ntry->mcc, oper_ntry->mnc >> 4, oper_ntry->source); | |
780 } | |
781 else | |
782 { | |
783 sprintf (g_sa, "%s\"%s\",\"%s\",\"%03X%03X\",%d", "%COPN: ", oper_ntry->longName, oper_ntry->shrtName, | |
784 oper_ntry->mcc, oper_ntry->mnc, oper_ntry->source); | |
785 } | |
786 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT); | |
787 | |
788 ACI_MFREE (oper_ntry); | |
789 return ATI_CMPL; | |
790 | |
791 | |
792 } | |
793 | |
794 #ifdef TI_PS_FF_AT_CMD_WS46 | |
795 /* | |
796 +--------------------------------------------------------------------+ | |
797 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
798 | STATE : code ROUTINE : atPlusWS46 | | |
799 +--------------------------------------------------------------------+ | |
800 | |
801 PURPOSE : +WS46 command (select wireless network) | |
802 */ | |
803 | |
804 GLOBAL T_ATI_RSLT setatPlusWS46 (char *cl, UBYTE srcId) | |
805 { | |
806 T_ACI_RETURN ret = AT_FAIL; | |
807 T_ACI_WS46_MOD mode=WS46_MOD_NotPresent; | |
808 | |
809 TRACE_FUNCTION("setatPLusWS46()"); | |
810 | |
811 cl = parse(cl,"d",&mode); | |
812 if (!cl) | |
813 { | |
814 cmdCmeError(CME_ERR_OpNotAllow); | |
815 return ATI_FAIL; | |
816 } | |
817 | |
818 #ifdef FF_ATI_BAT | |
819 | |
820 { | |
821 T_BAT_cmd_send cmd; | |
822 T_BAT_cmd_set_plus_ws46 ws46; | |
823 | |
824 cmd.ctrl_params = BAT_CMD_SET_PLUS_WS46; | |
825 cmd.params.ptr_set_plus_ws46=&ws46; | |
826 | |
827 ws46.n=(T_BAT_plus_ws46_n)mode; | |
828 | |
829 bat_send(ati_bat_get_client(srcId), &cmd); | |
830 return(ATI_EXCT); | |
831 } | |
832 | |
833 #else /* no FF_ATI_BAT */ | |
834 | |
835 ret=sAT_PlusWS46((T_ACI_CMD_SRC)srcId,mode); | |
836 | |
837 if (ret EQ AT_CMPL) | |
838 { | |
839 return ATI_CMPL; | |
840 } | |
841 else | |
842 { | |
843 cmdCmeError(CME_ERR_OpNotAllow); | |
844 return ATI_FAIL; | |
845 } | |
846 | |
847 #endif /* no FF_ATI_BAT */ | |
848 } | |
849 | |
850 GLOBAL T_ATI_RSLT queatPlusWS46 (char *cl, UBYTE srcId) | |
851 { | |
852 T_ACI_RETURN ret = AT_FAIL; | |
853 T_ACI_WS46_MOD mode=WS46_MOD_NotPresent; | |
854 | |
855 TRACE_FUNCTION("queatPLusWS46()"); | |
856 | |
857 #ifdef FF_ATI_BAT | |
858 { | |
859 T_BAT_cmd_send cmd; | |
860 T_BAT_no_parameter dummy; | |
861 | |
862 cmd.ctrl_params = BAT_CMD_QUE_PLUS_WS46; | |
863 dummy.bat_dummy = 0xFF; | |
864 cmd.params.ptr_que_plus_ws46 = &dummy; | |
865 bat_send(ati_bat_get_client(srcId), &cmd); | |
866 return(ATI_EXCT); | |
867 } | |
868 #else /* no FF_ATI_BAT */ | |
869 | |
870 ret = qAT_PlusWS46((T_ACI_CMD_SRC)srcId,&mode); | |
871 | |
872 if (ret EQ AT_CMPL) | |
873 { | |
874 resp_disp(srcId, cl,"e",&mode); | |
875 return ATI_CMPL; | |
876 } | |
877 else if (ret EQ AT_FAIL) | |
878 { | |
879 cmdCmeError(CME_ERR_OpNotAllow); | |
880 return ATI_FAIL; | |
881 } | |
882 return (map_aci_2_ati_rslt(ret)); | |
883 | |
884 #endif /* no FF_ATI_BAT */ | |
885 } | |
886 #endif /* TI_PS_FF_WS46 */ | |
887 /* | |
888 +--------------------------------------------------------------------+ | |
889 | PROJECT : GSM-F&D (8411) MODULE : | | |
890 | STATE : code ROUTINE : setatPercentCHPL | | |
891 +--------------------------------------------------------------------+ | |
892 | |
893 PURPOSE : show list of all available entries in the SIM field EF_HPLMNwAcT. | |
894 | |
895 Command Possible Response | |
896 %CHPL=oprFrmt %CHPL: <opr> | |
897 %CHPL=? %CHPL: (list of supported <oprFrmt>s) | |
898 | |
899 <oprFrmt>: | |
900 0 long format alphanumeric <opr> | |
901 1 short format alphanumeric <opr> | |
902 2 numeric <opr> | |
903 | |
904 <opr>: string type; <oprFrmt> indicates if the format is | |
905 alphanumeric or numeric. | |
906 Long alphanumeric can be up to 16 characters. | |
907 Short alphanumeric can be up to 8 characters. | |
908 Numeric format is the GSM LAI number, which consists of: | |
909 3 BCD country code. | |
910 2 BCD network code. | |
911 The returned <opr> string shall not be in BCD format, but | |
912 in IRA characters converted from BCD. Hence the number | |
913 will have the structure (CC digit 3)(CC digit 2)(CC digit 1) | |
914 (NW digit 2)(NW digit 1). | |
915 | |
916 */ | |
917 | |
918 GLOBAL T_ATI_RSLT setatPercentCHPL( char *cl, UBYTE srcId ) | |
919 { | |
920 T_ACI_CHPL_FRMT format = CHPL_FRMT_NotPresent; | |
921 | |
922 #ifndef FF_ATI_BAT | |
923 T_ACI_OPER_NTRY oper; | |
924 #endif | |
925 | |
926 T_ACI_RETURN ret = AT_FAIL; | |
927 | |
928 TRACE_FUNCTION( "setatPercentCHPL()" ); | |
929 | |
930 if (CFUNfun NEQ CFUN_FUN_Full) | |
931 { | |
932 TRACE_EVENT_P1("+COPS error: cannot proceed Mobile has no Full CFUN: %d", CFUNfun); | |
933 cmdCmeError(CME_ERR_OpNotAllow); | |
934 return ATI_FAIL; | |
935 } | |
936 | |
937 /* parse mode */ | |
938 cl = parse (cl, "d", &format); | |
939 if ((!cl) OR (format > CHPL_FRMT_Numeric) OR (format < CHPL_FRMT_NotPresent)) | |
940 { | |
941 cmdCmeError (CME_ERR_OpNotAllow); | |
942 return (ATI_FAIL); | |
943 } | |
944 | |
945 #ifdef FF_ATI_BAT | |
946 | |
947 { | |
948 T_BAT_cmd_send cmd; | |
949 T_BAT_cmd_set_percent_chpl chpl; | |
950 | |
951 cmd.ctrl_params = BAT_CMD_SET_PERCENT_CHPL; | |
952 cmd.params.ptr_set_percent_chpl=&chpl; | |
953 | |
954 /* | |
955 * This relies on T_ACI_CHPL_FRMT and T_BAT_percent_chpl_oprfrmt being | |
956 * identical. | |
957 */ | |
958 chpl.oprfrmt=(T_BAT_percent_chpl_oprfrmt)format; | |
959 | |
960 bat_send(ati_bat_get_client(srcId), &cmd); | |
961 return(ATI_EXCT); | |
962 } | |
963 | |
964 #else /* no FF_ATI_BAT */ | |
965 | |
966 ret = sAT_PercentCHPL ((T_ACI_CMD_SRC)srcId, &oper); | |
967 if (ret NEQ AT_CMPL) | |
968 { | |
969 cmdCmeError(CME_ERR_Unknown); | |
970 return (ATI_FAIL); | |
971 } | |
972 | |
973 switch (format) | |
974 { | |
975 case CHPL_FRMT_Long : | |
976 sprintf(g_sa, "%s: %s", "%CHPL", oper.longName); | |
977 break; | |
978 | |
979 case CHPL_FRMT_Short : | |
980 sprintf(g_sa, "%s: %s", "%CHPL", oper.shrtName); | |
981 break; | |
982 | |
983 case CHPL_FRMT_Numeric : | |
984 if ((oper.mnc & 0x00F) EQ 0xF) | |
985 /*lint -e{702} */ | |
986 sprintf(g_sa, "%s: %03x,%02x", "%CHPL", oper.mcc, oper.mnc >> 4); | |
987 else | |
988 sprintf(g_sa, "%s: %03x,%03x", "%CHPL", oper.mcc, oper.mnc); | |
989 break; | |
990 | |
991 default : | |
992 cmdCmeError(CME_ERR_Unknown); | |
993 return (ATI_FAIL); | |
994 } | |
995 io_sendMessage (srcId, g_sa, ATI_NORMAL_OUTPUT); | |
996 | |
997 return(ATI_CMPL); | |
998 | |
999 #endif /* no FF_ATI_BAT */ | |
1000 } | |
1001 | |
1002 /* | |
1003 +--------------------------------------------------------------------+ | |
1004 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
1005 | STATE : code ROUTINE : setatPlusCTZR | | |
1006 +--------------------------------------------------------------------+ | |
1007 | |
1008 PURPOSE : %CTZR command (Timezone Mode) | |
1009 */ | |
1010 GLOBAL T_ATI_RSLT setatPlusCTZR (char *cl, UBYTE srcId) | |
1011 { | |
1012 T_ACI_CTZR_MODE mode = CTZR_MODE_OFF; /* CTZR */ | |
1013 T_ACI_RETURN ret = AT_FAIL; | |
1014 | |
1015 TRACE_FUNCTION( "setatPlusCTZR()" ); | |
1016 | |
1017 /* parse mode */ | |
1018 cl = parse (cl, "d", &mode); | |
1019 if ((!cl) OR (mode > CTZR_MODE_ON) OR (mode < CTZR_MODE_OFF))/*lint !e685 (Warning -- 685: Relational operator '>' always evaluates to 'false ) */ | |
1020 { | |
1021 cmdCmeError (CME_ERR_OpNotAllow); | |
1022 return (ATI_FAIL); | |
1023 } | |
1024 | |
1025 ret = sAT_PlusCTZR ((T_ACI_CMD_SRC)srcId, mode); | |
1026 | |
1027 switch (ret) | |
1028 { | |
1029 case (AT_CMPL): /*operation completed*/ | |
1030 break; | |
1031 | |
1032 default: | |
1033 cmdCmeError(CME_ERR_Unknown); /*Command failed*/ | |
1034 break; | |
1035 } | |
1036 return (map_aci_2_ati_rslt(ret)); | |
1037 | |
1038 } | |
1039 | |
1040 /* | |
1041 +--------------------------------------------------------------------+ | |
1042 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
1043 | STATE : code ROUTINE : queatPlusCTZR | | |
1044 +--------------------------------------------------------------------+ | |
1045 | |
1046 PURPOSE : %CTZR command (Timezone Mode) | |
1047 */ | |
1048 GLOBAL T_ATI_RSLT queatPlusCTZR (char *cl, UBYTE srcId) | |
1049 { | |
1050 T_ACI_CTZR_MODE mode; | |
1051 T_ACI_RETURN ret = AT_FAIL; | |
1052 | |
1053 TRACE_FUNCTION("queatPlusCTZR()"); | |
1054 | |
1055 ret = qAT_PlusCTZR((T_ACI_CMD_SRC)srcId, &mode); | |
1056 if (ret NEQ AT_CMPL) | |
1057 { | |
1058 cmdCmeError(CME_ERR_Unknown); | |
1059 return (ATI_FAIL); | |
1060 } | |
1061 | |
1062 sprintf(g_sa,"+CTZR: %d", mode); | |
1063 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT); | |
1064 | |
1065 return ATI_CMPL; | |
1066 } | |
1067 | |
1068 /* | |
1069 +--------------------------------------------------------------------+ | |
1070 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
1071 | STATE : code ROUTINE : setatPlusCTZU | | |
1072 +--------------------------------------------------------------------+ | |
1073 | |
1074 PURPOSE : +CTZU command (Timezone Update) | |
1075 */ | |
1076 GLOBAL T_ATI_RSLT setatPlusCTZU (char *cl, UBYTE srcId) | |
1077 { | |
1078 T_ACI_CTZU_MODE mode = CTZU_MODE_OFF; /* CTZU */ | |
1079 T_ACI_RETURN ret = AT_FAIL; | |
1080 | |
1081 TRACE_FUNCTION( "setatPlusCTZU()" ); | |
1082 | |
1083 /* parse mode */ | |
1084 cl = parse (cl, "d", &mode); | |
1085 if ((!cl) OR (mode > CTZU_MODE_ON) OR (mode < CTZU_MODE_OFF))/*lint !e685 (Warning -- 685: Relational operator '>' always evaluates to 'false ) */ | |
1086 { | |
1087 cmdCmeError (CME_ERR_OpNotAllow); | |
1088 return (ATI_FAIL); | |
1089 } | |
1090 | |
1091 #ifdef FF_ATI_BAT | |
1092 | |
1093 { | |
1094 T_BAT_cmd_send cmd; | |
1095 T_BAT_cmd_set_plus_ctzu ctzu; | |
1096 | |
1097 cmd.ctrl_params = BAT_CMD_SET_PLUS_CTZU; | |
1098 cmd.params.ptr_set_plus_ctzu=&ctzu; | |
1099 | |
1100 /* | |
1101 * This relies on T_ACI_CTZU_MODE and T_BAT_plus_ctzu_onoff being | |
1102 * identical. | |
1103 */ | |
1104 ctzu.onoff=(T_BAT_plus_ctzu_onoff)mode; | |
1105 | |
1106 bat_send(ati_bat_get_client(srcId), &cmd); | |
1107 return(ATI_EXCT); | |
1108 } | |
1109 | |
1110 #else /* no FF_ATI_BAT */ | |
1111 | |
1112 ret = sAT_PlusCTZU ((T_ACI_CMD_SRC)srcId, mode); | |
1113 | |
1114 switch (ret) | |
1115 { | |
1116 case (AT_CMPL): /*operation completed*/ | |
1117 break; | |
1118 | |
1119 default: | |
1120 cmdCmeError(CME_ERR_Unknown); /*Command failed*/ | |
1121 break; | |
1122 } | |
1123 return (map_aci_2_ati_rslt(ret)); | |
1124 | |
1125 #endif /* no FF_ATI_BAT */ | |
1126 } | |
1127 | |
1128 | |
1129 /* | |
1130 +--------------------------------------------------------------------+ | |
1131 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
1132 | STATE : code ROUTINE : setatPercentCTZV | | |
1133 +--------------------------------------------------------------------+ | |
1134 | |
1135 PURPOSE : %CTZV command (time and date report) | |
1136 */ | |
1137 GLOBAL T_ATI_RSLT setatPercentCTZV (char *cl, UBYTE srcId) | |
1138 { | |
1139 T_ACI_PCTZV_MODE mode = PCTZV_MODE_OFF; /* %CTZV */ | |
1140 T_ACI_RETURN ret = AT_FAIL; | |
1141 | |
1142 TRACE_FUNCTION( "setatPercentCTZV()" ); | |
1143 | |
1144 /* parse mode */ | |
1145 cl = parse (cl, "d", &mode); | |
1146 if ((!cl) OR (mode > PCTZV_MODE_ON) OR (mode < PCTZV_MODE_OFF))/*lint !e685 (Warning -- 685: Relational operator '>' always evaluates to 'false ) */ | |
1147 { | |
1148 cmdCmeError (CME_ERR_OpNotAllow); | |
1149 return (ATI_FAIL); | |
1150 } | |
1151 | |
1152 ret = sAT_PercentCTZV ((T_ACI_CMD_SRC)srcId, mode); | |
1153 | |
1154 switch (ret) | |
1155 { | |
1156 case (AT_CMPL): /*operation completed*/ | |
1157 break; | |
1158 | |
1159 default: | |
1160 cmdCmeError(CME_ERR_Unknown); /*Command failed*/ | |
1161 break; | |
1162 } | |
1163 return (map_aci_2_ati_rslt(ret)); | |
1164 | |
1165 } | |
1166 | |
1167 | |
1168 | |
1169 /* | |
1170 +--------------------------------------------------------------------+ | |
1171 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
1172 | STATE : code ROUTINE : setatPercentCNIV | | |
1173 +--------------------------------------------------------------------+ | |
1174 | |
1175 PURPOSE : %CNIV command (network identity report) | |
1176 */ | |
1177 GLOBAL T_ATI_RSLT setatPercentCNIV (char *cl, UBYTE srcId) | |
1178 { | |
1179 T_ACI_CNIV_MODE mode = CNIV_MODE_OFF; /* CNIV */ | |
1180 T_ACI_RETURN ret = AT_FAIL; | |
1181 | |
1182 TRACE_FUNCTION( "setatPercentCNIV()" ); | |
1183 | |
1184 /* parse mode */ | |
1185 cl = parse (cl, "d", &mode); | |
1186 if ((!cl) OR (mode > CNIV_MODE_ON) OR (mode < CNIV_MODE_OFF))/*lint !e685 (Warning -- 685: Relational operator '>' always evaluates to 'false ) */ | |
1187 { | |
1188 cmdCmeError (CME_ERR_OpNotAllow); | |
1189 return (ATI_FAIL); | |
1190 } | |
1191 | |
1192 #ifdef FF_ATI_BAT | |
1193 { | |
1194 T_BAT_cmd_send cmd; | |
1195 T_BAT_cmd_set_percent_cniv my_bat_set_percent_cniv; | |
1196 | |
1197 memset(&my_bat_set_percent_cniv, 0 , sizeof(my_bat_set_percent_cniv)); | |
1198 cmd.ctrl_params = BAT_CMD_SET_PERCENT_CNIV; | |
1199 cmd.params.ptr_set_percent_cniv = &my_bat_set_percent_cniv; | |
1200 | |
1201 my_bat_set_percent_cniv.mode= (T_BAT_VAL_percent_cniv_mode)mode; | |
1202 | |
1203 bat_send(ati_bat_get_client(srcId), &cmd); | |
1204 return ATI_EXCT; /* executing, because response is passed by callback function */ | |
1205 } | |
1206 #else | |
1207 { | |
1208 ret = sAT_PercentCNIV ((T_ACI_CMD_SRC)srcId, mode); | |
1209 | |
1210 switch (ret) | |
1211 { | |
1212 case (AT_CMPL): /*operation completed*/ | |
1213 break; | |
1214 | |
1215 default: | |
1216 cmdCmeError(CME_ERR_Unknown); /*Command failed*/ | |
1217 break; | |
1218 } | |
1219 return (map_aci_2_ati_rslt(ret)); | |
1220 } | |
1221 #endif /* FF_ATI_BAT */ | |
1222 } | |
1223 | |
1224 /* | |
1225 +--------------------------------------------------------------------+ | |
1226 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
1227 | STATE : code ROUTINE : queatPlusCTZU | | |
1228 +--------------------------------------------------------------------+ | |
1229 | |
1230 PURPOSE : +CTZU query command (Timezone update) | |
1231 */ | |
1232 GLOBAL T_ATI_RSLT queatPlusCTZU (char *cl, UBYTE srcId) | |
1233 { | |
1234 #ifndef FF_ATI_BAT | |
1235 T_ACI_CTZU_MODE mode; | |
1236 T_ACI_RETURN ret = AT_FAIL; | |
1237 #endif | |
1238 | |
1239 TRACE_FUNCTION("queatPlusCTZU()"); | |
1240 | |
1241 #ifdef FF_ATI_BAT | |
1242 { | |
1243 T_BAT_cmd_send cmd; | |
1244 T_BAT_no_parameter dummy; | |
1245 | |
1246 cmd.ctrl_params = BAT_CMD_QUE_PLUS_CTZU; | |
1247 dummy.bat_dummy = 0xFF; | |
1248 cmd.params.ptr_que_plus_ctzu = &dummy; | |
1249 bat_send(ati_bat_get_client(srcId), &cmd); | |
1250 return(ATI_EXCT); | |
1251 } | |
1252 #else /* no FF_ATI_BAT */ | |
1253 | |
1254 ret = qAT_PlusCTZU((T_ACI_CMD_SRC)srcId, &mode); | |
1255 if (ret NEQ AT_CMPL) | |
1256 { | |
1257 cmdCmeError(CME_ERR_Unknown); | |
1258 return (ATI_FAIL); | |
1259 } | |
1260 | |
1261 sprintf(g_sa,"+CTZU: %d", mode); | |
1262 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT); | |
1263 | |
1264 return ATI_CMPL; | |
1265 | |
1266 #endif /* no FF_ATI_BAT */ | |
1267 } | |
1268 | |
1269 | |
1270 | |
1271 /* | |
1272 +--------------------------------------------------------------------+ | |
1273 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
1274 | STATE : code ROUTINE : queatPercentCTZV | | |
1275 +--------------------------------------------------------------------+ | |
1276 | |
1277 PURPOSE : %CTZV command (time and date report) | |
1278 */ | |
1279 GLOBAL T_ATI_RSLT queatPercentCTZV (char *cl, UBYTE srcId) | |
1280 { | |
1281 T_ACI_PCTZV_MODE mode; | |
1282 T_ACI_RETURN ret = AT_FAIL; | |
1283 | |
1284 TRACE_FUNCTION("queatPercentCTZV()"); | |
1285 | |
1286 ret = qAT_PercentCTZV((T_ACI_CMD_SRC)srcId, &mode); | |
1287 if (ret NEQ AT_CMPL) | |
1288 { | |
1289 cmdCmeError(CME_ERR_Unknown); | |
1290 return (ATI_FAIL); | |
1291 } | |
1292 | |
1293 sprintf(g_sa,"%s: %d","%CTZV", mode); | |
1294 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT); | |
1295 | |
1296 return ATI_CMPL; | |
1297 } | |
1298 | |
1299 | |
1300 /* | |
1301 +--------------------------------------------------------------------+ | |
1302 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
1303 | STATE : code ROUTINE : queatPercentCNIV | | |
1304 +--------------------------------------------------------------------+ | |
1305 | |
1306 PURPOSE : %CNIV command (time and date report) | |
1307 */ | |
1308 GLOBAL T_ATI_RSLT queatPercentCNIV (char *cl, UBYTE srcId) | |
1309 { | |
1310 | |
1311 TRACE_FUNCTION("queatPercentCNIV()"); | |
1312 | |
1313 #ifdef FF_ATI_BAT | |
1314 { | |
1315 T_BAT_cmd_send cmd; | |
1316 T_BAT_no_parameter dummy; | |
1317 | |
1318 cmd.ctrl_params = BAT_CMD_QUE_PERCENT_CNIV; | |
1319 dummy.bat_dummy = 0xFF; | |
1320 cmd.params.ptr_que_percent_cniv= &dummy; | |
1321 | |
1322 bat_send(ati_bat_get_client(srcId), &cmd); | |
1323 | |
1324 return(ATI_EXCT); | |
1325 } | |
1326 #else | |
1327 { | |
1328 T_ACI_CNIV_MODE mode; | |
1329 T_ACI_RETURN ret = AT_FAIL; | |
1330 | |
1331 ret = qAT_PercentCNIV((T_ACI_CMD_SRC)srcId, &mode); | |
1332 if (ret NEQ AT_CMPL) | |
1333 { | |
1334 cmdCmeError(CME_ERR_Unknown); | |
1335 return (ATI_FAIL); | |
1336 } | |
1337 sprintf(g_sa,"%s: %d","%CNIV", mode); | |
1338 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT); | |
1339 | |
1340 return ATI_CMPL; | |
1341 } | |
1342 #endif /*FF_ATI_BAT*/ | |
1343 } | |
1344 | |
1345 /* | |
1346 +--------------------------------------------------------------------+ | |
1347 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
1348 | STATE : code ROUTINE : setatPercentTREG | | |
1349 +--------------------------------------------------------------------+ | |
1350 | |
1351 PURPOSE : %CWUP command (force power campaign) | |
1352 */ | |
1353 | |
1354 GLOBAL T_ATI_RSLT setatPercentCWUP (char *cl, UBYTE srcId) | |
1355 { | |
1356 T_ACI_RETURN ret = AT_FAIL; | |
1357 T_ACI_CWUP_TYPE type; | |
1358 | |
1359 TRACE_FUNCTION( "setatPercentCWUP()" ); | |
1360 | |
1361 /* parse mode */ | |
1362 cl = parse (cl, "d", &type); | |
1363 if ((!cl) OR (type NEQ CWUP_TYPE_RR)) | |
1364 { | |
1365 cmdCmeError (CME_ERR_OpNotAllow); | |
1366 return (ATI_FAIL); | |
1367 } | |
1368 | |
1369 #ifdef FF_ATI_BAT | |
1370 | |
1371 { | |
1372 T_BAT_cmd_send cmd; | |
1373 T_BAT_cmd_set_percent_cwup cwup; | |
1374 | |
1375 cmd.ctrl_params = BAT_CMD_SET_PERCENT_CWUP; | |
1376 cmd.params.ptr_set_percent_cwup=&cwup; | |
1377 | |
1378 /* | |
1379 * This relies on T_ACI_CWUP_TYPE and T_BAT_percent_cwup_type being | |
1380 * identical. | |
1381 */ | |
1382 cwup.type=(T_BAT_percent_cwup_type)type; | |
1383 | |
1384 bat_send(ati_bat_get_client(srcId), &cmd); | |
1385 return(ATI_EXCT); | |
1386 } | |
1387 | |
1388 #else /* no FF_ATI_BAT */ | |
1389 | |
1390 ret = sAT_PercentCWUP ((T_ACI_CMD_SRC)srcId, type); | |
1391 | |
1392 switch (ret) | |
1393 { | |
1394 case (AT_CMPL): /*operation completed*/ | |
1395 break; | |
1396 | |
1397 default: | |
1398 cmdCmeError(CME_ERR_Unknown); /*Command failed*/ | |
1399 break; | |
1400 } | |
1401 return (map_aci_2_ati_rslt(ret)); | |
1402 | |
1403 #endif /* no FF_ATI_BAT */ | |
1404 } | |
1405 | |
1406 /* | |
1407 +--------------------------------------------------------------------+ | |
1408 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
1409 | STATE : code ROUTINE : atPlusCIND | | |
1410 +--------------------------------------------------------------------+ | |
1411 | |
1412 PURPOSE : +CIND command | |
1413 (configures the signal strength and SMS full indication) | |
1414 */ | |
1415 GLOBAL T_ATI_RSLT setatPlusCIND (char *cl, UBYTE srcId) | |
1416 { | |
1417 T_ACI_RETURN tRet = AT_FAIL; | |
1418 T_ACI_MM_CIND_VAL_TYPE sCindSettings; | |
1419 | |
1420 TRACE_FUNCTION("setatPLusCIND()"); | |
1421 | |
1422 if (!cl) | |
1423 { | |
1424 cmdCmeError(CME_ERR_OpNotAllow); | |
1425 return ATI_FAIL; | |
1426 } | |
1427 | |
1428 sCindSettings.sCindSignalParam = CIND_SIGNAL_INDICATOR_LVL0; | |
1429 sCindSettings.sCindSmsFullParam = CIND_SMSFULL_INDICATOR_MEMAVAIL; | |
1430 | |
1431 cl = parse(cl,"dd", &sCindSettings.sCindSignalParam, | |
1432 &sCindSettings.sCindSmsFullParam); | |
1433 | |
1434 if ((sCindSettings.sCindSignalParam < CIND_SIGNAL_INDICATOR_LVL0 OR | |
1435 sCindSettings.sCindSignalParam > CIND_SIGNAL_INDICATOR_LVL5) OR | |
1436 (sCindSettings.sCindSmsFullParam < CIND_SMSFULL_INDICATOR_MEMAVAIL OR | |
1437 sCindSettings.sCindSmsFullParam > CIND_SMSFULL_INDICATOR_MEMFULL)) | |
1438 { | |
1439 cmdCmeError(CME_ERR_OpNotAllow); | |
1440 return ATI_FAIL; | |
1441 } | |
1442 | |
1443 #ifdef FF_ATI_BAT | |
1444 { | |
1445 T_BAT_cmd_send cmd; | |
1446 T_BAT_cmd_set_plus_cind cind; | |
1447 | |
1448 /* | |
1449 * Without this we will lose track of the source ID by the time the | |
1450 * response arrives. | |
1451 */ | |
1452 srcId_cb=srcId; | |
1453 | |
1454 cmd.ctrl_params = BAT_CMD_SET_PLUS_CIND; | |
1455 cmd.params.ptr_set_plus_cind=&cind; | |
1456 | |
1457 /* | |
1458 * This relies on T_ACI_CIND_SIGNAL_TYPE being identical to | |
1459 * T_BAT_plus_cind_signal_ctrl and T_ACI_CIND_SMSFULL_TYPE being | |
1460 * identical to T_BAT_plus_cind_smsfull_ctrl. | |
1461 */ | |
1462 cind.signal_ctrl=(T_BAT_plus_cind_signal_ctrl)sCindSettings.sCindSignalParam; | |
1463 cind.smsfull_ctrl=(T_BAT_plus_cind_smsfull_ctrl)sCindSettings.sCindSmsFullParam; | |
1464 | |
1465 bat_send(ati_bat_get_client(srcId), &cmd); | |
1466 return(ATI_EXCT); | |
1467 } | |
1468 #else /* no FF_ATI_BAT */ | |
1469 | |
1470 tRet = sAT_PlusCIND( (T_ACI_CMD_SRC)srcId, sCindSettings.sCindSignalParam, | |
1471 sCindSettings.sCindSmsFullParam ); | |
1472 | |
1473 if (tRet EQ AT_FAIL) | |
1474 { | |
1475 cmdCmeError(CME_ERR_OpNotAllow); | |
1476 return ATI_FAIL; | |
1477 } | |
1478 return ATI_CMPL; | |
1479 | |
1480 #endif /* no FF_ATI_BAT */ | |
1481 } | |
1482 | |
1483 /* | |
1484 +--------------------------------------------------------------------+ | |
1485 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
1486 | STATE : code ROUTINE : queatPlusCIND | | |
1487 +--------------------------------------------------------------------+ | |
1488 | |
1489 PURPOSE : +CIND query command | |
1490 (query the configured unsolicited signal strength | |
1491 and SMS full indication settings) | |
1492 */ | |
1493 GLOBAL T_ATI_RSLT queatPlusCIND ( char *cl, UBYTE srcId ) | |
1494 { | |
1495 #ifndef FF_ATI_BAT | |
1496 T_ACI_RETURN sRet = AT_FAIL; | |
1497 T_ACI_MM_CIND_VAL_TYPE sCindSettings; | |
1498 #endif | |
1499 | |
1500 TRACE_FUNCTION("queatPlusCIND()"); | |
1501 | |
1502 #ifdef FF_ATI_BAT | |
1503 { | |
1504 T_BAT_cmd_send cmd; | |
1505 T_BAT_no_parameter dummy; | |
1506 | |
1507 cmd.ctrl_params = BAT_CMD_QUE_PLUS_CIND; | |
1508 dummy.bat_dummy = 0xFF; | |
1509 cmd.params.ptr_que_plus_cind = &dummy; | |
1510 bat_send(ati_bat_get_client(srcId), &cmd); | |
1511 return(ATI_EXCT); | |
1512 } | |
1513 #else /* no FF_ATI_BAT */ | |
1514 | |
1515 sRet = qAT_PlusCIND( (T_ACI_CMD_SRC)srcId, &sCindSettings.sCindSignalParam, | |
1516 &sCindSettings.sCindSmsFullParam ); | |
1517 | |
1518 if ( sCindSettings.sCindSignalParam EQ CIND_SIGNAL_INDICATOR_INVALID ) { sCindSettings.sCindSignalParam = CIND_SIGNAL_INDICATOR_LVL0; } | |
1519 if ( sCindSettings.sCindSmsFullParam EQ CIND_SMSFULL_INDICATOR_INVALID ) { sCindSettings.sCindSmsFullParam = CIND_SMSFULL_INDICATOR_MEMAVAIL; } | |
1520 | |
1521 if (sRet EQ AT_CMPL) | |
1522 { | |
1523 resp_disp( srcId, cl,"ee", &sCindSettings.sCindSignalParam, | |
1524 &sCindSettings.sCindSmsFullParam ); | |
1525 return ATI_CMPL; | |
1526 } | |
1527 else | |
1528 { /* error case */ | |
1529 cmdCmeError(CME_ERR_OpNotAllow); | |
1530 return ATI_FAIL; | |
1531 } | |
1532 | |
1533 #endif /* no FF_ATI_BAT */ | |
1534 } | |
1535 | |
1536 /* | |
1537 +--------------------------------------------------------------------+ | |
1538 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
1539 | STATE : code ROUTINE : atPlusCMER | | |
1540 +--------------------------------------------------------------------+ | |
1541 | |
1542 PURPOSE : +CMER command | |
1543 (configures the kind of indication handling toward terminal) | |
1544 */ | |
1545 GLOBAL T_ATI_RSLT setatPlusCMER ( char *cl, UBYTE srcId ) | |
1546 { | |
1547 /* UINT uiBufferCounter; */ | |
1548 T_ACI_RETURN tRet = AT_FAIL; | |
1549 T_ACI_MM_CMER_VAL_TYPE sCmerSettings; | |
1550 T_ACI_MM_CMER_VAL_TYPE sOldCmerSettings; | |
1551 T_ACI_MM_CMER_VAL_TYPE sEnteredCmerSettings; | |
1552 UINT uiDummy1 = 0u; | |
1553 UINT uiDummy2 = 0u; | |
1554 | |
1555 TRACE_FUNCTION("setatPLusCMER()"); | |
1556 | |
1557 if (!cl) | |
1558 { | |
1559 cmdCmeError(CME_ERR_OpNotAllow); | |
1560 return ATI_FAIL; | |
1561 } | |
1562 | |
1563 sCmerSettings.sCmerModeParam = CMER_MODE_INVALID; | |
1564 sCmerSettings.sCmerIndParam = CMER_INDICATOR_INVALID; | |
1565 sCmerSettings.sCmerBfrParam = CMER_BFR_INVALID; | |
1566 | |
1567 cl = parse(cl,"ddddd", &sCmerSettings.sCmerModeParam, | |
1568 &uiDummy1, | |
1569 &uiDummy2, | |
1570 &sCmerSettings.sCmerIndParam, | |
1571 &sCmerSettings.sCmerBfrParam ); | |
1572 | |
1573 if ((sCmerSettings.sCmerModeParam < CMER_MODE_INVALID OR | |
1574 sCmerSettings.sCmerModeParam > CMER_MODE_2) OR | |
1575 (sCmerSettings.sCmerIndParam < CMER_INDICATOR_INVALID OR | |
1576 sCmerSettings.sCmerIndParam > CMER_INDICATOR_2) OR | |
1577 (sCmerSettings.sCmerBfrParam < CMER_BFR_INVALID OR | |
1578 sCmerSettings.sCmerBfrParam > CMER_BFR_1) OR | |
1579 (uiDummy1 NEQ 0u) OR ((uiDummy2 NEQ 0u))) | |
1580 { | |
1581 cmdCmeError(CME_ERR_OpNotAllow); | |
1582 return ATI_FAIL; | |
1583 } | |
1584 | |
1585 cmhMM_GetCmerSettings( (T_ACI_CMD_SRC)srcId, &sOldCmerSettings ); | |
1586 | |
1587 sEnteredCmerSettings.sCmerModeParam = sCmerSettings.sCmerModeParam; | |
1588 | |
1589 #ifdef FF_ATI_BAT | |
1590 { | |
1591 T_BAT_cmd_send cmd; | |
1592 T_BAT_cmd_set_plus_cmer cmer; | |
1593 | |
1594 /* | |
1595 * Without this we will lose track of the source ID by the time the | |
1596 * response arrives. | |
1597 */ | |
1598 srcId_cb=srcId; | |
1599 | |
1600 cmd.ctrl_params = BAT_CMD_SET_PLUS_CMER; | |
1601 cmd.params.ptr_set_plus_cmer=&cmer; | |
1602 | |
1603 cmer.ind_option=BAT_CMER_IND_OPTION_NOT_PRESENT; | |
1604 | |
1605 bat_send(ati_bat_get_client(srcId), &cmd); | |
1606 return(ATI_EXCT); | |
1607 } | |
1608 #else /* no FF_ATI_BAT */ | |
1609 | |
1610 tRet = sAT_PlusCMER((T_ACI_CMD_SRC)srcId, sCmerSettings.sCmerModeParam, | |
1611 sCmerSettings.sCmerIndParam, | |
1612 sCmerSettings.sCmerBfrParam ); | |
1613 if (tRet EQ AT_FAIL) | |
1614 { | |
1615 cmdCmeError(CME_ERR_OpNotAllow); | |
1616 return ATI_FAIL; | |
1617 } | |
1618 | |
1619 if ( sCmerSettings.sCmerModeParam EQ CMER_MODE_INVALID ) { sCmerSettings.sCmerModeParam = sOldCmerSettings.sCmerModeParam; } | |
1620 if ( sCmerSettings.sCmerIndParam EQ CMER_INDICATOR_INVALID ) { sCmerSettings.sCmerIndParam = sOldCmerSettings.sCmerIndParam; } | |
1621 if ( sCmerSettings.sCmerBfrParam EQ CMER_BFR_INVALID ) { sCmerSettings.sCmerBfrParam = sOldCmerSettings.sCmerBfrParam; } | |
1622 if ( sCmerSettings.sCmerIndParam EQ CMER_INDICATOR_INVALID ) { sCmerSettings.sCmerIndParam = CMER_INDICATOR_0; } | |
1623 if ( sCmerSettings.sCmerBfrParam EQ CMER_BFR_INVALID ) { sCmerSettings.sCmerBfrParam = CMER_BFR_0; } | |
1624 | |
1625 switch( sCmerSettings.sCmerModeParam ) | |
1626 { | |
1627 case CMER_MODE_INVALID : | |
1628 case CMER_MODE_0 : | |
1629 { /* always buffer --> do nothing */ | |
1630 break; | |
1631 } | |
1632 case CMER_MODE_1 : | |
1633 case CMER_MODE_2 : | |
1634 { /* flush and/or clear buffer */ | |
1635 if ( (sEnteredCmerSettings.sCmerModeParam EQ CMER_MODE_1) OR | |
1636 (sEnteredCmerSettings.sCmerModeParam EQ CMER_MODE_2) ) | |
1637 { | |
1638 if ( sCmerSettings.sCmerBfrParam EQ CMER_BFR_0 ) | |
1639 { | |
1640 cmd_clearCievBuf( srcId ); | |
1641 } | |
1642 else | |
1643 { /* BFR == '2' */ | |
1644 cmd_flushCievBuf( srcId ); | |
1645 } | |
1646 | |
1647 } | |
1648 break; | |
1649 } | |
1650 default : | |
1651 { /* error case */ | |
1652 cmdCmeError(CME_ERR_OpNotAllow); | |
1653 return ATI_FAIL; | |
1654 } | |
1655 } | |
1656 return ATI_CMPL; | |
1657 | |
1658 #endif /* no FF_ATI_BAT */ | |
1659 } | |
1660 | |
1661 /* | |
1662 +--------------------------------------------------------------------+ | |
1663 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
1664 | STATE : code ROUTINE : queatPlusCMER | | |
1665 +--------------------------------------------------------------------+ | |
1666 | |
1667 PURPOSE : +CMER query command | |
1668 (query the configured indication handling settings | |
1669 toward terminal ) | |
1670 */ | |
1671 GLOBAL T_ATI_RSLT queatPlusCMER ( char *cl, UBYTE srcId ) | |
1672 { | |
1673 #ifndef FF_ATI_BAT | |
1674 T_ACI_RETURN sRet = AT_FAIL; | |
1675 T_ACI_MM_CMER_VAL_TYPE sCmerSettings; | |
1676 UINT uiDummy = 0u; | |
1677 #endif | |
1678 | |
1679 TRACE_FUNCTION("queatPLusCMER()"); | |
1680 | |
1681 #ifdef FF_ATI_BAT | |
1682 { | |
1683 T_BAT_cmd_send cmd; | |
1684 T_BAT_no_parameter dummy; | |
1685 | |
1686 cmd.ctrl_params = BAT_CMD_QUE_PLUS_CMER; | |
1687 dummy.bat_dummy = 0xFF; | |
1688 cmd.params.ptr_que_plus_cmer = &dummy; | |
1689 bat_send(ati_bat_get_client(srcId), &cmd); | |
1690 return(ATI_EXCT); | |
1691 } | |
1692 #else /* no FF_ATI_BAT */ | |
1693 | |
1694 sRet = qAT_PlusCMER( (T_ACI_CMD_SRC)srcId, &sCmerSettings.sCmerModeParam, | |
1695 &sCmerSettings.sCmerIndParam, | |
1696 &sCmerSettings.sCmerBfrParam ); | |
1697 | |
1698 if (sRet NEQ AT_CMPL) | |
1699 { | |
1700 cmdCmeError(CME_ERR_OpNotAllow); | |
1701 return ATI_FAIL; | |
1702 } | |
1703 | |
1704 if ( sCmerSettings.sCmerModeParam EQ CMER_MODE_INVALID ) { sCmerSettings.sCmerModeParam = CMER_MODE_0; }; | |
1705 if ( sCmerSettings.sCmerIndParam EQ CMER_INDICATOR_INVALID ) { sCmerSettings.sCmerIndParam = CMER_INDICATOR_0; }; | |
1706 if ( sCmerSettings.sCmerBfrParam EQ CMER_BFR_INVALID ) { sCmerSettings.sCmerBfrParam = CMER_BFR_0; }; | |
1707 | |
1708 resp_disp( srcId, cl,"eeeee",&sCmerSettings.sCmerModeParam, | |
1709 &uiDummy, | |
1710 &uiDummy, | |
1711 &sCmerSettings.sCmerIndParam, | |
1712 &sCmerSettings.sCmerBfrParam ); | |
1713 return ATI_CMPL; | |
1714 | |
1715 #endif /* no FF_ATI_BAT */ | |
1716 } | |
1717 | |
1718 /* | |
1719 +--------------------------------------------------------------------+ | |
1720 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
1721 | STATE : code ROUTINE : cmd_flushCievBuf | | |
1722 +--------------------------------------------------------------------+ | |
1723 | |
1724 PURPOSE : This function flushes the buffer for storing new signal- | |
1725 and/or SMS-full indications while the serial interface is | |
1726 released from data transmission. | |
1727 */ | |
1728 GLOBAL void cmd_flushCievBuf ( UBYTE srcId ) | |
1729 { | |
1730 UINT uiBufferCounter; | |
1731 UINT uiTempLastIndex; | |
1732 T_ACI_MM_CIND_VAL_TYPE sCindValues; | |
1733 T_ACI_MM_CMER_VAL_TYPE sCmerSettings; | |
1734 | |
1735 TRACE_FUNCTION("cmd_flushCievBuf"); | |
1736 | |
1737 /* Signal buffer */ | |
1738 uiTempLastIndex = asCievSignalBuf.uiLastIndex; | |
1739 cmhMM_GetCmerSettings((T_ACI_CMD_SRC)srcId, &sCmerSettings); | |
1740 for( uiBufferCounter=0; uiBufferCounter < uiTempLastIndex; uiBufferCounter++ ) | |
1741 { | |
1742 sCindValues.sCindSignalParam = asCievSignalBuf.asBufferValues[uiBufferCounter]; | |
1743 sCindValues.sCindSmsFullParam = CIND_SMSFULL_INDICATOR_INVALID; | |
1744 rCI_PlusCIEV( sCindValues, sCmerSettings ); | |
1745 asCievSignalBuf.asBufferValues[uiBufferCounter] = CIND_SIGNAL_INDICATOR_INVALID; | |
1746 asCievSignalBuf.uiLastIndex--; | |
1747 } | |
1748 | |
1749 /* SMS Full buffer */ | |
1750 uiTempLastIndex = asCievSmsFullBuf.uiLastIndex; | |
1751 for( uiBufferCounter=0; uiBufferCounter < uiTempLastIndex; uiBufferCounter++ ) | |
1752 { | |
1753 sCindValues.sCindSmsFullParam = asCievSmsFullBuf.asBufferValues[uiBufferCounter]; | |
1754 sCindValues.sCindSignalParam = CIND_SIGNAL_INDICATOR_INVALID; | |
1755 rCI_PlusCIEV( sCindValues, sCmerSettings ); | |
1756 asCievSmsFullBuf.asBufferValues[uiBufferCounter] = CIND_SMSFULL_INDICATOR_INVALID; | |
1757 asCievSmsFullBuf.uiLastIndex--; | |
1758 } | |
1759 } | |
1760 | |
1761 /* | |
1762 +--------------------------------------------------------------------+ | |
1763 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
1764 | STATE : code ROUTINE : cmd_clearCievBuf | | |
1765 +--------------------------------------------------------------------+ | |
1766 | |
1767 PURPOSE : This function clear the buffer for storing new signal- | |
1768 and/or SMS-full indications | |
1769 */ | |
1770 GLOBAL void cmd_clearCievBuf ( UBYTE srcId ) | |
1771 { | |
1772 UBYTE tSrc; | |
1773 | |
1774 for( tSrc=0; tSrc < CIEV_BUF_SIZE; tSrc++ ) | |
1775 { | |
1776 asCievSignalBuf.asBufferValues[tSrc] = CIND_SIGNAL_INDICATOR_INVALID; | |
1777 asCievSmsFullBuf.asBufferValues[tSrc] = CIND_SMSFULL_INDICATOR_INVALID; | |
1778 } | |
1779 asCievSignalBuf.uiLastIndex = 0u; | |
1780 asCievSmsFullBuf.uiLastIndex = 0u; | |
1781 } | |
1782 | |
1783 /* | |
1784 +--------------------------------------------------------------------+ | |
1785 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
1786 | STATE : code ROUTINE : cmd_PlusCOPN_CB | | |
1787 +--------------------------------------------------------------------+ | |
1788 | |
1789 PURPOSE : Call back function for cmd_PlusCOPN_CB | |
1790 */ | |
1791 | |
1792 GLOBAL void cmd_PlusCOPN_CB ( UBYTE src_id ) | |
1793 { | |
1794 SHORT startIdx; | |
1795 UBYTE curCmd; | |
1796 T_ATI_SRC_PARAMS *src_params; | |
1797 T_COPN_VAR *COPN_Var; | |
1798 BOOL ret; | |
1799 | |
1800 | |
1801 COPN_Var = &mmShrdPrm.COPN_VAR[src_id]; | |
1802 | |
1803 | |
1804 startIdx = COPN_Var->Start_Count; | |
1805 | |
1806 | |
1807 TRACE_FUNCTION("cmd_PlusCOPN_CB()"); | |
1808 | |
1809 ret = cmd_readCOPNBlock(startIdx,src_id); | |
1810 | |
1811 if (ret EQ TRUE) | |
1812 { | |
1813 src_params = find_element (ati_src_list, src_id, search_ati_src_id); | |
1814 curCmd = src_params->curAtCmd; | |
1815 R_AT( RAT_OK, (T_ACI_CMD_SRC)src_id ) | |
1816 ( curCmd ); | |
1817 } | |
1818 } | |
1819 | |
1820 GLOBAL BOOL cmd_readCOPNBlock( SHORT startIdx, UBYTE src_id ) | |
1821 { | |
1822 SHORT lastIdx; | |
1823 UBYTE idx; | |
1824 T_ACI_COPN_LST operLst; | |
1825 T_COPN_VAR *COPN_Var; | |
1826 | |
1827 COPN_Var = &mmShrdPrm.COPN_VAR[src_id]; | |
1828 | |
1829 TRACE_FUNCTION("cmd_readCOPNBlock()"); | |
1830 | |
1831 if( qAT_PlusCOPN((T_ACI_CMD_SRC)src_id, COPN_LID_Cnst, startIdx, | |
1832 &lastIdx, operLst) EQ AT_FAIL ) | |
1833 return TRUE; | |
1834 | |
1835 for( idx=0; idx < MAX_OPER; idx++ ) | |
1836 { | |
1837 if( operLst[idx].numOper[0] EQ 0x0 ) | |
1838 return TRUE; | |
1839 | |
1840 sprintf(g_sa,"+COPN: \"%s\",\"%s\"",operLst[idx].numOper, | |
1841 operLst[idx].alphaOper ); | |
1842 io_sendMessage(src_id, g_sa, ATI_NORMAL_OUTPUT); | |
1843 } | |
1844 startIdx = lastIdx+1; | |
1845 COPN_Var->Start_Count = startIdx; | |
1846 return FALSE; | |
1847 } | |
1848 | |
1849 | |
1850 #endif /* ATI_MM_C */ |