comparison g23m-aci/aci/cmh_simr.c @ 0:75a11d740a02

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