FreeCalypso > hg > fc-magnetite
comparison src/g23m-aci/aci/cmh_sims.c @ 162:53929b40109c
src/g23m-aci: initial import from TCS3.2/LoCosto
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Tue, 11 Oct 2016 02:02:43 +0000 |
parents | |
children | 41f2cc21bca9 |
comparison
equal
deleted
inserted
replaced
161:4557e2a9c18e | 162:53929b40109c |
---|---|
1 /* | |
2 +----------------------------------------------------------------------------- | |
3 | Project : GSM-PS (6147) | |
4 | Modul : CMH_SIMS | |
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 provides the set functions related to the | |
18 | protocol stack adapter for the subscriber identity | |
19 | module. | |
20 +----------------------------------------------------------------------------- | |
21 */ | |
22 | |
23 #ifndef CMH_SIMS_C | |
24 #define CMH_SIMS_C | |
25 #endif | |
26 | |
27 #include "aci_all.h" | |
28 /*==== INCLUDES ===================================================*/ | |
29 #include "aci_cmh.h" | |
30 | |
31 #ifdef UART | |
32 #include "dti.h" /* functionality of the dti library */ | |
33 #include "dti.h" | |
34 #include "dti_conn_mng.h" | |
35 #endif | |
36 | |
37 #include "ati_cmd.h" | |
38 | |
39 #ifdef FF_ATI | |
40 #include "aci_io.h" | |
41 #endif /* of #ifdef FF_ATI */ | |
42 | |
43 #ifdef FAX_AND_DATA | |
44 #include "aci_fd.h" | |
45 #endif /* of #ifdef FAX_AND_DATA */ | |
46 | |
47 #include "psa.h" | |
48 #include "psa_sim.h" | |
49 #include "psa_mm.h" | |
50 #include "cmh.h" | |
51 #include "cmh_sim.h" | |
52 #include "cmh_mm.h" | |
53 | |
54 #ifdef GPRS | |
55 #include "dti_cntrl_mng.h" | |
56 #include "gaci.h" | |
57 #include "gaci_cmh.h" | |
58 #include "psa_gmm.h" | |
59 #include "cmh_gmm.h" | |
60 #endif | |
61 | |
62 #include "aci.h" | |
63 | |
64 /* #include "m_fac.h" */ | |
65 #include "aoc.h" | |
66 #include "ati_cmd.h" | |
67 #include "aci_cmd.h" | |
68 #include "phb.h" | |
69 | |
70 #include "aci_ext_pers.h" | |
71 #include "aci_slock.h" | |
72 | |
73 #include "cl_imei.h" | |
74 | |
75 | |
76 #ifdef SIM_PERS | |
77 #include "general.h" // included for compilation error UNIT8 in sec_drv.h | |
78 #include "sec_drv.h" | |
79 #include "cmh.h" | |
80 #include "aci_cmh.h" | |
81 | |
82 EXTERN T_SIM_MMI_INSERT_IND *last_sim_mmi_insert_ind; | |
83 EXTERN T_SEC_DRV_CATEGORY *personalisation_nw; | |
84 EXTERN T_SEC_DRV_CATEGORY *personalisation_ns; | |
85 EXTERN T_SEC_DRV_CATEGORY *personalisation_sp; | |
86 EXTERN T_SEC_DRV_CATEGORY *personalisation_cp; | |
87 EXTERN T_SEC_DRV_CATEGORY *personalisation_sim; | |
88 EXTERN T_SEC_DRV_CONFIGURATION *cfg_data ; | |
89 #endif | |
90 | |
91 /*==== CONSTANTS ==================================================*/ | |
92 | |
93 /*==== EXPORT =====================================================*/ | |
94 | |
95 /*==== VARIABLES ==================================================*/ | |
96 | |
97 /*==== FUNCTIONS ==================================================*/ | |
98 LOCAL T_ACI_RETURN cmhSIM_analyze_SIMLOCK_STATUS( T_SIMLOCK_STATUS status ); | |
99 LOCAL T_ACI_RETURN sAT_Plus_CAMM_CACM ( T_ACI_AT_CMD at_cmd_id, | |
100 T_ACI_CMD_SRC srcId, | |
101 UBYTE value_type, | |
102 void *value, | |
103 UBYTE *pwd ); | |
104 /* | |
105 +--------------------------------------------------------------------+ | |
106 | PROJECT : GSM-PS (6147) MODULE : CMH_SIMS | | |
107 | STATE : code ROUTINE : sAT_PlusCFUN | | |
108 +--------------------------------------------------------------------+ | |
109 | |
110 PURPOSE : This is the functional counterpart to the +CFUN AT command | |
111 which is responsible to set the phone functionality. | |
112 | |
113 <fun>: defines the level of functionality to switch to. | |
114 <rst>: reset mode | |
115 */ | |
116 | |
117 GLOBAL T_ACI_RETURN sAT_PlusCFUN ( T_ACI_CMD_SRC srcId, | |
118 T_ACI_CFUN_FUN fun, | |
119 T_ACI_CFUN_RST rst ) | |
120 { | |
121 T_SIM_SET_PRM * pSIMSetPrm; /* points to MM parameter set */ | |
122 T_ACI_RETURN retCd; /* holds return code */ | |
123 UBYTE idx; /* holds index value */ | |
124 | |
125 /* variables for IMEI control mechanism */ | |
126 #ifndef _SIMULATION_ | |
127 BYTE retVal; /* holds return value */ | |
128 UBYTE dummyIMEIBuf[CL_IMEI_SIZE]; /* dummy IMEI buffer */ | |
129 #endif /* if NOT defined windows simulation */ | |
130 | |
131 TRACE_FUNCTION ("sAT_PlusCFUN()"); | |
132 | |
133 #ifndef _SIMULATION_ | |
134 /* | |
135 *------------------------------------------------------------------- | |
136 * check IMEI | |
137 *------------------------------------------------------------------- | |
138 */ | |
139 | |
140 retVal = cl_get_imeisv(CL_IMEI_SIZE, dummyIMEIBuf, CL_IMEI_CONTROL_IMEI); | |
141 | |
142 if( retVal NEQ CL_IMEI_OK ) | |
143 { | |
144 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_IMEICheck ); | |
145 TRACE_EVENT("IMEI not valid"); | |
146 simShrdPrm.imei_blocked = TRUE; | |
147 /*return( AT_FAIL ); We dont return here to enable the stack to go to the state of "Limited Service' to enable emergency calls. */ | |
148 } | |
149 #endif /* if NOT defined windows simulation */ | |
150 | |
151 /* | |
152 *------------------------------------------------------------------- | |
153 * check command source | |
154 *------------------------------------------------------------------- | |
155 */ | |
156 if(!cmh_IsVldCmdSrc (srcId)) | |
157 { | |
158 return( AT_FAIL ); | |
159 } | |
160 | |
161 pSIMSetPrm = &simShrdPrm.setPrm[srcId]; | |
162 | |
163 /* | |
164 *------------------------------------------------------------------- | |
165 * check entity status | |
166 *------------------------------------------------------------------- | |
167 */ | |
168 if( simEntStat.curCmd NEQ AT_CMD_NONE ) | |
169 { | |
170 TRACE_EVENT("Entity SIM is busy: cannot proceed command..."); | |
171 return( AT_BUSY ); | |
172 } | |
173 | |
174 /* | |
175 *------------------------------------------------------------------- | |
176 * process the <rst> parameter | |
177 *------------------------------------------------------------------- | |
178 */ | |
179 switch( rst ) | |
180 { | |
181 case( CFUN_RST_NotPresent ): /* default value */ | |
182 case( CFUN_RST_NoReset ): | |
183 | |
184 break; | |
185 | |
186 default: /* unexpected parameter */ | |
187 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter ); | |
188 return( AT_FAIL ); | |
189 } | |
190 | |
191 /* | |
192 *------------------------------------------------------------------- | |
193 * process the <fun> parameter | |
194 *------------------------------------------------------------------- | |
195 */ | |
196 if( fun EQ CFUN_FUN_NotPresent ) fun = CFUNfun; | |
197 | |
198 switch( fun ) | |
199 { | |
200 case( CFUN_FUN_Minimum ): /* set ME to minimum functionality */ | |
201 CFUNfun = fun; | |
202 simEntStat.curCmd = AT_CMD_CFUN; | |
203 simShrdPrm.owner = (T_OWN)srcId; | |
204 simEntStat.entOwn = srcId; | |
205 | |
206 /* Turn off all possible ringing */ | |
207 #ifdef FF_ATI | |
208 io_setRngInd ( IO_RING_OFF, CRING_SERV_TYP_NotPresent, CRING_SERV_TYP_NotPresent ); /* V.24 Ring Indicator Line */ | |
209 #endif | |
210 for( idx = 0; idx < CMD_SRC_MAX; idx++ ) | |
211 { | |
212 R_AT( RAT_CRING_OFF, (T_ACI_CMD_SRC)idx )( 0 ); /* Turn of all ringing */ | |
213 } | |
214 | |
215 | |
216 /* We have to wait for both entities to finish in CFUN. So both EntStat are set to AT_CMD_CFUN and | |
217 when a certain entity finished it also emits AT_OK if the other entity has already finished */ | |
218 | |
219 simEntStat.curCmd = AT_CMD_CFUN; | |
220 simShrdPrm.owner = (T_OWN)srcId; | |
221 simEntStat.entOwn = srcId; | |
222 | |
223 mmEntStat.curCmd = AT_CMD_CFUN; | |
224 mmShrdPrm.owner = (T_OWN)srcId; | |
225 mmEntStat.entOwn = srcId; | |
226 | |
227 pb_exit(); | |
228 | |
229 /* simShrdPrm.synCs = SYNC_DEACTIVATE; */ /* This is moved to pb_exit */ | |
230 /* psaSIM_SyncSIM(); */ | |
231 | |
232 /* Reset ONSDesc */ | |
233 cmhMM_Reset_ONSDesc(); | |
234 | |
235 | |
236 #if defined (GPRS) AND defined (DTI) | |
237 mmShrdPrm.nrgCs = GMMREG_DT_POWER_OFF; | |
238 if( psaG_MM_CMD_DEREG ( mmShrdPrm.nrgCs ) < 0 ) /* deregister from network */ | |
239 #else | |
240 mmShrdPrm.nrgCs = CS_POW_OFF; | |
241 if( psaMM_DeRegistrate () < 0 ) /* deregister from network */ | |
242 #endif | |
243 { | |
244 TRACE_EVENT( "FATAL RETURN psaMM_DeRegistrate in +COPS" ); | |
245 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Internal ); | |
246 return( AT_FAIL ); | |
247 } | |
248 | |
249 percentCSTAT_indication(STATE_MSG_SMS, ENTITY_STATUS_NotReady); | |
250 | |
251 retCd = AT_EXCT; | |
252 break; | |
253 | |
254 case( CFUN_FUN_Full ): /* set ME to full functionality */ | |
255 if ( (CFUNfun EQ CFUN_FUN_Minimum) OR (simShrdPrm.PINStat NEQ PS_RDY) ) | |
256 { | |
257 CFUNfun = fun; | |
258 pSIMSetPrm -> actProc = SIM_INITIALISATION; | |
259 | |
260 simEntStat.curCmd = AT_CMD_CFUN; | |
261 simShrdPrm.owner = (T_OWN)srcId; | |
262 simEntStat.entOwn = srcId; | |
263 | |
264 if( psaSIM_ActivateSIM() < 0 ) /* activate SIM card */ | |
265 { | |
266 TRACE_EVENT( "FATAL RETURN psaSIM in +CFUN" ); | |
267 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Internal ); | |
268 return( AT_FAIL ); | |
269 } | |
270 | |
271 retCd = AT_EXCT; | |
272 #ifdef GPRS | |
273 { | |
274 PALLOC (gmmreg_attach_req, GMMREG_ATTACH_REQ); | |
275 | |
276 /* This is just a dummy req to trigger lower layer | |
277 for power scanning. It will be done based on bootup_act.*/ | |
278 gmmreg_attach_req->bootup_act = QUICK_REG; | |
279 | |
280 PSEND (hCommGMM,gmmreg_attach_req); | |
281 } | |
282 #else | |
283 { | |
284 PALLOC (mmr_reg_req, MMR_REG_REQ); | |
285 | |
286 /* This is just a dummy req to trigger lower layer | |
287 for power scanning. It will be done based on bootup_act. | |
288 Other parameters is filled for the simulation test cases to pass */ | |
289 mmr_reg_req->bootup_act = QUICK_REG; | |
290 | |
291 PSENDX (MM, mmr_reg_req); | |
292 } | |
293 #endif | |
294 } | |
295 #ifdef SIM_PERS | |
296 else if (CFUNfun EQ CFUN_FUN_Full ) | |
297 { | |
298 TRACE_EVENT("This is for if MMI calls sAT_PlusCFUN repetedly for verification of LOCKS"); | |
299 CFUNfun = fun; | |
300 pSIMSetPrm -> actProc = SIM_INITIALISATION; | |
301 | |
302 simEntStat.curCmd = AT_CMD_CFUN; | |
303 simShrdPrm.owner = (T_OWN)srcId; | |
304 simEntStat.entOwn = srcId; | |
305 | |
306 if( psaSIM_ActivateSIM() < 0 ) /* activate SIM card */ | |
307 { | |
308 TRACE_EVENT( "FATAL RETURN psaSIM in +CFUN" ); | |
309 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Internal ); | |
310 return( AT_FAIL ); | |
311 } | |
312 | |
313 retCd = AT_EXCT; | |
314 } | |
315 #endif | |
316 else | |
317 { | |
318 TRACE_EVENT("Switch mobile back on after radio low (CFUN=4)"); | |
319 CFUNfun = fun; | |
320 retCd = AT_CMPL; | |
321 } | |
322 break; | |
323 | |
324 case (CFUN_FUN_Disable_TX_RX_RF): | |
325 if (CFUNfun EQ CFUN_FUN_Minimum) | |
326 { | |
327 /* User directly goes to flight mode from power off. Only initialise | |
328 the SIM data */ | |
329 CFUNfun = fun; | |
330 pSIMSetPrm -> actProc = SIM_INITIALISATION; | |
331 | |
332 simEntStat.curCmd = AT_CMD_CFUN; | |
333 simShrdPrm.owner = (T_OWN)srcId; | |
334 simEntStat.entOwn = srcId; | |
335 | |
336 if( psaSIM_ActivateSIM() < 0 ) /* activate SIM card */ | |
337 { | |
338 TRACE_EVENT( "FATAL RETURN psaSIM in +CFUN" ); | |
339 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Internal ); | |
340 return( AT_FAIL ); | |
341 } | |
342 | |
343 retCd = AT_EXCT; | |
344 break; | |
345 } | |
346 CFUNfun = fun; | |
347 | |
348 /* Turn off all possible ringing */ | |
349 #ifdef FF_ATI | |
350 io_setRngInd ( IO_RING_OFF, CRING_SERV_TYP_NotPresent, CRING_SERV_TYP_NotPresent ); /* V.24 Ring Indicator Line */ | |
351 #endif | |
352 for( idx = 0; idx < CMD_SRC_MAX; idx++ ) | |
353 { | |
354 R_AT( RAT_CRING_OFF, (T_ACI_CMD_SRC)idx )( 0 ); /* Turn of all ringing */ | |
355 } | |
356 | |
357 if( mmEntStat.curCmd NEQ AT_CMD_BAND ) | |
358 { | |
359 /* If sAT_PlusCFUN has been called by sAT_PercentBAND !!! */ | |
360 mmEntStat.curCmd = AT_CMD_CFUN; | |
361 } | |
362 mmShrdPrm.owner = (T_OWN)srcId; | |
363 mmEntStat.entOwn = srcId; | |
364 | |
365 #if defined (GPRS) AND defined (DTI) | |
366 mmShrdPrm.nrgCs = GMMREG_DT_SOFT_OFF; | |
367 if( psaG_MM_CMD_DEREG ( mmShrdPrm.nrgCs ) < 0 ) /* deregister from network */ | |
368 #else | |
369 mmShrdPrm.nrgCs = CS_SOFT_OFF; | |
370 if( psaMM_DeRegistrate () < 0 ) /* deregister from network */ | |
371 #endif | |
372 { | |
373 TRACE_EVENT( "FATAL RETURN psaMM_DeRegistrate in +COPS" ); | |
374 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Internal ); | |
375 return( AT_FAIL ); | |
376 } | |
377 | |
378 retCd = AT_EXCT; | |
379 break; | |
380 | |
381 default: /* unexpected parameter */ | |
382 | |
383 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter ); | |
384 return( AT_FAIL ); | |
385 } | |
386 | |
387 /* | |
388 *------------------------------------------------------------------- | |
389 * log command execution | |
390 *------------------------------------------------------------------- | |
391 */ | |
392 #if defined SMI OR defined MFW OR defined FF_MMI_RIV | |
393 if( mmEntStat.curCmd NEQ AT_CMD_BAND | |
394 AND simEntStat.curCmd NEQ AT_CMD_BAND ) | |
395 { | |
396 T_ACI_CLOG cmdLog; /* holds logging info */ | |
397 | |
398 cmdLog.atCmd = AT_CMD_CFUN; | |
399 cmdLog.cmdType = CLOG_TYPE_Set; | |
400 cmdLog.retCode = retCd; | |
401 cmdLog.cId = ACI_NumParmNotPresent; | |
402 cmdLog.sId = ACI_NumParmNotPresent; | |
403 cmdLog.cmdPrm.sCFUN.srcId = srcId; | |
404 cmdLog.cmdPrm.sCFUN.fun = fun; | |
405 cmdLog.cmdPrm.sCFUN.rst = rst; | |
406 | |
407 rAT_PercentCLOG( &cmdLog ); | |
408 } | |
409 #endif | |
410 | |
411 return( retCd ); | |
412 | |
413 } | |
414 | |
415 #ifdef TI_PS_FF_AT_P_CMD_SECP | |
416 /* | |
417 +--------------------------------------------------------------------+ | |
418 | PROJECT : GSM-PS (6147) MODULE : CMH_SIMS | | |
419 | STATE : code ROUTINE : sAT_PercentSECP | | |
420 +--------------------------------------------------------------------+ | |
421 | |
422 PURPOSE : This is the functional counterpart to the %SEC AT command | |
423 which is responsible to enter a PIN. | |
424 | |
425 <pin>: string of PIN chars. | |
426 <newpin>: string of PIN chars required if requested PIN is | |
427 SIM PUK | |
428 */ | |
429 | |
430 GLOBAL T_ACI_RETURN sAT_PercentSECP ( T_ACI_CMD_SRC srcId, | |
431 CHAR * pin, | |
432 CHAR * newpin ) | |
433 { | |
434 T_SIMLOCK_STATUS result; | |
435 | |
436 TRACE_FUNCTION ("sAT_PercentSECP()"); | |
437 | |
438 /* | |
439 *------------------------------------------------------------------- | |
440 * check command source | |
441 *------------------------------------------------------------------- | |
442 */ | |
443 if(!cmh_IsVldCmdSrc (srcId)) | |
444 { | |
445 return( AT_FAIL ); | |
446 } | |
447 | |
448 /* Check validity of pin str*/ | |
449 if( pin EQ NULL) | |
450 { | |
451 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter ); | |
452 return( AT_FAIL ); | |
453 } | |
454 | |
455 /* Try to set new pin */ | |
456 result = aci_ext_personalisation_CS_change_password( pin, newpin ); | |
457 | |
458 /* Implements Measure 50 */ | |
459 return ( cmhSIM_analyze_SIMLOCK_STATUS ( result ) ); | |
460 | |
461 } | |
462 #endif /* TI_PS_FF_AT_P_CMD_SECP */ | |
463 | |
464 #ifdef TI_PS_FF_AT_P_CMD_SECS | |
465 /* | |
466 +--------------------------------------------------------------------+ | |
467 | PROJECT : GSM-PS (6147) MODULE : CMH_SIMS | | |
468 | STATE : code ROUTINE : sAT_PercentSECS | | |
469 +--------------------------------------------------------------------+ | |
470 | |
471 PURPOSE : This is the functional counterpart to the %SECS? AT command | |
472 which is responsible to set the status of the Security Code. | |
473 | |
474 <securityStatus>: Status of the security code. | |
475 <code>: Security code required to change the status. | |
476 */ | |
477 | |
478 | |
479 GLOBAL T_ACI_RETURN sAT_PercentSECS ( T_ACI_CMD_SRC srcId, | |
480 T_ACI_SECS_STA securityState, | |
481 CHAR * code ) | |
482 { | |
483 | |
484 T_SIMLOCK_STATUS result; | |
485 | |
486 TRACE_FUNCTION ("sAT_PercentSECS()"); | |
487 | |
488 | |
489 /* | |
490 *------------------------------------------------------------------- | |
491 * check command source | |
492 *------------------------------------------------------------------- | |
493 */ | |
494 if(!cmh_IsVldCmdSrc (srcId)) | |
495 { | |
496 return( AT_FAIL ); | |
497 } | |
498 | |
499 /* | |
500 *------------------------------------------------------------------- | |
501 * check status value | |
502 *------------------------------------------------------------------- | |
503 */ | |
504 switch (securityState) | |
505 { | |
506 case( SECS_STA_Enable ): | |
507 result = aci_ext_personalisation_CS_set_status(SIMLOCK_ENABLED, code); | |
508 break; | |
509 case( SECS_STA_Disable ): | |
510 result = aci_ext_personalisation_CS_set_status(SIMLOCK_DISABLED, code); | |
511 break; | |
512 default: | |
513 return( AT_FAIL ); | |
514 } | |
515 | |
516 /* | |
517 *------------------------------------------------------------------- | |
518 * analyze answer | |
519 *------------------------------------------------------------------- | |
520 */ | |
521 /* Implements Measure 50 */ | |
522 return ( cmhSIM_analyze_SIMLOCK_STATUS ( result ) ); | |
523 } | |
524 #endif /* TI_PS_FF_AT_P_CMD_SECS */ | |
525 | |
526 | |
527 | |
528 | |
529 | |
530 /* | |
531 +--------------------------------------------------------------------+ | |
532 | PROJECT : GSM-PS (6147) MODULE : CMH_SIMS | | |
533 | STATE : code ROUTINE : sAT_PlusCPIN | | |
534 +--------------------------------------------------------------------+ | |
535 | |
536 PURPOSE : This is the functional counterpart to the +CPIN AT command | |
537 which is responsible to enter a PIN. | |
538 | |
539 <pin>: string of PIN chars. | |
540 <newpin>: string of PIN chars required if requested PIN is | |
541 SIM PUK | |
542 */ | |
543 | |
544 GLOBAL T_ACI_RETURN sAT_PlusCPIN ( T_ACI_CMD_SRC srcId, | |
545 CHAR * pin, | |
546 CHAR * newpin ) | |
547 { | |
548 T_SIM_SET_PRM * pSIMSetPrm; /* points to SIM parameter set */ | |
549 T_ACI_RETURN retCd; /* holds return code */ | |
550 T_SIMLOCK_STATUS retSlStatus; /* holds return code */ | |
551 | |
552 TRACE_FUNCTION ("sAT_PlusCPIN()"); | |
553 | |
554 /* | |
555 *------------------------------------------------------------------- | |
556 * check command source | |
557 *------------------------------------------------------------------- | |
558 */ | |
559 if(!cmh_IsVldCmdSrc (srcId)) | |
560 { | |
561 return( AT_FAIL ); | |
562 } | |
563 | |
564 pSIMSetPrm = &simShrdPrm.setPrm[srcId]; | |
565 | |
566 /* | |
567 *------------------------------------------------------------------- | |
568 * check entity status | |
569 *------------------------------------------------------------------- | |
570 */ | |
571 if( simEntStat.curCmd NEQ AT_CMD_NONE ) | |
572 | |
573 return( AT_BUSY ); | |
574 | |
575 /* | |
576 *------------------------------------------------------------------- | |
577 * check for PIN status | |
578 *------------------------------------------------------------------- | |
579 */ | |
580 switch( simShrdPrm.PINStat ) | |
581 { | |
582 case( PS_RDY ): | |
583 /* | |
584 *--------------------------------------------------------------- | |
585 * Not a SIM PIN State, but a ME personalisation PIN | |
586 *--------------------------------------------------------------- | |
587 */ | |
588 #ifdef SIM_PERS | |
589 if (AciSLockShrd.blocked) | |
590 { | |
591 retSlStatus = aci_slock_authenticate(AciSLockShrd.current_lock, pin); | |
592 if ( retSlStatus NEQ SIMLOCK_DISABLED) | |
593 { | |
594 TRACE_EVENT( "Wrong PIN given for SIM lock." ); | |
595 if (retSlStatus EQ SIMLOCK_BLOCKED) | |
596 { | |
597 if(!aci_slock_set_CFG()) | |
598 { | |
599 ACI_ERR_DESC( ACI_ERR_CLASS_Ext,EXT_ERR_NoMEPD); | |
600 return( AT_FAIL ); | |
601 } | |
602 aci_set_cme_error(AciSLockShrd.current_lock); | |
603 MFREE(cfg_data); | |
604 } | |
605 else | |
606 ACI_ERR_DESC( ACI_ERR_CLASS_Cme, CME_ERR_WrongPasswd ); | |
607 return( AT_FAIL ); | |
608 } | |
609 else | |
610 { | |
611 simEntStat.curCmd = AT_CMD_CPIN; | |
612 if(!aci_slock_set_CFG()) | |
613 { | |
614 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_NoMEPD); | |
615 return( AT_FAIL ); | |
616 } | |
617 aci_slock_init(); | |
618 | |
619 retSlStatus = SIMLOCK_ENABLED; | |
620 if(AciSLockShrd.current_lock < SIMLOCK_SIM) | |
621 { | |
622 AciSLockShrd.current_lock=(T_SIMLOCK_TYPE)(AciSLockShrd.current_lock +SIMLOCK_NETWORK_SUBSET); | |
623 AciSLockShrd.check_lock = SIMLOCK_CHECK_PERS; | |
624 retSlStatus = aci_slock_checkpersonalisation(AciSLockShrd.current_lock); | |
625 } | |
626 switch(retSlStatus) | |
627 { | |
628 case SIMLOCK_ENABLED : | |
629 return( AT_CMPL); | |
630 case SIMLOCK_BLOCKED : | |
631 return( AT_FAIL); | |
632 case SIMLOCK_WAIT : | |
633 return (AT_EXCT); | |
634 | |
635 } | |
636 } | |
637 | |
638 } | |
639 | |
640 #endif | |
641 /* | |
642 *--------------------------------------------------------------- | |
643 * no PIN input is required | |
644 *--------------------------------------------------------------- | |
645 */ | |
646 retCd = AT_FAIL; | |
647 break; | |
648 | |
649 case( NO_VLD_PS ): | |
650 /* | |
651 *--------------------------------------------------------------- | |
652 * PIN Status is unknown | |
653 *--------------------------------------------------------------- | |
654 */ | |
655 | |
656 /* invoke SIM activate and enter PIN if needed ???? */ | |
657 ACI_ERR_DESC( ACI_ERR_CLASS_Cme, CME_ERR_OpNotAllow ); | |
658 return( AT_FAIL ); | |
659 | |
660 case( PS_PIN1 ): | |
661 /* | |
662 *--------------------------------------------------------------- | |
663 * PIN 1 input is required | |
664 *--------------------------------------------------------------- | |
665 */ | |
666 if( pin EQ NULL OR | |
667 strlen( pin ) < MIN_PIN_LEN OR | |
668 strlen( pin ) > PIN_LEN ) | |
669 { | |
670 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter ); | |
671 return( AT_FAIL ); | |
672 } | |
673 | |
674 cmhSIM_FillInPIN ( pin, pSIMSetPrm -> curPIN, PIN_LEN ); | |
675 pSIMSetPrm -> PINType = PHASE_2_PIN_1; | |
676 simEntStat.curCmd = AT_CMD_CPIN; | |
677 simShrdPrm.owner = (T_OWN)srcId; | |
678 simEntStat.entOwn = srcId; | |
679 | |
680 if( psaSIM_VerifyPIN() < 0 ) /* verify PIN */ | |
681 { | |
682 TRACE_EVENT( "FATAL RETURN psaSIM in +CPIN" ); | |
683 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Internal ); | |
684 return( AT_FAIL ); | |
685 } | |
686 | |
687 retCd = AT_EXCT; | |
688 break; | |
689 | |
690 case( PS_PIN2 ): | |
691 /* | |
692 *--------------------------------------------------------------- | |
693 * PIN 2 input is required | |
694 *--------------------------------------------------------------- | |
695 */ | |
696 if( pin EQ NULL OR | |
697 strlen( pin ) < MIN_PIN_LEN OR | |
698 strlen( pin ) > PIN_LEN ) | |
699 { | |
700 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter ); | |
701 return( AT_FAIL ); | |
702 } | |
703 | |
704 cmhSIM_FillInPIN ( pin, pSIMSetPrm -> curPIN, PIN_LEN ); | |
705 pSIMSetPrm -> PINType = PHASE_2_PIN_2; | |
706 simEntStat.curCmd = AT_CMD_CPIN; | |
707 simShrdPrm.owner = (T_OWN)srcId; | |
708 simEntStat.entOwn = srcId; | |
709 | |
710 if( psaSIM_VerifyPIN() < 0 ) /* verify PIN */ | |
711 { | |
712 TRACE_EVENT( "FATAL RETURN psaSIM in +CPIN" ); | |
713 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Internal ); | |
714 return( AT_FAIL ); | |
715 } | |
716 | |
717 retCd = AT_EXCT; | |
718 break; | |
719 | |
720 case( PS_PUK1 ): | |
721 /* | |
722 *--------------------------------------------------------------- | |
723 * PUK 1 input is required | |
724 *--------------------------------------------------------------- | |
725 */ | |
726 if( newpin EQ NULL OR | |
727 strlen( newpin ) EQ 0) | |
728 { | |
729 ACI_ERR_DESC( ACI_ERR_CLASS_Cme, CME_ERR_SimPukReq ); /* inform about needed PUK */ | |
730 return( AT_FAIL ); | |
731 } | |
732 if( pin EQ NULL OR | |
733 newpin EQ NULL OR | |
734 strlen( pin ) NEQ PUK_LEN OR | |
735 strlen( newpin ) < MIN_PIN_LEN OR | |
736 strlen( newpin ) > PIN_LEN ) | |
737 { | |
738 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter ); | |
739 return( AT_FAIL ); | |
740 } | |
741 | |
742 cmhSIM_FillInPIN ( pin, pSIMSetPrm -> unblkKey, PUK_LEN ); | |
743 cmhSIM_FillInPIN ( newpin, pSIMSetPrm -> curPIN, PIN_LEN ); | |
744 pSIMSetPrm -> PINType = PHASE_2_PUK_1; | |
745 simEntStat.curCmd = AT_CMD_CPIN; | |
746 simShrdPrm.owner = (T_OWN)srcId; | |
747 simEntStat.entOwn = srcId; | |
748 | |
749 if( psaSIM_UnblockCard( ) < 0 ) /* verify PIN */ | |
750 { | |
751 TRACE_EVENT( "FATAL RETURN psaSIM in +CPIN" ); | |
752 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Internal ); | |
753 return( AT_FAIL ); | |
754 } | |
755 | |
756 retCd = AT_EXCT; | |
757 break; | |
758 | |
759 case( PS_PUK2 ): | |
760 /* | |
761 *--------------------------------------------------------------- | |
762 * PUK 2 input is required | |
763 *--------------------------------------------------------------- | |
764 */ | |
765 if( newpin EQ NULL OR | |
766 strlen( newpin ) EQ 0) | |
767 { | |
768 ACI_ERR_DESC( ACI_ERR_CLASS_Cme, CME_ERR_SimPuk2Req ); /* inform about needed PUK2 */ | |
769 return( AT_FAIL ); | |
770 } | |
771 if( pin EQ NULL OR | |
772 newpin EQ NULL OR | |
773 strlen( pin ) NEQ PUK_LEN OR | |
774 strlen( newpin ) < MIN_PIN_LEN OR | |
775 strlen( newpin ) > PIN_LEN ) | |
776 { | |
777 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter ); | |
778 return( AT_FAIL ); | |
779 } | |
780 | |
781 cmhSIM_FillInPIN ( pin, pSIMSetPrm -> unblkKey, PUK_LEN ); | |
782 cmhSIM_FillInPIN ( newpin, pSIMSetPrm -> curPIN, PIN_LEN ); | |
783 pSIMSetPrm -> PINType = PHASE_2_PUK_2; | |
784 simEntStat.curCmd = AT_CMD_CPIN; | |
785 simShrdPrm.owner = (T_OWN)srcId; | |
786 simEntStat.entOwn = srcId; | |
787 | |
788 if( psaSIM_UnblockCard( ) < 0 ) /* verify PIN */ | |
789 { | |
790 TRACE_EVENT( "FATAL RETURN psaSIM in +CPIN" ); | |
791 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Internal ); | |
792 return( AT_FAIL ); | |
793 } | |
794 | |
795 retCd = AT_EXCT; | |
796 break; | |
797 | |
798 default: | |
799 /* | |
800 *--------------------------------------------------------------- | |
801 * unexpected PIN state | |
802 *--------------------------------------------------------------- | |
803 */ | |
804 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_DataCorrupt ); | |
805 return( AT_FAIL ); | |
806 } | |
807 | |
808 /* | |
809 *------------------------------------------------------------------- | |
810 * log command execution | |
811 *------------------------------------------------------------------- | |
812 */ | |
813 #if defined SMI OR defined MFW OR defined FF_MMI_RIV | |
814 { | |
815 T_ACI_CLOG cmdLog; /* holds logging info */ | |
816 | |
817 cmdLog.atCmd = AT_CMD_CPIN; | |
818 cmdLog.cmdType = CLOG_TYPE_Set; | |
819 cmdLog.retCode = retCd; | |
820 cmdLog.cId = ACI_NumParmNotPresent; | |
821 cmdLog.sId = ACI_NumParmNotPresent; | |
822 cmdLog.cmdPrm.sCPIN.srcId = srcId; | |
823 cmdLog.cmdPrm.sCPIN.pin = pin; | |
824 cmdLog.cmdPrm.sCPIN.newpin = newpin; | |
825 | |
826 rAT_PercentCLOG( &cmdLog ); | |
827 } | |
828 #endif | |
829 | |
830 return( retCd ); | |
831 } | |
832 | |
833 /* | |
834 +--------------------------------------------------------------------+ | |
835 | PROJECT : GSM-PS (6147) MODULE : CMH_SIMS | | |
836 | STATE : code ROUTINE : sAT_PlusCAMM | | |
837 +--------------------------------------------------------------------+ | |
838 | |
839 PURPOSE : This is the functional counterpart to the +CAMM AT command | |
840 which is responsible to set the ACMMax. | |
841 */ | |
842 | |
843 GLOBAL T_ACI_RETURN sAT_PlusCAMM ( T_ACI_CMD_SRC srcId, | |
844 LONG acmmax, | |
845 CHAR * pwd) | |
846 { | |
847 /* Implements Measure 40 */ | |
848 return ( sAT_Plus_CAMM_CACM( AT_CMD_CAMM, srcId, AOC_ACMMAX, | |
849 (void *) acmmax, (UBYTE *) pwd )); | |
850 } | |
851 | |
852 /* | |
853 +--------------------------------------------------------------------+ | |
854 | PROJECT : GSM-PS (6147) MODULE : CMH_SIMS | | |
855 | STATE : code ROUTINE : sAT_PlusCPUC | | |
856 +--------------------------------------------------------------------+ | |
857 | |
858 PURPOSE : This is the functional counterpart to the +CPUC AT command | |
859 which is responsible to set the PUCT values. | |
860 */ | |
861 | |
862 GLOBAL T_ACI_RETURN sAT_PlusCPUC ( T_ACI_CMD_SRC srcId, | |
863 CHAR * currency, | |
864 CHAR * ppu, | |
865 CHAR * pwd) | |
866 { | |
867 T_puct puct; | |
868 T_ACI_RETURN ret = AT_FAIL; | |
869 | |
870 TRACE_FUNCTION ("sAT_PlusCPUC()"); | |
871 /* | |
872 *------------------------------------------------------------------- | |
873 * check command source | |
874 *------------------------------------------------------------------- | |
875 */ | |
876 if(!cmh_IsVldCmdSrc (srcId)) | |
877 { | |
878 return( AT_FAIL ); | |
879 } | |
880 | |
881 /* | |
882 *------------------------------------------------------------------- | |
883 * send parameters to advice of charge module. | |
884 *------------------------------------------------------------------- | |
885 */ | |
886 strcpy ((char *) puct.currency, currency); | |
887 strcpy ((char *) puct.value, ppu); | |
888 simEntStat.curCmd = AT_CMD_CPUC; | |
889 simShrdPrm.owner = (T_OWN)srcId; | |
890 simEntStat.entOwn = srcId; | |
891 ret = aoc_set_values (srcId, | |
892 AOC_PUCT, | |
893 (void *)&puct, | |
894 (UBYTE *) pwd); | |
895 | |
896 /* | |
897 *------------------------------------------------------------------- | |
898 * Check return value of aoc_set_values() equal to AT_FAIL, | |
899 * resets simEntStat.curcmd and simEntStat.entown. | |
900 *------------------------------------------------------------------- | |
901 */ | |
902 | |
903 if( ret EQ AT_FAIL ) | |
904 { | |
905 simEntStat.curCmd = AT_CMD_NONE; | |
906 simShrdPrm.owner = (T_OWN)CMD_SRC_NONE; | |
907 simEntStat.entOwn = CMD_SRC_NONE; | |
908 } | |
909 | |
910 return( ret ); | |
911 } | |
912 | |
913 /* | |
914 +--------------------------------------------------------------------+ | |
915 | PROJECT : GSM-PS (6147) MODULE : CMH_SIMS | | |
916 | STATE : code ROUTINE : sAT_PlusCACM | | |
917 +--------------------------------------------------------------------+ | |
918 | |
919 PURPOSE : This is the functional counterpart to the +CACM AT command | |
920 which is responsible to reset the ACM value. | |
921 */ | |
922 | |
923 GLOBAL T_ACI_RETURN sAT_PlusCACM ( T_ACI_CMD_SRC srcId, | |
924 CHAR * pwd) | |
925 { | |
926 /* Implements Measure 40 */ | |
927 return ( sAT_Plus_CAMM_CACM( AT_CMD_CACM, srcId, AOC_ACM, | |
928 (void *) NULL, (UBYTE *) pwd )); | |
929 } | |
930 | |
931 /* | |
932 +--------------------------------------------------------------------+ | |
933 | PROJECT : GSM-PS (6147) MODULE : CMH_SIMS | | |
934 | STATE : code ROUTINE : sAT_PlusCPOL | | |
935 +--------------------------------------------------------------------+ | |
936 | |
937 PURPOSE : This is the functional counterpart to the +CPOL AT command | |
938 which is responsible to access the preferred PLMN list. | |
939 | |
940 <index>: PLMN list index | |
941 <format>: PLMN format | |
942 <oper>: PLMN name | |
943 <index2>: second PLMN list index for exchange operation | |
944 <mode>: supplemental mode information | |
945 */ | |
946 | |
947 GLOBAL T_ACI_RETURN sAT_PlusCPOL ( T_ACI_CMD_SRC srcId, | |
948 SHORT index, | |
949 T_ACI_CPOL_FRMT format, | |
950 CHAR * oper, | |
951 SHORT index2, | |
952 T_ACI_CPOL_MOD mode ) | |
953 { | |
954 T_SIM_CMD_PRM * pSIMCmdPrm; /* points to SIM command parameters */ | |
955 UBYTE plmn[ACI_LEN_PLMN_SEL_NTRY];/* holds coded plmn id */ | |
956 | |
957 TRACE_FUNCTION ("sAT_PlusCPOL()"); | |
958 | |
959 /* | |
960 *------------------------------------------------------------------- | |
961 * check command source | |
962 *------------------------------------------------------------------- | |
963 */ | |
964 if(!cmh_IsVldCmdSrc (srcId)) | |
965 { | |
966 return( AT_FAIL ); | |
967 } | |
968 pSIMCmdPrm = &cmhPrm[srcId].simCmdPrm; | |
969 | |
970 /* | |
971 *------------------------------------------------------------------- | |
972 * check mode parameter | |
973 *------------------------------------------------------------------- | |
974 */ | |
975 switch( mode ) | |
976 { | |
977 case( CPOL_MOD_CompactList ): | |
978 case( CPOL_MOD_Insert ): | |
979 case( CPOL_MOD_NotPresent ): | |
980 break; | |
981 | |
982 default: | |
983 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter ); | |
984 return( AT_FAIL ); | |
985 } | |
986 | |
987 /* | |
988 *------------------------------------------------------------------- | |
989 * check format parameter | |
990 *------------------------------------------------------------------- | |
991 */ | |
992 switch( format ) | |
993 { | |
994 case( CPOL_FRMT_Long ): | |
995 case( CPOL_FRMT_Short ): | |
996 case( CPOL_FRMT_Numeric ): | |
997 | |
998 if( index EQ ACI_NumParmNotPresent AND !oper ) | |
999 { | |
1000 pSIMCmdPrm->CPOLfrmt = format; | |
1001 return( AT_CMPL ); | |
1002 } | |
1003 break; | |
1004 | |
1005 case( CPOL_FRMT_NotPresent ): | |
1006 | |
1007 format = pSIMCmdPrm->CPOLfrmt; | |
1008 break; | |
1009 | |
1010 default: | |
1011 { | |
1012 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter ); | |
1013 return( AT_FAIL ); | |
1014 } | |
1015 } | |
1016 | |
1017 /* | |
1018 *------------------------------------------------------------------- | |
1019 * check for write entry | |
1020 *------------------------------------------------------------------- | |
1021 */ | |
1022 if( oper ) | |
1023 { | |
1024 /* code plmn id */ | |
1025 if( ! cmhSIM_GetCodedPLMN( oper, format, plmn )) | |
1026 { | |
1027 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter ); | |
1028 return( AT_FAIL ); | |
1029 } | |
1030 | |
1031 /* if EF is already read */ | |
1032 if( EfPLMNselStat EQ EF_STAT_READ ) | |
1033 { | |
1034 if( mode EQ CPOL_MOD_CompactList ) | |
1035 { | |
1036 cmhSIM_CmpctPlmnSel( CPOLSimEfDataLen, CPOLSimEfData ); | |
1037 } | |
1038 | |
1039 if( index NEQ ACI_NumParmNotPresent ) | |
1040 { | |
1041 if( index > (CPOLSimEfDataLen / ACI_LEN_PLMN_SEL_NTRY)) | |
1042 { | |
1043 ACI_ERR_DESC( ACI_ERR_CLASS_Cme, CME_ERR_InvIdx ); | |
1044 return( AT_FAIL ); | |
1045 } | |
1046 | |
1047 return cmhSIM_UpdPlmnSel( srcId, index, plmn, mode ); | |
1048 } | |
1049 else | |
1050 | |
1051 return cmhSIM_FndEmptyPlmnSel( srcId, plmn ); | |
1052 } | |
1053 else | |
1054 { | |
1055 if( simEntStat.curCmd NEQ AT_CMD_NONE ) | |
1056 | |
1057 return( AT_BUSY ); | |
1058 | |
1059 pSIMCmdPrm->CPOLidx = (UBYTE)(index EQ ACI_NumParmNotPresent)? | |
1060 NOT_PRESENT_8BIT:index; | |
1061 pSIMCmdPrm->CPOLmode = mode; | |
1062 pSIMCmdPrm->CPOLact = CPOL_ACT_Write; | |
1063 memcpy( pSIMCmdPrm->CPOLplmn, plmn, ACI_LEN_PLMN_SEL_NTRY ); | |
1064 | |
1065 simEntStat.curCmd = AT_CMD_CPOL; | |
1066 simEntStat.entOwn = srcId; | |
1067 | |
1068 /* Implements Measure 150 and 159 */ | |
1069 return cmhSIM_Req_or_Write_PlmnSel( srcId, ACT_RD_DAT ); | |
1070 } | |
1071 } | |
1072 | |
1073 /* | |
1074 *------------------------------------------------------------------- | |
1075 * check for delete entry | |
1076 *------------------------------------------------------------------- | |
1077 */ | |
1078 else | |
1079 { | |
1080 /* check presence of index */ | |
1081 if( index EQ ACI_NumParmNotPresent ) | |
1082 { | |
1083 ACI_ERR_DESC( ACI_ERR_CLASS_Cme, CME_ERR_InvIdx ); | |
1084 return( AT_FAIL ); | |
1085 } | |
1086 | |
1087 /* if EF is already read */ | |
1088 if( EfPLMNselStat EQ EF_STAT_READ ) | |
1089 { | |
1090 if( mode EQ CPOL_MOD_CompactList ) | |
1091 { | |
1092 cmhSIM_CmpctPlmnSel( CPOLSimEfDataLen, CPOLSimEfData ); | |
1093 } | |
1094 | |
1095 if( index > (CPOLSimEfDataLen / ACI_LEN_PLMN_SEL_NTRY) OR | |
1096 (index2 > (CPOLSimEfDataLen / ACI_LEN_PLMN_SEL_NTRY) AND | |
1097 index2 NEQ ACI_NumParmNotPresent)) | |
1098 { | |
1099 ACI_ERR_DESC( ACI_ERR_CLASS_Cme, CME_ERR_InvIdx ); | |
1100 return( AT_FAIL ); | |
1101 } | |
1102 | |
1103 if( index2 EQ ACI_NumParmNotPresent ) | |
1104 | |
1105 return cmhSIM_DelPlmnSel( srcId, index, mode ); | |
1106 | |
1107 else | |
1108 | |
1109 return cmhSIM_ChgPlmnSel( srcId, index, index2 ); | |
1110 } | |
1111 else | |
1112 { | |
1113 if( simEntStat.curCmd NEQ AT_CMD_NONE ) | |
1114 | |
1115 return( AT_BUSY ); | |
1116 | |
1117 pSIMCmdPrm->CPOLidx = (UBYTE)index; | |
1118 pSIMCmdPrm->CPOLidx2 = (index2 NEQ ACI_NumParmNotPresent)? | |
1119 (UBYTE)index2:NOT_PRESENT_8BIT; | |
1120 pSIMCmdPrm->CPOLmode = mode; | |
1121 pSIMCmdPrm->CPOLact = CPOL_ACT_Delete; | |
1122 | |
1123 simEntStat.curCmd = AT_CMD_CPOL; | |
1124 simEntStat.entOwn = srcId; | |
1125 | |
1126 /* Implements Measure 150 and 159 */ | |
1127 return cmhSIM_Req_or_Write_PlmnSel( srcId, ACT_RD_DAT ); | |
1128 } | |
1129 } | |
1130 } | |
1131 | |
1132 /* | |
1133 +--------------------------------------------------------------------+ | |
1134 | PROJECT : GSM-PS (6147) MODULE : CMH_SIMS | | |
1135 | STATE : code ROUTINE : sAT_PlusCRSM | | |
1136 +--------------------------------------------------------------------+ | |
1137 | |
1138 PURPOSE : This is the functional counterpart to the +CRSM AT command | |
1139 which is responsible for restricted SIM access. | |
1140 | |
1141 <cmd>: access command. | |
1142 <fileId>: file identifier | |
1143 <p1>: parameter 1 | |
1144 <p2>: parameter 2 | |
1145 <p3>: parameter 3 | |
1146 <dataLen>: length of data | |
1147 <data>: pointer to data | |
1148 */ | |
1149 | |
1150 T_ACI_RETURN sAT_PlusCRSM ( T_ACI_CMD_SRC srcId, | |
1151 T_ACI_CRSM_CMD cmd, | |
1152 SHORT fileId, | |
1153 SHORT p1, | |
1154 SHORT p2, | |
1155 SHORT p3, | |
1156 SHORT dataLen, | |
1157 UBYTE *data ) | |
1158 { | |
1159 T_SIM_TRNS_ACC_PRM prm; /* holds access parameter */ | |
1160 | |
1161 TRACE_FUNCTION ("sAT_PlusCRSM()"); | |
1162 | |
1163 /* | |
1164 *------------------------------------------------------------------- | |
1165 * check command source | |
1166 *------------------------------------------------------------------- | |
1167 */ | |
1168 if(!cmh_IsVldCmdSrc (srcId)) | |
1169 { | |
1170 return( AT_FAIL ); | |
1171 } | |
1172 | |
1173 /* | |
1174 *------------------------------------------------------------------- | |
1175 * check entity status | |
1176 *------------------------------------------------------------------- | |
1177 */ | |
1178 if( simEntStat.curCmd NEQ AT_CMD_NONE ) | |
1179 | |
1180 return( AT_BUSY ); | |
1181 | |
1182 /* | |
1183 *------------------------------------------------------------------- | |
1184 * check command, data, p1, p2 and p3 parameters | |
1185 *------------------------------------------------------------------- | |
1186 */ | |
1187 switch( cmd ) | |
1188 { | |
1189 case( CRSM_CMD_UpdBin ): | |
1190 case( CRSM_CMD_UpdRec ): | |
1191 | |
1192 if( !data OR !dataLen ) | |
1193 { | |
1194 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter ); | |
1195 return( AT_FAIL ); | |
1196 } | |
1197 /*lint -fallthrough*/ | |
1198 | |
1199 case( CRSM_CMD_ReadBin ): | |
1200 case( CRSM_CMD_ReadRec ): | |
1201 | |
1202 if( p1 EQ ACI_NumParmNotPresent OR | |
1203 p2 EQ ACI_NumParmNotPresent OR | |
1204 p3 EQ ACI_NumParmNotPresent ) | |
1205 { | |
1206 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter ); | |
1207 return( AT_FAIL ); | |
1208 } | |
1209 break; | |
1210 | |
1211 case( CRSM_CMD_GetResp ): | |
1212 case( CRSM_CMD_Status ): | |
1213 | |
1214 if( p3 EQ ACI_NumParmNotPresent ) | |
1215 p3 = 0; | |
1216 break; | |
1217 | |
1218 case( CRSM_CMD_NotPresent ): | |
1219 default: | |
1220 { | |
1221 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter ); | |
1222 return( AT_FAIL ); | |
1223 } | |
1224 } | |
1225 | |
1226 /* | |
1227 *------------------------------------------------------------------- | |
1228 * check fileId parameter | |
1229 *------------------------------------------------------------------- | |
1230 */ | |
1231 if( fileId EQ ACI_NumParmNotPresent AND cmd NEQ CRSM_CMD_Status ) | |
1232 { | |
1233 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter ); | |
1234 return( AT_FAIL ); | |
1235 } | |
1236 | |
1237 /* | |
1238 *------------------------------------------------------------------- | |
1239 * convert command | |
1240 *------------------------------------------------------------------- | |
1241 */ | |
1242 switch( cmd ) | |
1243 { | |
1244 case( CRSM_CMD_UpdBin ): prm.cmd = SIM_UPDATE_BINARY;break; | |
1245 case( CRSM_CMD_UpdRec ): prm.cmd = SIM_UPDATE_RECORD;break; | |
1246 case( CRSM_CMD_ReadBin ): prm.cmd = SIM_READ_BINARY;break; | |
1247 case( CRSM_CMD_ReadRec ): prm.cmd = SIM_READ_RECORD;break; | |
1248 case( CRSM_CMD_GetResp ): prm.cmd = SIM_GET_RESPONSE;break; | |
1249 case( CRSM_CMD_Status ): prm.cmd = SIM_STATUS;break; | |
1250 } | |
1251 | |
1252 /* | |
1253 *------------------------------------------------------------------- | |
1254 * access SIM | |
1255 *------------------------------------------------------------------- | |
1256 */ | |
1257 simEntStat.curCmd = AT_CMD_CRSM; | |
1258 simEntStat.entOwn = srcId; | |
1259 | |
1260 prm.reqDataFld = (USHORT)fileId; | |
1261 prm.p1 = (UBYTE)p1; | |
1262 prm.p2 = (UBYTE)p2; | |
1263 prm.p3 = (UBYTE)p3; | |
1264 prm.dataLen = (UBYTE)dataLen; | |
1265 prm.transData = data; | |
1266 | |
1267 psaSIM_TrnsSIMAccess( &prm ); | |
1268 | |
1269 return( AT_EXCT ); | |
1270 } | |
1271 | |
1272 /* | |
1273 +--------------------------------------------------------------------+ | |
1274 | PROJECT : GSM-PS (6147) MODULE : CMH_SIMS | | |
1275 | STATE : code ROUTINE : sAT_PlusCSIM | | |
1276 +--------------------------------------------------------------------+ | |
1277 | |
1278 PURPOSE : This is the functional counterpart to the +CSIM AT command | |
1279 which is responsible for generic SIM access. | |
1280 | |
1281 */ | |
1282 | |
1283 T_ACI_RETURN sAT_PlusCSIM ( T_ACI_CMD_SRC srcId, | |
1284 USHORT dataLen, | |
1285 UBYTE *data ) | |
1286 { | |
1287 T_SIM_TRNS_ACC_PRM prm; /* holds access parameter */ | |
1288 | |
1289 TRACE_FUNCTION ("sAT_PlusCSIM()"); | |
1290 | |
1291 /* | |
1292 *------------------------------------------------------------------- | |
1293 * check command source | |
1294 *------------------------------------------------------------------- | |
1295 */ | |
1296 if(!cmh_IsVldCmdSrc (srcId)) | |
1297 { | |
1298 return( AT_FAIL ); | |
1299 } | |
1300 | |
1301 /* | |
1302 *------------------------------------------------------------------- | |
1303 * check entity status | |
1304 *------------------------------------------------------------------- | |
1305 */ | |
1306 if( simEntStat.curCmd NEQ AT_CMD_NONE ) | |
1307 { | |
1308 return( AT_BUSY ); | |
1309 } | |
1310 | |
1311 if (data[0] EQ GSM_CLASS) | |
1312 { | |
1313 /* GSM instruction class is not allowed */ | |
1314 TRACE_EVENT("GSM instruction class is not allowed"); | |
1315 ACI_ERR_DESC( ACI_ERR_CLASS_Cme, CME_ERR_OpNotAllow ); | |
1316 return( AT_FAIL ); | |
1317 } | |
1318 #if 0 /* do we really need the check for the ATP source ? */ | |
1319 #ifdef _TARGET_ | |
1320 if (ati_is_src_type((UBYTE)srcId, ATI_SRC_TYPE_RIV) EQ FALSE) | |
1321 { | |
1322 /* don't allow other source type than RIV */ | |
1323 TRACE_EVENT("other src type than RIV is not allowed"); | |
1324 ACI_ERR_DESC( ACI_ERR_CLASS_Cme, CME_ERR_OpNotAllow ); | |
1325 return( AT_FAIL ); | |
1326 } | |
1327 #endif /*_TARGET_*/ | |
1328 #endif /* */ | |
1329 if (dataLen > MAX_SIM_TRANSP) | |
1330 { | |
1331 /* wrong length value */ | |
1332 TRACE_EVENT("wrong length value"); | |
1333 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter ); | |
1334 return( AT_FAIL ); | |
1335 } | |
1336 | |
1337 /* | |
1338 *------------------------------------------------------------------- | |
1339 * access SIM | |
1340 *------------------------------------------------------------------- | |
1341 */ | |
1342 simEntStat.curCmd = AT_CMD_CSIM; | |
1343 simEntStat.entOwn = srcId; | |
1344 | |
1345 prm.cmd = SIM_TRANSP_CMD; | |
1346 prm.dataLen = dataLen; | |
1347 prm.transData = data; | |
1348 | |
1349 psaSIM_TrnsSIMAccess( &prm ); | |
1350 | |
1351 return( AT_EXCT ); | |
1352 | |
1353 } | |
1354 | |
1355 /* | |
1356 +--------------------------------------------------------------------+ | |
1357 | PROJECT : GSM-PS (6147) MODULE : CMH_SIMS | | |
1358 | STATE : code ROUTINE : sAT_PercentPVRF | | |
1359 +--------------------------------------------------------------------+ | |
1360 | |
1361 PURPOSE : This is the functional counterpart to the %PVRF AT command | |
1362 which is responsible to verify a specific PIN. | |
1363 | |
1364 <pin>: string of PIN chars. | |
1365 <newpin>: string of PIN chars required if requested PIN is | |
1366 SIM PUK | |
1367 */ | |
1368 | |
1369 GLOBAL T_ACI_RETURN sAT_PercentPVRF( T_ACI_CMD_SRC srcId, | |
1370 T_ACI_PVRF_TYPE type, | |
1371 CHAR * pin, | |
1372 CHAR * newpin ) | |
1373 { | |
1374 T_SIM_SET_PRM * pSIMSetPrm; /* points to SIM parameter set */ | |
1375 T_ACI_RETURN retCd; /* holds return code */ | |
1376 | |
1377 TRACE_FUNCTION ("sAT_PercentPVRF()"); | |
1378 | |
1379 /* | |
1380 *------------------------------------------------------------------- | |
1381 * check command source | |
1382 *------------------------------------------------------------------- | |
1383 */ | |
1384 if(!cmh_IsVldCmdSrc (srcId)) | |
1385 { | |
1386 return( AT_FAIL ); | |
1387 } | |
1388 | |
1389 pSIMSetPrm = &simShrdPrm.setPrm[srcId]; | |
1390 | |
1391 /* | |
1392 *------------------------------------------------------------------- | |
1393 * check entity status | |
1394 *------------------------------------------------------------------- | |
1395 */ | |
1396 if( simEntStat.curCmd NEQ AT_CMD_NONE ) | |
1397 | |
1398 return( AT_BUSY ); | |
1399 | |
1400 /* | |
1401 *------------------------------------------------------------------- | |
1402 * check for PIN type | |
1403 *------------------------------------------------------------------- | |
1404 */ | |
1405 switch( type ) | |
1406 { | |
1407 case( PVRF_TYPE_Pin1 ): | |
1408 case( PVRF_TYPE_Pin2 ): | |
1409 /* | |
1410 *--------------------------------------------------------------- | |
1411 * PIN 1/2 verify is required | |
1412 *--------------------------------------------------------------- | |
1413 */ | |
1414 if( pin EQ NULL OR | |
1415 strlen( pin ) < MIN_PIN_LEN OR | |
1416 strlen( pin ) > PIN_LEN ) | |
1417 { | |
1418 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter ); | |
1419 return( AT_FAIL ); | |
1420 } | |
1421 | |
1422 cmhSIM_FillInPIN ( pin, pSIMSetPrm -> curPIN, PIN_LEN ); | |
1423 pSIMSetPrm -> PINType = (type EQ PVRF_TYPE_Pin1)? | |
1424 PHASE_2_PIN_1:PHASE_2_PIN_2; | |
1425 simEntStat.curCmd = AT_CMD_PVRF; | |
1426 simShrdPrm.owner = (T_OWN)srcId; | |
1427 simEntStat.entOwn = srcId; | |
1428 | |
1429 if( psaSIM_VerifyPIN() < 0 ) /* verify PIN */ | |
1430 { | |
1431 TRACE_EVENT( "FATAL RETURN psaSIM in %%PVRF" ); | |
1432 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Internal ); | |
1433 return( AT_FAIL ); | |
1434 } | |
1435 | |
1436 retCd = AT_EXCT; | |
1437 break; | |
1438 | |
1439 case( PVRF_TYPE_Puk1 ): | |
1440 case( PVRF_TYPE_Puk2 ): | |
1441 /* | |
1442 *--------------------------------------------------------------- | |
1443 * PUK 1/2 verify is required | |
1444 *--------------------------------------------------------------- | |
1445 */ | |
1446 if( pin EQ NULL OR | |
1447 newpin EQ NULL OR | |
1448 strlen( pin ) NEQ PUK_LEN OR | |
1449 strlen( newpin ) < MIN_PIN_LEN OR | |
1450 strlen( newpin ) > PIN_LEN ) | |
1451 { | |
1452 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter ); | |
1453 return( AT_FAIL ); | |
1454 } | |
1455 | |
1456 cmhSIM_FillInPIN ( pin, pSIMSetPrm -> unblkKey, PUK_LEN ); | |
1457 cmhSIM_FillInPIN ( newpin, pSIMSetPrm -> curPIN, PIN_LEN ); | |
1458 pSIMSetPrm -> PINType = (type EQ PVRF_TYPE_Puk1)? | |
1459 PHASE_2_PUK_1:PHASE_2_PUK_2; | |
1460 simEntStat.curCmd = AT_CMD_PVRF; | |
1461 simShrdPrm.owner = (T_OWN)srcId; | |
1462 simEntStat.entOwn = srcId; | |
1463 | |
1464 if( psaSIM_UnblockCard( ) < 0 ) /* verify PIN */ | |
1465 { | |
1466 TRACE_EVENT( "FATAL RETURN psaSIM in %%PVRF" ); | |
1467 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Internal ); | |
1468 return( AT_FAIL ); | |
1469 } | |
1470 | |
1471 retCd = AT_EXCT; | |
1472 break; | |
1473 | |
1474 default: | |
1475 /* | |
1476 *--------------------------------------------------------------- | |
1477 * unexpected PIN state | |
1478 *--------------------------------------------------------------- | |
1479 */ | |
1480 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_DataCorrupt ); | |
1481 return( AT_FAIL ); | |
1482 } | |
1483 | |
1484 /* | |
1485 *------------------------------------------------------------------- | |
1486 * log command execution | |
1487 *------------------------------------------------------------------- | |
1488 */ | |
1489 #if defined SMI OR defined MFW OR defined FF_MMI_RIV | |
1490 { | |
1491 T_ACI_CLOG cmdLog; /* holds logging info */ | |
1492 | |
1493 cmdLog.atCmd = AT_CMD_PVRF; | |
1494 cmdLog.cmdType = CLOG_TYPE_Set; | |
1495 cmdLog.retCode = retCd; | |
1496 cmdLog.cId = ACI_NumParmNotPresent; | |
1497 cmdLog.sId = ACI_NumParmNotPresent; | |
1498 cmdLog.cmdPrm.sPVRF.srcId = srcId; | |
1499 cmdLog.cmdPrm.sPVRF.type = type; | |
1500 cmdLog.cmdPrm.sPVRF.pin = pin; | |
1501 cmdLog.cmdPrm.sPVRF.newpin = newpin; | |
1502 | |
1503 rAT_PercentCLOG( &cmdLog ); | |
1504 } | |
1505 #endif | |
1506 | |
1507 return( retCd ); | |
1508 } | |
1509 | |
1510 | |
1511 /* | |
1512 +-------------------------------------------------------------------+ | |
1513 | PROJECT : GSM-PS (6147) MODULE : CMH_SIMS | | |
1514 | ROUTINE : sAT_PercentCPRI | | |
1515 +-------------------------------------------------------------------+ | |
1516 | |
1517 PURPOSE : set the CPRI mode for displaying/not displaying | |
1518 ciphering indications | |
1519 */ | |
1520 | |
1521 GLOBAL T_ACI_RETURN sAT_PercentCPRI( T_ACI_CMD_SRC srcId, | |
1522 UBYTE mode ) | |
1523 { | |
1524 TRACE_FUNCTION ("sAT_PercentCPRI()"); | |
1525 | |
1526 if( !cmh_IsVldCmdSrc( srcId ) ) | |
1527 { | |
1528 return( AT_FAIL ); | |
1529 } | |
1530 | |
1531 if (simShrdPrm.ciSIMEnabled NEQ FALSE) /* Since this function is used by MMI,it just returns AT_CMPL */ | |
1532 { | |
1533 return( AT_CMPL ); /* If CPRI is enabled in the SIM,it just returns AT_CMPL */ | |
1534 } | |
1535 | |
1536 else | |
1537 { | |
1538 ACI_ERR_DESC( ACI_ERR_CLASS_Cme, CME_ERR_OpNotAllow ); | |
1539 return( AT_FAIL ); | |
1540 } | |
1541 } | |
1542 | |
1543 #ifdef FF_DUAL_SIM | |
1544 /* | |
1545 +-------------------------------------------------------------------+ | |
1546 | PROJECT : GSM-PS (6147) MODULE : CMH_SIMS | | |
1547 | ROUTINE : sAT_PercentSIM | | |
1548 +-------------------------------------------------------------------+ | |
1549 | |
1550 PURPOSE : Select the SIM to be powered on | |
1551 */ | |
1552 | |
1553 GLOBAL T_ACI_RETURN sAT_PercentSIM( T_ACI_CMD_SRC srcId, | |
1554 UBYTE sim_num ) | |
1555 { | |
1556 T_SIM_SET_PRM * pSIMSetPrm; /* points to SIM parameter set */ | |
1557 | |
1558 TRACE_FUNCTION ("sAT_PercentSIM()"); | |
1559 | |
1560 if( !cmh_IsVldCmdSrc( srcId ) ) | |
1561 { | |
1562 return( AT_FAIL ); | |
1563 } | |
1564 | |
1565 pSIMSetPrm = &simShrdPrm.setPrm[srcId]; | |
1566 | |
1567 if( simEntStat.curCmd NEQ AT_CMD_NONE ) | |
1568 { | |
1569 TRACE_EVENT("Entity SIM is busy: cannot proceed command..."); | |
1570 return( AT_BUSY ); | |
1571 } | |
1572 | |
1573 if(CFUNfun EQ CFUN_FUN_Full) | |
1574 { | |
1575 ACI_ERR_DESC( ACI_ERR_CLASS_Cme, CME_ERR_OpNotAllow ); | |
1576 return( AT_FAIL ); | |
1577 } | |
1578 | |
1579 if(sim_num < SIM_NUM_0 OR sim_num > SIM_NUM_2) | |
1580 { | |
1581 ACI_ERR_DESC( ACI_ERR_CLASS_Cme, CME_ERR_OpNotAllow ); | |
1582 return( AT_FAIL ); | |
1583 } | |
1584 | |
1585 pSIMSetPrm->SIM_Selected = sim_num; | |
1586 | |
1587 simEntStat.curCmd = AT_CMD_SIM; | |
1588 simShrdPrm.owner = (T_OWN)srcId; | |
1589 simEntStat.entOwn = srcId; | |
1590 | |
1591 if( psaSIM_SelectSIM() < 0 ) /* select SIM card */ | |
1592 { | |
1593 TRACE_EVENT( "FATAL RETURN psaSIM in %SIM" ); | |
1594 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Internal ); | |
1595 return( AT_FAIL ); | |
1596 } | |
1597 return(AT_EXCT); | |
1598 } | |
1599 #endif /*FF_DUAL_SIM*/ | |
1600 | |
1601 #ifdef FF_CPHS_REL4 | |
1602 /* | |
1603 +-------------------------------------------------------------------+ | |
1604 | PROJECT : GSM-PS (6147) MODULE : CMH_SIMS | | |
1605 | ROUTINE : sAT_PercentCFIS | | |
1606 +-------------------------------------------------------------------+ | |
1607 | |
1608 PURPOSE : Set/Read the CFU staus in EF-CFIS file present in SIM | |
1609 */ | |
1610 | |
1611 GLOBAL T_ACI_RETURN sAT_PercentCFIS( T_ACI_CMD_SRC srcId, | |
1612 T_ACI_CFIS_MOD mode, | |
1613 UBYTE index, | |
1614 UBYTE mspId, | |
1615 UBYTE cfuStat, | |
1616 CHAR* number, | |
1617 T_ACI_TOA* type, | |
1618 UBYTE cc2_id) | |
1619 { | |
1620 | |
1621 TRACE_FUNCTION ("sAT_PercentCFIS()"); | |
1622 | |
1623 /* | |
1624 *------------------------------------------------------------------- | |
1625 * check command source | |
1626 *------------------------------------------------------------------- | |
1627 */ | |
1628 if(!cmh_IsVldCmdSrc (srcId)) | |
1629 { | |
1630 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter ); | |
1631 return( AT_FAIL ); | |
1632 } | |
1633 | |
1634 /* | |
1635 *------------------------------------------------------------------- | |
1636 * check entity status | |
1637 *------------------------------------------------------------------- | |
1638 */ | |
1639 if( simEntStat.curCmd NEQ AT_CMD_NONE ) | |
1640 return( AT_BUSY ); | |
1641 | |
1642 /* | |
1643 *------------------------------------------------------------------- | |
1644 * process parameter <mode> | |
1645 *------------------------------------------------------------------- | |
1646 */ | |
1647 switch( mode ) | |
1648 { | |
1649 case ( CFIS_MOD_Write ): | |
1650 case ( CFIS_MOD_Delete ): | |
1651 return cmhSIM_WrCfis (srcId,mode,index,mspId,cfuStat,number, | |
1652 type,cc2_id); | |
1653 default: | |
1654 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter ); | |
1655 return( AT_FAIL ); | |
1656 } | |
1657 } | |
1658 /* | |
1659 +-------------------------------------------------------------------+ | |
1660 | PROJECT : GSM-PS (6147) MODULE : CMH_SIMS | | |
1661 | ROUTINE : sAT_PercentMWIS | | |
1662 +-------------------------------------------------------------------+ | |
1663 | |
1664 PURPOSE :Set the Message Waiting status in EF-MWIS file in SIM | |
1665 */ | |
1666 | |
1667 GLOBAL T_ACI_RETURN sAT_PercentMWIS( T_ACI_CMD_SRC srcId, | |
1668 T_ACI_MWIS_MOD mode, | |
1669 UBYTE mspId, | |
1670 T_ACI_MWIS_MWI *mwis) | |
1671 { | |
1672 | |
1673 TRACE_FUNCTION ("sAT_PercentMWIS()"); | |
1674 | |
1675 /* | |
1676 *------------------------------------------------------------------- | |
1677 * check command source | |
1678 *------------------------------------------------------------------- | |
1679 */ | |
1680 if(!cmh_IsVldCmdSrc (srcId)) | |
1681 { | |
1682 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter ); | |
1683 return( AT_FAIL ); | |
1684 } | |
1685 | |
1686 /* | |
1687 *------------------------------------------------------------------- | |
1688 * check entity status | |
1689 *------------------------------------------------------------------- | |
1690 */ | |
1691 if( simEntStat.curCmd NEQ AT_CMD_NONE ) | |
1692 return( AT_BUSY ); | |
1693 | |
1694 /* | |
1695 *------------------------------------------------------------------- | |
1696 * process parameter <mode> | |
1697 *------------------------------------------------------------------- | |
1698 */ | |
1699 switch( mode ) | |
1700 { | |
1701 case ( MWIS_MOD_Write ): | |
1702 case ( MWIS_MOD_Delete ): | |
1703 return cmhSIM_WrMwis (srcId,mode,mspId,mwis); | |
1704 break; | |
1705 default: | |
1706 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter ); | |
1707 return( AT_FAIL ); | |
1708 } | |
1709 } | |
1710 /* | |
1711 +-------------------------------------------------------------------+ | |
1712 | PROJECT : GSM-PS (6147) MODULE : CMH_SIMS | | |
1713 | ROUTINE : sAT_PercentMBDN | | |
1714 +-------------------------------------------------------------------+ | |
1715 | |
1716 PURPOSE : Set/Read the Mailbox Numbers in EF-MBDN file present in SIM | |
1717 */ | |
1718 | |
1719 GLOBAL T_ACI_RETURN sAT_PercentMBDN( T_ACI_CMD_SRC srcId, | |
1720 T_ACI_MBN_MODE mode, | |
1721 UBYTE index, | |
1722 CHAR* number, | |
1723 T_ACI_TOA* type, | |
1724 UBYTE cc2_id, | |
1725 T_ACI_PB_TEXT *text) | |
1726 { | |
1727 | |
1728 TRACE_FUNCTION ("sAT_PercentMBDN()"); | |
1729 | |
1730 #ifndef NO_ASCIIZ | |
1731 /* convert Text */ | |
1732 if ( text NEQ NULL ) | |
1733 { | |
1734 UBYTE tmpBuf[MAX_ALPHA_LEN]; | |
1735 USHORT len; | |
1736 text->cs = CS_Sim; | |
1737 cmh_cvtToDefGsm ( (CHAR*)text->data, (CHAR*)tmpBuf, &len ); | |
1738 text->len = (UBYTE)len; | |
1739 memcpy ( text->data, tmpBuf, text->len ); | |
1740 } | |
1741 #endif /* #ifndef NO_ASCIIZ */ | |
1742 /* | |
1743 *------------------------------------------------------------------- | |
1744 * check command source | |
1745 *------------------------------------------------------------------- | |
1746 */ | |
1747 if(!cmh_IsVldCmdSrc (srcId)) | |
1748 { | |
1749 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter ); | |
1750 return( AT_FAIL ); | |
1751 } | |
1752 | |
1753 /* | |
1754 *------------------------------------------------------------------- | |
1755 * check entity status | |
1756 *------------------------------------------------------------------- | |
1757 */ | |
1758 if( simEntStat.curCmd NEQ AT_CMD_NONE ) | |
1759 return( AT_BUSY ); | |
1760 | |
1761 /* | |
1762 *------------------------------------------------------------------- | |
1763 * process parameter <mode> | |
1764 *------------------------------------------------------------------- | |
1765 */ | |
1766 switch( mode ) | |
1767 { | |
1768 case ( MBN_Mode_Write ): | |
1769 if (number EQ NULL) | |
1770 { | |
1771 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter ); | |
1772 return (AT_FAIL); | |
1773 } | |
1774 /* lint-fallthrough */ | |
1775 case ( MBN_Mode_Delete ): | |
1776 return cmhSIM_WrMbdn (srcId, mode, index, number, | |
1777 type, cc2_id, text); | |
1778 default: | |
1779 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter ); | |
1780 return( AT_FAIL ); | |
1781 } | |
1782 } | |
1783 #endif /* FF_CPHS_REL4 */ | |
1784 | |
1785 | |
1786 /* Implements Measure 50 */ | |
1787 /* | |
1788 +------------------------------------------------------------------------------ | |
1789 | Function : cmhSIM_analyze_SIMLOCK_STATUS | |
1790 +------------------------------------------------------------------------------ | |
1791 | Description : This Function will analyze the SIMLOCK STATUS, passed as an | |
1792 | argument to this function and accordingly returns AT_CMPL | |
1793 | AT_FAIL | |
1794 | | |
1795 | Parameters : status - SIMLOCK STATUS that needs to be analyzed | |
1796 | | |
1797 | Return : ACI Return Codes (Either AT_CMPL or AT_FAIL) | |
1798 +------------------------------------------------------------------------------ | |
1799 */ | |
1800 | |
1801 LOCAL T_ACI_RETURN cmhSIM_analyze_SIMLOCK_STATUS( T_SIMLOCK_STATUS status ) | |
1802 { | |
1803 TRACE_FUNCTION ( "cmhSIM_analyze_SIMLOCK_STATUS()" ); | |
1804 | |
1805 switch ( status ) | |
1806 { | |
1807 case SIMLOCK_ENABLED: | |
1808 case SIMLOCK_DISABLED: | |
1809 /* success */ | |
1810 return AT_CMPL; | |
1811 | |
1812 case SIMLOCK_BLOCKED: /* password tried too many times, phone blocked */ | |
1813 ACI_ERR_DESC(ACI_ERR_CLASS_Cme, CME_ERR_PhoneFail); | |
1814 return AT_FAIL; | |
1815 | |
1816 case SIMLOCK_LOCKED: /* password wrong */ | |
1817 ACI_ERR_DESC(ACI_ERR_CLASS_Cme, CME_ERR_WrongPasswd); | |
1818 return AT_FAIL; | |
1819 | |
1820 default: /* other error */ | |
1821 ACI_ERR_DESC(ACI_ERR_CLASS_Cme, CME_ERR_Unknown); | |
1822 return AT_FAIL; | |
1823 } | |
1824 } | |
1825 | |
1826 /* Implements Measure 40 */ | |
1827 /* | |
1828 +------------------------------------------------------------------------------ | |
1829 | Function : sAT_Plus_CAMM_CACM | |
1830 +------------------------------------------------------------------------------ | |
1831 | Description : This is the functional counterpart to the +CACM or +CAMM | |
1832 | AT commands. | |
1833 | | |
1834 | Parameters : at_cmd_id - AT command identifier | |
1835 | srcId - AT command source identifier | |
1836 | value_type - AOC_ACM or AOC_ACMMAX | |
1837 | value - NULL in case of +CACM | |
1838 | acmmax in case of +CAMM | |
1839 | pwd - password | |
1840 | | |
1841 | Return : ACI functional return codes | |
1842 +------------------------------------------------------------------------------ | |
1843 */ | |
1844 | |
1845 LOCAL T_ACI_RETURN sAT_Plus_CAMM_CACM ( T_ACI_AT_CMD at_cmd_id, | |
1846 T_ACI_CMD_SRC srcId, | |
1847 UBYTE value_type, | |
1848 void *value, | |
1849 UBYTE *pwd ) | |
1850 { | |
1851 T_ACI_RETURN ret = AT_FAIL; | |
1852 | |
1853 TRACE_FUNCTION ( "sAT_Plus_CAMM_CACM()" ); | |
1854 /* | |
1855 *------------------------------------------------------------------- | |
1856 * check command source | |
1857 *------------------------------------------------------------------- | |
1858 */ | |
1859 if(!cmh_IsVldCmdSrc (srcId)) | |
1860 { | |
1861 return( AT_FAIL ); | |
1862 } | |
1863 | |
1864 /* | |
1865 *------------------------------------------------------------------- | |
1866 * send parameters to advice of charge module. | |
1867 *------------------------------------------------------------------- | |
1868 */ | |
1869 simEntStat.curCmd = at_cmd_id; | |
1870 simShrdPrm.owner = (T_OWN)srcId; | |
1871 simEntStat.entOwn = srcId; | |
1872 ret = aoc_set_values ( srcId, | |
1873 value_type, | |
1874 value, | |
1875 pwd ); | |
1876 | |
1877 /* | |
1878 *------------------------------------------------------------------- | |
1879 * Check return value of aoc_set_values() equal to AT_FAIL, | |
1880 * resets simEntStat.curcmd and simEntStat.entown. | |
1881 *------------------------------------------------------------------- | |
1882 */ | |
1883 | |
1884 if( ret EQ AT_FAIL ) | |
1885 { | |
1886 simEntStat.curCmd = AT_CMD_NONE; | |
1887 simShrdPrm.owner = (T_OWN)srcId; | |
1888 simEntStat.entOwn = srcId; | |
1889 } | |
1890 | |
1891 return( ret ); | |
1892 | |
1893 } | |
1894 | |
1895 | |
1896 | |
1897 | |
1898 /*==== EOF ========================================================*/ |