FreeCalypso > hg > fc-magnetite
comparison src/aci2/aci/aci_bat_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 : 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 = sAT_PlusCPIN (src_infos_psi->srcId,pinOld,p_pinNew); | |
71 | |
72 switch(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= qAT_PlusCPIN (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 (ret) | |
119 { | |
120 case(AT_CMPL): | |
121 { | |
122 resp.response.ptr_que_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=sAT_PlusCPOL(src_infos_psi->srcId,index,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 = tAT_PlusCPOL(src_infos_psi->srcId,&lastIdx,&usdNtry); | |
193 if (ret EQ 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 ( 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 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 BAT_PARAMETER_NOT_PRESENT ) | |
241 { | |
242 loop = FALSE; | |
243 break; | |
244 } | |
245 resp.response.ptr_que_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(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 ( 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=(T_ACI_CFUN_FUN)cmd->params.ptr_set_plus_cfun->fun; | |
319 rst=(T_ACI_CFUN_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(src_infos_psi->srcId,fun,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(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 = qAT_PlusCIMI(src_infos_psi->srcId, imsi); | |
397 if (ret EQ AT_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 USHORT lenData = 0; | |
421 SHORT fileId = (SHORT)BAT_PARAMETER_NOT_PRESENT, | |
422 p1 = (SHORT)BAT_PARAMETER_NOT_PRESENT, | |
423 p2 = (SHORT)BAT_PARAMETER_NOT_PRESENT, | |
424 p3 = (SHORT)BAT_PARAMETER_NOT_PRESENT; | |
425 | |
426 TRACE_FUNCTION ("sBAT_PlusCRSM()"); | |
427 | |
428 command = cmd->params.ptr_set_plus_crsm->command; | |
429 if(cmd->params.ptr_set_plus_crsm->fileid NEQ BAT_PARAMETER_NOT_PRESENT) | |
430 { | |
431 fileId = (SHORT)cmd->params.ptr_set_plus_crsm->fileid; | |
432 } | |
433 p1 = cmd->params.ptr_set_plus_crsm->p1; | |
434 p2 = cmd->params.ptr_set_plus_crsm->p2; | |
435 p3 = cmd->params.ptr_set_plus_crsm->p3; | |
436 data = cmd->params.ptr_set_plus_crsm->data; | |
437 | |
438 ret=sAT_PlusCRSM( | |
439 src_infos_psi->srcId, | |
440 command, | |
441 fileId, | |
442 p1,p2,p3, | |
443 (SHORT)cmd->params.ptr_set_plus_crsm->c_data, | |
444 data); | |
445 | |
446 return(ret); | |
447 } | |
448 | |
449 /* | |
450 +--------------------------------------------------------------------+ | |
451 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT | | |
452 | STATE : code ROUTINE : sBAT_PlusCSIM | | |
453 +--------------------------------------------------------------------+ | |
454 | |
455 PURPOSE : | |
456 */ | |
457 GLOBAL T_ACI_BAT_RSLT sBAT_PlusCSIM (T_ACI_DTI_PRC_PSI *src_infos_psi, | |
458 T_BAT_cmd_send *cmd) | |
459 { | |
460 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL; | |
461 UBYTE *data; | |
462 USHORT lenData = 0; | |
463 | |
464 TRACE_FUNCTION ("sBAT_PlusCSIM()"); | |
465 | |
466 data = cmd->params.ptr_set_plus_csim->command; | |
467 lenData=(USHORT)cmd->params.ptr_set_plus_csim->c_command; | |
468 | |
469 if (lenData EQ 0) | |
470 return ACI_BAT_FAIL; | |
471 | |
472 ret = sAT_PlusCSIM( src_infos_psi->srcId, lenData, data ); | |
473 | |
474 return ret; | |
475 } | |
476 | |
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 = qAT_PercentATR( src_infos_psi->srcId, &phase, &atr_len, atr_info ); | |
500 if(ret EQ AT_CMPL) | |
501 { | |
502 resp.response.ptr_que_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 | |
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) | |
533 { | |
534 ACI_ERR_DESC(ACI_ERR_CLASS_Cme,CME_ERR_OpNotAllow); | |
535 return (ACI_BAT_FAIL); | |
536 } | |
537 memcpy(pin,cmd->params.ptr_set_percent_pvrf->pin,cmd->params.ptr_set_percent_pvrf->c_pin); | |
538 if(cmd->params.ptr_set_percent_pvrf->v_newpin) | |
539 { | |
540 memcpy(newpin,cmd->params.ptr_set_percent_pvrf->newpin,cmd->params.ptr_set_percent_pvrf->c_newpin); | |
541 } | |
542 else | |
543 { | |
544 p_newpin = NULL; | |
545 } | |
546 ret = sAT_PercentPVRF (src_infos_psi->srcId,cmd->params.ptr_set_percent_pvrf->type, pin, p_newpin); | |
547 return(ret); | |
548 } | |
549 | |
550 /* | |
551 +--------------------------------------------------------------------+ | |
552 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT | | |
553 | STATE : code ROUTINE : qBAT_PercentPVRF | | |
554 +--------------------------------------------------------------------+ | |
555 | |
556 PURPOSE : | |
557 */ | |
558 GLOBAL T_ACI_BAT_RSLT qBAT_PercentPVRF (T_ACI_DTI_PRC_PSI *src_infos_psi, | |
559 T_BAT_cmd_send *cmd) | |
560 { | |
561 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL; | |
562 T_BAT_cmd_response resp; | |
563 T_BAT_res_que_percent_pvrf que_pvrf_buffer; | |
564 SHORT pn1cnt = 0; | |
565 SHORT pn2cnt = 0; | |
566 SHORT pk1cnt = 0; | |
567 SHORT pk2cnt = 0; | |
568 T_BAT_percent_pvrf_ps1 ps1 = BAT_P_PVRF_PS1_NOT_PRESENT ; | |
569 T_BAT_percent_pvrf_ps2 ps2 = BAT_P_PVRF_PS1_NOT_PRESENT ; | |
570 | |
571 TRACE_FUNCTION ("qBAT_PercentPVRF()"); | |
572 | |
573 resp.ctrl_response = BAT_RES_QUE_PERCENT_PVRF ; | |
574 resp.response.ptr_que_percent_pvrf = &que_pvrf_buffer; | |
575 | |
576 ret = qAT_PercentPVRF(src_infos_psi->srcId, &pn1cnt, &pn2cnt, &pk1cnt, &pk2cnt,(T_ACI_PVRF_STAT *)&ps1,(T_ACI_PVRF_STAT *)&ps2); | |
577 resp.response.ptr_que_percent_pvrf->pn1cnt = pn1cnt; | |
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 /* | |
589 +--------------------------------------------------------------------+ | |
590 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT | | |
591 | STATE : code ROUTINE : sBAT_PercentCUST | | |
592 +--------------------------------------------------------------------+ | |
593 | |
594 PURPOSE : | |
595 */ | |
596 GLOBAL T_ACI_BAT_RSLT sBAT_PercentCUST (T_ACI_DTI_PRC_PSI *src_infos_psi, | |
597 T_BAT_cmd_send *cmd) | |
598 { | |
599 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL; | |
600 | |
601 TRACE_FUNCTION ("sBAT_PercentCUST()"); | |
602 | |
603 switch(cmd->params.ptr_set_percent_cust->mode) | |
604 { | |
605 case(BAT_P_CUST_MODE_NORMAL): | |
606 case(BAT_P_CUST_MODE_BEHAVIOUR_1): | |
607 { | |
608 if (sAT_PercentCUST(src_infos_psi->srcId, (UBYTE)(cmd->params.ptr_set_percent_cust->mode)) EQ AT_FAIL) | |
609 { | |
610 return (ACI_BAT_FAIL); | |
611 } | |
612 break; | |
613 } | |
614 default: | |
615 { | |
616 ACI_ERR_DESC(ACI_ERR_CLASS_Cme,CME_ERR_Unknown); | |
617 return (ACI_BAT_FAIL); | |
618 } | |
619 } | |
620 return ACI_BAT_CMPL; | |
621 } | |
622 | |
623 /* | |
624 +--------------------------------------------------------------------+ | |
625 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT | | |
626 | STATE : code ROUTINE : qBAT_PercentCUST | | |
627 +--------------------------------------------------------------------+ | |
628 | |
629 PURPOSE : | |
630 */ | |
631 GLOBAL T_ACI_BAT_RSLT qBAT_PercentCUST (T_ACI_DTI_PRC_PSI *src_infos_psi, | |
632 T_BAT_cmd_send *cmd) | |
633 { | |
634 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL; | |
635 T_BAT_percent_cust_mode mode; | |
636 T_BAT_cmd_response resp; | |
637 T_BAT_res_que_percent_cust que_cust_buffer; | |
638 | |
639 TRACE_FUNCTION ("qBAT_PercentCUST()"); | |
640 | |
641 resp.ctrl_response = BAT_RES_QUE_PERCENT_CUST; | |
642 resp.response.ptr_que_percent_cust = &que_cust_buffer; | |
643 | |
644 ret = qAT_PercentCUST(src_infos_psi->srcId,(T_CUST_MOD *)&mode); | |
645 if (ret NEQ AT_CMPL) | |
646 { | |
647 return (ACI_BAT_FAIL); | |
648 } | |
649 resp.response.ptr_que_percent_cust->mode = mode; | |
650 aci_bat_send(src_infos_psi,&resp); | |
651 return(ret); | |
652 } | |
653 | |
654 | |
655 /* | |
656 +--------------------------------------------------------------------+ | |
657 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT | | |
658 | STATE : code ROUTINE : sBAT_PercentSATCC | | |
659 +--------------------------------------------------------------------+ | |
660 | |
661 PURPOSE : | |
662 */ | |
663 GLOBAL T_ACI_BAT_RSLT sBAT_PercentSATCC (T_ACI_DTI_PRC_PSI *src_infos_psi, | |
664 T_BAT_cmd_send *cmd) | |
665 { | |
666 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL; | |
667 | |
668 TRACE_FUNCTION ("sBAT_PercentSATCC()"); | |
669 | |
670 ret = sAT_PercentSATCC(src_infos_psi->srcId, cmd->params.ptr_set_percent_satcc->mode); | |
671 | |
672 return ret; | |
673 } | |
674 | |
675 | |
676 /* | |
677 +--------------------------------------------------------------------+ | |
678 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT | | |
679 | STATE : code ROUTINE : qBAT_PercentSATCC | | |
680 +--------------------------------------------------------------------+ | |
681 | |
682 PURPOSE : | |
683 */ | |
684 GLOBAL T_ACI_BAT_RSLT qBAT_PercentSATCC (T_ACI_DTI_PRC_PSI *src_infos_psi, | |
685 T_BAT_cmd_send *cmd) | |
686 { | |
687 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL; | |
688 T_BAT_percent_satcc_mode mode; | |
689 T_BAT_cmd_response resp; | |
690 T_BAT_res_que_percent_satcc que_satcc_buffer; | |
691 | |
692 TRACE_FUNCTION ("qBAT_PercentSATCC()"); | |
693 | |
694 resp.ctrl_response = BAT_RES_QUE_PERCENT_SATCC; | |
695 | |
696 resp.response.ptr_que_percent_satcc = &que_satcc_buffer; | |
697 | |
698 ret = qAT_PercentSATCC(src_infos_psi->srcId,(T_SAT_CC_MOD *)&mode); | |
699 | |
700 if(ret EQ ACI_BAT_CMPL) | |
701 { | |
702 resp.response.ptr_que_percent_satcc->mode = mode; | |
703 aci_bat_send(src_infos_psi,&resp); | |
704 } | |
705 | |
706 return(ret); | |
707 } | |
708 | |
709 | |
710 /* | |
711 +--------------------------------------------------------------------+ | |
712 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT | | |
713 | STATE : code ROUTINE : sBAT_PlusEFRSLT | | |
714 +--------------------------------------------------------------------+ | |
715 | |
716 PURPOSE : | |
717 */ | |
718 GLOBAL T_ACI_BAT_RSLT sBAT_PercentEFRSLT (T_ACI_DTI_PRC_PSI *src_infos_psi, | |
719 T_BAT_cmd_send *cmd) | |
720 { | |
721 T_ACI_EFRSLT_RES result; | |
722 T_ACI_BAT_RSLT ret; | |
723 | |
724 TRACE_FUNCTION ("sBAT_PercentEFRSLT()"); | |
725 | |
726 /* | |
727 * This relies on T_BAT_percent_efrslt_result being identical to | |
728 * T_ACI_EFRSLT_RES. | |
729 */ | |
730 result=(T_ACI_EFRSLT_RES)cmd->params.ptr_set_percent_efrslt->result; | |
731 | |
732 /* | |
733 * Call the corresponding ACI function. T_ACI_BAT_RSLT is | |
734 * assumed to be equivalent to T_ACI_RESULT. | |
735 */ | |
736 ret=(T_ACI_BAT_RSLT)sAT_PercentEFRSLT(src_infos_psi->srcId,result); | |
737 | |
738 return(ret); | |
739 } | |
740 |