FreeCalypso > hg > fc-magnetite
comparison src/aci2/aci/ati_sim.c @ 3:93999a60b835
src/aci2, src/condat2: import of g23m/condat source pieces from TCS211
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Mon, 26 Sep 2016 00:29:36 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
2:c41a534f33c6 | 3:93999a60b835 |
---|---|
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: SIM related functions. | |
18 +----------------------------------------------------------------------------- | |
19 */ | |
20 | |
21 #ifndef ATI_SIM_C | |
22 #define ATI_SIM_C | |
23 | |
24 #undef DUMMY_ATI_STRINGS | |
25 | |
26 #include "aci_all.h" | |
27 | |
28 #include "aci_cmh.h" | |
29 #include "ati_cmd.h" | |
30 #include "aci_io.h" | |
31 #include "aci_cmd.h" | |
32 #include "l4_tim.h" | |
33 | |
34 #include "gdi.h" | |
35 #include "audio.h" | |
36 | |
37 #include "aci_mem.h" | |
38 #include "aci_ext_pers.h" | |
39 #include "aci_slock.h" | |
40 #include "aci_prs.h" | |
41 #include "aci_lst.h" | |
42 #include "ati_int.h" | |
43 | |
44 #ifdef FF_ATI_BAT | |
45 | |
46 #include "typedefs.h" | |
47 #include "gdd.h" | |
48 #include "bat.h" | |
49 | |
50 #include "ati_bat.h" | |
51 | |
52 #endif /* FF_ATI_BAT */ | |
53 | |
54 /*==== EXPORT ==================================================*/ | |
55 | |
56 EXTERN CHAR *cmdExtError (T_ACI_EXT_ERR e); | |
57 | |
58 /* | |
59 +--------------------------------------------------------------------+ | |
60 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
61 | STATE : code ROUTINE : setatPercentSECP | | |
62 +--------------------------------------------------------------------+ | |
63 | |
64 PURPOSE : %SECP command (PIN functionality for MMI Security) | |
65 */ | |
66 | |
67 GLOBAL T_ATI_RSLT setatPercentSECP(CHAR * cl, UBYTE srcId) | |
68 { | |
69 char pinOld [MAX_PWD_LENGTH]={0}; | |
70 char pinNew [MAX_PWD_LENGTH]={0}; | |
71 T_ACI_RETURN ret = AT_FAIL; | |
72 | |
73 TRACE_FUNCTION ("setatPercentSECP()"); | |
74 | |
75 cl = parse(cl, "nn", (LONG)MAX_PWD_LENGTH, pinOld,(LONG)MAX_PWD_LENGTH, pinNew); | |
76 if ( !cl OR (*pinOld EQ '\0' AND *pinNew EQ '\0') ) | |
77 { | |
78 cmdCmeError(CME_ERR_OpNotAllow); | |
79 return ATI_FAIL; | |
80 } | |
81 | |
82 ret = sAT_PercentSECP(srcId, pinOld, pinNew); | |
83 | |
84 return (map_aci_2_ati_rslt(ret)); | |
85 } | |
86 | |
87 | |
88 /* | |
89 +--------------------------------------------------------------------+ | |
90 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
91 | STATE : code ROUTINE : setatPercentSECS | | |
92 +--------------------------------------------------------------------+ | |
93 | |
94 PURPOSE : %SECS command (This function changes the state of the MMI Security code | |
95 It requires the existing security code as one of the parameters) | |
96 */ | |
97 | |
98 | |
99 GLOBAL T_ATI_RSLT setatPercentSECS (CHAR *cl, UBYTE srcId) | |
100 { | |
101 char code [MAX_PWD_LENGTH]={0}; | |
102 T_ACI_SECS_STA securityState = SECS_STA_NotPresent; | |
103 T_ACI_RETURN ret = AT_FAIL; | |
104 | |
105 | |
106 TRACE_FUNCTION ("setatPercentSECS()"); | |
107 | |
108 /* Get the required state and the Security code from the command parameters*/ | |
109 cl = parse(cl, "dn", &securityState, (LONG)MAX_PWD_LENGTH, code); | |
110 | |
111 if ( !cl OR *code EQ '\0' ) | |
112 { | |
113 cmdCmeError(CME_ERR_OpNotAllow); | |
114 return ATI_FAIL; | |
115 } | |
116 | |
117 ret = sAT_PercentSECS(srcId,securityState,code); | |
118 return (map_aci_2_ati_rslt(ret)); | |
119 | |
120 | |
121 } | |
122 | |
123 | |
124 /* | |
125 +--------------------------------------------------------------------+ | |
126 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
127 | STATE : code ROUTINE : qetatPercentSECS | | |
128 +--------------------------------------------------------------------+ | |
129 | |
130 PURPOSE : %SECS? command (It queries the state of the MMI Security code) | |
131 */ | |
132 | |
133 | |
134 GLOBAL T_ATI_RSLT quetatPercentSECS (CHAR *cl, UBYTE srcId) | |
135 { | |
136 T_ACI_SECS_STA securityState = SECS_STA_NotPresent; | |
137 T_ACI_RETURN ret = AT_FAIL; | |
138 | |
139 | |
140 TRACE_FUNCTION ("qetatPercentSECS()"); | |
141 | |
142 /* Get the State value from the Command Handler */ | |
143 ret = qAT_PercentSECS(srcId, &securityState); | |
144 | |
145 if (ret EQ AT_CMPL) | |
146 { | |
147 resp_disp(srcId, cl,"e",&securityState); | |
148 return ATI_CMPL; | |
149 } | |
150 else | |
151 { | |
152 cmdCmeError(CME_ERR_Unknown); | |
153 return ATI_FAIL; | |
154 } | |
155 | |
156 | |
157 } | |
158 | |
159 | |
160 | |
161 GLOBAL CHAR *CPIN_RESULT(T_ACI_CPIN_RSLT code) | |
162 { | |
163 switch (code) | |
164 { | |
165 default: | |
166 case(CPIN_RSLT_NotPresent): return"not present"; | |
167 case(CPIN_RSLT_SimReady): return"READY"; | |
168 case(CPIN_RSLT_SimPinReq): return"SIM PIN"; | |
169 case(CPIN_RSLT_SimPukReq): return"SIM PUK"; | |
170 case(CPIN_RSLT_PhSimPinReq):return"PH-SIM PIN"; | |
171 case(CPIN_RSLT_SimPin2Req): return"SIM PIN2"; | |
172 case(CPIN_RSLT_SimPuk2Req): return"SIM PUK2"; | |
173 /* OVK: Extended list of all possible result according to 07.07 */ | |
174 case(CPIN_RSLT_PhFSimPinReq): return"PH-FSIM PIN"; | |
175 case(CPIN_RSLT_PhFSimPukReq): return"PH-FSIM PUK"; | |
176 case(CPIN_RSLT_PhNetPinReq): return"PH-NET PIN"; | |
177 case(CPIN_RSLT_PhNetPukReq): return"PH_NET PUK"; | |
178 case(CPIN_RSLT_PhNetSubPinReq): return"PH-NETSUB PIN"; | |
179 case(CPIN_RSLT_PhNetSubPukReq): return"PH-NETSUB PUK"; | |
180 case(CPIN_RSLT_PhSPPinReq): return"PH-SP PIN"; | |
181 case(CPIN_RSLT_PhSPPukReq): return"PH-SP PUK"; | |
182 case(CPIN_RSLT_PhCorpPinReq): return"PH-CORP PIN"; | |
183 case(CPIN_RSLT_PhCorpPukReq): return"PH-CORP PUK"; | |
184 | |
185 | |
186 } | |
187 } | |
188 | |
189 /* | |
190 +--------------------------------------------------------------------+ | |
191 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
192 | STATE : code ROUTINE : atPlusCPIN | | |
193 +--------------------------------------------------------------------+ | |
194 | |
195 PURPOSE : +CPIN command (PIN functionality of ME) | |
196 */ | |
197 | |
198 GLOBAL T_ATI_RSLT setatPlusCPIN (char *cl, UBYTE srcId) | |
199 { | |
200 char pinOld [MAX_PWD_LENGTH]={0}; /* ES!! enough for bad guys?*/ | |
201 char pinNew [MAX_PWD_LENGTH]={0}; | |
202 T_ACI_RETURN ret = AT_FAIL; | |
203 UBYTE slockBlocked = 0; /* @GBR: AT_CMPL is interpreted as error per default. This is wrong, if the ME is SIMLOCKed */ | |
204 | |
205 TRACE_FUNCTION ("setatPlusCPIN()"); | |
206 | |
207 cl = parse(cl,"nn",(LONG)MAX_PWD_LENGTH,&pinOld,(LONG)MAX_PWD_LENGTH,&pinNew); | |
208 if ( !cl OR *pinOld EQ '\0' ) | |
209 { | |
210 cmdCmeError(CME_ERR_OpNotAllow); | |
211 return ATI_FAIL; | |
212 } | |
213 #ifdef SIM_PERS | |
214 slockBlocked = AciSLockShrd.blocked; | |
215 #endif | |
216 #ifdef FF_ATI_BAT | |
217 { | |
218 T_BAT_cmd_send cmd; | |
219 T_BAT_cmd_set_plus_cpin my_bat_set_plus_cpin = {0}; | |
220 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id); | |
221 | |
222 TRACE_FUNCTION("setatPlusCPIN() calls bat_send() <=== as APPLICATION"); | |
223 | |
224 /* memset(&my_bat_set_plus_cpin, FALSE, sizeof(my_bat_set_plus_cpin)); Already initilaised */ | |
225 cmd.ctrl_params = BAT_CMD_SET_PLUS_CPIN; | |
226 cmd.params.ptr_set_plus_cpin = &my_bat_set_plus_cpin; | |
227 | |
228 /* Set old pin BAT attribs */ | |
229 my_bat_set_plus_cpin.c_pin = strlen(pinOld); | |
230 memcpy(my_bat_set_plus_cpin.pin, pinOld, BAT_MAX_CPIN_PIN_LEN); | |
231 | |
232 /* Set new pin BAT attribs */ | |
233 if(my_bat_set_plus_cpin.c_newpin = strlen(pinNew)) | |
234 { | |
235 my_bat_set_plus_cpin.v_newpin = TRUE; | |
236 memcpy(my_bat_set_plus_cpin.pin, pinNew, BAT_MAX_CPIN_PIN_LEN); | |
237 } | |
238 | |
239 src_params->curAtCmd = AT_CMD_CPIN; | |
240 | |
241 bat_send(ati_bat_get_client(srcId), &cmd); | |
242 return ATI_EXCT; /* executing, because response is passed by callback function */ | |
243 } | |
244 | |
245 #else /* no FF_ATI_BAT */ | |
246 | |
247 TRACE_FUNCTION("setatPlusCPIN()"); | |
248 ret = sAT_PlusCPIN (srcId,pinOld,pinNew); | |
249 | |
250 switch(ret) | |
251 { | |
252 case(AT_EXCT): | |
253 { | |
254 break; | |
255 } | |
256 case(AT_BUSY): | |
257 { | |
258 cmdCmeError(CME_ERR_SimBusy); | |
259 break; | |
260 } | |
261 case(AT_FAIL): | |
262 { | |
263 cmdCmeError(CME_ERR_Unknown); | |
264 break; | |
265 } | |
266 case(AT_CMPL): | |
267 { | |
268 if (!slockBlocked) | |
269 { | |
270 cmdCmeError(CME_ERR_Unknown); | |
271 } | |
272 break; | |
273 } | |
274 } | |
275 return (map_aci_2_ati_rslt(ret)); | |
276 #endif /* FF_ATI_BAT */ | |
277 } | |
278 | |
279 GLOBAL T_ATI_RSLT queatPlusCPIN (char *cl, UBYTE srcId) | |
280 { | |
281 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id); | |
282 src_params->curAtCmd = AT_CMD_CPIN; | |
283 | |
284 #ifdef FF_ATI_BAT | |
285 { | |
286 T_BAT_cmd_send cmd; | |
287 T_BAT_no_parameter dummy; | |
288 | |
289 TRACE_FUNCTION("queatPlusCPIN() calls bat_send() <=== as APPLICATION"); | |
290 | |
291 cmd.ctrl_params = BAT_CMD_QUE_PLUS_CPIN; | |
292 dummy.bat_dummy = 0xFF; | |
293 cmd.params.ptr_que_plus_cpin = &dummy; | |
294 bat_send(ati_bat_get_client(srcId), &cmd); | |
295 return ATI_EXCT; /* executing, because response is passed by callback function */ | |
296 } | |
297 #else /* no FF_ATI_BAT */ | |
298 { | |
299 char pinOld [MAX_PWD_LENGTH]={0}; /* ES!! enough for bad guys?*/ | |
300 char pinNew [MAX_PWD_LENGTH]={0}; | |
301 T_ACI_RETURN ret = AT_FAIL; | |
302 T_ACI_CPIN_RSLT code; | |
303 | |
304 TRACE_FUNCTION ("queatPlusCPIN()"); | |
305 | |
306 ret= qAT_PlusCPIN (srcId,&code); /*PIN status is requested*/ | |
307 switch (ret) | |
308 { | |
309 case(AT_CMPL): | |
310 { | |
311 sprintf (g_sa,"+CPIN: %s",CPIN_RESULT(code)); | |
312 io_sendMessage (srcId, g_sa, ATI_NORMAL_OUTPUT); | |
313 break; | |
314 } | |
315 case(AT_EXCT): | |
316 { | |
317 src_params->curAtCmd = AT_CMD_CPIN; | |
318 break; | |
319 } | |
320 default: | |
321 { | |
322 cmdCmeError (CME_ERR_Unknown); | |
323 break; | |
324 } | |
325 } | |
326 return (map_aci_2_ati_rslt(ret)); | |
327 } | |
328 #endif /* no FF_ATI_BAT */ | |
329 } | |
330 | |
331 /* | |
332 +--------------------------------------------------------------------+ | |
333 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
334 | STATE : code ROUTINE : atPlusCPOL | | |
335 +--------------------------------------------------------------------+ | |
336 | |
337 PURPOSE : +CPOL command (preferred operator list) | |
338 */ | |
339 | |
340 GLOBAL T_ATI_RSLT setatPlusCPOL (char *cl, UBYTE srcId) | |
341 { | |
342 T_ACI_CPOL_FRMT format = CPOL_FRMT_NotPresent; | |
343 SHORT index = ACI_NumParmNotPresent; | |
344 SHORT startIdx=0,lastIdx=0,usdNtry=0; | |
345 char op[20] = {0}; | |
346 T_ACI_RETURN ret = AT_FAIL; | |
347 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id); | |
348 | |
349 TRACE_FUNCTION("setatPlusCPOL()"); | |
350 | |
351 cl = parse(cl,"dds",&index,&format,(LONG)20,op); | |
352 if(!cl) | |
353 { | |
354 cmdCmeError(CME_ERR_OpNotAllow); | |
355 return ATI_FAIL; | |
356 } | |
357 | |
358 #ifdef FF_ATI_BAT | |
359 | |
360 { | |
361 T_BAT_cmd_send cmd; | |
362 T_BAT_cmd_set_plus_cpol cpol; | |
363 UBYTE len; | |
364 | |
365 len=strlen(op); | |
366 | |
367 /* | |
368 * If the operator name is too big for the BAT structure, there's | |
369 * nothing we can do. A truncated version would be meaningless, and | |
370 * to omit it would result in an operator being deleted from the | |
371 * list. | |
372 */ | |
373 if (len>BAT_MAX_CPOL_OPER_LEN) | |
374 return(ATI_FAIL); | |
375 | |
376 cmd.ctrl_params = BAT_CMD_SET_PLUS_CPOL; | |
377 cmd.params.ptr_set_plus_cpol=&cpol; | |
378 | |
379 cpol.index=(S16)index; | |
380 | |
381 /* | |
382 * This relies on T_ACI_CPOL_FRMT being identical to | |
383 * T_BAT_plus_cpol_format. | |
384 */ | |
385 cpol.format=(T_BAT_plus_cpol_format)format; | |
386 | |
387 if (len>0) | |
388 { | |
389 memcpy(cpol.oper,op,len); | |
390 cpol.v_oper=TRUE; | |
391 cpol.c_oper=(U8)len; | |
392 } | |
393 else | |
394 { | |
395 cpol.v_oper=FALSE; | |
396 } | |
397 | |
398 bat_send(ati_bat_get_client(srcId), &cmd); | |
399 src_params->curAtCmd=AT_CMD_CPOL; | |
400 return(ATI_EXCT); | |
401 } | |
402 | |
403 #else /* no FF_ATI_BAT */ | |
404 | |
405 #ifdef WIN32 | |
406 ret=sAT_PlusCPOL(srcId,index,format, | |
407 ((op[0] NEQ 0x0)?op:NULL), | |
408 cpolIdx2, | |
409 cpolMode); | |
410 #else | |
411 ret=sAT_PlusCPOL(srcId,index,format, | |
412 ((op[0] NEQ 0x0)?op:NULL), | |
413 ACI_NumParmNotPresent, | |
414 CPOL_MOD_NotPresent); | |
415 #endif | |
416 | |
417 | |
418 switch (ret) | |
419 { | |
420 case (AT_CMPL): | |
421 return ATI_CMPL; | |
422 case (AT_EXCT): | |
423 src_params->curAtCmd = AT_CMD_CPOL; | |
424 return ATI_EXCT; | |
425 default: | |
426 cmdCmeError(CME_ERR_Unknown); | |
427 return ATI_FAIL; | |
428 } | |
429 #endif /* no FF_ATI_BAT */ | |
430 } | |
431 | |
432 GLOBAL T_ATI_RSLT tesatPlusCPOL (char *cl, UBYTE srcId) | |
433 { | |
434 T_ACI_CPOL_FRMT format = CPOL_FRMT_NotPresent; | |
435 SHORT index = ACI_NumParmNotPresent; | |
436 SHORT startIdx=0,lastIdx=0,usdNtry=0; | |
437 char op[20] = {0}; | |
438 T_ACI_RETURN ret = AT_FAIL; | |
439 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id); | |
440 | |
441 TRACE_FUNCTION("tesatPlusCPOL()"); | |
442 | |
443 src_params->curAtCmd=AT_CMD_CPOL; | |
444 | |
445 #ifdef FF_ATI_BAT | |
446 { | |
447 T_BAT_cmd_send cmd; | |
448 T_BAT_no_parameter dummy; | |
449 | |
450 cmd.ctrl_params = BAT_CMD_TST_PLUS_CPOL; | |
451 dummy.bat_dummy = 0xFF; | |
452 cmd.params.ptr_tst_plus_cpol = &dummy; | |
453 bat_send(ati_bat_get_client(srcId), &cmd); | |
454 return(ATI_EXCT); | |
455 } | |
456 #else /* no FF_ATI_BAT */ | |
457 | |
458 ret = tAT_PlusCPOL(srcId,&lastIdx,&usdNtry); | |
459 if (ret EQ AT_CMPL) | |
460 { | |
461 sprintf(g_sa,"+CPOL: (1-%d),(0-2)", lastIdx); | |
462 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT); | |
463 } | |
464 if (ret EQ AT_EXCT) | |
465 { | |
466 src_params->curAtCmd = AT_CMD_CPOL; | |
467 } | |
468 if (ret EQ AT_FAIL) | |
469 { | |
470 cmdCmeError(CME_ERR_Unknown); | |
471 } | |
472 return (map_aci_2_ati_rslt(ret)); | |
473 | |
474 #endif /* no FF_ATI_BAT */ | |
475 } | |
476 | |
477 GLOBAL T_ATI_RSLT queatPlusCPOL (char *cl, UBYTE srcId) | |
478 { | |
479 #ifndef FF_ATI_BAT | |
480 T_ACI_CPOL_LST plmnSelLst; | |
481 UBYTE idx; | |
482 BOOL loop; | |
483 #endif | |
484 | |
485 T_ACI_CPOL_FRMT format = CPOL_FRMT_NotPresent; | |
486 SHORT index = ACI_NumParmNotPresent; | |
487 SHORT startIdx=0,lastIdx=0,usdNtry=0; | |
488 char op[20] = {0}; | |
489 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id); | |
490 | |
491 src_params->curAtCmd=AT_CMD_CPOL; | |
492 | |
493 TRACE_FUNCTION("queatPlusCPOL()"); | |
494 | |
495 #ifdef FF_ATI_BAT | |
496 { | |
497 T_BAT_cmd_send cmd; | |
498 T_BAT_no_parameter dummy; | |
499 | |
500 cmd.ctrl_params = BAT_CMD_QUE_PLUS_CPOL; | |
501 dummy.bat_dummy = 0xFF; | |
502 cmd.params.ptr_que_plus_cpol = &dummy; | |
503 bat_send(ati_bat_get_client(srcId), &cmd); | |
504 return(ATI_EXCT); | |
505 } | |
506 #else /* no FF_ATI_BAT */ | |
507 | |
508 #ifdef WIN32 | |
509 switch (qAT_PlusCPOL ( srcId, | |
510 1, &lastIdx, | |
511 &plmnSelLst[0], | |
512 cpolMode)) | |
513 #else | |
514 switch (qAT_PlusCPOL ( srcId, | |
515 1, &lastIdx, | |
516 &plmnSelLst[0], | |
517 CPOL_MOD_NotPresent)) | |
518 #endif | |
519 { | |
520 case AT_CMPL: | |
521 loop = TRUE; | |
522 do | |
523 { | |
524 if( lastIdx EQ ACI_NumParmNotPresent ) | |
525 break; | |
526 | |
527 startIdx = lastIdx+1; | |
528 | |
529 for( idx=0; idx < MAX_OPER; idx++ ) | |
530 { | |
531 if( plmnSelLst[idx].index EQ ACI_NumParmNotPresent ) | |
532 { | |
533 loop = FALSE; | |
534 break; | |
535 } | |
536 sprintf(g_sa,"+CPOL: %d,%d,\"%s\"", plmnSelLst[idx].index, | |
537 plmnSelLst[idx].format, | |
538 plmnSelLst[idx].oper ); | |
539 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT); | |
540 } | |
541 | |
542 if( qAT_PlusCPOL(srcId, startIdx, &lastIdx, &plmnSelLst[0], | |
543 #ifdef WIN32 | |
544 cpolMode | |
545 #else | |
546 CPOL_MOD_NotPresent | |
547 #endif | |
548 ) EQ AT_FAIL OR !loop) | |
549 { | |
550 break; | |
551 } | |
552 } | |
553 while( loop ); | |
554 return ATI_CMPL; | |
555 | |
556 case AT_EXCT: | |
557 src_params->curAtCmd = AT_CMD_CPOL; | |
558 return ATI_EXCT; | |
559 | |
560 default: | |
561 cmdCmeError(CME_ERR_Unknown); | |
562 return ATI_FAIL; | |
563 } | |
564 | |
565 #endif /* no FF_ATI_BAT */ | |
566 } | |
567 | |
568 /* | |
569 +--------------------------------------------------------------------+ | |
570 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
571 | STATE : code ROUTINE : atPlusCNUM | | |
572 +--------------------------------------------------------------------+ | |
573 | |
574 PURPOSE : +CNUM command (subscriber number) | |
575 */ | |
576 | |
577 GLOBAL T_ATI_RSLT setatPlusCNUM (char *cl, UBYTE srcId) | |
578 { | |
579 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id); | |
580 TRACE_FUNCTION("setatPlusCNUM()"); | |
581 | |
582 #ifdef FF_ATI_BAT | |
583 | |
584 { | |
585 T_BAT_cmd_send cmd; | |
586 T_BAT_no_parameter dummy; | |
587 | |
588 TRACE_FUNCTION("setatPlusCNUM() calls bat_send() <=== as APPLICATION"); | |
589 | |
590 cmd.ctrl_params = BAT_CMD_SET_PLUS_CNUM; | |
591 dummy.bat_dummy = 0xFF; | |
592 cmd.params.ptr_set_plus_cnum = &dummy; | |
593 | |
594 bat_send(ati_bat_get_client(srcId), &cmd); | |
595 | |
596 src_params->curAtCmd=AT_CMD_CNUM; | |
597 return(ATI_EXCT); | |
598 } | |
599 | |
600 #else /* no FF_ATI_BAT */ | |
601 | |
602 if ( qAT_PlusCNUM ( srcId, CNUM_MOD_NewRead ) EQ AT_EXCT ) | |
603 { | |
604 src_params->curAtCmd = AT_CMD_CNUM; | |
605 return ATI_EXCT; | |
606 } | |
607 else | |
608 { | |
609 cmdCmeError ( CME_ERR_Unknown ); | |
610 return ATI_FAIL; | |
611 } | |
612 | |
613 #endif /* no FF_ATI_BAT */ | |
614 } | |
615 | |
616 | |
617 /* | |
618 +--------------------------------------------------------------------+ | |
619 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
620 | STATE : code ROUTINE : atPlusCFUN | | |
621 +--------------------------------------------------------------------+ | |
622 | |
623 PURPOSE : +CFUN command (Phone functionality) | |
624 */ | |
625 | |
626 GLOBAL T_ATI_RSLT setatPlusCFUN (char *cl, UBYTE srcId) | |
627 { | |
628 T_ACI_RETURN ret = AT_FAIL; | |
629 T_ACI_CFUN_FUN fun = CFUN_FUN_NotPresent; | |
630 T_ACI_CFUN_RST rst = CFUN_RST_NotPresent; | |
631 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id); | |
632 | |
633 src_params->curAtCmd = AT_CMD_CFUN; | |
634 | |
635 cl = parse (cl, "dd", &fun, &rst); | |
636 if ( !cl ) | |
637 { | |
638 cmdCmeError (CME_ERR_OpNotAllow); | |
639 return ret; | |
640 } | |
641 | |
642 #ifdef FF_ATI_BAT | |
643 { | |
644 T_BAT_cmd_send cmd; | |
645 T_BAT_cmd_set_plus_cfun my_bat_set_plus_cfun; | |
646 | |
647 TRACE_FUNCTION("setatPlusCFUN() calls bat_send() <=== as APPLICATION"); | |
648 | |
649 memset(&my_bat_set_plus_cfun, FALSE, sizeof(my_bat_set_plus_cfun)); | |
650 cmd.ctrl_params = BAT_CMD_SET_PLUS_CFUN; | |
651 cmd.params.ptr_set_plus_cfun = &my_bat_set_plus_cfun; | |
652 | |
653 my_bat_set_plus_cfun.fun = (T_BAT_VAL_plus_cfun_fun)fun; | |
654 my_bat_set_plus_cfun.rst = (T_BAT_VAL_plus_cfun_rst)rst; | |
655 | |
656 | |
657 bat_send(ati_bat_get_client(srcId), &cmd); | |
658 return ATI_EXCT; /* executing, because response is passed by callback function */ | |
659 } | |
660 #else /* no FF_ATI_BAT */ | |
661 { | |
662 TRACE_FUNCTION("setatPlusCFUN()"); | |
663 ret = sAT_PlusCFUN (srcId,fun,rst); | |
664 switch (ret) | |
665 { | |
666 case AT_EXCT: /*Command is executing*/ | |
667 audio_SetAmplf (AUDIO_MICROPHONE, (UBYTE)75); | |
668 audio_SetAmplf (AUDIO_SPEAKER, (UBYTE)175); | |
669 src_params->curAtCmd = AT_CMD_CFUN; | |
670 break; | |
671 | |
672 case AT_CMPL: | |
673 src_params->curAtCmd = AT_CMD_NONE; | |
674 break; | |
675 | |
676 default: /* AT_FAIL or nothing was returned */ | |
677 cmdExtError (EXT_ERR_NotPresent); | |
678 break; | |
679 } | |
680 return (map_aci_2_ati_rslt (ret)); | |
681 } | |
682 #endif /* no FF_ATI_BAT */ | |
683 } | |
684 | |
685 GLOBAL T_ATI_RSLT queatPlusCFUN (char *cl, UBYTE srcId) | |
686 { | |
687 T_ACI_RETURN ret = AT_FAIL; | |
688 T_ACI_CFUN_FUN fun = CFUN_FUN_NotPresent; | |
689 T_ACI_CFUN_RST rst = CFUN_RST_NotPresent; | |
690 | |
691 #ifdef FF_ATI_BAT | |
692 { | |
693 T_BAT_cmd_send cmd; | |
694 T_BAT_no_parameter dummy; | |
695 | |
696 TRACE_FUNCTION("queatPlusCFUN() calls bat_send() <=== as APPLICATION"); | |
697 | |
698 cmd.ctrl_params = BAT_CMD_QUE_PLUS_CFUN; | |
699 dummy.bat_dummy = 0xFF; | |
700 cmd.params.ptr_que_plus_cfun = &dummy; | |
701 bat_send(ati_bat_get_client(srcId), &cmd); | |
702 return ATI_EXCT; /* executing, because response is passed by callback function */ | |
703 } | |
704 #else /* no FF_ATI_BAT */ | |
705 TRACE_FUNCTION("queatPlusCFUN()"); | |
706 | |
707 ret = qAT_PlusCFUN(srcId, &fun); | |
708 if (ret EQ AT_CMPL) | |
709 { | |
710 resp_disp(srcId, cl,"e",&fun); | |
711 return ATI_CMPL; | |
712 } | |
713 else | |
714 { | |
715 cmdCmeError(CME_ERR_Unknown); | |
716 return ATI_FAIL; | |
717 } | |
718 #endif /* no FF_ATI_BAT */ | |
719 } | |
720 | |
721 /* | |
722 +--------------------------------------------------------------------+ | |
723 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
724 | STATE : code ROUTINE : atPlusCIMI | | |
725 +--------------------------------------------------------------------+ | |
726 | |
727 PURPOSE : +CIMI command (request international mobile subscriber | |
728 identity) | |
729 */ | |
730 GLOBAL T_ATI_RSLT setatPlusCIMI(char *cl, UBYTE srcId) | |
731 { | |
732 #ifndef FF_ATI_BAT | |
733 CHAR imsi[MAX_IMSI_LEN+1]; /* +1 for '\0' */ | |
734 #endif | |
735 | |
736 T_ACI_RETURN ret = AT_FAIL; | |
737 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id); | |
738 | |
739 TRACE_FUNCTION("setatPlusCIMI()"); | |
740 | |
741 #ifdef FF_ATI_BAT | |
742 | |
743 { | |
744 T_BAT_cmd_send cmd; | |
745 T_BAT_no_parameter dummy; | |
746 | |
747 TRACE_FUNCTION("setatPlusCIMI() calls bat_send() <=== as APPLICATION"); | |
748 | |
749 cmd.ctrl_params = BAT_CMD_SET_PLUS_CIMI; | |
750 dummy.bat_dummy = 0xFF; | |
751 cmd.params.ptr_set_plus_cimi = &dummy; | |
752 | |
753 bat_send(ati_bat_get_client(srcId), &cmd); | |
754 | |
755 src_params->curAtCmd=AT_CMD_CIMI; | |
756 return(ATI_EXCT); | |
757 } | |
758 | |
759 #else /* no FF_ATI_BAT */ | |
760 | |
761 ret = qAT_PlusCIMI(srcId, imsi); | |
762 switch (ret) | |
763 { | |
764 case( AT_CMPL ): | |
765 | |
766 sprintf(g_sa,"%s",imsi); | |
767 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT); | |
768 break; | |
769 | |
770 case( AT_EXCT ): | |
771 src_params->curAtCmd = AT_CMD_CIMI; | |
772 break; | |
773 | |
774 default: | |
775 | |
776 break; | |
777 } | |
778 return (map_aci_2_ati_rslt(ret)); | |
779 | |
780 #endif /* no FF_ATI_BAT */ | |
781 } | |
782 | |
783 | |
784 /* | |
785 +--------------------------------------------------------------------+ | |
786 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
787 | STATE : code ROUTINE : atPlusCRSM | | |
788 +--------------------------------------------------------------------+ | |
789 | |
790 PURPOSE : +CRSM Restricted SIM access | |
791 */ | |
792 GLOBAL T_ATI_RSLT setatPlusCRSM(char *cl, UBYTE srcId) | |
793 { | |
794 T_ACI_RETURN ret = AT_FAIL; | |
795 UBYTE *data; | |
796 USHORT lenData = 0; | |
797 T_ACI_CRSM_CMD cmd = CRSM_CMD_NotPresent; | |
798 SHORT fileId = ACI_NumParmNotPresent, | |
799 p1 = ACI_NumParmNotPresent, | |
800 p2 = ACI_NumParmNotPresent, | |
801 p3 = ACI_NumParmNotPresent; | |
802 USHORT lenDataStr = 0; | |
803 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id); | |
804 | |
805 | |
806 TRACE_FUNCTION("setatPlusCRSM"); | |
807 | |
808 cl = parse(cl,"drrrrl", &cmd,&fileId, &p1, &p2, &p3,&lenDataStr,&data ); | |
809 if(!cl) | |
810 { | |
811 cmdCmeError(CME_ERR_OpNotAllow); | |
812 return ATI_FAIL; | |
813 } | |
814 | |
815 utl_hexToGsm( data, lenDataStr, data, &lenData, GSM_ALPHA_Def, | |
816 CSCS_ALPHA_Reserved ); | |
817 | |
818 #ifdef FF_ATI_BAT | |
819 { | |
820 T_BAT_cmd_send bat_cmd; | |
821 T_BAT_cmd_set_plus_crsm crsm; | |
822 | |
823 /* | |
824 * If the data is too big for the BAT structure, there's | |
825 * nothing we can do. A truncated version would be meaningless. | |
826 */ | |
827 if (lenData>BAT_MAX_CRSM_DATA_LEN) | |
828 return(ATI_FAIL); | |
829 | |
830 bat_cmd.ctrl_params = BAT_CMD_SET_PLUS_CRSM; | |
831 bat_cmd.params.ptr_set_plus_crsm=&crsm; | |
832 | |
833 /* | |
834 * This relies on T_ACI_CRSM_COMMAND and T_BAT_plus_crsm_command | |
835 * being identical. They are, except in that the ACI version has | |
836 * a 'not present' value. This is not an issue in this direction. | |
837 */ | |
838 crsm.command=(T_BAT_plus_crsm_command)cmd; | |
839 | |
840 crsm.fileid=(S32)fileId; | |
841 crsm.p1=(S16)p1; | |
842 crsm.p2=(S16)p2; | |
843 crsm.p3=(S16)p3; | |
844 crsm.c_data=(U8)lenData; | |
845 memcpy(crsm.data,data,lenData); | |
846 | |
847 bat_send(ati_bat_get_client(srcId),&bat_cmd); | |
848 | |
849 src_params->curAtCmd=AT_CMD_CRSM; | |
850 return(ATI_EXCT); | |
851 } | |
852 #else /* no FF_ATI_BAT */ | |
853 | |
854 ret = sAT_PlusCRSM( srcId, cmd, fileId, p1, p2, p3, | |
855 lenData, data ); | |
856 if (ret EQ AT_EXCT) | |
857 { | |
858 src_params->curAtCmd = AT_CMD_CRSM; | |
859 } | |
860 if (ret EQ AT_FAIL) | |
861 { | |
862 cmdCmeError(CME_ERR_Unknown); | |
863 } | |
864 return (map_aci_2_ati_rslt(ret)); | |
865 | |
866 #endif /* no FF_ATI_BAT */ | |
867 } | |
868 | |
869 /* | |
870 +--------------------------------------------------------------------+ | |
871 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
872 | STATE : code ROUTINE : setatPlusCSIM | | |
873 +--------------------------------------------------------------------+ | |
874 | |
875 PURPOSE : +CSIM Generic SIM access | |
876 */ | |
877 GLOBAL T_ATI_RSLT setatPlusCSIM(char *cl, UBYTE srcId) | |
878 { | |
879 T_ACI_RETURN ret = AT_FAIL; | |
880 USHORT given_length; | |
881 UBYTE *data; | |
882 USHORT lenData = 0; | |
883 USHORT lenDataStr = 0; | |
884 | |
885 | |
886 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id); | |
887 | |
888 | |
889 TRACE_FUNCTION("setatPlusCSIM"); | |
890 | |
891 cl = parse(cl,"rl", &given_length, &lenDataStr, &data ); | |
892 if(!cl) | |
893 { | |
894 cmdCmeError(CME_ERR_OpNotAllow); | |
895 return ATI_FAIL; | |
896 } | |
897 | |
898 if ((given_length > MAX_SIM_TRANSP*2) | |
899 OR (given_length NEQ lenDataStr) | |
900 OR (lenDataStr EQ 0)) | |
901 { | |
902 cmdCmeError(CME_ERR_OpNotAllow); | |
903 return ATI_FAIL; | |
904 } | |
905 | |
906 lenData = utl_HexStrToBin(data, lenDataStr, data, MAX_SIM_TRANSP); | |
907 | |
908 if (lenData EQ 0) | |
909 { | |
910 TRACE_EVENT("invalid character in <command>"); | |
911 cmdCmeError(CME_ERR_OpNotAllow); | |
912 return ATI_FAIL; | |
913 } | |
914 | |
915 #ifdef FF_ATI_BAT | |
916 | |
917 { | |
918 T_BAT_cmd_send bat_cmd; | |
919 T_BAT_cmd_set_plus_csim csim; | |
920 | |
921 /* | |
922 * If the data is too big for the BAT structure, there's | |
923 * nothing we can do. A truncated version would be meaningless. | |
924 */ | |
925 if (lenData>BAT_MAX_CSIM_CMD_LEN) | |
926 return(ATI_FAIL); | |
927 | |
928 bat_cmd.ctrl_params = BAT_CMD_SET_PLUS_CSIM; | |
929 bat_cmd.params.ptr_set_plus_csim=&csim; | |
930 | |
931 csim.c_command=(U8)lenData; | |
932 memcpy(csim.command,data,lenData); | |
933 | |
934 bat_send(ati_bat_get_client(srcId),&bat_cmd); | |
935 | |
936 src_params->curAtCmd=AT_CMD_CRSM; | |
937 return(ATI_EXCT); | |
938 } | |
939 | |
940 #else /* no FF_ATI_BAT */ | |
941 | |
942 ret = sAT_PlusCSIM( srcId, lenData, data ); | |
943 if (ret EQ AT_EXCT) | |
944 { | |
945 src_params->curAtCmd = AT_CMD_CSIM; | |
946 } | |
947 if (ret EQ AT_FAIL) | |
948 { | |
949 cmdCmeError(CME_ERR_Unknown); | |
950 } | |
951 return (map_aci_2_ati_rslt(ret)); | |
952 | |
953 #endif /* no FF_ATI_BAT */ | |
954 } | |
955 | |
956 /* | |
957 +--------------------------------------------------------------------+ | |
958 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
959 | STATE : code ROUTINE : queatPercentATR | | |
960 +--------------------------------------------------------------------+ | |
961 | |
962 PURPOSE : %ATR answer to reset (query) | |
963 */ | |
964 GLOBAL T_ATI_RSLT queatPercentATR ( char *cl, UBYTE srcId ) | |
965 { | |
966 #ifndef FF_ATI_BAT | |
967 T_ACI_RETURN ret; | |
968 UBYTE i; | |
969 UBYTE phase; | |
970 UBYTE atr_len = 0; | |
971 UBYTE atr_info[MAX_SIM_ATR]; | |
972 #endif | |
973 | |
974 TRACE_FUNCTION( "queatPercentATR()" ); | |
975 | |
976 #ifdef FF_ATI_BAT | |
977 { | |
978 T_BAT_cmd_send cmd; | |
979 T_BAT_no_parameter dummy; | |
980 | |
981 cmd.ctrl_params = BAT_CMD_QUE_PERCENT_ATR; | |
982 dummy.bat_dummy = 0xFF; | |
983 cmd.params.ptr_que_percent_atr = &dummy; | |
984 | |
985 /* | |
986 * Without this we will lose track of the source ID by the time the | |
987 * response arrives. | |
988 */ | |
989 srcId_cb=srcId; | |
990 | |
991 bat_send(ati_bat_get_client(srcId), &cmd); | |
992 return(ATI_EXCT); | |
993 } | |
994 #else /* no FF_ATI_BAT */ | |
995 | |
996 ret = qAT_PercentATR( srcId, &phase, &atr_len, atr_info ); | |
997 | |
998 if( ret NEQ AT_CMPL ) | |
999 { | |
1000 cmdCmeError(CME_ERR_Unknown); | |
1001 } | |
1002 else | |
1003 { | |
1004 if(phase NEQ NOT_PRESENT_8BIT) | |
1005 { | |
1006 i=sprintf(g_sa,"%s%d,", "%ATR: ", phase);/* if phase available.. return phase*/ | |
1007 } | |
1008 else | |
1009 { | |
1010 i=sprintf(g_sa,"%s", "%ATR: FFFF");/* else return FFFF*/ | |
1011 } | |
1012 | |
1013 if(atr_len) /* if ATR data available... return ATR data*/ | |
1014 { | |
1015 sprintf(g_sa+i,","); | |
1016 utl_binToHex( atr_info, atr_len, g_sa+i ); | |
1017 } | |
1018 | |
1019 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT); | |
1020 } | |
1021 return (map_aci_2_ati_rslt(ret)); | |
1022 | |
1023 #endif /* no FF_ATI_BAT */ | |
1024 } | |
1025 | |
1026 /* | |
1027 +--------------------------------------------------------------------+ | |
1028 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
1029 | STATE : code ROUTINE : setatPercentCPRI | | |
1030 +--------------------------------------------------------------------+ | |
1031 | |
1032 PURPOSE : %CPRI command (select cipher indication mode) | |
1033 */ | |
1034 | |
1035 GLOBAL T_ATI_RSLT setatPercentCPRI ( char *cl, UBYTE srcId ) | |
1036 { | |
1037 T_ACI_RETURN ACI_return = AT_FAIL; | |
1038 UBYTE CPRImode; | |
1039 | |
1040 TRACE_FUNCTION( "setatPercentCPRI()" ); | |
1041 | |
1042 switch( *cl ) | |
1043 { | |
1044 case '0': | |
1045 case '1': | |
1046 CPRImode = *cl - 0x30; /* make binary value */ | |
1047 cl++; | |
1048 ACI_return = sAT_PercentCPRI( srcId, CPRImode ); | |
1049 if( ACI_return NEQ AT_CMPL ) | |
1050 { | |
1051 cmdCmeError(CME_ERR_Unknown); | |
1052 } | |
1053 else /* If ACI_return is AT_CMPL,updates the CPRI_stat with CPRImode */ | |
1054 { | |
1055 ati_user_output_cfg[srcId].CPRI_stat = CPRImode; | |
1056 } | |
1057 break; | |
1058 default: | |
1059 cmdCmeError(CME_ERR_OpNotAllow); | |
1060 break; | |
1061 } | |
1062 return (map_aci_2_ati_rslt(ACI_return)); | |
1063 } | |
1064 | |
1065 | |
1066 GLOBAL T_ATI_RSLT queatPercentCPRI ( char *cl, UBYTE srcId ) | |
1067 { | |
1068 T_ACI_RETURN ACI_return = AT_FAIL; | |
1069 UBYTE CPRIenabled; | |
1070 | |
1071 TRACE_FUNCTION( "queatPercentCPRI()" ); | |
1072 | |
1073 ACI_return = qAT_PercentCPRI( srcId, &CPRIenabled ); | |
1074 | |
1075 if( ACI_return NEQ AT_CMPL ) | |
1076 { | |
1077 cmdCmeError(CME_ERR_Unknown); | |
1078 } | |
1079 else | |
1080 { | |
1081 if (CPRIenabled) | |
1082 { | |
1083 CPRIenabled = ati_user_output_cfg[srcId].CPRI_stat; | |
1084 } | |
1085 else | |
1086 { | |
1087 CPRIenabled = CI_DISABLED; | |
1088 } | |
1089 resp_disp(srcId, cl,"b",&CPRIenabled); | |
1090 } | |
1091 return (map_aci_2_ati_rslt(ACI_return)); | |
1092 } | |
1093 | |
1094 /* | |
1095 +--------------------------------------------------------------------+ | |
1096 | PROJECT : GSM-F&D (8411) MODULE : | | |
1097 | STATE : code ROUTINE : setatPercentPVRF | | |
1098 +--------------------------------------------------------------------+ | |
1099 | |
1100 PURPOSE : return information relating to status of PIN. | |
1101 | |
1102 */ | |
1103 | |
1104 GLOBAL T_ATI_RSLT setatPercentPVRF( char *cl, UBYTE srcId ) | |
1105 { | |
1106 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id); | |
1107 T_ACI_PVRF_TYPE type; | |
1108 CHAR pin[10]; | |
1109 CHAR newpin[10]; | |
1110 T_ACI_RETURN ret = AT_FAIL; | |
1111 | |
1112 TRACE_FUNCTION( "setatPercentPVRF()" ); | |
1113 | |
1114 /* parse mode */ | |
1115 cl = parse (cl, "dss", &type, (LONG) sizeof (pin),pin, (LONG) sizeof (newpin), newpin); | |
1116 if ((!cl) OR (type > PVRF_TYPE_Puk2) OR (type <= PVRF_TYPE_NotPresent)) | |
1117 { | |
1118 cmdCmeError (CME_ERR_OpNotAllow); | |
1119 return (ATI_FAIL); | |
1120 } | |
1121 | |
1122 #ifdef FF_ATI_BAT | |
1123 | |
1124 { | |
1125 T_BAT_cmd_send cmd; | |
1126 T_BAT_cmd_set_percent_pvrf pvrf; | |
1127 UBYTE len; | |
1128 | |
1129 cmd.ctrl_params = BAT_CMD_SET_PERCENT_PVRF; | |
1130 cmd.params.ptr_set_percent_pvrf=&pvrf; | |
1131 | |
1132 /* | |
1133 * This relies on T_ACI_PVRF_TYPE and T_BAT_percent_pvrf_type | |
1134 * being identical. They are, except in that the ACI version has | |
1135 * a 'not present' value. In this direction, that doesn't matter. | |
1136 */ | |
1137 pvrf.type=(T_BAT_percent_pvrf_type)type; | |
1138 | |
1139 len=strlen(pin); | |
1140 if (len>BAT_MAX_PVRF_PIN_LEN) | |
1141 return(ATI_FAIL); | |
1142 | |
1143 pvrf.c_pin=(U8)len; | |
1144 memcpy(pvrf.pin,pin,len); | |
1145 | |
1146 len=strlen(newpin); | |
1147 if (len>BAT_MAX_PVRF_NEW_PIN_LEN) | |
1148 return(ATI_FAIL); | |
1149 | |
1150 if (len) | |
1151 { | |
1152 pvrf.v_newpin=TRUE; | |
1153 pvrf.c_newpin=(U8)len; | |
1154 memcpy(pvrf.newpin,newpin,len); | |
1155 } | |
1156 else | |
1157 { | |
1158 pvrf.v_newpin=FALSE; | |
1159 } | |
1160 bat_send(ati_bat_get_client(srcId), &cmd); | |
1161 | |
1162 src_params->curAtCmd=AT_CMD_PVRF; | |
1163 return(ATI_EXCT); | |
1164 } | |
1165 | |
1166 #else /* no FF_ATI_BAT */ | |
1167 | |
1168 ret = sAT_PercentPVRF (srcId, type, pin, newpin); | |
1169 | |
1170 switch (ret) | |
1171 { | |
1172 case (AT_CMPL): /*operation completed*/ | |
1173 break; | |
1174 case (AT_EXCT): | |
1175 src_params->curAtCmd = AT_CMD_PVRF; | |
1176 break; | |
1177 default: | |
1178 cmdCmeError(CME_ERR_Unknown); /*Command failed*/ | |
1179 break; | |
1180 } | |
1181 return (map_aci_2_ati_rslt(ret)); | |
1182 | |
1183 #endif /* no FF_ATI_BAT */ | |
1184 } | |
1185 | |
1186 /* | |
1187 +--------------------------------------------------------------------+ | |
1188 | PROJECT : GPRS (8441) MODULE : GACI_CMD | | |
1189 | STATE : code ROUTINE : queatPercentPVRF | | |
1190 +--------------------------------------------------------------------+ | |
1191 | |
1192 PURPOSE : %PVRF command | |
1193 */ | |
1194 GLOBAL T_ATI_RSLT queatPercentPVRF (char *cl, UBYTE srcId) | |
1195 { | |
1196 TRACE_FUNCTION("queatPercentPVRF()"); | |
1197 | |
1198 #ifdef FF_ATI_BAT | |
1199 { | |
1200 T_BAT_cmd_send cmd; | |
1201 T_BAT_no_parameter dummy; | |
1202 | |
1203 cmd.ctrl_params = BAT_CMD_QUE_PERCENT_PVRF; | |
1204 dummy.bat_dummy = 0xFF; | |
1205 cmd.params.ptr_que_percent_pvrf = &dummy; | |
1206 bat_send(ati_bat_get_client(srcId), &cmd); | |
1207 return(ATI_EXCT); | |
1208 } | |
1209 #else /* no FF_ATI_BAT */ | |
1210 { | |
1211 T_ACI_PVRF_STAT ps1; | |
1212 T_ACI_PVRF_STAT ps2; | |
1213 CHAR *me = "%PVRF: "; | |
1214 SHORT pn1cnt = 0; | |
1215 SHORT pn2cnt = 0; | |
1216 SHORT pk1cnt = 0; | |
1217 SHORT pk2cnt = 0; | |
1218 | |
1219 T_ACI_RETURN ret = qAT_PercentPVRF(srcId, &pn1cnt, &pn2cnt, &pk1cnt, &pk2cnt, &ps1, &ps2); | |
1220 | |
1221 if (ret NEQ AT_CMPL) | |
1222 { | |
1223 cmdCmeError(CME_ERR_Unknown); | |
1224 return (ATI_FAIL); | |
1225 } | |
1226 | |
1227 sprintf(g_sa,"%s%d, %d, %d, %d, %d, %d", me, pn1cnt, pn2cnt, pk1cnt, pk2cnt, ps1, ps2); | |
1228 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT); | |
1229 | |
1230 return (ATI_CMPL); | |
1231 } | |
1232 #endif /* no FF_ATI_BAT */ | |
1233 } | |
1234 | |
1235 /* | |
1236 +--------------------------------------------------------------------+ | |
1237 | PROJECT : GSM-F&D (8411) MODULE : | | |
1238 | STATE : code ROUTINE : setatPercentCUST | | |
1239 +--------------------------------------------------------------------+ | |
1240 | |
1241 PURPOSE : %CUST command ( Set Customisation Mode Function ) | |
1242 */ | |
1243 | |
1244 GLOBAL T_ACI_RETURN setatPercentCUST ( char *cl, UBYTE srcId ) | |
1245 { | |
1246 TRACE_FUNCTION( "setatPercentCUST()" ); | |
1247 | |
1248 #ifdef FF_ATI_BAT | |
1249 | |
1250 { | |
1251 T_BAT_cmd_send cmd; | |
1252 T_BAT_cmd_set_percent_cust cust; | |
1253 | |
1254 cmd.ctrl_params = BAT_CMD_SET_PERCENT_CUST; | |
1255 cmd.params.ptr_set_percent_cust=&cust; | |
1256 | |
1257 switch (*cl) | |
1258 { | |
1259 case '0': | |
1260 cust.mode=BAT_P_CUST_MODE_NORMAL; | |
1261 break; | |
1262 | |
1263 case '1': | |
1264 cust.mode=BAT_P_CUST_MODE_BEHAVIOUR_1; | |
1265 break; | |
1266 | |
1267 default: | |
1268 cmdCmeError(CME_ERR_OpNotAllow); | |
1269 return(ATI_FAIL); | |
1270 } | |
1271 bat_send(ati_bat_get_client(srcId), &cmd); | |
1272 | |
1273 return(ATI_EXCT); | |
1274 } | |
1275 #else /* no FF_ATI_BAT */ | |
1276 | |
1277 switch( *cl ) | |
1278 { | |
1279 case '0': | |
1280 if (sAT_PercentCUST(srcId, (UBYTE)CUST_NORMAL_BEHAVIOUR) EQ AT_FAIL) | |
1281 { | |
1282 cmdCmeError(CME_ERR_Unknown); | |
1283 return (ATI_FAIL); | |
1284 } | |
1285 break; | |
1286 | |
1287 case '1': | |
1288 if (sAT_PercentCUST (srcId, (UBYTE)CUST_MODE_BEHAVIOUR_1) EQ AT_FAIL) | |
1289 { | |
1290 cmdCmeError(CME_ERR_Unknown); | |
1291 return (ATI_FAIL); | |
1292 } | |
1293 break; | |
1294 | |
1295 default: | |
1296 cmdCmeError(CME_ERR_OpNotAllow); | |
1297 return (ATI_FAIL); | |
1298 } | |
1299 | |
1300 return (ATI_CMPL); | |
1301 | |
1302 #endif /* no FF_ATI_BAT */ | |
1303 } | |
1304 | |
1305 /* | |
1306 +--------------------------------------------------------------------+ | |
1307 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
1308 | STATE : code ROUTINE : queatPercentCUST | | |
1309 +--------------------------------------------------------------------+ | |
1310 | |
1311 PURPOSE : %CUST command (Customisaton Mode) | |
1312 */ | |
1313 GLOBAL T_ATI_RSLT queatPercentCUST (char *cl, UBYTE srcId) | |
1314 { | |
1315 TRACE_FUNCTION("queatPercentCUST()"); | |
1316 | |
1317 #ifdef FF_ATI_BAT | |
1318 { | |
1319 T_BAT_cmd_send cmd; | |
1320 T_BAT_no_parameter dummy; | |
1321 | |
1322 cmd.ctrl_params = BAT_CMD_QUE_PERCENT_CUST; | |
1323 dummy.bat_dummy = 0xFF; | |
1324 cmd.params.ptr_que_percent_cust = &dummy; | |
1325 bat_send(ati_bat_get_client(srcId), &cmd); | |
1326 return(ATI_EXCT); | |
1327 } | |
1328 #else /* no FF_ATI_BAT */ | |
1329 { | |
1330 T_CUST_MOD mode; | |
1331 T_ACI_RETURN ret = qAT_PercentCUST(srcId, &mode); | |
1332 | |
1333 if (ret NEQ AT_CMPL) | |
1334 { | |
1335 cmdCmeError(CME_ERR_Unknown); | |
1336 return (ATI_FAIL); | |
1337 } | |
1338 | |
1339 sprintf(g_sa,"%%CUST: %d", mode); | |
1340 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT); | |
1341 | |
1342 return ATI_CMPL; | |
1343 } | |
1344 #endif /* no FF_ATI_BAT */ | |
1345 } | |
1346 | |
1347 /* | |
1348 +--------------------------------------------------------------------+ | |
1349 | PROJECT : GSM-F&D (8411) MODULE : | | |
1350 | STATE : code ROUTINE : setatPercentSATCC | | |
1351 +--------------------------------------------------------------------+ | |
1352 | |
1353 PURPOSE : %SATCC command ( Enable/Disable the Call/Short Message Control By SIM ) | |
1354 */ | |
1355 | |
1356 GLOBAL T_ACI_RETURN setatPercentSATCC ( char *cl, UBYTE srcId ) | |
1357 | |
1358 { | |
1359 #ifdef FF_ATI_BAT | |
1360 T_BAT_cmd_send bat_cmd; | |
1361 T_BAT_cmd_set_percent_satcc satcc; | |
1362 #endif | |
1363 TRACE_FUNCTION( "setatPercentSATCC()" ); | |
1364 | |
1365 #ifdef FF_ATI_BAT | |
1366 switch( *cl ) | |
1367 { | |
1368 case '0': | |
1369 satcc.mode = BAT_P_SATCC_MODE_INACTIVE; | |
1370 break; | |
1371 case '1': | |
1372 satcc.mode = BAT_P_SATCC_MODE_ACTIVE; | |
1373 break; | |
1374 default: | |
1375 cmdCmeError(CME_ERR_Unknown); | |
1376 return (ATI_FAIL); | |
1377 } | |
1378 | |
1379 bat_cmd.ctrl_params = BAT_CMD_SET_PERCENT_SATCC; | |
1380 bat_cmd.params.ptr_set_percent_satcc = &satcc; | |
1381 | |
1382 bat_send(ati_bat_get_client(srcId),&bat_cmd); | |
1383 | |
1384 return(ATI_EXCT); | |
1385 | |
1386 #else | |
1387 switch( *cl ) | |
1388 { | |
1389 case '0': | |
1390 if (sAT_PercentSATCC(srcId, (UBYTE)SATCC_CONTROL_BY_SIM_INACTIVE) EQ AT_FAIL) | |
1391 { | |
1392 cmdCmeError(CME_ERR_Unknown); | |
1393 return (ATI_FAIL); | |
1394 } | |
1395 break; | |
1396 | |
1397 case '1': | |
1398 if (sAT_PercentSATCC (srcId, (UBYTE)SATCC_CONTROL_BY_SIM_ACTIVE) EQ AT_FAIL) | |
1399 { | |
1400 cmdCmeError(CME_ERR_Unknown); | |
1401 return (ATI_FAIL); | |
1402 } | |
1403 break; | |
1404 | |
1405 default: | |
1406 cmdCmeError(CME_ERR_OpNotAllow); | |
1407 return (ATI_FAIL); | |
1408 } | |
1409 | |
1410 return (ATI_CMPL); | |
1411 | |
1412 #endif | |
1413 } | |
1414 | |
1415 /* | |
1416 +--------------------------------------------------------------------+ | |
1417 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
1418 | STATE : code ROUTINE : queatPercentSATCC | | |
1419 +--------------------------------------------------------------------+ | |
1420 | |
1421 PURPOSE : %SATCC command (Query Call/Short Message control By SIM) | |
1422 */ | |
1423 GLOBAL T_ATI_RSLT queatPercentSATCC (char *cl, UBYTE srcId) | |
1424 { | |
1425 #ifdef FF_ATI_BAT | |
1426 T_BAT_cmd_send bat_cmd; | |
1427 T_BAT_no_parameter satcc; | |
1428 #else | |
1429 T_SAT_CC_MOD mode; | |
1430 T_ACI_RETURN ret = AT_FAIL; | |
1431 #endif | |
1432 | |
1433 TRACE_FUNCTION("queatPercentSATCC()"); | |
1434 | |
1435 #ifdef FF_ATI_BAT | |
1436 bat_cmd.ctrl_params = BAT_CMD_QUE_PERCENT_SATCC; | |
1437 bat_cmd.params.ptr_que_percent_satcc = &satcc; | |
1438 | |
1439 bat_send(ati_bat_get_client(srcId),&bat_cmd); | |
1440 | |
1441 return(ATI_EXCT); | |
1442 | |
1443 #else | |
1444 | |
1445 ret = qAT_PercentSATCC(srcId, &mode); | |
1446 | |
1447 if (ret NEQ AT_CMPL) | |
1448 { | |
1449 cmdCmeError(CME_ERR_Unknown); | |
1450 return (ATI_FAIL); | |
1451 } | |
1452 | |
1453 sprintf(g_sa,"%%SATCC: %d", mode); | |
1454 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT); | |
1455 | |
1456 #endif /*FF_ATI_BAT*/ | |
1457 | |
1458 return ATI_CMPL; | |
1459 } | |
1460 | |
1461 /* | |
1462 +--------------------------------------------------------------------+ | |
1463 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
1464 | STATE : code ROUTINE : setatPercentSIMIND | | |
1465 +--------------------------------------------------------------------+ | |
1466 | |
1467 PURPOSE : enable %SIMINS / %SIMREM indications | |
1468 */ | |
1469 | |
1470 GLOBAL T_ATI_RSLT setatPercentSIMIND(char *cl, UBYTE srcId) | |
1471 { | |
1472 int mode = 1; | |
1473 | |
1474 TRACE_FUNCTION("setatPercentSIMIND()"); | |
1475 | |
1476 /* parse mode */ | |
1477 cl = parse (cl, "d", &mode); | |
1478 | |
1479 if (mode EQ 0 OR mode EQ 1) | |
1480 { | |
1481 ati_user_output_cfg[srcId].SIMIND_stat = mode; | |
1482 return (ATI_CMPL); | |
1483 } | |
1484 else | |
1485 { | |
1486 cmdCmeError(CME_ERR_OpNotAllow); | |
1487 return (ATI_FAIL); | |
1488 } | |
1489 } | |
1490 | |
1491 /* | |
1492 +--------------------------------------------------------------------+ | |
1493 | PROJECT : GPRS (8441) MODULE : ACI_CMD | | |
1494 | STATE : code ROUTINE : queatPercentSIMIND | | |
1495 +--------------------------------------------------------------------+ | |
1496 | |
1497 PURPOSE : query status of %SIMINS / %SIMREM indications | |
1498 */ | |
1499 GLOBAL T_ATI_RSLT queatPercentSIMIND(char *cl, UBYTE srcId) | |
1500 { | |
1501 CHAR *me = "%SIMIND"; | |
1502 | |
1503 TRACE_FUNCTION("queatPercentSIMIND()"); | |
1504 | |
1505 sprintf(g_sa,"%s: %d", me, ati_user_output_cfg[srcId].SIMIND_stat); | |
1506 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT); | |
1507 | |
1508 return (ATI_CMPL); | |
1509 } | |
1510 | |
1511 #ifdef FF_DUAL_SIM | |
1512 /* | |
1513 +--------------------------------------------------------------------+ | |
1514 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
1515 | STATE : code ROUTINE : atPlusCFUN | | |
1516 +--------------------------------------------------------------------+ | |
1517 | |
1518 PURPOSE : %SIM command (SIM Selection) | |
1519 */ | |
1520 | |
1521 GLOBAL T_ATI_RSLT setatPercentSIM (char *cl, UBYTE srcId) | |
1522 { | |
1523 T_ACI_RETURN ret = AT_FAIL; | |
1524 UBYTE sim_num; | |
1525 | |
1526 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id); | |
1527 | |
1528 TRACE_FUNCTION("setatPercentSIM()"); | |
1529 | |
1530 /*input functionality*/ | |
1531 cl = parse (cl,"d",&sim_num); | |
1532 if ( !cl ) | |
1533 { | |
1534 cmdCmeError (CME_ERR_OpNotAllow); | |
1535 return(ATI_FAIL); | |
1536 } | |
1537 | |
1538 ret = sAT_PercentSIM (srcId,sim_num); | |
1539 switch (ret) | |
1540 { | |
1541 case AT_EXCT: /*Command is executing*/ | |
1542 src_params->curAtCmd = AT_CMD_SIM; | |
1543 break; | |
1544 | |
1545 case AT_FAIL: | |
1546 src_params->curAtCmd = AT_CMD_NONE; | |
1547 break; | |
1548 | |
1549 default: | |
1550 cmdCmeError(CME_ERR_Unknown); | |
1551 break; | |
1552 } | |
1553 return (map_aci_2_ati_rslt (ret)); | |
1554 } | |
1555 | |
1556 GLOBAL T_ATI_RSLT queatPercentSIM (char *cl, UBYTE srcId) | |
1557 { | |
1558 T_ACI_RETURN ret = AT_FAIL; | |
1559 UBYTE sim_num; | |
1560 | |
1561 TRACE_FUNCTION("queatPercentSIM()"); | |
1562 | |
1563 ret = qAT_PercentSIM(srcId, &sim_num); | |
1564 | |
1565 if (ret EQ AT_CMPL) | |
1566 { | |
1567 resp_disp(srcId, cl,"b",&sim_num); | |
1568 return ATI_CMPL; | |
1569 } | |
1570 else | |
1571 { | |
1572 cmdCmeError(CME_ERR_Unknown); | |
1573 return ATI_FAIL; | |
1574 } | |
1575 } | |
1576 #endif /*FF_DUAL_SIM*/ | |
1577 #endif /* ATI_SIM_C */ |