FreeCalypso > hg > freecalypso-sw
comparison gsm-fw/g23m-aci/aci/aci_bat_sim.c @ 775:eedbf248bac0
gsm-fw/g23m-aci subtree: initial import from LoCosto source
author | Michael Spacefalcon <msokolov@ivan.Harhan.ORG> |
---|---|
date | Sun, 12 Oct 2014 01:45:14 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
774:40a721fd9854 | 775:eedbf248bac0 |
---|---|
1 /* | |
2 +----------------------------------------------------------------------------- | |
3 | Project : GSM-F&D (8411) | |
4 | Modul : ACI_BAT | |
5 +----------------------------------------------------------------------------- | |
6 | Copyright 2002 Texas Instruments Berlin, AG | |
7 | All rights reserved. | |
8 | | |
9 | This file is confidential and a trade secret of Texas | |
10 | Instruments Berlin, AG | |
11 | The receipt of or possession of this file does not convey | |
12 | any rights to reproduce or disclose its contents or to | |
13 | manufacture, use, or sell anything it may describe, in | |
14 | whole, or in part, without the specific written consent of | |
15 | Texas Instruments Berlin, AG. | |
16 +----------------------------------------------------------------------------- | |
17 | Purpose : This BAT wrapper modul is ... | |
18 | | |
19 +----------------------------------------------------------------------------- | |
20 */ | |
21 | |
22 #include "aci_all.h" /* includes prim.h, which includes p_bat.h */ | |
23 #include "aci_cmh.h" /* prototypes of sAT_,qAT_,tAT_ */ | |
24 #include "aci_bat_cmh.h" /* prototypes of sBAT_,qBAT_,tBAT_ */ | |
25 #include "ati_cmd.h" | |
26 #include "aci_cmd.h" | |
27 #include "aci_bat.h" | |
28 #include "psa.h" | |
29 #include "cmh.h" | |
30 #include "audio.h" | |
31 #include "aci_ext_pers.h" | |
32 #include "aci_slock.h" | |
33 | |
34 | |
35 | |
36 /* | |
37 +--------------------------------------------------------------------+ | |
38 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT | | |
39 | STATE : code ROUTINE : sBAT_PlusCPIN | | |
40 +--------------------------------------------------------------------+ | |
41 | |
42 PURPOSE : | |
43 */ | |
44 GLOBAL T_ACI_BAT_RSLT sBAT_PlusCPIN (T_ACI_DTI_PRC_PSI *src_infos_psi, | |
45 T_BAT_cmd_send *cmd) | |
46 { | |
47 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL; | |
48 char pinOld [MAX_PWD_LENGTH]={0}; | |
49 char pinNew [MAX_PWD_LENGTH]={0}; | |
50 char* p_pinNew; | |
51 UBYTE slockBlocked = 0; | |
52 | |
53 TRACE_FUNCTION ("sBAT_PlusCPIN()"); | |
54 | |
55 p_pinNew = pinNew; | |
56 memset(pinOld,0,MAX_PWD_LENGTH); | |
57 | |
58 memcpy(pinOld,cmd->params.ptr_set_plus_cpin->pin,cmd->params.ptr_set_plus_cpin->c_pin); | |
59 if(cmd->params.ptr_set_plus_cpin->v_newpin) | |
60 { | |
61 memcpy(pinNew,cmd->params.ptr_set_plus_cpin->newpin,cmd->params.ptr_set_plus_cpin->c_newpin); | |
62 } | |
63 else | |
64 { | |
65 p_pinNew = NULL; | |
66 } | |
67 #ifdef SIM_PERS | |
68 slockBlocked = AciSLockShrd.blocked; | |
69 #endif | |
70 ret = (T_ACI_BAT_RSLT)sAT_PlusCPIN ((T_ACI_CMD_SRC)src_infos_psi->srcId,pinOld,p_pinNew); | |
71 | |
72 switch((T_ACI_RETURN)ret) | |
73 { | |
74 case(AT_EXCT): | |
75 case (AT_FAIL): | |
76 { | |
77 break; | |
78 } | |
79 case(AT_BUSY): | |
80 { | |
81 ACI_ERR_DESC(ACI_ERR_CLASS_Cme, CME_ERR_SimBusy); | |
82 break; | |
83 } | |
84 case(AT_CMPL): | |
85 { | |
86 if (!slockBlocked) | |
87 { | |
88 ACI_ERR_DESC(ACI_ERR_CLASS_Cme, CME_ERR_Unknown); | |
89 } | |
90 break; | |
91 } | |
92 } | |
93 return(ret); | |
94 } | |
95 | |
96 /* | |
97 +--------------------------------------------------------------------+ | |
98 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT | | |
99 | STATE : code ROUTINE : qBAT_PlusCPIN | | |
100 +--------------------------------------------------------------------+ | |
101 | |
102 PURPOSE : | |
103 */ | |
104 GLOBAL T_ACI_BAT_RSLT qBAT_PlusCPIN (T_ACI_DTI_PRC_PSI *src_infos_psi, | |
105 T_BAT_cmd_send *cmd) | |
106 { | |
107 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL; | |
108 T_ACI_CPIN_RSLT code; | |
109 T_BAT_cmd_response resp; | |
110 T_BAT_res_que_plus_cpin que_cpin_buffer; | |
111 | |
112 TRACE_FUNCTION ("qBAT_PlusCPIN()"); | |
113 | |
114 ret=(T_ACI_BAT_RSLT) qAT_PlusCPIN ((T_ACI_CMD_SRC)src_infos_psi->srcId,&code); | |
115 resp.ctrl_response = BAT_RES_QUE_PLUS_CPIN; /*PIN status is requested*/ | |
116 resp.response.ptr_que_plus_cpin = &que_cpin_buffer; | |
117 | |
118 switch ((T_ACI_RETURN)ret) | |
119 { | |
120 case(AT_CMPL): | |
121 { | |
122 resp.response.ptr_que_plus_cpin->code = (T_BAT_plus_cpin_code)code; | |
123 aci_bat_send(src_infos_psi,&resp); | |
124 break; | |
125 } | |
126 case(AT_EXCT): | |
127 default : | |
128 { | |
129 break; | |
130 } | |
131 } | |
132 return(ret); | |
133 } | |
134 | |
135 /* | |
136 +--------------------------------------------------------------------+ | |
137 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT | | |
138 | STATE : code ROUTINE : sBAT_PlusCPOL | | |
139 +--------------------------------------------------------------------+ | |
140 | |
141 PURPOSE : | |
142 */ | |
143 GLOBAL T_ACI_BAT_RSLT sBAT_PlusCPOL (T_ACI_DTI_PRC_PSI *src_infos_psi, | |
144 T_BAT_cmd_send *cmd) | |
145 { | |
146 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL; | |
147 T_BAT_plus_cpol_format format = BAT_CPOL_FORMAT_NOT_PRESENT ; | |
148 SHORT index = (SHORT)BAT_PARAMETER_NOT_PRESENT; | |
149 char op[20] = {0}; | |
150 char* p_op; | |
151 | |
152 TRACE_FUNCTION ("sBAT_PlusCPOL()"); | |
153 | |
154 p_op = op; | |
155 | |
156 index = cmd->params.ptr_set_plus_cpol->index; | |
157 format = cmd->params.ptr_set_plus_cpol->format; | |
158 if(cmd->params.ptr_set_plus_cpol->v_oper) | |
159 { | |
160 memcpy(op,cmd->params.ptr_set_plus_cpol->oper,cmd->params.ptr_set_plus_cpol->c_oper); | |
161 } | |
162 else | |
163 { | |
164 p_op = NULL; | |
165 } | |
166 | |
167 ret=(T_ACI_BAT_RSLT)sAT_PlusCPOL((T_ACI_CMD_SRC)src_infos_psi->srcId,index,(T_ACI_CPOL_FRMT)format,p_op, | |
168 (SHORT)BAT_PARAMETER_NOT_PRESENT,CPOL_MOD_NotPresent); | |
169 return(ret); | |
170 } | |
171 | |
172 /* | |
173 +--------------------------------------------------------------------+ | |
174 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT | | |
175 | STATE : code ROUTINE : tBAT_PlusCPOL | | |
176 +--------------------------------------------------------------------+ | |
177 | |
178 PURPOSE : | |
179 */ | |
180 GLOBAL T_ACI_BAT_RSLT tBAT_PlusCPOL (T_ACI_DTI_PRC_PSI *src_infos_psi, | |
181 T_BAT_cmd_send *cmd) | |
182 { | |
183 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL; | |
184 SHORT lastIdx=0,usdNtry=0; | |
185 T_BAT_cmd_response resp; | |
186 T_BAT_res_tst_plus_cpol tst_cpol_buffer; | |
187 | |
188 TRACE_FUNCTION ("tBAT_PlusCPOL()"); | |
189 resp.ctrl_response = BAT_RES_TST_PLUS_CPOL; | |
190 resp.response.ptr_tst_plus_cpol = &tst_cpol_buffer; | |
191 | |
192 ret =(T_ACI_BAT_RSLT) tAT_PlusCPOL((T_ACI_CMD_SRC)src_infos_psi->srcId,&lastIdx,&usdNtry); | |
193 if (ret EQ ((T_ACI_BAT_RSLT)AT_CMPL)) | |
194 { | |
195 resp.response.ptr_tst_plus_cpol->index1 = 1; | |
196 resp.response.ptr_tst_plus_cpol->index2 = lastIdx; | |
197 aci_bat_send(src_infos_psi,&resp); | |
198 } | |
199 return ret; | |
200 } | |
201 | |
202 /* | |
203 +--------------------------------------------------------------------+ | |
204 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT | | |
205 | STATE : code ROUTINE : qBAT_PlusCPOL | | |
206 +--------------------------------------------------------------------+ | |
207 | |
208 PURPOSE : | |
209 */ | |
210 GLOBAL T_ACI_BAT_RSLT qBAT_PlusCPOL (T_ACI_DTI_PRC_PSI *src_infos_psi, | |
211 T_BAT_cmd_send *cmd) | |
212 { | |
213 //T_ACI_BAT_RSLT ret = ACI_BAT_FAIL; | |
214 T_ACI_CPOL_LST plmnSelLst; | |
215 T_BAT_cmd_response resp; | |
216 T_BAT_res_que_plus_cpol que_cpol_buffer; | |
217 SHORT startIdx=0,lastIdx=0; | |
218 UBYTE idx; | |
219 BOOL loop; | |
220 | |
221 TRACE_FUNCTION ("qBAT_PlusCPOL()"); | |
222 resp.ctrl_response = BAT_RES_QUE_PLUS_CPOL; | |
223 resp.response.ptr_que_plus_cpol = &que_cpol_buffer; | |
224 | |
225 switch (qAT_PlusCPOL ((T_ACI_CMD_SRC) src_infos_psi->srcId,1, &lastIdx,&plmnSelLst[0],CPOL_MOD_NotPresent)) | |
226 { | |
227 case AT_CMPL: | |
228 { | |
229 loop = TRUE; | |
230 do | |
231 { | |
232 if( lastIdx EQ (SHORT)BAT_PARAMETER_NOT_PRESENT ) | |
233 { | |
234 break; | |
235 } | |
236 startIdx = lastIdx+1; | |
237 | |
238 for( idx=0; idx < MAX_OPER; idx++ ) | |
239 { | |
240 if( plmnSelLst[idx].index EQ (SHORT)BAT_PARAMETER_NOT_PRESENT ) | |
241 { | |
242 loop = FALSE; | |
243 break; | |
244 } | |
245 resp.response.ptr_que_plus_cpol->format = (T_BAT_plus_cpol_format)plmnSelLst[idx].format; | |
246 resp.response.ptr_que_plus_cpol->index = (U8)plmnSelLst[idx].index; | |
247 resp.response.ptr_que_plus_cpol->c_oper = strlen(plmnSelLst[idx].oper); | |
248 memcpy(resp.response.ptr_que_plus_cpol->oper,plmnSelLst[idx].oper,strlen(plmnSelLst[idx].oper)); | |
249 aci_bat_send(src_infos_psi,&resp); | |
250 } | |
251 | |
252 if( qAT_PlusCPOL((T_ACI_CMD_SRC)src_infos_psi->srcId, startIdx, &lastIdx, &plmnSelLst[0], | |
253 CPOL_MOD_NotPresent) EQ AT_FAIL OR !loop) | |
254 { | |
255 break; | |
256 } | |
257 } | |
258 while( loop ); | |
259 return ACI_BAT_CMPL; | |
260 } | |
261 | |
262 case AT_EXCT: | |
263 { | |
264 return ACI_BAT_EXCT; | |
265 } | |
266 | |
267 default: | |
268 { | |
269 return ACI_BAT_FAIL; | |
270 } | |
271 } | |
272 } | |
273 | |
274 /* | |
275 +--------------------------------------------------------------------+ | |
276 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT | | |
277 | STATE : code ROUTINE : sBAT_PlusCNUM | | |
278 +--------------------------------------------------------------------+ | |
279 | |
280 PURPOSE : | |
281 */ | |
282 GLOBAL T_ACI_BAT_RSLT sBAT_PlusCNUM (T_ACI_DTI_PRC_PSI *src_infos_psi, | |
283 T_BAT_cmd_send *cmd) | |
284 { | |
285 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL; | |
286 | |
287 TRACE_FUNCTION ("sBAT_PlusCNUM()"); | |
288 | |
289 if(qAT_PlusCNUM ((T_ACI_CMD_SRC) src_infos_psi->srcId, CNUM_MOD_NewRead) EQ AT_EXCT) | |
290 { | |
291 return ACI_BAT_EXCT; | |
292 } | |
293 return ret; | |
294 } | |
295 | |
296 /* | |
297 +--------------------------------------------------------------------+ | |
298 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT | | |
299 | STATE : code ROUTINE : sBAT_PlusCFUN | | |
300 +--------------------------------------------------------------------+ | |
301 | |
302 PURPOSE : | |
303 */ | |
304 GLOBAL T_ACI_BAT_RSLT sBAT_PlusCFUN (T_ACI_DTI_PRC_PSI *src_infos_psi, | |
305 T_BAT_cmd_send *cmd) | |
306 { | |
307 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL; | |
308 T_BAT_plus_cfun_fun fun = BAT_CFUN_FUN_NOT_PRESENT; | |
309 T_BAT_plus_cfun_rst rst = BAT_CFUN_RST_NOT_PRESENT; | |
310 | |
311 TRACE_FUNCTION ("sBAT_PlusCFUN()"); | |
312 | |
313 /* | |
314 * This relies on T_BAT_VAL_plus_cfun_fun being identical to | |
315 * T_ACI_CFUN_FUN and T_BAT_VAL_plus_cfun_rst being identical | |
316 * to T_ACI_CFUN_RST. At the time of writing, they are. | |
317 */ | |
318 fun=cmd->params.ptr_set_plus_cfun->fun; | |
319 rst=cmd->params.ptr_set_plus_cfun->rst; | |
320 | |
321 /* | |
322 * Call the corresponding sAT function. T_ACI_BAT_RSLT is | |
323 * assumed to be equivalent to T_ACI_RESULT. | |
324 */ | |
325 ret=(T_ACI_BAT_RSLT)sAT_PlusCFUN((T_ACI_CMD_SRC)src_infos_psi->srcId,(T_ACI_CFUN_FUN)fun,(T_ACI_CFUN_RST)rst); | |
326 | |
327 return(ret); | |
328 } | |
329 | |
330 /* | |
331 +--------------------------------------------------------------------+ | |
332 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT | | |
333 | STATE : code ROUTINE : qBAT_PlusCFUN | | |
334 +--------------------------------------------------------------------+ | |
335 | |
336 PURPOSE : | |
337 */ | |
338 GLOBAL T_ACI_BAT_RSLT qBAT_PlusCFUN (T_ACI_DTI_PRC_PSI *src_infos_psi, | |
339 T_BAT_cmd_send *cmd) | |
340 { | |
341 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL; | |
342 T_ACI_CFUN_FUN fun; | |
343 | |
344 TRACE_FUNCTION ("qBAT_PlusCFUN()"); | |
345 | |
346 /* | |
347 * Call the corresponding sAT function. T_ACI_BAT_RSLT is | |
348 * assumed to be equivalent to T_ACI_RESULT. | |
349 */ | |
350 ret=(T_ACI_BAT_RSLT)qAT_PlusCFUN((T_ACI_CMD_SRC)src_infos_psi->srcId,&fun); | |
351 | |
352 /* | |
353 * If the query completes, we must send a response. | |
354 */ | |
355 if (ret==ACI_BAT_CMPL) | |
356 { | |
357 T_BAT_cmd_response resp; | |
358 T_BAT_res_que_plus_cfun cfun_data; | |
359 | |
360 resp.ctrl_response=BAT_RES_QUE_PLUS_CFUN; | |
361 resp.response.ptr_que_plus_cfun=&cfun_data; | |
362 | |
363 /* | |
364 * This relies on T_BAT_plus_cfun_fun being identical to | |
365 * T_ACI_CFUN_FUN. | |
366 */ | |
367 cfun_data.fun=(T_BAT_plus_cfun_fun)fun; | |
368 | |
369 aci_bat_send(src_infos_psi,&resp); | |
370 } | |
371 | |
372 return(ret); | |
373 } | |
374 | |
375 /* | |
376 +--------------------------------------------------------------------+ | |
377 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT | | |
378 | STATE : code ROUTINE : sBAT_PlusCIMI | | |
379 +--------------------------------------------------------------------+ | |
380 | |
381 PURPOSE : | |
382 */ | |
383 GLOBAL T_ACI_BAT_RSLT sBAT_PlusCIMI (T_ACI_DTI_PRC_PSI *src_infos_psi, | |
384 T_BAT_cmd_send *cmd) | |
385 { | |
386 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL; | |
387 CHAR imsi[MAX_IMSI_LEN+1]; | |
388 T_BAT_cmd_response resp; | |
389 T_BAT_res_set_plus_cimi set_cimi_buffer; | |
390 | |
391 TRACE_FUNCTION ("sBAT_PlusCIMI()"); | |
392 | |
393 resp.ctrl_response = BAT_RES_SET_PLUS_CIMI ; | |
394 resp.response.ptr_set_plus_cimi = &set_cimi_buffer; | |
395 | |
396 ret =(T_ACI_BAT_RSLT) qAT_PlusCIMI((T_ACI_CMD_SRC)src_infos_psi->srcId, imsi); | |
397 if (ret EQ ACI_BAT_CMPL) | |
398 { | |
399 resp.response.ptr_set_plus_cimi->c_imsi = strlen(imsi); | |
400 memcpy(resp.response.ptr_set_plus_cimi->imsi,imsi,resp.response.ptr_set_plus_cimi->c_imsi); | |
401 aci_bat_send(src_infos_psi,&resp); | |
402 } | |
403 return ret; | |
404 } | |
405 | |
406 /* | |
407 +--------------------------------------------------------------------+ | |
408 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT | | |
409 | STATE : code ROUTINE : sBAT_PlusCRSM | | |
410 +--------------------------------------------------------------------+ | |
411 | |
412 PURPOSE : | |
413 */ | |
414 GLOBAL T_ACI_BAT_RSLT sBAT_PlusCRSM (T_ACI_DTI_PRC_PSI *src_infos_psi, | |
415 T_BAT_cmd_send *cmd) | |
416 { | |
417 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL; | |
418 T_BAT_plus_crsm_command command; | |
419 UBYTE *data; | |
420 SHORT fileId = (SHORT)BAT_PARAMETER_NOT_PRESENT, | |
421 p1 = (SHORT)BAT_PARAMETER_NOT_PRESENT, | |
422 p2 = (SHORT)BAT_PARAMETER_NOT_PRESENT, | |
423 p3 = (SHORT)BAT_PARAMETER_NOT_PRESENT; | |
424 | |
425 TRACE_FUNCTION ("sBAT_PlusCRSM()"); | |
426 | |
427 command = cmd->params.ptr_set_plus_crsm->command; | |
428 if(cmd->params.ptr_set_plus_crsm->fileid NEQ (S32)BAT_PARAMETER_NOT_PRESENT) | |
429 { | |
430 fileId = (SHORT)cmd->params.ptr_set_plus_crsm->fileid; | |
431 } | |
432 p1 = cmd->params.ptr_set_plus_crsm->p1; | |
433 p2 = cmd->params.ptr_set_plus_crsm->p2; | |
434 p3 = cmd->params.ptr_set_plus_crsm->p3; | |
435 data = cmd->params.ptr_set_plus_crsm->data; | |
436 | |
437 ret=(T_ACI_BAT_RSLT)sAT_PlusCRSM( | |
438 (T_ACI_CMD_SRC)src_infos_psi->srcId, | |
439 (T_ACI_CRSM_CMD)command, | |
440 fileId, | |
441 p1,p2,p3, | |
442 (SHORT)cmd->params.ptr_set_plus_crsm->c_data, | |
443 data); | |
444 | |
445 return(ret); | |
446 } | |
447 | |
448 /* | |
449 +--------------------------------------------------------------------+ | |
450 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT | | |
451 | STATE : code ROUTINE : sBAT_PlusCSIM | | |
452 +--------------------------------------------------------------------+ | |
453 | |
454 PURPOSE : | |
455 */ | |
456 GLOBAL T_ACI_BAT_RSLT sBAT_PlusCSIM (T_ACI_DTI_PRC_PSI *src_infos_psi, | |
457 T_BAT_cmd_send *cmd) | |
458 { | |
459 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL; | |
460 UBYTE *data; | |
461 USHORT lenData = 0; | |
462 | |
463 TRACE_FUNCTION ("sBAT_PlusCSIM()"); | |
464 | |
465 data = cmd->params.ptr_set_plus_csim->command; | |
466 lenData=(USHORT)cmd->params.ptr_set_plus_csim->c_command; | |
467 | |
468 if (lenData EQ 0) | |
469 return ACI_BAT_FAIL; | |
470 | |
471 ret =(T_ACI_BAT_RSLT) sAT_PlusCSIM((T_ACI_CMD_SRC) src_infos_psi->srcId, lenData, data ); | |
472 | |
473 return ret; | |
474 } | |
475 | |
476 #ifdef TI_PS_FF_AT_P_CMD_ATR | |
477 /* | |
478 +--------------------------------------------------------------------+ | |
479 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT | | |
480 | STATE : code ROUTINE : qBAT_PercentATR | | |
481 +--------------------------------------------------------------------+ | |
482 | |
483 PURPOSE : | |
484 */ | |
485 GLOBAL T_ACI_BAT_RSLT qBAT_PercentATR (T_ACI_DTI_PRC_PSI *src_infos_psi, | |
486 T_BAT_cmd_send *cmd) | |
487 { | |
488 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL; | |
489 UBYTE phase; | |
490 UBYTE atr_len; | |
491 UBYTE atr_info[MAX_SIM_ATR]; | |
492 T_BAT_cmd_response resp; | |
493 T_BAT_res_que_percent_atr que_atr_buffer; | |
494 | |
495 TRACE_FUNCTION ("qBAT_PercentATR()"); | |
496 resp.ctrl_response = BAT_RES_QUE_PERCENT_ATR ; | |
497 resp.response.ptr_que_percent_atr = &que_atr_buffer; | |
498 | |
499 ret =(T_ACI_BAT_RSLT) qAT_PercentATR((T_ACI_CMD_SRC) src_infos_psi->srcId, &phase, &atr_len, atr_info ); | |
500 if(ret EQ ACI_BAT_CMPL) | |
501 { | |
502 resp.response.ptr_que_percent_atr->phase = (T_BAT_percent_atr_phase)phase ; | |
503 resp.response.ptr_que_percent_atr->c_atr = atr_len; | |
504 memcpy(resp.response.ptr_que_percent_atr->atr,atr_info,resp.response.ptr_que_percent_atr->c_atr); | |
505 aci_bat_send(src_infos_psi,&resp); | |
506 } | |
507 return(ret); | |
508 } | |
509 #endif /* TI_PS_FF_AT_P_CMD_ATR */ | |
510 | |
511 /* | |
512 +--------------------------------------------------------------------+ | |
513 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT | | |
514 | STATE : code ROUTINE : sBAT_PercentPVRF | | |
515 +--------------------------------------------------------------------+ | |
516 | |
517 PURPOSE : | |
518 */ | |
519 GLOBAL T_ACI_BAT_RSLT sBAT_PercentPVRF (T_ACI_DTI_PRC_PSI *src_infos_psi, | |
520 T_BAT_cmd_send *cmd) | |
521 { | |
522 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL; | |
523 CHAR pin[10]; | |
524 CHAR newpin[10]; | |
525 CHAR* p_newpin; | |
526 | |
527 TRACE_FUNCTION ("sBAT_PercentPVRF()"); | |
528 | |
529 p_newpin = newpin; | |
530 memset(pin,0,sizeof(pin)); | |
531 | |
532 if (cmd->params.ptr_set_percent_pvrf->type <= BAT_P_PVRF_TYPE_PUK2)/*lint !e685 (Warning : always evaluates to false)*/ | |
533 { | |
534 | |
535 memcpy(pin,cmd->params.ptr_set_percent_pvrf->pin,cmd->params.ptr_set_percent_pvrf->c_pin); | |
536 if(cmd->params.ptr_set_percent_pvrf->v_newpin) | |
537 { | |
538 memcpy(newpin,cmd->params.ptr_set_percent_pvrf->newpin,cmd->params.ptr_set_percent_pvrf->c_newpin); | |
539 } | |
540 else | |
541 { | |
542 p_newpin = NULL; | |
543 } | |
544 ret =(T_ACI_BAT_RSLT) sAT_PercentPVRF ((T_ACI_CMD_SRC)src_infos_psi->srcId,(T_ACI_PVRF_TYPE)cmd->params.ptr_set_percent_pvrf->type, pin, p_newpin); | |
545 return(ret); | |
546 } | |
547 else | |
548 { | |
549 ACI_ERR_DESC(ACI_ERR_CLASS_Cme,CME_ERR_OpNotAllow); | |
550 return (ACI_BAT_FAIL); | |
551 } | |
552 } | |
553 | |
554 /* | |
555 +--------------------------------------------------------------------+ | |
556 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT | | |
557 | STATE : code ROUTINE : qBAT_PercentPVRF | | |
558 +--------------------------------------------------------------------+ | |
559 | |
560 PURPOSE : | |
561 */ | |
562 GLOBAL T_ACI_BAT_RSLT qBAT_PercentPVRF (T_ACI_DTI_PRC_PSI *src_infos_psi, | |
563 T_BAT_cmd_send *cmd) | |
564 { | |
565 T_BAT_cmd_response resp; | |
566 T_BAT_res_que_percent_pvrf que_pvrf_buffer; | |
567 SHORT pn2cnt = 0; | |
568 SHORT pk1cnt = 0; | |
569 SHORT pk2cnt = 0; | |
570 T_BAT_percent_pvrf_ps1 ps1 = BAT_P_PVRF_PS1_NOT_PRESENT ; | |
571 T_BAT_percent_pvrf_ps2 ps2 = BAT_P_PVRF_PS2_NOT_PRESENT ; | |
572 | |
573 TRACE_FUNCTION ("qBAT_PercentPVRF()"); | |
574 | |
575 resp.ctrl_response = BAT_RES_QUE_PERCENT_PVRF ; | |
576 resp.response.ptr_que_percent_pvrf = &que_pvrf_buffer; | |
577 | |
578 resp.response.ptr_que_percent_pvrf->pn2cnt = pn2cnt; | |
579 resp.response.ptr_que_percent_pvrf->pk1cnt = pk1cnt; | |
580 resp.response.ptr_que_percent_pvrf->pk2cnt = pk2cnt; | |
581 resp.response.ptr_que_percent_pvrf->ps1 = ps1; | |
582 resp.response.ptr_que_percent_pvrf->ps2 = ps2; | |
583 | |
584 aci_bat_send(src_infos_psi,&resp); | |
585 return (ACI_BAT_CMPL); | |
586 } | |
587 | |
588 #ifdef TI_PS_FF_AT_P_CMD_CUST | |
589 /* | |
590 +--------------------------------------------------------------------+ | |
591 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT | | |
592 | STATE : code ROUTINE : sBAT_PercentCUST | | |
593 +--------------------------------------------------------------------+ | |
594 | |
595 PURPOSE : | |
596 */ | |
597 GLOBAL T_ACI_BAT_RSLT sBAT_PercentCUST (T_ACI_DTI_PRC_PSI *src_infos_psi, | |
598 T_BAT_cmd_send *cmd) | |
599 { | |
600 TRACE_FUNCTION ("sBAT_PercentCUST()"); | |
601 | |
602 switch(cmd->params.ptr_set_percent_cust->mode) | |
603 { | |
604 case(BAT_P_CUST_MODE_NORMAL): | |
605 case(BAT_P_CUST_MODE_BEHAVIOUR_1): | |
606 { | |
607 if (sAT_PercentCUST((T_ACI_CMD_SRC)src_infos_psi->srcId, (T_CUST_MOD)(cmd->params.ptr_set_percent_cust->mode)) EQ AT_FAIL) | |
608 { | |
609 return (ACI_BAT_FAIL); | |
610 } | |
611 break; | |
612 } | |
613 default: | |
614 { | |
615 ACI_ERR_DESC(ACI_ERR_CLASS_Cme,CME_ERR_Unknown); | |
616 return (ACI_BAT_FAIL); | |
617 } | |
618 } | |
619 return ACI_BAT_CMPL; | |
620 } | |
621 | |
622 /* | |
623 +--------------------------------------------------------------------+ | |
624 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT | | |
625 | STATE : code ROUTINE : qBAT_PercentCUST | | |
626 +--------------------------------------------------------------------+ | |
627 | |
628 PURPOSE : | |
629 */ | |
630 GLOBAL T_ACI_BAT_RSLT qBAT_PercentCUST (T_ACI_DTI_PRC_PSI *src_infos_psi, | |
631 T_BAT_cmd_send *cmd) | |
632 { | |
633 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL; | |
634 T_BAT_percent_cust_mode mode; | |
635 T_BAT_cmd_response resp; | |
636 T_BAT_res_que_percent_cust que_cust_buffer; | |
637 | |
638 TRACE_FUNCTION ("qBAT_PercentCUST()"); | |
639 | |
640 resp.ctrl_response = BAT_RES_QUE_PERCENT_CUST; | |
641 resp.response.ptr_que_percent_cust = &que_cust_buffer; | |
642 | |
643 ret = (T_ACI_BAT_RSLT)qAT_PercentCUST((T_ACI_CMD_SRC)src_infos_psi->srcId,(T_CUST_MOD *)&mode); | |
644 if (ret NEQ ACI_BAT_CMPL) | |
645 { | |
646 return (ACI_BAT_FAIL); | |
647 } | |
648 resp.response.ptr_que_percent_cust->mode = mode; | |
649 aci_bat_send(src_infos_psi,&resp); | |
650 return(ret); | |
651 } | |
652 #endif /* TI_PS_FF_AT_P_CMD_CUST */ | |
653 | |
654 /* | |
655 +--------------------------------------------------------------------+ | |
656 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT | | |
657 | STATE : code ROUTINE : sBAT_PercentSATCC | | |
658 +--------------------------------------------------------------------+ | |
659 | |
660 PURPOSE : | |
661 */ | |
662 GLOBAL T_ACI_BAT_RSLT sBAT_PercentSATCC (T_ACI_DTI_PRC_PSI *src_infos_psi, | |
663 T_BAT_cmd_send *cmd) | |
664 { | |
665 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL; | |
666 | |
667 TRACE_FUNCTION ("sBAT_PercentSATCC()"); | |
668 | |
669 ret = (T_ACI_BAT_RSLT)sAT_PercentSATCC((T_ACI_CMD_SRC)src_infos_psi->srcId, (T_SAT_CC_MOD)cmd->params.ptr_set_percent_satcc->mode); | |
670 | |
671 return ret; | |
672 } | |
673 | |
674 | |
675 /* | |
676 +--------------------------------------------------------------------+ | |
677 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT | | |
678 | STATE : code ROUTINE : qBAT_PercentSATCC | | |
679 +--------------------------------------------------------------------+ | |
680 | |
681 PURPOSE : | |
682 */ | |
683 GLOBAL T_ACI_BAT_RSLT qBAT_PercentSATCC (T_ACI_DTI_PRC_PSI *src_infos_psi, | |
684 T_BAT_cmd_send *cmd) | |
685 { | |
686 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL; | |
687 T_BAT_percent_satcc_mode mode; | |
688 T_BAT_cmd_response resp; | |
689 T_BAT_res_que_percent_satcc que_satcc_buffer; | |
690 | |
691 TRACE_FUNCTION ("qBAT_PercentSATCC()"); | |
692 | |
693 resp.ctrl_response = BAT_RES_QUE_PERCENT_SATCC; | |
694 | |
695 resp.response.ptr_que_percent_satcc = &que_satcc_buffer; | |
696 | |
697 ret = (T_ACI_BAT_RSLT)qAT_PercentSATCC((T_ACI_CMD_SRC)src_infos_psi->srcId,(T_SAT_CC_MOD *)&mode); | |
698 | |
699 if(ret EQ ACI_BAT_CMPL) | |
700 { | |
701 resp.response.ptr_que_percent_satcc->mode = mode; | |
702 aci_bat_send(src_infos_psi,&resp); | |
703 } | |
704 | |
705 return(ret); | |
706 } | |
707 | |
708 | |
709 /* | |
710 +--------------------------------------------------------------------+ | |
711 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT | | |
712 | STATE : code ROUTINE : sBAT_PlusEFRSLT | | |
713 +--------------------------------------------------------------------+ | |
714 | |
715 PURPOSE : | |
716 */ | |
717 GLOBAL T_ACI_BAT_RSLT sBAT_PercentEFRSLT (T_ACI_DTI_PRC_PSI *src_infos_psi, | |
718 T_BAT_cmd_send *cmd) | |
719 { | |
720 T_ACI_EFRSLT_RES result; | |
721 T_ACI_BAT_RSLT ret; | |
722 | |
723 TRACE_FUNCTION ("sBAT_PercentEFRSLT()"); | |
724 | |
725 /* | |
726 * This relies on T_BAT_percent_efrslt_result being identical to | |
727 * T_ACI_EFRSLT_RES. | |
728 */ | |
729 result=(T_ACI_EFRSLT_RES)cmd->params.ptr_set_percent_efrslt->result; | |
730 | |
731 /* | |
732 * Call the corresponding ACI function. T_ACI_BAT_RSLT is | |
733 * assumed to be equivalent to T_ACI_RESULT. | |
734 */ | |
735 ret=(T_ACI_BAT_RSLT)sAT_PercentEFRSLT((T_ACI_CMD_SRC)src_infos_psi->srcId,result); | |
736 | |
737 return(ret); | |
738 } | |
739 | |
740 /* | |
741 +--------------------------------------------------------------------+ | |
742 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT | | |
743 | STATE : code ROUTINE : sBAT_PercentSIMEF | | |
744 +--------------------------------------------------------------------+ | |
745 | |
746 PURPOSE : | |
747 */ | |
748 GLOBAL T_ACI_BAT_RSLT sBAT_PercentSIMEF (T_ACI_DTI_PRC_PSI *src_infos_psi, | |
749 T_BAT_cmd_send *cmd) | |
750 { | |
751 T_ACI_SIMEF_MODE mode; | |
752 T_ACI_BAT_RSLT ret; | |
753 | |
754 TRACE_FUNCTION ("sBAT_PercentSIMEF()"); | |
755 | |
756 /* | |
757 * This relies on T_BAT_percent_simef_mode being identical to | |
758 * T_ACI_SIMEF_MODE. | |
759 */ | |
760 mode=(T_ACI_SIMEF_MODE)cmd->params.ptr_set_percent_simef->mode; | |
761 | |
762 /* | |
763 * Call the corresponding ACI function. T_ACI_BAT_RSLT is | |
764 * assumed to be equivalent to T_ACI_RESULT. | |
765 */ | |
766 ret=(T_ACI_BAT_RSLT)sAT_PercentSIMEF((T_ACI_CMD_SRC)src_infos_psi->srcId,mode); | |
767 | |
768 return(ret); | |
769 } | |
770 | |
771 /* | |
772 +--------------------------------------------------------------------+ | |
773 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT | | |
774 | STATE : code ROUTINE : qBAT_PercentSIMEF | | |
775 +--------------------------------------------------------------------+ | |
776 | |
777 PURPOSE : | |
778 */ | |
779 GLOBAL T_ACI_BAT_RSLT qBAT_PercentSIMEF (T_ACI_DTI_PRC_PSI *src_infos_psi, | |
780 T_BAT_cmd_send *cmd) | |
781 { | |
782 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL; | |
783 T_BAT_percent_simef_mode mode; | |
784 T_BAT_cmd_response resp; | |
785 T_BAT_res_que_percent_simef que_simef_buffer; | |
786 | |
787 TRACE_FUNCTION ("qBAT_PercentSIMEF()"); | |
788 | |
789 resp.ctrl_response = BAT_RES_QUE_PERCENT_SIMEF; | |
790 | |
791 resp.response.ptr_res_que_percent_simef = &que_simef_buffer; | |
792 | |
793 ret = (T_ACI_BAT_RSLT)qAT_PercentSIMEF((T_ACI_CMD_SRC)src_infos_psi->srcId,(T_ACI_SIMEF_MODE *)&mode); | |
794 | |
795 if(ret EQ ACI_BAT_CMPL) | |
796 { | |
797 resp.response.ptr_res_que_percent_simef->mode = mode; | |
798 aci_bat_send(src_infos_psi,&resp); | |
799 } | |
800 | |
801 return(ret); | |
802 } |