FreeCalypso > hg > tcs211-l1-reconst
comparison g23m/condat/ms/src/aci/cmh_simr.c @ 0:509db1a7b7b8
initial import: leo2moko-r1
author | Space Falcon <falcon@ivan.Harhan.ORG> |
---|---|
date | Mon, 01 Jun 2015 03:24:05 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:509db1a7b7b8 |
---|---|
1 /* | |
2 +----------------------------------------------------------------------------- | |
3 | Project : GSM-PS (6147) | |
4 | Modul : CMH_SIMR | |
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 module defines the functions which are responsible | |
18 | for the responses of the protocol stack adapter for | |
19 | the subscriber identity module. | |
20 +----------------------------------------------------------------------------- | |
21 */ | |
22 | |
23 #ifndef CMH_SIMR_C | |
24 #define CMH_SIMR_C | |
25 #endif | |
26 | |
27 #include "aci_all.h" | |
28 /*==== INCLUDES ===================================================*/ | |
29 #include "aci_mem.h" | |
30 | |
31 #include "aci_cmh.h" | |
32 #include "ati_cmd.h" | |
33 #include "aci_cmd.h" | |
34 #include "pcm.h" | |
35 | |
36 #ifdef FAX_AND_DATA | |
37 #include "aci_fd.h" | |
38 #endif /* of #ifdef FAX_AND_DATA */ | |
39 | |
40 #ifndef _SIMULATION_ | |
41 #include "ffs/ffs.h" | |
42 #include "ffs_coat.h" | |
43 #endif | |
44 | |
45 #ifdef DTI | |
46 #include "dti.h" /* functionality of the dti library */ | |
47 #include "dti_conn_mng.h" | |
48 #include "dti_cntrl_mng.h" | |
49 #endif /* DTI */ | |
50 | |
51 #include "phb.h" | |
52 #include "ksd.h" | |
53 #include "aci.h" | |
54 #include "psa.h" | |
55 #include "psa_sim.h" | |
56 #include "psa_cc.h" | |
57 #include "psa_sat.h" | |
58 #include "psa_mm.h" | |
59 #include "cmh.h" | |
60 #include "cmh_sim.h" | |
61 #include "cmh_mm.h" | |
62 #include "cmh_phb.h" | |
63 | |
64 #include "aci_ext_pers.h" | |
65 #include "aci_slock.h" | |
66 | |
67 #ifdef SIM_PERS | |
68 #include "general.h" // included for compilation error UNIT8 in sec_drv.h | |
69 #include "sec_drv.h" | |
70 #endif | |
71 | |
72 #ifdef GPRS | |
73 #include "gaci.h" | |
74 #include "gaci_cmh.h" | |
75 #include "psa_gmm.h" | |
76 #include "cmh_gmm.h" | |
77 #endif | |
78 | |
79 #include "p_mmcc.h" | |
80 #include "m_cc.h" | |
81 | |
82 #include "aoc.h" | |
83 | |
84 #ifdef DTI | |
85 #include "wap_aci.h" | |
86 #include "psa_tcpip.h" | |
87 #include "psa_l2r.h" | |
88 #endif | |
89 | |
90 #ifdef SIM_PERS | |
91 EXTERN T_ACI_SIM_CONFIG aci_slock_sim_config; /* SIM configuration, initialised by a T_SIM_MMI_INSERT_IND */ | |
92 EXTERN T_SEC_DRV_CONFIGURATION *cfg_data ; | |
93 #endif | |
94 | |
95 /*==== CONSTANTS ==================================================*/ | |
96 | |
97 | |
98 /*==== TYPES ======================================================*/ | |
99 | |
100 | |
101 /*==== EXPORT =====================================================*/ | |
102 | |
103 | |
104 /*==== VARIABLES ==================================================*/ | |
105 | |
106 /*==== FUNCTIONS ==================================================*/ | |
107 | |
108 /* | |
109 +-------------------------------------------------------------------+ | |
110 | PROJECT : GSM-PS (6147) MODULE : CMH_SIMR | | |
111 | ROUTINE : cmhSIM_SIMSync | | |
112 +-------------------------------------------------------------------+ | |
113 | |
114 PURPOSE : SIM data synchronized | |
115 | |
116 */ | |
117 | |
118 GLOBAL void cmhSIM_SIMSync ( void ) | |
119 { | |
120 TRACE_FUNCTION ("cmhSIM_SIMSync()"); | |
121 | |
122 /* process event */ | |
123 switch( simEntStat.curCmd ) | |
124 { | |
125 case( AT_CMD_CFUN ): | |
126 if (mmEntStat.curCmd NEQ AT_CMD_CFUN) /* Has MM already deregistered? */ | |
127 { | |
128 R_AT( RAT_OK, simEntStat.entOwn ) | |
129 ( AT_CMD_CFUN ); | |
130 | |
131 /* log result */ | |
132 cmh_logRslt ( simEntStat.entOwn, RAT_OK, AT_CMD_CFUN, -1, -1, -1 ); | |
133 } | |
134 /*lint -fallthrough*/ | |
135 case( AT_CMD_COPS ): | |
136 case( AT_CMD_P_COPS ): | |
137 | |
138 simEntStat.curCmd = AT_CMD_NONE; | |
139 break; | |
140 } | |
141 } | |
142 | |
143 /* | |
144 +-------------------------------------------------------------------+ | |
145 | PROJECT : GSM-PS (6147) MODULE : CMH_SIMR | | |
146 | ROUTINE : clck_fdn_accepted() | | |
147 +-------------------------------------------------------------------+ | |
148 | |
149 PURPOSE : PIN2 status allows CLCK changing the status concerning FDN. | |
150 | |
151 */ | |
152 | |
153 LOCAL void clck_fdn_accepted ( void ) | |
154 { | |
155 switch( simShrdPrm.setPrm[simEntStat.entOwn].actProc ) | |
156 { | |
157 case( SIM_FDN_ENABLE ): | |
158 if( simShrdPrm.crdFun EQ SIM_ADN_ENABLED ) | |
159 { | |
160 simShrdPrm.crdFun = SIM_FDN_ENABLED; | |
161 } | |
162 if( simShrdPrm.crdFun EQ SIM_ADN_BDN_ENABLED ) | |
163 { | |
164 simShrdPrm.crdFun = SIM_FDN_BDN_ENABLED; | |
165 } | |
166 | |
167 pb_switch_adn_fdn( FDN_ENABLE, simShrdPrm.classFDN ); /* inform PHB */ | |
168 break; | |
169 | |
170 case( SIM_FDN_DISABLE ): | |
171 if( simShrdPrm.crdFun EQ SIM_FDN_ENABLED ) | |
172 { | |
173 simShrdPrm.crdFun = SIM_ADN_ENABLED; | |
174 } | |
175 if( simShrdPrm.crdFun EQ SIM_FDN_BDN_ENABLED ) | |
176 { | |
177 simShrdPrm.crdFun = SIM_ADN_BDN_ENABLED; | |
178 } | |
179 pb_switch_adn_fdn( FDN_DISABLE, simShrdPrm.classFDN ); /* inform PHB */ | |
180 break; | |
181 } | |
182 } | |
183 | |
184 /* | |
185 +-------------------------------------------------------------------+ | |
186 | PROJECT : GSM-PS (6147) MODULE : CMH_SIMR | | |
187 | ROUTINE : cmhsim_simactivated_clck | | |
188 +-------------------------------------------------------------------+ | |
189 PURPOSE : SIM activated after AT+CLCK | |
190 */ | |
191 | |
192 LOCAL void cmhsim_simactivated_clck( void ) | |
193 { | |
194 T_ACI_CME_ERR err = CME_ERR_Unknown; | |
195 T_SIM_SET_PRM *sim_set_prm; | |
196 | |
197 TRACE_FUNCTION ("cmhsim_simactivated_clck()"); | |
198 | |
199 simEntStat.curCmd = AT_CMD_NONE; | |
200 sim_set_prm = &simShrdPrm.setPrm[simEntStat.entOwn]; | |
201 | |
202 switch( simShrdPrm.rslt ) | |
203 { | |
204 case( SIM_NO_ERROR ): | |
205 clck_fdn_accepted(); | |
206 | |
207 R_AT( RAT_OK, simEntStat.entOwn ) | |
208 ( AT_CMD_CLCK ); | |
209 cmh_logRslt ( simEntStat.entOwn, RAT_OK, AT_CMD_CLCK, -1, -1, -1 ); | |
210 return; | |
211 | |
212 case( SIM_CAUSE_PIN2_EXPECT ): | |
213 TRACE_EVENT_P1("simShrdPrm.pn2Stat: %d", simShrdPrm.pn2Stat); | |
214 | |
215 if ( simShrdPrm.pn2Stat EQ PS_PIN2 ) | |
216 { | |
217 if ( ( simShrdPrm.setPrm[simEntStat.entOwn].curPIN[0] NEQ 0x00 ) AND | |
218 ( simShrdPrm.setPrm[simEntStat.entOwn].curPIN[0] NEQ NOT_PRESENT_CHAR ) ) | |
219 { | |
220 /* if PIN2 is required and a pin is given, then check pin with PIN2 */ | |
221 simEntStat.curCmd = AT_CMD_CLCK; /* further processing */ | |
222 | |
223 simShrdPrm.setPrm[simEntStat.entOwn].PINType = PHASE_2_PIN_2; | |
224 psaSIM_VerifyPIN(); /* verify PIN */ | |
225 return; | |
226 } | |
227 else | |
228 { | |
229 /* if PIN2 is required and no pin is given, then send cme_err with PIN2 | |
230 required message code */ | |
231 if ( simShrdPrm.PINStat EQ PS_RDY ) | |
232 { | |
233 simShrdPrm.PINStat = PS_PIN2; | |
234 } | |
235 err = CME_ERR_SimPin2Req; | |
236 } | |
237 } | |
238 else | |
239 { | |
240 err = CME_ERR_WrongPasswd; | |
241 } | |
242 break; | |
243 | |
244 /*case( SIM_CAUSE_PIN1_EXPECT ): | |
245 case( SIM_CAUSE_PUK1_EXPECT ):*/ | |
246 | |
247 /* Should be CME_ERR_SimPuk2Req, and it is done | |
248 in the default case | |
249 case( SIM_CAUSE_PIN2_BLOCKED): | |
250 case( SIM_CAUSE_PUK2_EXPECT ): | |
251 err = CME_ERR_WrongPasswd; | |
252 break;*/ | |
253 | |
254 default: | |
255 err = cmhSIM_GetCmeFromSim( simShrdPrm.rslt ); | |
256 break; | |
257 } | |
258 | |
259 R_AT( RAT_CME, simEntStat.entOwn ) | |
260 ( AT_CMD_CLCK, err ); | |
261 cmh_logRslt ( simEntStat.entOwn, RAT_CME, AT_CMD_CLCK, | |
262 -1, -1, err ); | |
263 | |
264 } | |
265 | |
266 /* | |
267 +-------------------------------------------------------------------+ | |
268 | PROJECT : GSM-PS (6147) MODULE : CMH_SIMR | | |
269 | ROUTINE : cmhsim_simactivated_start | | |
270 +-------------------------------------------------------------------+ | |
271 PURPOSE : SIM activated after AT+CFUN, +CPIN, +CIMI and %NRG | |
272 */ | |
273 LOCAL void simactivated_cpinresult( T_ACI_CPIN_RSLT cpin_result ) | |
274 { | |
275 R_AT( RAT_CPIN, simEntStat.entOwn ) | |
276 ( cpin_result ); | |
277 R_AT( RAT_OK, simEntStat.entOwn ) | |
278 ( AT_CMD_CPIN ); | |
279 cmh_logRslt ( simEntStat.entOwn, RAT_OK, AT_CMD_CPIN, | |
280 -1, -1, -1 ); | |
281 } | |
282 | |
283 LOCAL void simactivated_errorresult( T_ACI_CME_ERR error_result, UBYTE cmdBuf ) | |
284 { | |
285 R_AT( RAT_CME, simEntStat.entOwn ) | |
286 ( cmdBuf, error_result ); | |
287 | |
288 if( cmdBuf NEQ AT_CMD_CIMI ) | |
289 { | |
290 cmh_logRslt ( simEntStat.entOwn, RAT_CME, cmdBuf, | |
291 -1, -1, error_result ); | |
292 } | |
293 } | |
294 | |
295 LOCAL void cmhsim_simactivated_start( void ) | |
296 { | |
297 UBYTE cmdBuf = simEntStat.curCmd; /* buffers current command */ | |
298 | |
299 TRACE_FUNCTION ("cmhsim_simactivated_start()"); | |
300 | |
301 simEntStat.curCmd = AT_CMD_NONE; | |
302 | |
303 switch( simShrdPrm.SIMStat ) | |
304 { | |
305 case( SS_INV ): | |
306 simactivated_errorresult( CME_ERR_SimWrong, cmdBuf ); | |
307 return; | |
308 | |
309 case( SS_URCHB ): | |
310 simactivated_errorresult( CME_ERR_SimNotIns, cmdBuf ); | |
311 return; | |
312 | |
313 case( NO_VLD_SS ): | |
314 simactivated_errorresult( CME_ERR_NotPresent, cmdBuf ); | |
315 return; | |
316 | |
317 case( SS_OK ): | |
318 switch( simShrdPrm.PINStat ) | |
319 { | |
320 case( PS_PIN1 ): | |
321 if( cmdBuf EQ AT_CMD_CPIN ) | |
322 { | |
323 simactivated_cpinresult( CPIN_RSLT_SimPinReq ); | |
324 } | |
325 else | |
326 { | |
327 simactivated_errorresult( CME_ERR_SimPinReq, cmdBuf ); | |
328 } | |
329 break; | |
330 | |
331 case( PS_PIN2 ): | |
332 if( cmdBuf EQ AT_CMD_CPIN ) | |
333 { | |
334 simactivated_cpinresult( CPIN_RSLT_SimPin2Req ); | |
335 } | |
336 else | |
337 { | |
338 simactivated_errorresult( CME_ERR_SimPin2Req, cmdBuf ); | |
339 } | |
340 break; | |
341 | |
342 case( PS_RDY ): | |
343 /* wait for SIM insert indication to complete command */ | |
344 simEntStat.curCmd = cmdBuf; | |
345 break; | |
346 } | |
347 break; | |
348 | |
349 case( SS_BLKD ): | |
350 | |
351 switch( simShrdPrm.PINStat ) | |
352 { | |
353 case( PS_PUK1 ): | |
354 if( cmdBuf EQ AT_CMD_CPIN ) | |
355 { | |
356 simactivated_cpinresult( CPIN_RSLT_SimPukReq ); | |
357 } | |
358 else | |
359 { | |
360 simactivated_errorresult( CME_ERR_SimPukReq, cmdBuf ); | |
361 } | |
362 break; | |
363 | |
364 case( PS_PUK2 ): | |
365 if( cmdBuf EQ AT_CMD_CPIN ) | |
366 { | |
367 simactivated_cpinresult( CPIN_RSLT_SimPuk2Req ); | |
368 } | |
369 else | |
370 { | |
371 simactivated_errorresult( CME_ERR_SimPuk2Req, cmdBuf ); | |
372 } | |
373 break; | |
374 } | |
375 break; | |
376 | |
377 } | |
378 } | |
379 | |
380 /* | |
381 +-------------------------------------------------------------------+ | |
382 | PROJECT : GSM-PS (6147) MODULE : CMH_SIMR | | |
383 | ROUTINE : cmhSIM_SIMActivated | | |
384 +-------------------------------------------------------------------+ | |
385 | |
386 PURPOSE : SIM activated | |
387 | |
388 */ | |
389 | |
390 GLOBAL void cmhSIM_SIMActivated ( void ) | |
391 { | |
392 T_ACI_CMD_SRC idx; | |
393 | |
394 TRACE_FUNCTION ("cmhSIM_SIMActivated()"); | |
395 | |
396 /* check for command context */ | |
397 switch( simEntStat.curCmd ) | |
398 { | |
399 case( AT_CMD_CFUN ): | |
400 case( AT_CMD_CPIN ): | |
401 case( AT_CMD_CIMI ): | |
402 case( AT_CMD_NRG ): | |
403 case( AT_CMD_SIMRST): | |
404 /* process event for +CFUN, +CPIN, +CIMI and for %NRG command */ | |
405 cmhsim_simactivated_start( ); | |
406 break; | |
407 | |
408 case( AT_CMD_CLCK ): | |
409 /* process event for +CLCK command */ | |
410 cmhsim_simactivated_clck( ); | |
411 break; | |
412 | |
413 case( AT_CMD_NONE ): | |
414 /* process event spontaneous insertion */ | |
415 if (simShrdPrm.rslt EQ SIM_NO_ERROR) | |
416 { | |
417 ; /* do nothing right now since the %SIMINS: -1 must be | |
418 syncronized with SIM_MMI_INSERT_IND which will come later! */ | |
419 } | |
420 else | |
421 { | |
422 for( idx = 0; idx < CMD_SRC_MAX; idx++ ) | |
423 { | |
424 R_AT( RAT_SIMINS, idx )(cmhSIM_GetCmeFromSim (simShrdPrm.rslt)); | |
425 } | |
426 } | |
427 break; | |
428 } | |
429 } | |
430 | |
431 /* | |
432 +-------------------------------------------------------------------+ | |
433 | PROJECT : GSM-PS (6147) MODULE : CMH_SIMR | | |
434 | ROUTINE : cmhSIM_SIMInserted | | |
435 +-------------------------------------------------------------------+ | |
436 | |
437 PURPOSE : SIM inserted | |
438 | |
439 */ | |
440 | |
441 GLOBAL void cmhSIM_SIMInserted ( void ) | |
442 { | |
443 UBYTE cmdBuf; /* buffers current command */ | |
444 CHAR imsiBuf[MAX_IMSI_LEN+1]; /* buffer IMSI representation +1 for '\0'*/ | |
445 T_ACI_CME_ERR err_code = CME_ERR_NotPresent; /* code holding the correct error code calculated */ | |
446 BOOL return_rat_ok = 1; /* return ok? */ | |
447 | |
448 TRACE_FUNCTION ("cmhSIM_SIMInserted()"); | |
449 | |
450 /* Check if the SIM is functional and the IMSI value is valid*/ | |
451 if ( simShrdPrm.crdFun EQ SIM_NO_OPERATION OR | |
452 simShrdPrm.imsi.c_field EQ 0 ) | |
453 { | |
454 simShrdPrm.SIMStat = SS_INV; | |
455 err_code = CME_ERR_SimWrong; | |
456 } | |
457 | |
458 switch( simEntStat.curCmd ) | |
459 { | |
460 case( AT_CMD_CFUN ): | |
461 case( AT_CMD_CPIN ): | |
462 case( AT_CMD_PVRF ): | |
463 case( AT_CMD_SIMRST): | |
464 case( KSD_CMD_UBLK): | |
465 /* | |
466 *---------------------------------------------------------------- | |
467 * process event for +CFUN, +CPIN, %PVRF commands and for the | |
468 SIM reset condition | |
469 *---------------------------------------------------------------- | |
470 */ | |
471 | |
472 cmdBuf = simEntStat.curCmd; | |
473 simEntStat.curCmd = AT_CMD_NONE; | |
474 #ifdef SIM_PERS | |
475 if((aci_slock_sim_config.sim_type EQ SIM_TYPEAPPROVAL) AND AciSLockShrd.blocked) | |
476 { | |
477 simShrdPrm.SIMStat = SS_INV; | |
478 err_code = CME_ERR_SimWrong; | |
479 } | |
480 if(cfg_data EQ NULL) | |
481 { | |
482 simShrdPrm.SIMStat = SS_INV; | |
483 err_code = CME_ERR_Unknown; | |
484 R_AT( RAT_CME, simEntStat.entOwn ) ( cmdBuf, err_code ); | |
485 cmh_logRslt ( simEntStat.entOwn, RAT_CME, cmdBuf, -1, -1, err_code ); | |
486 simShrdPrm.PINQuery = 0; | |
487 return; | |
488 } | |
489 #endif | |
490 | |
491 if( err_code EQ CME_ERR_SimWrong ) | |
492 { | |
493 R_AT( RAT_CME, simEntStat.entOwn ) ( cmdBuf, err_code ); | |
494 cmh_logRslt ( simEntStat.entOwn, RAT_CME, cmdBuf, -1, -1, err_code ); | |
495 simShrdPrm.PINQuery = 0; | |
496 return; | |
497 } | |
498 | |
499 #ifdef SIM_PERS | |
500 /* check for personalisation locking. If SIM was detected as not correct, do signal AT_CPIN */ | |
501 | |
502 if ( AciSLockShrd.blocked) | |
503 { | |
504 /* @GBR: Alternativly CME_ERR_SimWrong might be returned, but this way is telling the MMI mor specific, what went wrong. */ | |
505 aci_set_cme_error_code(AciSLockShrd.current_lock,&err_code); | |
506 | |
507 return_rat_ok = 0; | |
508 R_AT( RAT_CME, simEntStat.entOwn ) | |
509 ( cmdBuf, err_code ); | |
510 cmh_logRslt ( simEntStat.entOwn, RAT_CME, cmdBuf, -1, -1, err_code ); | |
511 } | |
512 | |
513 #endif | |
514 if ( (cmdBuf EQ AT_CMD_CPIN) AND (simShrdPrm.PINQuery EQ 1) ) /* Case when PIN is disabled and CFUN=0 */ | |
515 { | |
516 R_AT( RAT_CPIN, simEntStat.entOwn ) | |
517 ( CPIN_RSLT_SimReady ); | |
518 simShrdPrm.PINQuery = 0; | |
519 } | |
520 | |
521 #if defined (GPRS) AND defined (DTI) | |
522 gprs_sim_inserted(); | |
523 #endif /* GPRS */ | |
524 | |
525 if (return_rat_ok EQ 1) /* @gbr: only send ok, if everhing went okay. The +CFUN might not be ready here, so don't send something! */ | |
526 { | |
527 | |
528 R_AT( RAT_OK, simEntStat.entOwn ) ( cmdBuf ); | |
529 cmh_logRslt ( simEntStat.entOwn, RAT_OK, cmdBuf, -1, -1, -1 ); | |
530 } | |
531 break; | |
532 | |
533 case( AT_CMD_CIMI ): | |
534 /* | |
535 *---------------------------------------------------------------- | |
536 * process event for +CIMI command | |
537 *---------------------------------------------------------------- | |
538 */ | |
539 | |
540 | |
541 if( err_code EQ CME_ERR_SimWrong ) | |
542 { | |
543 R_AT( RAT_CME, simEntStat.entOwn ) ( AT_CMD_CIMI, err_code ); | |
544 cmh_logRslt ( simEntStat.entOwn, RAT_CME, AT_CMD_CIMI, -1, -1, err_code ); | |
545 return; | |
546 } | |
547 | |
548 R_AT( RAT_CIMI, simEntStat.entOwn ) | |
549 ( psaSIM_cnvrtIMSI2ASCII( imsiBuf )); | |
550 | |
551 simEntStat.curCmd = AT_CMD_NONE; | |
552 | |
553 R_AT( RAT_OK, simEntStat.entOwn ) | |
554 ( AT_CMD_CIMI ); | |
555 break; | |
556 | |
557 case( AT_CMD_NRG ): | |
558 /* | |
559 *---------------------------------------------------------------- | |
560 * process event for %NRG | |
561 *---------------------------------------------------------------- | |
562 */ | |
563 cmdBuf = simEntStat.curCmd; | |
564 if( err_code EQ CME_ERR_SimWrong ) | |
565 { | |
566 simEntStat.curCmd = AT_CMD_NONE; | |
567 mmEntStat.curCmd = AT_CMD_NONE; | |
568 R_AT( RAT_CME, simEntStat.entOwn ) ( cmdBuf, err_code ); | |
569 cmh_logRslt ( simEntStat.entOwn, RAT_CME, cmdBuf, -1, -1, err_code ); | |
570 return; | |
571 } | |
572 | |
573 switch( cmhPrm[simShrdPrm.owner].mmCmdPrm.NRGregMode ) | |
574 { | |
575 case( NRG_RGMD_Auto ): | |
576 | |
577 mmShrdPrm.regMode = MODE_AUTO; | |
578 | |
579 simEntStat.curCmd = AT_CMD_NONE; | |
580 mmEntStat.curCmd = AT_CMD_NRG; | |
581 mmEntStat.entOwn = mmShrdPrm.owner = simShrdPrm.owner; | |
582 | |
583 #if defined (GPRS) AND defined (DTI) | |
584 (void)psaG_MM_CMD_REG (); /* register to network */ | |
585 #else | |
586 (void)psaMM_Registrate (); /* register to network */ | |
587 #endif | |
588 | |
589 cmhMM_Ntfy_NtwRegistrationStatus(CREG_STAT_Search); | |
590 break; | |
591 | |
592 case( NRG_RGMD_Manual ): | |
593 | |
594 mmShrdPrm.regMode = MODE_MAN; | |
595 | |
596 simEntStat.curCmd = AT_CMD_NONE; | |
597 mmEntStat.curCmd = AT_CMD_NRG; | |
598 mmEntStat.entOwn = mmShrdPrm.owner = simShrdPrm.owner; | |
599 | |
600 #if defined (GPRS) && defined (DTI) | |
601 psaG_MM_CMD_NET_SEL ( ); /* register to network */ | |
602 #else | |
603 psaMM_NetSel (); /* register to network */ | |
604 #endif | |
605 | |
606 cmhMM_Ntfy_NtwRegistrationStatus(CREG_STAT_Search); | |
607 break; | |
608 } | |
609 break; | |
610 | |
611 case( AT_CMD_NONE ): | |
612 { | |
613 T_ACI_CMD_SRC idx; | |
614 /* process event spontaneous insertion */ | |
615 for( idx = 0; idx < CMD_SRC_MAX; idx++ ) | |
616 { | |
617 R_AT( RAT_SIMINS, idx )( err_code ); | |
618 } | |
619 } | |
620 break; | |
621 | |
622 } | |
623 } | |
624 | |
625 /* | |
626 +-------------------------------------------------------------------+ | |
627 | PROJECT : GSM-PS (6147) MODULE : CMH_SIMR | | |
628 | ROUTINE : cmhSIM_SIMRemoved | | |
629 +-------------------------------------------------------------------+ | |
630 | |
631 PURPOSE : SIM removed | |
632 | |
633 */ | |
634 | |
635 GLOBAL void cmhSIM_SIMRemoved ( void ) | |
636 { | |
637 UBYTE cmdBuf; /* buffers command */ | |
638 T_ACI_CMD_SRC idx; | |
639 T_ACI_CME_ERR cme_error; /* CME error code */ | |
640 T_ACI_SIMREM_TYPE srt; /* type of SIM remove */ | |
641 | |
642 TRACE_FUNCTION ("cmhSIM_SIMRemoved()"); | |
643 | |
644 if (simEntStat.curCmd NEQ AT_CMD_NONE) | |
645 { | |
646 cmdBuf = simEntStat.curCmd; | |
647 simEntStat.curCmd = AT_CMD_NONE; | |
648 | |
649 if (simShrdPrm.rslt EQ SIM_NO_ERROR) | |
650 cme_error = CME_ERR_SimBusy; | |
651 else | |
652 cme_error = cmhSIM_GetCmeFromSim (simShrdPrm.rslt); | |
653 | |
654 R_AT( RAT_CME, simEntStat.entOwn ) | |
655 ( cmdBuf, cme_error ); | |
656 cmh_logRslt ( simEntStat.entOwn, RAT_CME, cmdBuf, | |
657 -1, -1, cme_error ); | |
658 } | |
659 EfPLMNselStat = EF_STAT_UNKNWN; | |
660 /* | |
661 *---------------------------------------------------------------- | |
662 * send unsolicited result | |
663 *---------------------------------------------------------------- | |
664 */ | |
665 TRACE_EVENT_P1("Result of SIM remove indication: %x", simShrdPrm.rslt); | |
666 switch (simShrdPrm.rslt) | |
667 { | |
668 case SIM_NO_ERROR: | |
669 /* In this case the AT command state is set to SIM RESET */ | |
670 /* NO, don't do this! | |
671 This line would prevent a %SIMIND: 11 and instead leads to | |
672 "+CME ERROR: SIM PIN required" without any command context which is wrong */ | |
673 /* simEntStat.curCmd = AT_CMD_SIMRST; */ | |
674 srt = SIMREM_RESET; | |
675 break; | |
676 case SIM_CAUSE_DRV_TEMPFAIL: | |
677 srt = SIMREM_RETRY; | |
678 break; | |
679 default: | |
680 srt = SIMREM_FAILURE; | |
681 break; | |
682 } | |
683 | |
684 for( idx = 0; idx < CMD_SRC_MAX; idx++ ) | |
685 { | |
686 R_AT( RAT_SIMREM, idx )(srt); | |
687 } | |
688 } | |
689 | |
690 /* | |
691 +-------------------------------------------------------------------+ | |
692 | PROJECT : GSM-PS (6147) MODULE : CMH_SIMR | | |
693 | ROUTINE : cmhSIM_PINVerified | | |
694 +-------------------------------------------------------------------+ | |
695 | |
696 PURPOSE : SIM verified | |
697 | |
698 */ | |
699 LOCAL void pin_verified_clck (USHORT sim_result) | |
700 { | |
701 TRACE_FUNCTION ("pin_verified_clck()"); | |
702 | |
703 switch(sim_result) | |
704 { | |
705 case( SIM_NO_ERROR ): | |
706 /* now do it ! */ | |
707 | |
708 /* Check if we want to do FDN Lock or ALS Lock */ | |
709 switch (simShrdPrm.setPrm[simShrdPrm.owner].actProc) | |
710 { | |
711 case SIM_FDN_ENABLE: | |
712 case SIM_FDN_DISABLE: | |
713 /* FDN Lock */ | |
714 if( psaSIM_ActivateSIM() < 0 ) /* activate SIM card */ | |
715 { | |
716 simEntStat.curCmd = AT_CMD_NONE; | |
717 | |
718 R_AT( RAT_CME, simEntStat.entOwn ) | |
719 ( AT_CMD_CLCK, CME_ERR_Unknown ); | |
720 cmh_logRslt ( simEntStat.entOwn, RAT_CME, AT_CMD_CLCK, | |
721 -1, -1, CME_ERR_Unknown ); | |
722 } | |
723 break; | |
724 | |
725 case SIM_ALS_LOCK: | |
726 case SIM_ALS_UNLOCK: | |
727 /* ALS Lock to PIN2 */ | |
728 if (simShrdPrm.setPrm[simShrdPrm.owner].actProc EQ SIM_ALS_LOCK) | |
729 { | |
730 ALSlock = cmhPrm[simShrdPrm.owner].ccCmdPrm.ALSmode; | |
731 /* pull all sources to the current ALSmode, otherwise a lock won't make sense */ | |
732 { | |
733 int i; | |
734 for (i=0; i<OWN_MAX; i++) | |
735 cmhPrm[i].ccCmdPrm.ALSmode = ALSlock; | |
736 /* and lock them all */ | |
737 } | |
738 #ifndef _SIMULATION_ | |
739 /* write Lock to FFS */ | |
740 FFS_fwrite("/gsm/com/ALSlock", &ALSlock, sizeof(ALSlock)); | |
741 #endif | |
742 } | |
743 else | |
744 /* unlock ALS */ | |
745 { | |
746 ALSlock = ALS_MOD_NOTPRESENT; | |
747 #ifndef _SIMULATION_ | |
748 /* remove lock from FFS */ | |
749 FFS_remove("/gsm/com/ALSlock"); | |
750 #endif | |
751 } | |
752 | |
753 simEntStat.curCmd = AT_CMD_NONE; | |
754 | |
755 R_AT( RAT_OK, simEntStat.entOwn ) | |
756 ( AT_CMD_CLCK ); | |
757 cmh_logRslt ( simEntStat.entOwn, RAT_OK, AT_CMD_CLCK, -1, -1, -1 ); | |
758 break; | |
759 | |
760 } | |
761 break; /* SIM_NO_ERROR */ | |
762 | |
763 case( SIM_CAUSE_PIN1_EXPECT ): | |
764 case( SIM_CAUSE_PIN2_EXPECT ): | |
765 case( SIM_CAUSE_PIN1_BLOCKED ): | |
766 case( SIM_CAUSE_PUK1_EXPECT ): | |
767 case( SIM_CAUSE_PIN2_BLOCKED ): | |
768 case( SIM_CAUSE_PUK2_EXPECT ): | |
769 simEntStat.curCmd = AT_CMD_NONE; | |
770 | |
771 R_AT( RAT_CME, simEntStat.entOwn ) | |
772 ( AT_CMD_CLCK, cmhSIM_GetCmeFromSim ( sim_result ) /*CME_ERR_WrongPasswd*/ ); | |
773 cmh_logRslt ( simEntStat.entOwn, RAT_CME, AT_CMD_CLCK, | |
774 -1, -1, CME_ERR_WrongPasswd ); | |
775 break; | |
776 | |
777 default: | |
778 simEntStat.curCmd = AT_CMD_NONE; | |
779 R_AT( RAT_CME, simEntStat.entOwn ) | |
780 ( AT_CMD_CLCK, CME_ERR_SimFail ); | |
781 cmh_logRslt ( simEntStat.entOwn, RAT_CME, AT_CMD_CLCK, | |
782 -1, -1, CME_ERR_SimFail ); | |
783 break; | |
784 } | |
785 } | |
786 | |
787 GLOBAL void cmhSIM_PINVerified ( void ) | |
788 { | |
789 UBYTE cmdBuf; /* buffers command */ | |
790 T_PHB_CMD_PRM * pPHBCmdPrm; /* points to PHB command parameters */ | |
791 | |
792 TRACE_FUNCTION ("cmhSIM_PINVerified()"); | |
793 | |
794 pPHBCmdPrm = &cmhPrm[simShrdPrm.owner].phbCmdPrm; | |
795 | |
796 /* | |
797 *------------------------------------------------------------------- | |
798 * check for command context | |
799 *------------------------------------------------------------------- | |
800 */ | |
801 switch( simEntStat.curCmd ) | |
802 { | |
803 case( AT_CMD_CLCK ): | |
804 /* process event for +CLCK command */ | |
805 pin_verified_clck( simShrdPrm.rslt ); | |
806 return; | |
807 | |
808 case( AT_CMD_CPIN ): | |
809 case( AT_CMD_PVRF ): | |
810 /* | |
811 *---------------------------------------------------------------- | |
812 * process event for +CPIN and %PVRF command | |
813 *---------------------------------------------------------------- | |
814 */ | |
815 switch( simShrdPrm.rslt ) | |
816 { | |
817 case( SIM_NO_ERROR ): | |
818 | |
819 /* if verified PIN was PIN 2 or PIN 1 was already entered */ | |
820 if( simShrdPrm.setPrm[simEntStat.entOwn].PINType EQ | |
821 PHASE_2_PIN_2 OR | |
822 simShrdPrm.crdPhs NEQ 0xFF ) | |
823 { | |
824 cmdBuf = simEntStat.curCmd; | |
825 simEntStat.curCmd = AT_CMD_NONE; | |
826 | |
827 R_AT( RAT_OK, simEntStat.entOwn ) | |
828 ( cmdBuf ); | |
829 cmh_logRslt ( simEntStat.entOwn, RAT_OK, cmdBuf, -1, -1, -1 ); | |
830 } | |
831 /* otherwise wait for SIM insert indication to complete command */ | |
832 break; | |
833 | |
834 case( SIM_CAUSE_PIN1_EXPECT ): | |
835 case( SIM_CAUSE_PIN2_EXPECT ): | |
836 case( SIM_CAUSE_PUK1_EXPECT ): | |
837 case( SIM_CAUSE_PUK2_EXPECT ): | |
838 cmdBuf = simEntStat.curCmd; | |
839 simEntStat.curCmd = AT_CMD_NONE; | |
840 | |
841 R_AT( RAT_CME, simEntStat.entOwn ) | |
842 ( cmdBuf, CME_ERR_WrongPasswd ); | |
843 cmh_logRslt ( simEntStat.entOwn, RAT_CME, cmdBuf, | |
844 -1, -1, CME_ERR_WrongPasswd ); | |
845 break; | |
846 case( SIM_CAUSE_PIN1_BLOCKED): | |
847 cmdBuf = simEntStat.curCmd; | |
848 simEntStat.curCmd = AT_CMD_NONE; | |
849 | |
850 R_AT( RAT_CME, simEntStat.entOwn ) | |
851 ( cmdBuf, CME_ERR_SimPukReq ); | |
852 cmh_logRslt ( simEntStat.entOwn, RAT_CME, cmdBuf, | |
853 -1, -1, CME_ERR_SimPukReq ); | |
854 break; | |
855 case( SIM_CAUSE_PIN2_BLOCKED): | |
856 cmdBuf = simEntStat.curCmd; | |
857 simEntStat.curCmd = AT_CMD_NONE; | |
858 | |
859 R_AT( RAT_CME, simEntStat.entOwn ) | |
860 ( cmdBuf, CME_ERR_SimPuk2Req ); | |
861 cmh_logRslt ( simEntStat.entOwn, RAT_CME, cmdBuf, | |
862 -1, -1, CME_ERR_SimPuk2Req ); | |
863 break; | |
864 default: | |
865 cmdBuf = simEntStat.curCmd; | |
866 simEntStat.curCmd = AT_CMD_NONE; | |
867 R_AT( RAT_CME, simEntStat.entOwn ) | |
868 ( cmdBuf, CME_ERR_SimFail ); | |
869 break; | |
870 } | |
871 break; | |
872 | |
873 case( AT_CMD_CAMM ): | |
874 /* | |
875 *---------------------------------------------------------------- | |
876 * process event for +CAMM command | |
877 *---------------------------------------------------------------- | |
878 */ | |
879 switch( simShrdPrm.rslt ) | |
880 { | |
881 case( SIM_NO_ERROR ): | |
882 /* | |
883 * Try it again | |
884 */ | |
885 simEntStat.curCmd = AT_CMD_NONE; | |
886 aoc_update_acmmax (SECOND_UPDATE, 0L); | |
887 break; | |
888 | |
889 default: | |
890 simEntStat.curCmd = AT_CMD_NONE; | |
891 R_AT( RAT_CME, simEntStat.entOwn ) | |
892 ( AT_CMD_CAMM, CME_ERR_WrongPasswd ); | |
893 break; | |
894 } | |
895 break; | |
896 | |
897 case( AT_CMD_CPUC ): | |
898 /* | |
899 *---------------------------------------------------------------- | |
900 * process event for +CPUC command | |
901 *---------------------------------------------------------------- | |
902 */ | |
903 switch( simShrdPrm.rslt ) | |
904 { | |
905 case( SIM_NO_ERROR ): | |
906 /* | |
907 * Try it again | |
908 */ | |
909 simEntStat.curCmd = AT_CMD_NONE; | |
910 aoc_update_puct (SECOND_UPDATE, 0L); | |
911 break; | |
912 | |
913 default: | |
914 simEntStat.curCmd = AT_CMD_NONE; | |
915 R_AT( RAT_CME, simEntStat.entOwn ) | |
916 ( AT_CMD_CPUC, CME_ERR_WrongPasswd ); | |
917 break; | |
918 } | |
919 break; | |
920 | |
921 case( AT_CMD_CACM ): | |
922 /* | |
923 *---------------------------------------------------------------- | |
924 * process event for +CACM command | |
925 *---------------------------------------------------------------- | |
926 */ | |
927 switch( simShrdPrm.rslt ) | |
928 { | |
929 case( SIM_NO_ERROR ): | |
930 /* | |
931 * Try it again | |
932 */ | |
933 simEntStat.curCmd = AT_CMD_NONE; | |
934 aoc_update_acm (SECOND_UPDATE, 0L); | |
935 break; | |
936 | |
937 default: | |
938 simEntStat.curCmd = AT_CMD_NONE; | |
939 R_AT( RAT_CME, simEntStat.entOwn ) | |
940 ( AT_CMD_CACM, CME_ERR_WrongPasswd ); | |
941 break; | |
942 } | |
943 break; | |
944 | |
945 /*----------------------------------------------------------* | |
946 * The below code is for CPBW SIM verification response * | |
947 *----------------------------------------------------------*/ | |
948 | |
949 case( AT_CMD_CPBS ): | |
950 /* | |
951 *---------------------------------------------------------------- | |
952 * process event for +CPBW command | |
953 *---------------------------------------------------------------- | |
954 */ | |
955 switch( simShrdPrm.rslt ) | |
956 { | |
957 case( SIM_NO_ERROR ): | |
958 | |
959 /*-----------------------------------------------* | |
960 * if verified PIN was PIN 2 was already entered * | |
961 *-----------------------------------------------*/ | |
962 | |
963 cmdBuf = simEntStat.curCmd; | |
964 simEntStat.curCmd = AT_CMD_NONE; | |
965 | |
966 pPHBCmdPrm->cmhStor = pPHBCmdPrm->temp_cmhStor; | |
967 pPHBCmdPrm->phbStor = pPHBCmdPrm->temp_phbStor; | |
968 | |
969 R_AT( RAT_OK, simEntStat.entOwn ) | |
970 ( cmdBuf ); | |
971 | |
972 cmh_logRslt ( simEntStat.entOwn, RAT_OK, cmdBuf, -1, -1, -1 ); | |
973 | |
974 /*---------------------------------------------------------------* | |
975 * otherwise wait for SIM insert indication to complete command * | |
976 *---------------------------------------------------------------*/ | |
977 | |
978 break; | |
979 | |
980 case( SIM_CAUSE_PUK2_EXPECT ): | |
981 case( SIM_CAUSE_PIN2_BLOCKED): | |
982 case( SIM_CAUSE_PIN2_EXPECT ): | |
983 | |
984 cmdBuf = simEntStat.curCmd; | |
985 simEntStat.curCmd = AT_CMD_NONE; | |
986 | |
987 R_AT( RAT_CME, simEntStat.entOwn ) | |
988 ( cmdBuf, CME_ERR_WrongPasswd ); | |
989 cmh_logRslt ( simEntStat.entOwn, RAT_CME, cmdBuf, | |
990 -1, -1, CME_ERR_WrongPasswd ); | |
991 break; | |
992 | |
993 default: | |
994 cmdBuf = simEntStat.curCmd; | |
995 simEntStat.curCmd = AT_CMD_NONE; | |
996 R_AT( RAT_CME, simEntStat.entOwn ) | |
997 ( cmdBuf, CME_ERR_SimFail ); | |
998 break; | |
999 } | |
1000 break; | |
1001 | |
1002 default: | |
1003 | |
1004 simEntStat.curCmd = AT_CMD_NONE; | |
1005 R_AT( RAT_CME, simEntStat.entOwn ) | |
1006 ( AT_CMD_CPIN, CME_ERR_Unknown ); | |
1007 cmh_logRslt ( simEntStat.entOwn, RAT_CME, AT_CMD_CPIN, | |
1008 -1, -1, CME_ERR_Unknown ); | |
1009 break; | |
1010 } | |
1011 } | |
1012 | |
1013 /* | |
1014 +-------------------------------------------------------------------+ | |
1015 | PROJECT : GSM-PS (6147) MODULE : CMH_SIMR | | |
1016 | ROUTINE : cmhSIM_PINChanged | | |
1017 +-------------------------------------------------------------------+ | |
1018 | |
1019 PURPOSE : SIM changed | |
1020 | |
1021 */ | |
1022 | |
1023 GLOBAL void cmhSIM_PINChanged ( void ) | |
1024 { | |
1025 T_ACI_CME_ERR err; | |
1026 UBYTE cmdBuf; | |
1027 | |
1028 TRACE_FUNCTION ("cmhSIM_PINChanged()"); | |
1029 | |
1030 /* | |
1031 *------------------------------------------------------------------- | |
1032 * check for command context | |
1033 *------------------------------------------------------------------- | |
1034 */ | |
1035 switch( simEntStat.curCmd ) | |
1036 { | |
1037 case( AT_CMD_CPWD ): | |
1038 /*lint -e{408} */ | |
1039 case( KSD_CMD_PWD ): /* KSD_CMD_* extends AT_CMD_* */ | |
1040 /* | |
1041 *---------------------------------------------------------------- | |
1042 * process event for +CPWD and KSD PWD command | |
1043 *---------------------------------------------------------------- | |
1044 */ | |
1045 switch( simShrdPrm.rslt ) | |
1046 { | |
1047 case( SIM_NO_ERROR ): | |
1048 | |
1049 cmdBuf = simEntStat.curCmd; | |
1050 simEntStat.curCmd = AT_CMD_NONE; | |
1051 | |
1052 R_AT( RAT_OK, simEntStat.entOwn ) | |
1053 ( cmdBuf ); | |
1054 cmh_logRslt ( simEntStat.entOwn, RAT_OK, cmdBuf, -1, -1, -1 ); | |
1055 return; | |
1056 | |
1057 /* why not use a meaningful CME error code? | |
1058 case( SIM_CAUSE_PUK1_EXPECT ): | |
1059 case( SIM_CAUSE_PUK2_EXPECT ): */ | |
1060 case( SIM_CAUSE_PIN1_EXPECT ): | |
1061 case( SIM_CAUSE_PIN2_EXPECT ): | |
1062 err = CME_ERR_WrongPasswd; | |
1063 break; | |
1064 | |
1065 default: | |
1066 err = cmhSIM_GetCmeFromSim ( simShrdPrm.rslt ); | |
1067 break; | |
1068 } | |
1069 | |
1070 cmdBuf = simEntStat.curCmd; | |
1071 simEntStat.curCmd = AT_CMD_NONE; | |
1072 | |
1073 R_AT( RAT_CME, simEntStat.entOwn ) | |
1074 ( cmdBuf, err ); | |
1075 cmh_logRslt ( simEntStat.entOwn, RAT_CME, cmdBuf, | |
1076 -1, -1, err ); | |
1077 break; | |
1078 } | |
1079 } | |
1080 | |
1081 /* | |
1082 +-------------------------------------------------------------------+ | |
1083 | PROJECT : GSM-PS (6147) MODULE : CMH_SIMR | | |
1084 | ROUTINE : cmhSIM_PINEnabled | | |
1085 +-------------------------------------------------------------------+ | |
1086 | |
1087 PURPOSE : SIM enabled | |
1088 | |
1089 */ | |
1090 | |
1091 GLOBAL void cmhSIM_PINEnabled ( void ) | |
1092 { | |
1093 T_ACI_CME_ERR err; | |
1094 | |
1095 TRACE_FUNCTION ("cmhSIM_PINEnabled()"); | |
1096 | |
1097 /* | |
1098 *------------------------------------------------------------------- | |
1099 * check for command context | |
1100 *------------------------------------------------------------------- | |
1101 */ | |
1102 switch( simEntStat.curCmd ) | |
1103 { | |
1104 case( AT_CMD_CLCK ): | |
1105 /* | |
1106 *---------------------------------------------------------------- | |
1107 * process event for +CLCK command | |
1108 *---------------------------------------------------------------- | |
1109 */ | |
1110 switch( simShrdPrm.rslt ) | |
1111 { | |
1112 case( SIM_NO_ERROR ): | |
1113 | |
1114 simEntStat.curCmd = AT_CMD_NONE; | |
1115 | |
1116 R_AT( RAT_OK, simEntStat.entOwn ) | |
1117 ( AT_CMD_CLCK ); | |
1118 cmh_logRslt ( simEntStat.entOwn, RAT_OK, AT_CMD_CLCK, -1, -1, -1 ); | |
1119 return; | |
1120 | |
1121 case( SIM_CAUSE_PIN1_EXPECT ): | |
1122 case( SIM_CAUSE_PIN1_BLOCKED ): | |
1123 err = CME_ERR_WrongPasswd; | |
1124 break; | |
1125 | |
1126 default: | |
1127 err = cmhSIM_GetCmeFromSim ( simShrdPrm.rslt ); | |
1128 break; | |
1129 } | |
1130 | |
1131 simEntStat.curCmd = AT_CMD_NONE; | |
1132 | |
1133 R_AT( RAT_CME, simEntStat.entOwn ) | |
1134 ( AT_CMD_CLCK, err ); | |
1135 cmh_logRslt ( simEntStat.entOwn, RAT_CME, AT_CMD_CLCK, | |
1136 -1, -1, err ); | |
1137 break; | |
1138 } | |
1139 } | |
1140 | |
1141 /* | |
1142 +-------------------------------------------------------------------+ | |
1143 | PROJECT : GSM-PS (6147) MODULE : CMH_SIMR | | |
1144 | ROUTINE : cmhSIM_PINDisabled | | |
1145 +-------------------------------------------------------------------+ | |
1146 | |
1147 PURPOSE : SIM disabled | |
1148 | |
1149 */ | |
1150 | |
1151 GLOBAL void cmhSIM_PINDisabled ( void ) | |
1152 { | |
1153 T_ACI_CME_ERR err; | |
1154 | |
1155 TRACE_FUNCTION ("cmhSIM_PINDisabled()"); | |
1156 | |
1157 /* | |
1158 *------------------------------------------------------------------- | |
1159 * check for command context | |
1160 *------------------------------------------------------------------- | |
1161 */ | |
1162 switch( simEntStat.curCmd ) | |
1163 { | |
1164 case( AT_CMD_CLCK ): | |
1165 /* | |
1166 *---------------------------------------------------------------- | |
1167 * process event for +CLCK command | |
1168 *---------------------------------------------------------------- | |
1169 */ | |
1170 switch( simShrdPrm.rslt ) | |
1171 { | |
1172 case( SIM_NO_ERROR ): | |
1173 | |
1174 simEntStat.curCmd = AT_CMD_NONE; | |
1175 | |
1176 R_AT( RAT_OK, simEntStat.entOwn ) | |
1177 ( AT_CMD_CLCK ); | |
1178 cmh_logRslt ( simEntStat.entOwn, RAT_OK, AT_CMD_CLCK, -1, -1, -1 ); | |
1179 return; | |
1180 | |
1181 case( SIM_CAUSE_PIN1_EXPECT ): | |
1182 case( SIM_CAUSE_PIN1_BLOCKED ): | |
1183 err = CME_ERR_WrongPasswd; | |
1184 break; | |
1185 | |
1186 default: | |
1187 err = cmhSIM_GetCmeFromSim ( simShrdPrm.rslt ); | |
1188 break; | |
1189 } | |
1190 | |
1191 simEntStat.curCmd = AT_CMD_NONE; | |
1192 | |
1193 R_AT( RAT_CME, simEntStat.entOwn ) | |
1194 ( AT_CMD_CLCK, err ); | |
1195 cmh_logRslt ( simEntStat.entOwn, RAT_CME, AT_CMD_CLCK, | |
1196 -1, -1, err ); | |
1197 break; | |
1198 } | |
1199 } | |
1200 | |
1201 /* | |
1202 +-------------------------------------------------------------------+ | |
1203 | PROJECT : GSM-PS (6147) MODULE : CMH_SIMR | | |
1204 | ROUTINE : cmhSIM_CardUnblocked | | |
1205 +-------------------------------------------------------------------+ | |
1206 | |
1207 PURPOSE : Card unblocked | |
1208 | |
1209 */ | |
1210 | |
1211 GLOBAL void cmhSIM_CardUnblocked ( void ) | |
1212 { | |
1213 UBYTE cmdBuf; | |
1214 T_ACI_CME_ERR err; | |
1215 | |
1216 TRACE_FUNCTION ("cmhSIM_CardUnblocked()"); | |
1217 | |
1218 /* | |
1219 *------------------------------------------------------------------- | |
1220 * check for command context | |
1221 *------------------------------------------------------------------- | |
1222 */ | |
1223 switch( simEntStat.curCmd ) | |
1224 { | |
1225 case( AT_CMD_CPIN ): | |
1226 case( AT_CMD_PVRF ): | |
1227 /*lint -e{408} */ | |
1228 case( KSD_CMD_UBLK ): | |
1229 /* | |
1230 *---------------------------------------------------------------- | |
1231 * process event for +CPIN, %PVRF and KSD UBLK command | |
1232 *---------------------------------------------------------------- | |
1233 */ | |
1234 switch( simShrdPrm.rslt ) | |
1235 { | |
1236 case( SIM_NO_ERROR ): | |
1237 | |
1238 if(simShrdPrm.crdPhs NEQ 0xFF)/* If SIM insert indication is already received*/ | |
1239 { | |
1240 cmdBuf = simEntStat.curCmd; | |
1241 simEntStat.curCmd = AT_CMD_NONE; | |
1242 | |
1243 R_AT( RAT_OK, simEntStat.entOwn ) | |
1244 ( cmdBuf ); | |
1245 cmh_logRslt ( simEntStat.entOwn, RAT_OK, cmdBuf, -1, -1, -1 ); | |
1246 }/* else wait till SIM insert indication is received*/ | |
1247 return; | |
1248 | |
1249 /* why not use a meaningful CME error code? | |
1250 case( SIM_CAUSE_PUK1_EXPECT ): | |
1251 case( SIM_CAUSE_PUK2_EXPECT ): */ | |
1252 case( SIM_CAUSE_PIN1_EXPECT ): | |
1253 case( SIM_CAUSE_PIN2_EXPECT ): | |
1254 err = CME_ERR_WrongPasswd; | |
1255 break; | |
1256 | |
1257 default: | |
1258 err = cmhSIM_GetCmeFromSim ( simShrdPrm.rslt ); | |
1259 break; | |
1260 } | |
1261 | |
1262 cmdBuf = simEntStat.curCmd; | |
1263 simEntStat.curCmd = AT_CMD_NONE; | |
1264 | |
1265 R_AT( RAT_CME, simEntStat.entOwn ) | |
1266 ( cmdBuf, err ); | |
1267 cmh_logRslt ( simEntStat.entOwn, RAT_CME, cmdBuf, | |
1268 -1, -1, err ); | |
1269 break; | |
1270 } | |
1271 } | |
1272 | |
1273 /* | |
1274 +-------------------------------------------------------------------+ | |
1275 | PROJECT : GSM-PS (6147) MODULE : CMH_SIMR | | |
1276 | ROUTINE : cmhSIM_SIMResponseData | | |
1277 +-------------------------------------------------------------------+ | |
1278 | |
1279 PURPOSE : SIM response data | |
1280 | |
1281 */ | |
1282 | |
1283 GLOBAL void cmhSIM_SIMResponseData( T_SIM_TRNS_RSP_PRM* rsp ) | |
1284 { | |
1285 UBYTE cmdBuf; /* buffers command */ | |
1286 T_ACI_CMD_SRC ownBuf; /* buffers current owner */ | |
1287 UBYTE *rspData; | |
1288 | |
1289 TRACE_FUNCTION ("cmhSIM_SIMResponseData()"); | |
1290 | |
1291 cmdBuf = simEntStat.curCmd; | |
1292 simEntStat.curCmd = AT_CMD_NONE; | |
1293 | |
1294 ownBuf = simEntStat.entOwn; | |
1295 simEntStat.entOwn = simShrdPrm.owner = OWN_NONE; | |
1296 | |
1297 /* | |
1298 *------------------------------------------------------------------- | |
1299 * check for command context | |
1300 *------------------------------------------------------------------- | |
1301 */ | |
1302 switch( cmdBuf ) | |
1303 { | |
1304 case( AT_CMD_CRSM ): | |
1305 if (simShrdPrm.rslt NEQ SIM_NO_ERROR AND | |
1306 GET_CAUSE_DEFBY(simShrdPrm.rslt) EQ DEFBY_CONDAT ) | |
1307 { | |
1308 /* | |
1309 *---------------------------------------------------------------- | |
1310 * error event for +CRSM | |
1311 *---------------------------------------------------------------- | |
1312 */ | |
1313 R_AT( RAT_CME, ownBuf ) | |
1314 ( | |
1315 cmdBuf, | |
1316 cmhSIM_GetCmeFromSim ( simShrdPrm.rslt ) | |
1317 ); | |
1318 } | |
1319 else | |
1320 { | |
1321 /* | |
1322 *---------------------------------------------------------------- | |
1323 * process event for +CRSM | |
1324 *---------------------------------------------------------------- | |
1325 */ | |
1326 R_AT( RAT_CRSM, ownBuf ) | |
1327 ( rsp->sw1, rsp->sw2, rsp->rspLen, ((rsp->rspLen)?rsp->rsp:NULL)); | |
1328 | |
1329 R_AT( RAT_OK, ownBuf ) | |
1330 ( cmdBuf ); | |
1331 } | |
1332 break; | |
1333 | |
1334 case( AT_CMD_CSIM ): | |
1335 /* | |
1336 *---------------------------------------------------------------- | |
1337 * error event for +CSIM | |
1338 *---------------------------------------------------------------- | |
1339 */ | |
1340 if (simShrdPrm.rslt NEQ SIM_NO_ERROR) | |
1341 { | |
1342 R_AT( RAT_CME, ownBuf ) | |
1343 ( | |
1344 cmdBuf, | |
1345 cmhSIM_GetCmeFromSim ( simShrdPrm.rslt ) | |
1346 ); | |
1347 | |
1348 return; | |
1349 } | |
1350 /* | |
1351 *---------------------------------------------------------------- | |
1352 * process event for +CSIM | |
1353 *---------------------------------------------------------------- | |
1354 */ | |
1355 ACI_MALLOC(rspData, MAX_SIM_CMD+2); /* alloc 2 byte more for sw1 and sw2 */ | |
1356 memcpy (rspData, rsp->rsp, rsp->rspLen); | |
1357 rspData[rsp->rspLen++] = rsp->sw1; | |
1358 rspData[rsp->rspLen++] = rsp->sw2; | |
1359 | |
1360 R_AT( RAT_CSIM, ownBuf ) | |
1361 ( rsp->rspLen, rspData); | |
1362 | |
1363 ACI_MFREE(rspData); | |
1364 | |
1365 R_AT( RAT_OK, ownBuf ) | |
1366 ( cmdBuf ); | |
1367 break; | |
1368 | |
1369 default: | |
1370 TRACE_EVENT("wrong command context (+CRSM or +CSIM expected)"); | |
1371 break; | |
1372 } | |
1373 } | |
1374 | |
1375 /* | |
1376 +--------------------------------------------------------------------+ | |
1377 | PROJECT : GSM-PS (6147) MODULE : CMH_SIMR | | |
1378 | ROUTINE : cmhSIM_CnfMsisdn | | |
1379 +--------------------------------------------------------------------+ | |
1380 | |
1381 PURPOSE : This function handles the confirmation of reading | |
1382 EF MSISDN from SIM. | |
1383 */ | |
1384 GLOBAL void cmhSIM_CnfMsisdn ( SHORT table_id ) | |
1385 { | |
1386 T_SIM_CMD_PRM* pSIMCmdPrm; /* points to SIM command parameters */ | |
1387 T_ACI_AT_CMD cmdBuf; /* buffers current command */ | |
1388 T_ACI_CMD_SRC ownBuf; /* buffers current owner */ | |
1389 | |
1390 UBYTE* ptr; /* pointer to decoded data */ | |
1391 UBYTE alphaLen; /* max. length of alpha identifier */ | |
1392 UBYTE tmpActRec; /* actual record number */ | |
1393 UBYTE* pExchData; /* points to exchange data buffer */ | |
1394 UBYTE dataLen; /* holds length of data */ | |
1395 | |
1396 TRACE_FUNCTION ("cmhSIM_CnfMsisdn()"); | |
1397 | |
1398 pSIMCmdPrm = &cmhPrm[simEntStat.entOwn].simCmdPrm; | |
1399 cmdBuf = simEntStat.curCmd; | |
1400 ownBuf = simEntStat.entOwn; | |
1401 pExchData = simShrdPrm.atb[table_id].exchData; | |
1402 dataLen = simShrdPrm.atb[table_id].dataLen; | |
1403 | |
1404 | |
1405 switch ( simShrdPrm.atb[table_id].errCode ) | |
1406 { | |
1407 case ( SIM_NO_ERROR ): | |
1408 { | |
1409 /* | |
1410 *------------------------------------------------------------- | |
1411 * check basic consistency of read data | |
1412 *------------------------------------------------------------- | |
1413 */ | |
1414 if ( pExchData EQ NULL OR | |
1415 dataLen < ACI_MIN_SIZE_EF_MSISDN ) | |
1416 { | |
1417 simEntStat.curCmd = AT_CMD_NONE; | |
1418 simEntStat.entOwn = simShrdPrm.owner = OWN_NONE; | |
1419 | |
1420 R_AT( RAT_CME, ownBuf ) ( cmdBuf, CME_ERR_Unknown ); | |
1421 } | |
1422 else | |
1423 { | |
1424 ptr = pExchData; | |
1425 alphaLen = dataLen - ACI_MIN_SIZE_EF_MSISDN; | |
1426 | |
1427 /* | |
1428 *----------------------------------------------------------- | |
1429 * process parameter <lenEfMsisdn> | |
1430 *----------------------------------------------------------- | |
1431 */ | |
1432 CNUMLenEfMsisdn = dataLen; | |
1433 | |
1434 /* | |
1435 *----------------------------------------------------------- | |
1436 * process parameter <cnumMaxRec> | |
1437 *----------------------------------------------------------- | |
1438 */ | |
1439 if ( pSIMCmdPrm -> CNUMActRec EQ 1 ) | |
1440 CNUMMaxRec = simShrdPrm.atb[table_id].recMax; | |
1441 | |
1442 /* | |
1443 *----------------------------------------------------------- | |
1444 * process parameter <alpha> | |
1445 *----------------------------------------------------------- | |
1446 */ | |
1447 cmhPHB_getTagNt ( ptr, | |
1448 alphaLen, | |
1449 CNUMMsisdn[CNUMMsisdnIdx].alpha, | |
1450 MAX_ALPHA_LEN ); | |
1451 | |
1452 ptr += alphaLen; | |
1453 | |
1454 /* | |
1455 *----------------------------------------------------------- | |
1456 * process parameter <number> | |
1457 *----------------------------------------------------------- | |
1458 */ | |
1459 cmhPHB_getAdrStr ( CNUMMsisdn[CNUMMsisdnIdx].number, | |
1460 MAX_PHB_NUM_LEN - 1, | |
1461 ptr + 2, | |
1462 *ptr ); | |
1463 | |
1464 /* | |
1465 *----------------------------------------------------------- | |
1466 * validate entry of MSISDN list | |
1467 *----------------------------------------------------------- | |
1468 */ | |
1469 /* VO patch 14.03.01 | |
1470 * move validate entry to after decoding alpha and number | |
1471 * and set the vldFlag only when the alpha or the number exists. */ | |
1472 if ( strlen(CNUMMsisdn[CNUMMsisdnIdx].number) OR | |
1473 strlen(CNUMMsisdn[CNUMMsisdnIdx].alpha) ) | |
1474 { | |
1475 CNUMMsisdn[CNUMMsisdnIdx].vldFlag = TRUE; | |
1476 pSIMCmdPrm -> CNUMOutput++; | |
1477 } | |
1478 | |
1479 /* | |
1480 *----------------------------------------------------------- | |
1481 * process parameter <type> | |
1482 *----------------------------------------------------------- | |
1483 */ | |
1484 cmhPHB_toaDmrg ( *( ptr + 1 ), | |
1485 &CNUMMsisdn[CNUMMsisdnIdx].type ); | |
1486 | |
1487 ptr += 12; | |
1488 | |
1489 /* | |
1490 *----------------------------------------------------------- | |
1491 * invalidate parameter <speed>, <service>, <itc> | |
1492 *----------------------------------------------------------- | |
1493 */ | |
1494 CNUMMsisdn[CNUMMsisdnIdx].speed = BS_SPEED_NotPresent; | |
1495 CNUMMsisdn[CNUMMsisdnIdx].service = CNUM_SERV_NotPresent; | |
1496 CNUMMsisdn[CNUMMsisdnIdx].itc = CNUM_ITC_NotPresent; | |
1497 | |
1498 if ( *ptr NEQ 0xFF ) | |
1499 { | |
1500 /* | |
1501 *--------------------------------------------------------- | |
1502 * bearer capability EF present | |
1503 *--------------------------------------------------------- | |
1504 */ | |
1505 if ( cmhSIM_ReqCcp ( ownBuf, *ptr++ ) NEQ AT_EXCT ) | |
1506 { | |
1507 simEntStat.curCmd = AT_CMD_NONE; | |
1508 simEntStat.entOwn = simShrdPrm.owner = OWN_NONE; | |
1509 | |
1510 R_AT( RAT_CME, ownBuf ) ( cmdBuf, CME_ERR_Unknown ); | |
1511 } | |
1512 } | |
1513 else | |
1514 { | |
1515 /* | |
1516 *--------------------------------------------------------- | |
1517 * tmpActRec is used to prevent conflicts with global | |
1518 * variable pSIMCmdPrm -> CNUMActRec | |
1519 *--------------------------------------------------------- | |
1520 */ | |
1521 tmpActRec = pSIMCmdPrm -> CNUMActRec; | |
1522 | |
1523 /* | |
1524 *--------------------------------------------------------- | |
1525 * bearer capability EF abscent | |
1526 *--------------------------------------------------------- | |
1527 */ | |
1528 /* VO patch 14.03.01 - check vldFlag when it isn't TRUE decrease CNUMMsisdnIdx. | |
1529 * read the next entry and write the entry in the CNUMMsisdnIdx again */ | |
1530 if ( CNUMMsisdn[CNUMMsisdnIdx].vldFlag EQ FALSE ) | |
1531 CNUMMsisdnIdx--; | |
1532 | |
1533 if ( CNUMMsisdnIdx EQ MAX_MSISDN - 1 OR | |
1534 tmpActRec EQ CNUMMaxRec ) | |
1535 { | |
1536 simEntStat.curCmd = AT_CMD_NONE; | |
1537 simEntStat.entOwn = simShrdPrm.owner = OWN_NONE; | |
1538 | |
1539 R_AT( RAT_CNUM, ownBuf ) ( &CNUMMsisdn[0], CNUMMaxRec ); | |
1540 | |
1541 if ( tmpActRec EQ CNUMMaxRec ) | |
1542 { | |
1543 if (pSIMCmdPrm -> CNUMOutput) | |
1544 { | |
1545 R_AT( RAT_OK, ownBuf ) ( cmdBuf ); | |
1546 } | |
1547 else | |
1548 { | |
1549 R_AT( RAT_CME, ownBuf ) ( cmdBuf, CME_ERR_NotFound ); | |
1550 } | |
1551 } | |
1552 } | |
1553 else | |
1554 { | |
1555 CNUMMsisdnIdx++; | |
1556 pSIMCmdPrm -> CNUMActRec++; | |
1557 | |
1558 if ( cmhSIM_ReqMsisdn | |
1559 ( ownBuf, pSIMCmdPrm -> CNUMActRec ) NEQ AT_EXCT ) | |
1560 { | |
1561 simEntStat.curCmd = AT_CMD_NONE; | |
1562 simEntStat.entOwn = simShrdPrm.owner = OWN_NONE; | |
1563 | |
1564 R_AT( RAT_CME, ownBuf ) ( cmdBuf, CME_ERR_Unknown ); | |
1565 } | |
1566 } | |
1567 } | |
1568 } | |
1569 | |
1570 break; | |
1571 } | |
1572 | |
1573 default: | |
1574 { | |
1575 simEntStat.curCmd = AT_CMD_NONE; | |
1576 simEntStat.entOwn = simShrdPrm.owner = OWN_NONE; | |
1577 | |
1578 R_AT( RAT_CME, ownBuf ) | |
1579 ( | |
1580 cmdBuf, | |
1581 cmhSIM_GetCmeFromSim ( simShrdPrm.atb[table_id].errCode ) | |
1582 ); | |
1583 break; | |
1584 } | |
1585 | |
1586 } | |
1587 | |
1588 simShrdPrm.atb[table_id].ntryUsdFlg = FALSE; | |
1589 } | |
1590 | |
1591 /* | |
1592 +--------------------------------------------------------------------+ | |
1593 | PROJECT : GSM-F&D (8411) MODULE : CMH_SIMR | | |
1594 | STATE : code ROUTINE : cmhSIM_CnfCcp | | |
1595 +--------------------------------------------------------------------+ | |
1596 | |
1597 PURPOSE : This function handles the confirmation of reading | |
1598 EF CCP from SIM. | |
1599 */ | |
1600 GLOBAL void cmhSIM_CnfCcp ( SHORT table_id ) | |
1601 { | |
1602 T_SIM_CMD_PRM* pSIMCmdPrm; /* points to SIM command parameters */ | |
1603 T_ACI_AT_CMD cmdBuf; /* buffers current command */ | |
1604 T_ACI_CMD_SRC ownBuf; /* buffers current owner */ | |
1605 | |
1606 T_U_CALL_CONF* callCnf; /* call confirm message */ | |
1607 T_bearer_cap* bearCap; /* bearer capability */ | |
1608 UBYTE tmpActRec; /* actual record number */ | |
1609 UBYTE* pExchData; /* points to exchange data buffer */ | |
1610 UBYTE dataLen; /* holds length of data */ | |
1611 | |
1612 TRACE_FUNCTION ("cmhSIM_CnfCcp()"); | |
1613 | |
1614 pSIMCmdPrm = &cmhPrm[simEntStat.entOwn].simCmdPrm; | |
1615 cmdBuf = simEntStat.curCmd; | |
1616 ownBuf = simEntStat.entOwn; | |
1617 dataLen = simShrdPrm.atb[table_id].dataLen; | |
1618 pExchData = simShrdPrm.atb[table_id].exchData; | |
1619 | |
1620 switch ( simShrdPrm.atb[table_id].errCode ) | |
1621 { | |
1622 case ( SIM_NO_ERROR ): | |
1623 { | |
1624 /* | |
1625 *------------------------------------------------------------- | |
1626 * check basic consistency of read data | |
1627 *------------------------------------------------------------- | |
1628 */ | |
1629 if ( pExchData EQ NULL OR | |
1630 dataLen NEQ ACI_SIZE_EF_CCP ) | |
1631 { | |
1632 simEntStat.curCmd = AT_CMD_NONE; | |
1633 simEntStat.entOwn = simShrdPrm.owner = OWN_NONE; | |
1634 | |
1635 R_AT( RAT_CME, ownBuf ) ( cmdBuf, CME_ERR_Unknown ); | |
1636 } | |
1637 else | |
1638 { | |
1639 /* | |
1640 *----------------------------------------------------------- | |
1641 * extracting the relevant data from bearer capability IE | |
1642 *----------------------------------------------------------- | |
1643 */ | |
1644 UBYTE bearCapLen = pExchData[0]; | |
1645 | |
1646 if (bearCapLen <= 13 ) /* do not decode empty or invalid entries, | |
1647 see 11.11/10.5.4.1 max 14 bytes */ | |
1648 { | |
1649 PALLOC_MSG ( msg, MMCC_DATA_REQ, U_CALL_CONF); | |
1650 | |
1651 msg -> sdu.l_buf = bearCapLen * 0x08; | |
1652 msg -> sdu.o_buf = 0x08; | |
1653 msg -> sdu.buf[0] = 0x83; | |
1654 msg -> sdu.buf[1] = U_CALL_CONF; | |
1655 | |
1656 memcpy ( &msg -> sdu.buf[2], | |
1657 pExchData, | |
1658 bearCapLen + 1 ); | |
1659 | |
1660 /* | |
1661 *----------------------------------------------------------- | |
1662 * use of CCD for decoding of bearer capability | |
1663 *----------------------------------------------------------- | |
1664 */ | |
1665 CCD_START; | |
1666 | |
1667 memset (_decodedMsg, 0, sizeof (_decodedMsg)); | |
1668 | |
1669 if ( ccd_decodeMsg ( CCDENT_CC, | |
1670 UPLINK, | |
1671 (T_MSGBUF *) &msg->sdu, | |
1672 (UBYTE *) _decodedMsg, | |
1673 NOT_PRESENT_8BIT) EQ ccdOK | |
1674 AND | |
1675 | |
1676 _decodedMsg[0] EQ U_CALL_CONF ) | |
1677 { | |
1678 callCnf = ( T_U_CALL_CONF * )&_decodedMsg[0]; | |
1679 | |
1680 if ( callCnf -> v_bearer_cap ) | |
1681 { | |
1682 bearCap = &callCnf -> bearer_cap; | |
1683 | |
1684 /* | |
1685 *------------------------------------------------------- | |
1686 * process parameter <speed> of MSISDN | |
1687 *------------------------------------------------------- | |
1688 */ | |
1689 if ( bearCap -> v_user_rate ) | |
1690 { | |
1691 CNUMMsisdn[CNUMMsisdnIdx].speed = | |
1692 cmhSIM_GetUserRate ( bearCap -> user_rate ); | |
1693 } | |
1694 | |
1695 /* | |
1696 *------------------------------------------------------- | |
1697 * process parameter <itc> and <service> of MSISDN | |
1698 *------------------------------------------------------- | |
1699 */ | |
1700 if ( bearCap -> v_trans_cap ) | |
1701 { | |
1702 CNUMMsisdn[CNUMMsisdnIdx].itc = | |
1703 cmhSIM_GetItc ( bearCap -> trans_cap ); | |
1704 } | |
1705 | |
1706 if ( bearCap -> v_user_inf_l2_prot AND | |
1707 bearCap -> user_inf_l2_prot EQ L2_X25 AND | |
1708 bearCap -> v_sync_async AND | |
1709 bearCap -> sync_async EQ SYNCHRONOUS ) | |
1710 { | |
1711 CNUMMsisdn[CNUMMsisdnIdx].service = | |
1712 CNUM_SERV_PacketSynch; | |
1713 } | |
1714 else if | |
1715 ( bearCap -> v_sig_access_prot | |
1716 AND | |
1717 ( bearCap -> sig_access_prot EQ SIAP_X28_INDIV_NUI OR | |
1718 bearCap -> sig_access_prot EQ SIAP_X28_UNIV_NUI OR | |
1719 bearCap -> sig_access_prot EQ SIAP_X28_NON_DEDIC | |
1720 ) | |
1721 AND | |
1722 bearCap -> v_sync_async | |
1723 AND | |
1724 bearCap -> sync_async EQ ASYNCHRONOUS | |
1725 ) | |
1726 { | |
1727 CNUMMsisdn[CNUMMsisdnIdx].service = | |
1728 CNUM_SERV_PadAsynch; | |
1729 } | |
1730 else if ( bearCap -> v_sync_async ) | |
1731 { | |
1732 CNUMMsisdn[CNUMMsisdnIdx].service = | |
1733 cmhSIM_GetSrvFromSync ( bearCap -> sync_async ); | |
1734 | |
1735 } | |
1736 else if ( bearCap -> v_trans_cap ) | |
1737 { | |
1738 CNUMMsisdn[CNUMMsisdnIdx].service = | |
1739 cmhSIM_GetSrvFromItc ( bearCap -> trans_cap ); | |
1740 } | |
1741 } | |
1742 } | |
1743 CCD_END; | |
1744 | |
1745 PFREE ( msg ); | |
1746 } | |
1747 | |
1748 /* | |
1749 *----------------------------------------------------------- | |
1750 * tmpActRec is used to prevent conflicts with global | |
1751 * variable pSIMCmdPrm -> CNUMActRec | |
1752 *----------------------------------------------------------- | |
1753 */ | |
1754 tmpActRec = pSIMCmdPrm -> CNUMActRec; | |
1755 | |
1756 if ( CNUMMsisdnIdx EQ MAX_MSISDN - 1 OR | |
1757 tmpActRec EQ CNUMMaxRec ) | |
1758 { | |
1759 simEntStat.curCmd = AT_CMD_NONE; | |
1760 simEntStat.entOwn = simShrdPrm.owner = OWN_NONE; | |
1761 | |
1762 R_AT( RAT_CNUM, ownBuf ) ( &CNUMMsisdn[0], CNUMMaxRec ); | |
1763 | |
1764 if ( tmpActRec EQ CNUMMaxRec ) | |
1765 { | |
1766 if (pSIMCmdPrm -> CNUMOutput) | |
1767 { | |
1768 R_AT( RAT_OK, ownBuf ) ( cmdBuf ); | |
1769 } | |
1770 else | |
1771 { | |
1772 R_AT( RAT_CME, ownBuf ) ( cmdBuf, CME_ERR_NotFound ); | |
1773 } | |
1774 } | |
1775 } | |
1776 else | |
1777 { | |
1778 CNUMMsisdnIdx++; | |
1779 pSIMCmdPrm -> CNUMActRec++; | |
1780 | |
1781 if ( cmhSIM_ReqMsisdn | |
1782 ( ownBuf, pSIMCmdPrm -> CNUMActRec ) NEQ AT_EXCT ) | |
1783 { | |
1784 simEntStat.curCmd = AT_CMD_NONE; | |
1785 simEntStat.entOwn = simShrdPrm.owner = OWN_NONE; | |
1786 | |
1787 R_AT( RAT_CME, ownBuf ) ( cmdBuf, CME_ERR_Unknown ); | |
1788 } | |
1789 } | |
1790 } | |
1791 | |
1792 break; | |
1793 } | |
1794 | |
1795 default: | |
1796 { | |
1797 simEntStat.curCmd = AT_CMD_NONE; | |
1798 simEntStat.entOwn = simShrdPrm.owner = OWN_NONE; | |
1799 | |
1800 R_AT( RAT_CME, ownBuf ) | |
1801 ( | |
1802 cmdBuf, | |
1803 cmhSIM_GetCmeFromSim ( simShrdPrm.atb[table_id].errCode ) | |
1804 ); | |
1805 break; | |
1806 } | |
1807 | |
1808 } | |
1809 | |
1810 simShrdPrm.atb[table_id].ntryUsdFlg = FALSE; | |
1811 } | |
1812 | |
1813 /* | |
1814 +--------------------------------------------------------------------+ | |
1815 | PROJECT : GSM-F&D (8411) MODULE : CMH_SIMR | | |
1816 | STATE : code ROUTINE : cmhSIM_RdCnfPlmnSel| | |
1817 +--------------------------------------------------------------------+ | |
1818 | |
1819 PURPOSE : This function handles the confirmation of reading | |
1820 EF PLMN SEL from SIM. | |
1821 */ | |
1822 GLOBAL void cmhSIM_RdCnfPlmnSel ( SHORT table_id ) | |
1823 { | |
1824 T_SIM_CMD_PRM * pSIMCmdPrm; /* points to SIM command parameters */ | |
1825 T_ACI_AT_CMD cmdBuf; /* buffers current command */ | |
1826 T_ACI_CMD_SRC ownBuf; /* buffers current owner */ | |
1827 T_ACI_CPOL_LST CPOLPlmnSelLst; /* PLMN SEL list */ | |
1828 T_ACI_RETURN ret; | |
1829 SHORT lastIdx; /* holds last index */ | |
1830 SHORT usdNtry; /* holds number of used entries */ | |
1831 | |
1832 TRACE_FUNCTION ("cmhSIM_RdCnfPlmnSel()"); | |
1833 | |
1834 pSIMCmdPrm = &cmhPrm[simEntStat.entOwn].simCmdPrm; | |
1835 cmdBuf = simEntStat.curCmd; | |
1836 ownBuf = simEntStat.entOwn; | |
1837 | |
1838 | |
1839 switch ( simShrdPrm.atb[table_id].errCode ) | |
1840 { | |
1841 case ( SIM_NO_ERROR ): | |
1842 { | |
1843 /* | |
1844 *------------------------------------------------------------- | |
1845 * check basic consistency of read data | |
1846 *------------------------------------------------------------- | |
1847 */ | |
1848 if ( simShrdPrm.atb[table_id].exchData EQ NULL OR | |
1849 simShrdPrm.atb[table_id].dataLen < ACI_MIN_SIZE_EF_PLMN_SEL) | |
1850 { | |
1851 pSIMCmdPrm->CPOLact = CPOL_ACT_None; | |
1852 simEntStat.curCmd = AT_CMD_NONE; | |
1853 simEntStat.entOwn = simShrdPrm.owner = OWN_NONE; | |
1854 | |
1855 R_AT( RAT_CME, ownBuf ) ( cmdBuf, CME_ERR_Unknown ); | |
1856 break; | |
1857 } | |
1858 | |
1859 EfPLMNselStat = EF_STAT_READ; | |
1860 CPOLSimEfDataLen = simShrdPrm.atb[table_id].dataLen; | |
1861 | |
1862 if( pSIMCmdPrm->CPOLmode EQ CPOL_MOD_CompactList ) | |
1863 { | |
1864 cmhSIM_CmpctPlmnSel( simShrdPrm.atb[table_id].dataLen, | |
1865 simShrdPrm.atb[table_id].exchData ); | |
1866 } | |
1867 | |
1868 /* | |
1869 *----------------------------------------------------------- | |
1870 * what is to do ? | |
1871 *----------------------------------------------------------- | |
1872 */ | |
1873 switch( pSIMCmdPrm->CPOLact ) | |
1874 { | |
1875 /* | |
1876 *----------------------------------------------------------- | |
1877 * read out PLMN SEL list | |
1878 *----------------------------------------------------------- | |
1879 */ | |
1880 case( CPOL_ACT_Read ): | |
1881 | |
1882 /* fill in buffer */ | |
1883 lastIdx = cmhSIM_FillPlmnSelList(pSIMCmdPrm->CPOLidx, | |
1884 pSIMCmdPrm->CPOLfrmt, | |
1885 &CPOLPlmnSelLst[0], | |
1886 simShrdPrm.atb[table_id].dataLen, | |
1887 (UBYTE *)simShrdPrm.atb[table_id].exchData); | |
1888 /* notify about PLMN SEL list */ | |
1889 simEntStat.curCmd = AT_CMD_NONE; | |
1890 simEntStat.entOwn = simShrdPrm.owner = OWN_NONE; | |
1891 | |
1892 R_AT( RAT_CPOL, ownBuf ) ( ACI_NumParmNotPresent, | |
1893 lastIdx, | |
1894 &CPOLPlmnSelLst[0], | |
1895 ACI_NumParmNotPresent ); | |
1896 | |
1897 R_AT( RAT_OK, ownBuf )( AT_CMD_CPOL ); | |
1898 break; | |
1899 | |
1900 /* | |
1901 *----------------------------------------------------------- | |
1902 * write PLMN SEL list | |
1903 *----------------------------------------------------------- | |
1904 */ | |
1905 case( CPOL_ACT_Write ): | |
1906 | |
1907 if( pSIMCmdPrm->CPOLidx EQ NOT_PRESENT_8BIT ) | |
1908 | |
1909 ret = cmhSIM_FndEmptyPlmnSel( simEntStat.entOwn, | |
1910 pSIMCmdPrm->CPOLplmn ); | |
1911 else | |
1912 | |
1913 ret = cmhSIM_UpdPlmnSel( simEntStat.entOwn, | |
1914 pSIMCmdPrm->CPOLidx, | |
1915 pSIMCmdPrm->CPOLplmn, | |
1916 pSIMCmdPrm->CPOLmode); | |
1917 if( ret EQ AT_FAIL ) | |
1918 { | |
1919 pSIMCmdPrm->CPOLact = CPOL_ACT_None; | |
1920 simEntStat.curCmd = AT_CMD_NONE; | |
1921 simEntStat.entOwn = simShrdPrm.owner = OWN_NONE; | |
1922 | |
1923 R_AT( RAT_CME, simEntStat.entOwn ) | |
1924 ( | |
1925 AT_CMD_CPOL, | |
1926 ACI_ERR_DESC_NR( aciErrDesc ) | |
1927 ); | |
1928 } | |
1929 break; | |
1930 | |
1931 /* | |
1932 *----------------------------------------------------------- | |
1933 * delete PLMN SEL entry | |
1934 *----------------------------------------------------------- | |
1935 */ | |
1936 case( CPOL_ACT_Delete ): | |
1937 | |
1938 if( pSIMCmdPrm->CPOLidx2 EQ NOT_PRESENT_8BIT ) | |
1939 | |
1940 ret = cmhSIM_DelPlmnSel( simEntStat.entOwn, | |
1941 pSIMCmdPrm->CPOLidx, | |
1942 pSIMCmdPrm->CPOLmode ); | |
1943 else | |
1944 | |
1945 ret = cmhSIM_ChgPlmnSel( simEntStat.entOwn, | |
1946 pSIMCmdPrm->CPOLidx, | |
1947 pSIMCmdPrm->CPOLidx2 ); | |
1948 | |
1949 if( ret EQ AT_FAIL ) | |
1950 { | |
1951 pSIMCmdPrm->CPOLact = CPOL_ACT_None; | |
1952 simEntStat.curCmd = AT_CMD_NONE; | |
1953 simEntStat.entOwn = simShrdPrm.owner = OWN_NONE; | |
1954 | |
1955 R_AT( RAT_CME, simEntStat.entOwn ) | |
1956 ( | |
1957 AT_CMD_CPOL, | |
1958 ACI_ERR_DESC_NR( aciErrDesc ) | |
1959 ); | |
1960 } | |
1961 break; | |
1962 | |
1963 /* | |
1964 *----------------------------------------------------------- | |
1965 * test PLMN SEL entry number | |
1966 *----------------------------------------------------------- | |
1967 */ | |
1968 case( CPOL_ACT_Test ): | |
1969 | |
1970 /* notify about PLMN SEL entry number */ | |
1971 simEntStat.curCmd = AT_CMD_NONE; | |
1972 simEntStat.entOwn = simShrdPrm.owner = OWN_NONE; | |
1973 | |
1974 lastIdx = CPOLSimEfDataLen / ACI_LEN_PLMN_SEL_NTRY; | |
1975 usdNtry = cmhSIM_UsdPlmnSelNtry( CPOLSimEfDataLen, | |
1976 (UBYTE *)simShrdPrm.atb[table_id].exchData ); | |
1977 | |
1978 R_AT( RAT_CPOL, ownBuf ) ( ACI_NumParmNotPresent, | |
1979 lastIdx, | |
1980 NULL, | |
1981 usdNtry ); | |
1982 | |
1983 R_AT( RAT_OK, ownBuf )( AT_CMD_CPOL ); | |
1984 break; | |
1985 } | |
1986 break; | |
1987 } | |
1988 | |
1989 case ( SIM_CAUSE_UNKN_FILE_ID ): | |
1990 EfPLMNselStat = EF_STAT_NOT_AVAIL; | |
1991 /*lint -fallthrough*/ | |
1992 /*lint -fallthrough*/ | |
1993 default: | |
1994 { | |
1995 pSIMCmdPrm->CPOLact = CPOL_ACT_None; | |
1996 simEntStat.curCmd = AT_CMD_NONE; | |
1997 simEntStat.entOwn = simShrdPrm.owner = OWN_NONE; | |
1998 | |
1999 R_AT( RAT_CME, ownBuf ) | |
2000 ( | |
2001 cmdBuf, | |
2002 cmhSIM_GetCmeFromSim ( simShrdPrm.atb[table_id].errCode ) | |
2003 ); | |
2004 break; | |
2005 } | |
2006 | |
2007 } | |
2008 | |
2009 simShrdPrm.atb[table_id].ntryUsdFlg = FALSE; | |
2010 | |
2011 } | |
2012 | |
2013 /* | |
2014 +--------------------------------------------------------------------+ | |
2015 | PROJECT : GSM-F&D (8411) MODULE : CMH_SIMR | | |
2016 | STATE : code ROUTINE : cmhSIM_WrCnfPlmnSel| | |
2017 +--------------------------------------------------------------------+ | |
2018 | |
2019 PURPOSE : This function handles the confirmation of writing | |
2020 EF PLMN SEL to SIM. | |
2021 */ | |
2022 GLOBAL void cmhSIM_WrCnfPlmnSel ( SHORT table_id ) | |
2023 { | |
2024 T_SIM_CMD_PRM * pSIMCmdPrm; /* points to SIM command parameters */ | |
2025 UBYTE ownBuf; | |
2026 | |
2027 TRACE_FUNCTION ("cmhSIM_WrCnfPlmnSel()"); | |
2028 | |
2029 pSIMCmdPrm = &cmhPrm[simEntStat.entOwn].simCmdPrm; | |
2030 ownBuf = simEntStat.entOwn; | |
2031 | |
2032 switch ( simShrdPrm.atb[table_id].errCode ) | |
2033 { | |
2034 /* successful PLMN SEL list update */ | |
2035 case ( SIM_NO_ERROR ): | |
2036 { | |
2037 pSIMCmdPrm->CPOLact = CPOL_ACT_None; | |
2038 simEntStat.curCmd = AT_CMD_NONE; | |
2039 simEntStat.entOwn = simShrdPrm.owner = OWN_NONE; | |
2040 | |
2041 R_AT( RAT_OK, ownBuf )( AT_CMD_CPOL ); | |
2042 break; | |
2043 } | |
2044 case SIM_CAUSE_ACCESS_PROHIBIT: | |
2045 { | |
2046 pSIMCmdPrm->CPOLact = CPOL_ACT_None; | |
2047 simEntStat.curCmd = AT_CMD_NONE; | |
2048 simEntStat.entOwn = simShrdPrm.owner = OWN_NONE; | |
2049 | |
2050 R_AT( RAT_CME, ownBuf /*simEntStat.entOwn*/ ) | |
2051 ( | |
2052 AT_CMD_CPOL, | |
2053 CME_ERR_OpNotAllow | |
2054 ); | |
2055 break; | |
2056 } | |
2057 | |
2058 /* unsuccessful PLMN SEL list update */ | |
2059 default: | |
2060 { | |
2061 pSIMCmdPrm->CPOLact = CPOL_ACT_None; | |
2062 simEntStat.curCmd = AT_CMD_NONE; | |
2063 simEntStat.entOwn = simShrdPrm.owner = OWN_NONE; | |
2064 | |
2065 R_AT( RAT_CME, ownBuf /*simEntStat.entOwn*/ ) | |
2066 ( | |
2067 AT_CMD_CPOL, | |
2068 cmhSIM_GetCmeFromSim ( simShrdPrm.atb[table_id].errCode ) | |
2069 ); | |
2070 break; | |
2071 } | |
2072 } | |
2073 | |
2074 simShrdPrm.atb[table_id].ntryUsdFlg = FALSE; | |
2075 } | |
2076 | |
2077 /* | |
2078 +--------------------------------------------------------------------+ | |
2079 | PROJECT : GSM-F&D (8411) MODULE : CMH_SIMR | | |
2080 | STATE : code ROUTINE : cmhSIM_RdCnfLangELP| | |
2081 +--------------------------------------------------------------------+ | |
2082 | |
2083 PURPOSE : This function handles the confirmation of reading | |
2084 from the SIM (EF ELP). | |
2085 */ | |
2086 GLOBAL void cmhSIM_RdCnfLangELP ( SHORT table_id ) | |
2087 { | |
2088 T_SIM_CMD_PRM *pSIMCmdPrm; /* points to SIM command parameters */ | |
2089 T_PHB_CMD_PRM *pPHBCmdPrm; /* points to PHB command parameter */ | |
2090 | |
2091 T_ACI_AT_CMD cmdBuf; /* buffers current command */ | |
2092 T_ACI_CMD_SRC ownBuf; /* buffers current owner */ | |
2093 CHAR Clang_buffer[3]={0};/* Current language */ | |
2094 T_ACI_LAN_SUP clng; | |
2095 CHAR *ef = EF_CLNG_ID; | |
2096 EF_CLNG lng; | |
2097 BOOL Suplng = FALSE; | |
2098 T_ACI_LAN_SUP LngPCMsupLst[MAX_LAN]; | |
2099 SHORT lastIdx; | |
2100 T_ACI_RETURN ret ; | |
2101 | |
2102 TRACE_FUNCTION ("cmhSIM_RdCnfLangELP()"); | |
2103 | |
2104 pSIMCmdPrm = &cmhPrm[simEntStat.entOwn].simCmdPrm; | |
2105 cmdBuf = simEntStat.curCmd; | |
2106 ownBuf = simEntStat.entOwn; | |
2107 pPHBCmdPrm = &cmhPrm[ownBuf].phbCmdPrm; | |
2108 simShrdPrm.atb[table_id].ntryUsdFlg = FALSE; | |
2109 simEntStat.curCmd = AT_CMD_NONE; | |
2110 | |
2111 clng.str = Clang_buffer; | |
2112 | |
2113 switch ( simShrdPrm.atb[table_id].errCode ) | |
2114 { | |
2115 case ( SIM_NO_ERROR ): | |
2116 /* | |
2117 *------------------------------------------------------------- | |
2118 * check basic consistency of read data | |
2119 *------------------------------------------------------------- | |
2120 */ | |
2121 if ( simShrdPrm.atb[table_id].exchData EQ NULL OR | |
2122 simShrdPrm.atb[table_id].dataLen < ACI_MIN_SIZE_EF_LAN) | |
2123 | |
2124 { | |
2125 pSIMCmdPrm->CLANact = CLAN_ACT_None; | |
2126 simEntStat.entOwn = simShrdPrm.owner = OWN_NONE; | |
2127 | |
2128 R_AT( RAT_CME, ownBuf ) ( cmdBuf, CME_ERR_Unknown ); | |
2129 return; | |
2130 } | |
2131 | |
2132 memcpy(clng.str, (UBYTE *)simShrdPrm.atb[table_id].exchData, CLAN_CODE_LEN); | |
2133 ret=getSupLangFromPCM(&LngPCMsupLst[0], &lastIdx); | |
2134 if (ret EQ AT_FAIL) | |
2135 { | |
2136 return; | |
2137 } | |
2138 Suplng=checkSuppLang(&LngPCMsupLst[0],lastIdx, &clng); | |
2139 | |
2140 simEntStat.entOwn = simShrdPrm.owner = OWN_NONE; | |
2141 | |
2142 /* | |
2143 *--------------------------------------------------------------------- | |
2144 * check if the language,which was read from EF ELP is supported in PCM | |
2145 *--------------------------------------------------------------------- | |
2146 */ | |
2147 if(Suplng) | |
2148 { | |
2149 switch( pSIMCmdPrm->CLANact ) | |
2150 { | |
2151 case( CLAN_ACT_Read ): | |
2152 R_AT( RAT_CLAN, ownBuf ) (&clng); | |
2153 R_AT( RAT_OK, ownBuf )( AT_CMD_CLAN ); | |
2154 break; | |
2155 case( CLAN_ACT_Write ): | |
2156 memcpy(lng.data,clng.str ,CLAN_CODE_LEN); | |
2157 pcm_WriteFile (( UBYTE* )ef,SIZE_EF_CLNG,( UBYTE*) &lng); | |
2158 | |
2159 if (pPHBCmdPrm->CLAEmode EQ CLAE_MOD_Enable) | |
2160 R_AT( RAT_CLAE, ownBuf ) (&clng); | |
2161 | |
2162 R_AT( RAT_OK, ownBuf )( AT_CMD_CLAN ); | |
2163 break; | |
2164 } | |
2165 } | |
2166 else | |
2167 /* | |
2168 *------------------------------------------------------------- | |
2169 * read the EF LP if the language is not supported in PCM | |
2170 *------------------------------------------------------------- | |
2171 */ | |
2172 cmhSIM_ReqLanguageLP (ownBuf ); | |
2173 break; | |
2174 | |
2175 /* | |
2176 *------------------------------------------------------------- | |
2177 * read the EF LP if the EF ELP not available | |
2178 *------------------------------------------------------------- | |
2179 */ | |
2180 case ( SIM_CAUSE_UNKN_FILE_ID ): | |
2181 cmhSIM_ReqLanguageLP (ownBuf ); | |
2182 break; | |
2183 | |
2184 default: | |
2185 pSIMCmdPrm->CLANact = CLAN_ACT_None; | |
2186 simEntStat.entOwn = simShrdPrm.owner = OWN_NONE; | |
2187 | |
2188 R_AT( RAT_CME, ownBuf) ( AT_CMD_CLAN, CME_ERR_Unknown ); | |
2189 break; | |
2190 | |
2191 } | |
2192 | |
2193 } | |
2194 | |
2195 | |
2196 /* | |
2197 +------------------------------------------------------------------------+ | |
2198 | PROJECT : GSM-F&D (8411) MODULE : CMH_SIMR | | |
2199 | STATE : code ROUTINE : cmhSIM_RdCnfLangPrfELP | | |
2200 +------------------------------------------------------------------------+ | |
2201 | |
2202 PURPOSE : This function handles the confirmation of reading | |
2203 from the SIM (EF ELP) for SAT feature LS. | |
2204 */ | |
2205 GLOBAL void cmhSIM_RdCnfLangPrfELP ( SHORT table_id ) | |
2206 { | |
2207 | |
2208 T_ACI_SAT_TERM_RESP resp_data; | |
2209 CHAR Clang_buffer[3]={0};/* Current language */ | |
2210 T_ACI_LAN_SUP clng; | |
2211 BOOL Suplng = FALSE; | |
2212 T_ACI_LAN_SUP LngPCMsupLst[MAX_LAN]; | |
2213 SHORT lastIdx; | |
2214 T_ACI_RETURN ret ; | |
2215 | |
2216 | |
2217 TRACE_FUNCTION ("cmhSIM_RdCnfLangPrfELP()"); | |
2218 | |
2219 psaSAT_InitTrmResp( &resp_data ); | |
2220 | |
2221 simShrdPrm.atb[table_id].ntryUsdFlg = FALSE; | |
2222 | |
2223 clng.str = Clang_buffer; | |
2224 | |
2225 switch ( simShrdPrm.atb[table_id].errCode ) | |
2226 { | |
2227 case ( SIM_NO_ERROR ): | |
2228 /* | |
2229 *------------------------------------------------------------- | |
2230 * check basic consistency of read data | |
2231 *------------------------------------------------------------- | |
2232 */ | |
2233 if ( simShrdPrm.atb[table_id].exchData EQ NULL OR | |
2234 simShrdPrm.atb[table_id].dataLen < ACI_MIN_SIZE_EF_LAN) | |
2235 | |
2236 { | |
2237 psaSAT_SendTrmResp( RSLT_ME_UNAB_PROC, &resp_data ); | |
2238 return; | |
2239 } | |
2240 | |
2241 memcpy(clng.str, (UBYTE *)simShrdPrm.atb[table_id].exchData, CLAN_CODE_LEN); | |
2242 ret=getSupLangFromPCM(&LngPCMsupLst[0], &lastIdx); | |
2243 if (ret EQ AT_FAIL) | |
2244 { | |
2245 psaSAT_SendTrmResp( RSLT_ME_UNAB_PROC, &resp_data ); | |
2246 return; | |
2247 } | |
2248 | |
2249 Suplng=checkSuppLang(&LngPCMsupLst[0],lastIdx, &clng); | |
2250 | |
2251 | |
2252 /* | |
2253 *--------------------------------------------------------------------- | |
2254 * check if the language,which was read from EF ELP is supported in PCM | |
2255 *--------------------------------------------------------------------- | |
2256 */ | |
2257 if(Suplng) | |
2258 { | |
2259 /* Send Terminal resp*/ | |
2260 memcpy(&resp_data.lang, (UBYTE *)simShrdPrm.atb[table_id].exchData, CLAN_CODE_LEN); | |
2261 | |
2262 #ifdef _SIMULATION_ | |
2263 memset(resp_data.lang, 0xA0, 2); | |
2264 #endif | |
2265 | |
2266 psaSAT_SendTrmResp( RSLT_PERF_SUCCESS, &resp_data ); | |
2267 | |
2268 } | |
2269 else | |
2270 { | |
2271 /* | |
2272 *------------------------------------------------------------- | |
2273 * read the EF LP if the language is not supported in PCM | |
2274 *------------------------------------------------------------- | |
2275 */ | |
2276 if (cmhSIM_ReqLanguagePrfLP () EQ FALSE) | |
2277 { | |
2278 psaSAT_SendTrmResp( RSLT_ME_UNAB_PROC, &resp_data ); | |
2279 } | |
2280 } | |
2281 break; | |
2282 | |
2283 /* | |
2284 *------------------------------------------------------------- | |
2285 * read the EF LP if the EF ELP not available | |
2286 *------------------------------------------------------------- | |
2287 */ | |
2288 case ( SIM_CAUSE_UNKN_FILE_ID ): | |
2289 if (cmhSIM_ReqLanguagePrfLP () EQ FALSE) | |
2290 { | |
2291 psaSAT_SendTrmResp( RSLT_ME_UNAB_PROC, &resp_data ); | |
2292 } | |
2293 break; | |
2294 | |
2295 default: | |
2296 psaSAT_SendTrmResp( RSLT_ME_UNAB_PROC, &resp_data ); | |
2297 break; | |
2298 | |
2299 } | |
2300 } | |
2301 | |
2302 | |
2303 /* | |
2304 +--------------------------------------------------------------------+ | |
2305 | PROJECT : GSM-F&D (8411) MODULE : CMH_SIMR | | |
2306 | STATE : code ROUTINE : cmhSIM_RdCnfLangLP | | |
2307 +--------------------------------------------------------------------+ | |
2308 | |
2309 PURPOSE : This function handles the confirmation of reading | |
2310 EF LP from SIM. | |
2311 */ | |
2312 GLOBAL void cmhSIM_RdCnfLangLP ( SHORT table_id ) | |
2313 { | |
2314 T_SIM_CMD_PRM * pSIMCmdPrm; /* points to SIM command parameters */ | |
2315 T_PHB_CMD_PRM * pPHBCmdPrm; /* points to PHB command parameter */ | |
2316 T_ACI_AT_CMD cmdBuf; /* buffers current command */ | |
2317 T_ACI_CMD_SRC ownBuf; /* buffers current owner */ | |
2318 T_ACI_LAN_SUP clng; | |
2319 CHAR* ef = EF_CLNG_ID; | |
2320 EF_CLNG lng; | |
2321 BOOL Suplng= FALSE; | |
2322 SHORT lastIdx; | |
2323 T_ACI_LAN_SUP LngPCMsupLst[MAX_LAN]; | |
2324 | |
2325 | |
2326 TRACE_FUNCTION ("cmhSIM_RdCnfLangLP()"); | |
2327 | |
2328 pSIMCmdPrm = &cmhPrm[simEntStat.entOwn].simCmdPrm; | |
2329 cmdBuf = simEntStat.curCmd; | |
2330 ownBuf = simEntStat.entOwn; | |
2331 pPHBCmdPrm = &cmhPrm[ownBuf].phbCmdPrm; | |
2332 simShrdPrm.atb[table_id].ntryUsdFlg = FALSE; | |
2333 simEntStat.curCmd = AT_CMD_NONE; | |
2334 | |
2335 clng.lng=(UBYTE )simShrdPrm.atb[table_id].exchData[0]; | |
2336 | |
2337 getSupLangFromPCM(&LngPCMsupLst[0], &lastIdx); | |
2338 Suplng=checkSuppLangInLP(&LngPCMsupLst[0],lastIdx, &clng); | |
2339 | |
2340 if ( simShrdPrm.atb[table_id].errCode EQ SIM_NO_ERROR AND | |
2341 Suplng ) | |
2342 { | |
2343 | |
2344 simEntStat.entOwn = simShrdPrm.owner = OWN_NONE; | |
2345 /* | |
2346 *------------------------------------------------------------- | |
2347 * check basic consistency of read data | |
2348 *------------------------------------------------------------- | |
2349 */ | |
2350 if ( simShrdPrm.atb[table_id].exchData EQ NULL OR | |
2351 simShrdPrm.atb[table_id].dataLen < ACI_LEN_LAN_LP_NTRY) | |
2352 | |
2353 { | |
2354 simEntStat.entOwn = simShrdPrm.owner = OWN_NONE; | |
2355 pSIMCmdPrm->CLANact = CLAN_ACT_None; | |
2356 R_AT( RAT_CME, ownBuf ) ( cmdBuf, CME_ERR_Unknown ); | |
2357 return; | |
2358 } | |
2359 | |
2360 #ifdef SIM_TOOLKIT | |
2361 if (simShrdPrm.fuRef >= 0) | |
2362 { | |
2363 psaSAT_FUConfirm (simShrdPrm.fuRef, SIM_FU_SUCCESS); | |
2364 } | |
2365 #endif | |
2366 | |
2367 /* | |
2368 *----------------------------------------------------- | |
2369 * read the supported laguage or write it PCM | |
2370 *----------------------------------------------------- | |
2371 */ | |
2372 switch( pSIMCmdPrm->CLANact ) | |
2373 { | |
2374 case( CLAN_ACT_Read ): | |
2375 R_AT( RAT_CLAN, ownBuf ) (&clng); | |
2376 R_AT( RAT_OK, ownBuf )( AT_CMD_CLAN ); | |
2377 break; | |
2378 case( CLAN_ACT_Write ): | |
2379 memcpy(lng.data,(UBYTE *) clng.str,CLAN_CODE_LEN); | |
2380 pcm_WriteFile (( UBYTE* )ef,SIZE_EF_CLNG,( UBYTE*) &lng); | |
2381 if (pPHBCmdPrm->CLAEmode EQ CLAE_MOD_Enable) | |
2382 { R_AT( RAT_CLAE, ownBuf ) (&clng);} | |
2383 | |
2384 R_AT( RAT_OK, ownBuf )( AT_CMD_CLAN ); | |
2385 break; | |
2386 | |
2387 } | |
2388 } | |
2389 else | |
2390 { | |
2391 | |
2392 #ifdef SIM_TOOLKIT | |
2393 if (simShrdPrm.fuRef >= 0) | |
2394 { | |
2395 psaSAT_FUConfirm (simShrdPrm.fuRef, SIM_FU_ERROR); | |
2396 } | |
2397 #endif | |
2398 /* | |
2399 *--------------------------------------------------------------- | |
2400 * Preferred language is not supported in MS | |
2401 *--------------------------------------------------------------- | |
2402 */ | |
2403 if ( simShrdPrm.atb[table_id].errCode EQ SIM_CAUSE_UNKN_FILE_ID OR | |
2404 !Suplng ) | |
2405 { | |
2406 TRACE_FUNCTION ("preferred language not supported"); | |
2407 | |
2408 switch( pSIMCmdPrm->CLANact ) | |
2409 { | |
2410 case( CLAN_ACT_Read ): | |
2411 R_AT( RAT_CLAN, ownBuf ) (&LngPCMsupLst[0]); | |
2412 R_AT( RAT_OK, ownBuf )( AT_CMD_CLAN ); | |
2413 break; | |
2414 case( CLAN_ACT_Write ): /* Preferred Language not supported,so not change CLAN */ | |
2415 R_AT( RAT_OK, ownBuf )( AT_CMD_CLAN ); | |
2416 break; | |
2417 } | |
2418 } | |
2419 else | |
2420 { | |
2421 pSIMCmdPrm->CLANact = CLAN_ACT_None; | |
2422 simEntStat.entOwn = simShrdPrm.owner = OWN_NONE; | |
2423 R_AT( RAT_CME, ownBuf) ( AT_CMD_CLAN, CME_ERR_Unknown ); | |
2424 } | |
2425 } | |
2426 } | |
2427 | |
2428 | |
2429 /* | |
2430 +-----------------------------------------------------------------------+ | |
2431 | PROJECT : GSM-F&D (8411) MODULE : CMH_SIMR | | |
2432 | STATE : code ROUTINE : cmhSIM_RdCnfLangPrfLP | | |
2433 +-----------------------------------------------------------------------+ | |
2434 | |
2435 PURPOSE : This function handles the confirmation of reading | |
2436 EF LP from SIM for SAT feature LS. | |
2437 */ | |
2438 GLOBAL void cmhSIM_RdCnfLangPrfLP ( SHORT table_id ) | |
2439 { | |
2440 | |
2441 T_ACI_SAT_TERM_RESP resp_data; | |
2442 T_ACI_LAN_SUP clng; | |
2443 BOOL Suplng= FALSE; | |
2444 SHORT lastIdx; | |
2445 T_ACI_LAN_SUP lngPCMsupLst[MAX_LAN]; | |
2446 T_ACI_RETURN ret; | |
2447 | |
2448 TRACE_FUNCTION ("cmhSIM_RdCnfLangPrfLP()"); | |
2449 | |
2450 psaSAT_InitTrmResp( &resp_data ); | |
2451 | |
2452 simShrdPrm.atb[table_id].ntryUsdFlg = FALSE; | |
2453 | |
2454 clng.lng=(UBYTE )simShrdPrm.atb[table_id].exchData[0]; | |
2455 ret = getSupLangFromPCM(&lngPCMsupLst[0], &lastIdx); | |
2456 if(ret EQ AT_FAIL) | |
2457 { | |
2458 psaSAT_SendTrmResp( RSLT_ME_UNAB_PROC, &resp_data ); | |
2459 return; | |
2460 } | |
2461 | |
2462 Suplng=checkSuppLangInLP(&lngPCMsupLst[0],lastIdx, &clng); | |
2463 | |
2464 if ( simShrdPrm.atb[table_id].errCode EQ SIM_NO_ERROR AND | |
2465 Suplng ) | |
2466 { | |
2467 | |
2468 | |
2469 /* | |
2470 *------------------------------------------------------------- | |
2471 * check basic consistency of read data | |
2472 *------------------------------------------------------------- | |
2473 */ | |
2474 if ( simShrdPrm.atb[table_id].exchData EQ NULL OR | |
2475 simShrdPrm.atb[table_id].dataLen < ACI_LEN_LAN_LP_NTRY) | |
2476 | |
2477 { | |
2478 psaSAT_SendTrmResp( RSLT_ME_UNAB_PROC, &resp_data ); | |
2479 return; | |
2480 } | |
2481 | |
2482 | |
2483 #ifdef SIM_TOOLKIT | |
2484 if (simShrdPrm.fuRef >= 0) | |
2485 { | |
2486 psaSAT_FUConfirm (simShrdPrm.fuRef, SIM_FU_SUCCESS); | |
2487 } | |
2488 #endif | |
2489 | |
2490 /* | |
2491 *----------------------------------------------------- | |
2492 * Send the Terminal Response | |
2493 *----------------------------------------------------- | |
2494 */ | |
2495 memcpy(&resp_data.lang, (UBYTE* )simShrdPrm.atb[table_id].exchData, CLAN_CODE_LEN); | |
2496 #ifdef _SIMULATION_ | |
2497 memset(resp_data.lang, 0xA0, 2); | |
2498 #endif | |
2499 psaSAT_SendTrmResp( RSLT_PERF_SUCCESS, &resp_data ); | |
2500 } | |
2501 else | |
2502 { | |
2503 | |
2504 #ifdef SIM_TOOLKIT | |
2505 if (simShrdPrm.fuRef >= 0) | |
2506 { | |
2507 psaSAT_FUConfirm (simShrdPrm.fuRef, SIM_FU_ERROR); | |
2508 } | |
2509 #endif | |
2510 /* | |
2511 *--------------------------------------------------------------- | |
2512 * read default language from ME | |
2513 *--------------------------------------------------------------- | |
2514 */ | |
2515 | |
2516 if ( simShrdPrm.atb[table_id].errCode EQ SIM_CAUSE_UNKN_FILE_ID OR | |
2517 !Suplng ) | |
2518 { | |
2519 TRACE_FUNCTION ("default language is selected"); | |
2520 memcpy(&resp_data.lang, &lngPCMsupLst[0].str, CLAN_CODE_LEN); | |
2521 #ifdef _SIMULATION_ | |
2522 memset(resp_data.lang, 0xA0, 2); | |
2523 #endif | |
2524 psaSAT_SendTrmResp( RSLT_PERF_SUCCESS, &resp_data ); | |
2525 | |
2526 } | |
2527 else | |
2528 { | |
2529 psaSAT_SendTrmResp( RSLT_ME_UNAB_PROC, &resp_data ); | |
2530 } | |
2531 | |
2532 } | |
2533 | |
2534 } | |
2535 | |
2536 | |
2537 /* | |
2538 +--------------------------------------------------------------------------+ | |
2539 | PROJECT : GSM-F&D (8411) MODULE : CMH_SIMR | | |
2540 | STATE : code ROUTINE : SIM_ENT_CSDconnect_dti_cb | | |
2541 +--------------------------------------------------------------------------+ | |
2542 | |
2543 PURPOSE : Callback for connection between SIM and TRA/L2R for CSD. | |
2544 | |
2545 */ | |
2546 #ifdef FF_SAT_E | |
2547 #ifdef DTI | |
2548 GLOBAL BOOL SIM_ENT_CSDconnect_dti_cb(UBYTE dti_id, T_DTI_CONN_STATE result_type) | |
2549 { | |
2550 TRACE_FUNCTION("SIM_ENT_CSDconnect_dti_cb"); | |
2551 | |
2552 switch( result_type) | |
2553 { | |
2554 case DTI_CONN_STATE_DISCONNECTING: | |
2555 break; | |
2556 case DTI_CONN_STATE_DISCONNECTED: | |
2557 /* wap_state is set to IPA_Deactivated in psaTCPIP_config_dispatch() */ | |
2558 if (wap_state EQ UDPA_Deactivation) | |
2559 { | |
2560 wap_state = IPA_Deactivation; | |
2561 psaUDPIP_config_dispatch(); | |
2562 } | |
2563 dti_cntrl_erase_entry(dti_id); | |
2564 dti_cntrl_clear_conn_parms(dti_id); | |
2565 if (simShrdPrm.sat_class_e_dti_id EQ dti_id) | |
2566 { | |
2567 simShrdPrm.sat_class_e_dti_id = DTI_DTI_ID_NOTPRESENT; | |
2568 TRACE_EVENT("sat_class_e_dti_id reset"); | |
2569 } | |
2570 break; | |
2571 case DTI_CONN_STATE_CONNECTING: | |
2572 break; | |
2573 case DTI_CONN_STATE_CONNECTED: | |
2574 /* the SIM-SNDCP connection has been established, now send SIM_BIP_CONFIG | |
2575 * request to SIM */ | |
2576 psaSIM_Bip_Config_Req(); | |
2577 | |
2578 break; | |
2579 case DTI_CONN_STATE_ERROR: | |
2580 /* connection not possible: disconnect UDP, L2R or TRA */ | |
2581 TRACE_EVENT("SIM_ENT_CSDconnect_dti_cb connection not possible: disconnect UDP,L2R or TRA"); | |
2582 dti_cntrl_close_dpath_from_dti_id( dti_id ); | |
2583 break; | |
2584 case DTI_CONN_STATE_UNKNOWN: | |
2585 default: | |
2586 TRACE_EVENT("SIM_ENT_CSDconnect_dti_cb call with not awaited value"); | |
2587 break; | |
2588 } | |
2589 return TRUE; | |
2590 } | |
2591 #endif /* DTI */ | |
2592 | |
2593 #if defined (GPRS) AND defined (DTI) | |
2594 /* | |
2595 +---------------------------------------------------------------------------+ | |
2596 | PROJECT : GSM-F&D (8411) MODULE : CMH_SIMR | | |
2597 | STATE : code ROUTINE : SIM_SNDCP_connect_dti_cb | | |
2598 +---------------------------------------------------------------------------+ | |
2599 | |
2600 PURPOSE : Callback for connection between SIM and SNDCP. | |
2601 | |
2602 */ | |
2603 GLOBAL BOOL SIM_SNDCP_connect_dti_cb(UBYTE dti_id, T_DTI_CONN_STATE result_type) | |
2604 { | |
2605 TRACE_FUNCTION("SIM_SNDCP_connect_dti_cb"); | |
2606 | |
2607 switch( result_type) | |
2608 { | |
2609 case DTI_CONN_STATE_DISCONNECTING: | |
2610 break; | |
2611 case DTI_CONN_STATE_DISCONNECTED: | |
2612 dti_cntrl_erase_entry(dti_id); | |
2613 if (simShrdPrm.sat_class_e_dti_id EQ dti_id) | |
2614 { | |
2615 simShrdPrm.sat_class_e_dti_id = DTI_DTI_ID_NOTPRESENT; | |
2616 TRACE_EVENT("sat_class_e_dti_id reset"); | |
2617 } | |
2618 break; | |
2619 case DTI_CONN_STATE_CONNECTING: | |
2620 break; | |
2621 case DTI_CONN_STATE_CONNECTED: | |
2622 /* the SIM-SNDCP connection has been established, now send SIM_BIP_CONFIG | |
2623 * request to SIM */ | |
2624 psaSIM_Bip_Config_Req(); | |
2625 break; | |
2626 case DTI_CONN_STATE_ERROR: | |
2627 /* connection not possible: disconnect SNDCP */ | |
2628 dti_cntrl_close_dpath_from_dti_id( dti_id ); | |
2629 break; | |
2630 case DTI_CONN_STATE_UNKNOWN: | |
2631 default: | |
2632 TRACE_EVENT("SIM_SNDCP_connect_dti_cb call with not awaited value"); | |
2633 break; | |
2634 } | |
2635 return TRUE; | |
2636 } | |
2637 | |
2638 | |
2639 /* | |
2640 +--------------------------------------------------------------------------+ | |
2641 | PROJECT : GSM-F&D (8411) MODULE : CMH_SIMR | | |
2642 | STATE : code ROUTINE : SIM_ENT_GPRSconnect_dti_cb| | |
2643 +--------------------------------------------------------------------------+ | |
2644 | |
2645 PURPOSE : Callback for connection between SIM and UDP/SNDCP for GPRS. | |
2646 | |
2647 */ | |
2648 | |
2649 GLOBAL BOOL SIM_ENT_GPRSconnect_dti_cb(UBYTE dti_id, T_DTI_CONN_STATE result_type) | |
2650 { | |
2651 TRACE_FUNCTION("SIM_ENT_GPRSconnect_dti_cb"); | |
2652 | |
2653 switch( result_type) | |
2654 { | |
2655 case DTI_CONN_STATE_DISCONNECTING: | |
2656 break; | |
2657 case DTI_CONN_STATE_DISCONNECTED: | |
2658 dti_cntrl_erase_entry(dti_id); | |
2659 if (simShrdPrm.sat_class_e_dti_id EQ dti_id) | |
2660 { | |
2661 simShrdPrm.sat_class_e_dti_id = DTI_DTI_ID_NOTPRESENT; | |
2662 TRACE_EVENT("sat_class_e_dti_id reset"); | |
2663 } | |
2664 break; | |
2665 case DTI_CONN_STATE_CONNECTING: | |
2666 case DTI_CONN_STATE_CONNECTED: | |
2667 break; | |
2668 case DTI_CONN_STATE_ERROR: | |
2669 /* connection not possible: disconnect UDP or SNDCP */ | |
2670 TRACE_EVENT("SIM_ENT_GPRSconnect_dti_cb connection not possible: disconnect UDP or SNDCP"); | |
2671 dti_cntrl_close_dpath_from_dti_id( dti_id ); | |
2672 break; | |
2673 case DTI_CONN_STATE_UNKNOWN: | |
2674 default: | |
2675 TRACE_EVENT("SIM_ENT_GPRSconnect_dti_cb call with not awaited value"); | |
2676 break; | |
2677 } | |
2678 return TRUE; | |
2679 } | |
2680 | |
2681 #endif /* GPRS */ | |
2682 | |
2683 #endif /* FF_SAT_E */ | |
2684 | |
2685 #ifdef FF_DUAL_SIM | |
2686 | |
2687 /* | |
2688 +-------------------------------------------------------------------+ | |
2689 | PROJECT : GSM-PS (6147) MODULE : CMH_SIMR | | |
2690 | ROUTINE : cmhSIM_SIMSelected | | |
2691 +-------------------------------------------------------------------+ | |
2692 | |
2693 PURPOSE : Informs the upper layer the result of the SIM Selection process. | |
2694 | |
2695 */ | |
2696 GLOBAL void cmhSIM_SIMSelected ( void ) | |
2697 { | |
2698 UBYTE cmdBuf; | |
2699 T_ACI_CME_ERR err; | |
2700 | |
2701 TRACE_FUNCTION("cmhSIM_SIMSelected()"); | |
2702 | |
2703 switch(simEntStat.curCmd) | |
2704 { | |
2705 case(AT_CMD_SIM): | |
2706 | |
2707 switch( simShrdPrm.rslt ) | |
2708 { | |
2709 case( SIM_NO_ERROR ): | |
2710 | |
2711 simEntStat.curCmd = AT_CMD_NONE; | |
2712 | |
2713 R_AT( RAT_OK, simEntStat.entOwn ) | |
2714 ( AT_CMD_SIM ); | |
2715 cmh_logRslt ( simEntStat.entOwn, RAT_OK, AT_CMD_SIM, -1, -1, -1 ); | |
2716 return; | |
2717 | |
2718 default: | |
2719 err = cmhSIM_GetCmeFromSim ( simShrdPrm.rslt ); | |
2720 break; | |
2721 } | |
2722 | |
2723 cmdBuf = simEntStat.curCmd; | |
2724 simEntStat.curCmd = AT_CMD_NONE; | |
2725 | |
2726 R_AT( RAT_CME, simEntStat.entOwn ) | |
2727 ( cmdBuf, err ); | |
2728 cmh_logRslt ( simEntStat.entOwn, RAT_CME, cmdBuf, | |
2729 -1, -1, err ); | |
2730 break; | |
2731 } | |
2732 } | |
2733 #endif /*FF_DUAL_SIM*/ | |
2734 | |
2735 /*==== EOF ========================================================*/ | |
2736 |