FreeCalypso > hg > fc-tourmaline
comparison src/ui/mfw/mfw_sim.c @ 3:67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Fri, 16 Oct 2020 06:33:10 +0000 |
parents | |
children | 92abb46dc1ba |
comparison
equal
deleted
inserted
replaced
2:3a14ee9a9843 | 3:67bfe9f274f6 |
---|---|
1 /* | |
2 +--------------------------------------------------------------------+ | |
3 | PROJECT: MMI-Framework (8417) $Workfile:: mfw_sim.c $| | |
4 | $Author:: Vo $Revision:: 1 $| | |
5 | CREATED: 13.10.98 $Modtime:: 22.03.00 17:21 $| | |
6 | STATE : code | | |
7 +--------------------------------------------------------------------+ | |
8 | |
9 MODULE : MFW_SIM | |
10 | |
11 PURPOSE : This modul contains the functions for SIM management. | |
12 | |
13 | |
14 $History:: mfw_sim.c | |
15 | |
16 May 30, 2007 DR: OMAPS00132483 x0pleela | |
17 Description: MM: While playing an AAC, unplug USB freezes the audio | |
18 Solution: Defined new functions mfw_get_Phlock_status(), mfw_set_Phlock_status( ), | |
19 mfw_get_Auto_Phlock_status(), mfw_set_Auto_Phlock_status() to set and | |
20 get the phone lock and automatic phone lock status | |
21 | |
22 Apr 03, 2007 ER: OMAPS00122561 x0pleela | |
23 Description: [ACI] Phone lock feature has to be supported by ACI | |
24 Solution: Phone Lock ER implementation | |
25 | |
26 Feb 19, 2006 ER:OMAPS00115179 a0393213 | |
27 Description : support SIM insertion without powering down | |
28 Solution : New case is handled in rAT_PercentSIMINS | |
29 | |
30 Dec 13, 2006 DR: OMAPS00105640 x0039928 | |
31 Description: SIMP: The board reboots when removing SIM card. | |
32 Solution: Sim status is updated. | |
33 | |
34 Nov 13, 2006 DR: OMAPS00103356 x0pleela | |
35 Description: SIMP:Master unlock failed through MMI | |
36 Solution: In function mfw_simlock_master_unlock() a check is added if the master unlock | |
37 password is wrong. If wrong, displays Wrong password. | |
38 Also a check is added if the error code for any of the categories (non-dependent) | |
39 being locked/blocked. If yes, return OK as the dependent categories are unblocked | |
40 using Master unblock password | |
41 | |
42 Sep 26, 2006 DR: OMAPS00095524 x0pleela | |
43 Description:Implement 2 missing SIM Lock types | |
44 Solution: Made the following changes | |
45 1) sim_error_cfun(), sim_error_cpin() | |
46 - Setting the aciErrdesc separately for all the CME errors related to | |
47 SIMP categories | |
48 - Handling the extension error of request for Blocked network password | |
49 (both PIN and PUK) | |
50 2) mfw_simlock_check_lock_bootup() | |
51 - Updating aciErrDesc with Blocked Network (PIN or PUK) password request | |
52 3) mfw_simlock_return_lock_type() | |
53 - Return coresponding ACI lock type for Blocked network category | |
54 4) sim_simlock_cpin_code() | |
55 - Set the reqduired parameters for Blocked Network Password and Unblock | |
56 code request | |
57 | |
58 Sep 26, 2006 DR: OMAPS00096565 x0pleela | |
59 Description: After blocking PIN, when ISAMPLE is reset, instead of prompting for PUK, master | |
60 unlock key is asked | |
61 Solution: Reset C_KEY_REQ to 0 in functions sim_error_cfun() and sim_error_cpin() | |
62 | |
63 Sep 11, 2006 DR: OMAPS00094215 x0pleela | |
64 Description: MMI compilation failed as CME_ErrBusy undefined | |
65 Solution: Handling new Ext_ERR_Busy sent by ACI | |
66 | |
67 xashmic 9 Sep 2006, OMAPS00092732 | |
68 USBMS ER | |
69 | |
70 Sep 08, 2006 DR: OMAPS00091250 x0pleela | |
71 Description:The phone resets if no MEPD data is presented | |
72 Solution: CME_Unknown error is sent by ACI and is now handled by MFW in fucntions sim_error_cpin() and | |
73 sim_error_cfun | |
74 | |
75 July 21, 2006 ER: OMAPS00087586, OMAPS00087587 x0pleela | |
76 Description: OMAPS00087586: MasterKey funtion in TCS3.2 SW | |
77 OMAPS00087587: Time Penaly feature extend handset security | |
78 Solution:Made the following changes | |
79 1) Defined new static variable "Simp_Busy_State" which will be set to either TRUE or FALSE based on the ACI's busy error | |
80 2) sim_error_cfun(): Update global aciErrDesc with the current CME error code | |
81 3) mfw_simlock_check_lock_bootup(): Check for the CME busy error and update "Simp_Busy_State" accordingly | |
82 4) mfw_simlock_return_lock_type(): Return coresponding lock type for master unlock | |
83 5) Added following new functions: | |
84 mfw_simlock_master_unlock: This function unlocks(dependent categories) or unblocks ME | |
85 mfw_simlock_check_masterkey: This function checks from ACI whether Master Unlock feature is enabled or not. If | |
86 enabled, displays a menu item for the user toy select master unlocking option. If not enabled, doesn't | |
87 display master unlocking option in the menu | |
88 mfw_simlock_set_busy_state: This function sets Simp_Busy_State to either TRUE or FALSE based on ACI's CME error | |
89 mfw_simlock_get_busy_state: This function returns the current value of Simp_Busy_State | |
90 | |
91 Jun 23, 2006 DR: OMAPS00082374 x0pleela | |
92 Description: EONS Failures - unexpected output from the MMI: 2 carriers; on the top always T-Mobile | |
93 Solution: a) Removed the usage of global variable gEons_alloc_active | |
94 b) Removed the check for services 51 and 52 from function rat_pluscfunp | |
95 | |
96 xrashmic 6 Jul, 2006 OMAPS00080708 | |
97 For error return value in sAT_PercentPVRF, bmi has to be informed | |
98 | |
99 xrashmic 1 Jul, 2006 OMAPS00075784 | |
100 Hanlding of SIMP events during bootup | |
101 | |
102 May 15, 2006 DR: OMAPS00067919 x0pleela | |
103 Description: SIMP:On repeat Depersonalisation with invalid password MEPD unblock key should | |
104 be asked not Puk1. | |
105 Solution:Made the following changes | |
106 1. Added global variables (simp_cpin_code, simp_cpin_flag) to store the code result of qAT_PlusCPIN() result | |
107 2. Using new enum type T_MFW_SIMP_CLCK_FLAG sim_unlock_in_prog instead of U8 | |
108 3. Added code in sim_error_cpin() to set the sim_status field to request for Unblocking code | |
109 4. Modified the code to check SIMP during bootup sequence | |
110 5. Added new function sim_simlock_cpin_code() which checks for the code and take action for SIMP category unlocking | |
111 | |
112 Feb 15, 2006 ER: OMAPS00065203 x0pleela | |
113 Description: Cingular Operator Name Prioritization implementation required | |
114 Solution: Incorporated review comments | |
115 Combined both checks for services 51 and 52 in rAT_PlusCFUNP | |
116 | |
117 Feb 09, 2006 ER: OMAPS00065203 x0pleela | |
118 Description: Cingular Operator Name Prioritization implementation required | |
119 Solution: Check for services 51 - OPL and 52 - PNN in function rAT_PlusCFUNP and | |
120 gEons_alloc_active is updated accordingly | |
121 | |
122 Nov 24, 2005 DR: OMAPS00045909 - Shashi Shekar B.S. | |
123 Description: Improve IMEI control mechanism | |
124 Solution : When MMI calls sAT_PLUSCFUN, if an IMEI invalid error is returned, | |
125 we will block on that screen & will not allow the user to browse menus further, | |
126 since the PS will not be booted at all!!! | |
127 | |
128 Nov 15,2005 DR : OMAPS00057280 - x0034700 | |
129 Description: Compilation Errors in Neptune build while integrating latest MMI Changes | |
130 Solution: Included the compilation FLAG "NEPTUNE_BOARD" for un wanted code for Neptune build | |
131 | |
132 Nov 03, 2005 DR: OMAPS00052032 - xpradipg | |
133 Description : Locosto: SIMP - integration of issues submitted by solDel on | |
134 ME Personalization - changes as per the new interfaces | |
135 Solution : The return value of sAT_PlusCLCK of AT_EXCT is handled and | |
136 a please wait screen is displayed until the response is recieved | |
137 | |
138 Nov 03, 2005 DR: OMAPS00050595 - xpradipg | |
139 Description: SIMP: If the SIM is blocked (by entering invalid PIN1), the user is | |
140 not able to unblock it even after entering the valid PUK1 | |
141 Solution : The global flag for SIM Personlaization PUK request was set even | |
142 for the SIM PUK request. This setting is removed. Also the condition | |
143 check has been done first for the global flag and then the rest of the | |
144 checks. | |
145 | |
146 Sept 24, 2005 REF: LOCOSTO-ENH-34438, xpradipg | |
147 Description: Integration changes required with new aci labe | |
148 Solution: changes to adopt to the new ACI label | |
149 | |
150 July 19, 2005 REF: CRR LOCOSTO-ENH-28173 xpradipg | |
151 Description: To provide MMI Support to enable/disable/change password and | |
152 query all the Personalization locks | |
153 Solution: Integration of the changes for the same provided by the soldel | |
154 team | |
155 | |
156 Aug 16, 2004 REF: CRR 24323 Deepa M.D | |
157 Bug:Clenup of sprintf used for tracing | |
158 Fix:Replace the char buf[]; sprintf (buf, "...", ...); TRACE_EVENT (buf); statements by TRACE_EVENT_PX $ | |
159 | |
160 May 22, 2006 x0047685 | |
161 Removed pref_plmn from nm_mmi_parameter(...); due to REL99 EF handling. | |
162 | |
163 * * ***************** Version 43 ***************** | |
164 * User: MC Date: 14.11.02 Time: 10:40 | |
165 * Updated in $/BMI/Condat/MS/SRC/MFW | |
166 * Changed simlock functions into wrappers for aci_slock functions, and | |
167 * removed variables definitions and helper functions rendered obsolete. | |
168 * | |
169 * ***************** Version 43 ***************** | |
170 * User: Vo Date: 22.03.00 Time: 17:29 | |
171 * Updated in $/GSM/Condat/MS/SRC/MFW | |
172 * Add new parameter PIN type in structure T_MFW_SIM_STATUS to | |
173 * identify PIN type | |
174 * Change in SIM lock | |
175 * | |
176 * ***************** Version 42 ***************** | |
177 * User: Es Date: 2.03.00 Time: 16:18 | |
178 * Updated in $/GSM/Condat/MS/SRC/MFW | |
179 * use 'aci_delete()' instead of 'aci_ext_init()' to clear the | |
180 * primitive routing for mfw_sim. (because other routings may have to | |
181 * be preserved!) | |
182 * | |
183 * ***************** Version 41 ***************** | |
184 * User: Vo Date: 22.12.99 Time: 16:03 | |
185 * Updated in $/GSM/Condat/MS/SRC/MFW | |
186 * Remove maximum preferred PLMN records and used preferred PLMN | |
187 * records in local memory | |
188 * | |
189 * ***************** Version 40 ***************** | |
190 * User: Vo Date: 2.12.99 Time: 13:18 | |
191 * Updated in $/GSM/Condat/MS/SRC/MFW | |
192 * New: request of max/used perferred PLMN list | |
193 * | |
194 * ***************** Version 39 ***************** | |
195 * User: Vo Date: 17.11.99 Time: 11:37 | |
196 * Updated in $/GSM/Condat/MS/SRC/MFW | |
197 * Bug fix: de-personalisation for SIM lock | |
198 * New: SIM inserted | |
199 * | |
200 * ***************** Version 38 ***************** | |
201 * User: Vo Date: 21.10.99 Time: 13:26 | |
202 * Updated in $/GSM/Condat/MS/SRC/MFW | |
203 * add response of de-registration | |
204 | | |
205 | ***************** Version 37 ***************** | |
206 | User: Le Date: 11.10.99 Time: 16:27 | |
207 | Updated in $/GSM/Condat/MS/SRC/MFW | |
208 | | |
209 | ***************** Version 36 ***************** | |
210 | User: Le Date: 8.10.99 Time: 13:38 | |
211 | Updated in $/GSM/Condat/MS/SRC/MFW | |
212 | | |
213 | ***************** Version 35 ***************** | |
214 | User: Le Date: 4.10.99 Time: 10:33 | |
215 | Updated in $/GSM/Condat/MS/SRC/MFW | |
216 * | |
217 * ***************** Version 34 ***************** | |
218 * User: Es Date: 29.09.99 Time: 11:20 | |
219 * Updated in $/GSM/DEV/MS/SRC/MFW | |
220 * including CFUN_OK enhancement by AK, not fully implemented | |
221 * | |
222 * ***************** Version 33 ***************** | |
223 * User: Es Date: 16.09.99 Time: 16:56 | |
224 * Updated in $/GSM/DEV/MS/SRC/MFW | |
225 * reordered include statements due to addons in mfw_phb.h | |
226 * | |
227 * ***************** Version 32 ***************** | |
228 * User: Vo Date: 13.09.99 Time: 12:05 | |
229 * Updated in $/GSM/DEV/MS/SRC/MFW | |
230 * change comment | |
231 * | |
232 * ***************** Version 31 ***************** | |
233 * User: Vo Date: 12.09.99 Time: 15:32 | |
234 * Updated in $/GSM/DEV/MS/SRC/MFW | |
235 * Bug fix: change PIN | |
236 * Bug fix/New: SIM lock | |
237 * New: request of PIN status | |
238 * New: save preferred language | |
239 * New: read group identifier level 1 & 2 | |
240 * | |
241 * ***************** Version 30 ***************** | |
242 * User: Vo Date: 30.08.99 Time: 14:23 | |
243 * Updated in $/GSM/DEV/MS/SRC/MFW | |
244 * bug fix | |
245 * new function | |
246 * | |
247 * ***************** Version 29 ***************** | |
248 * User: Vo Date: 9.08.99 Time: 13:11 | |
249 * Updated in $/GSM/DEV/MS/SRC/MFW | |
250 * PIN/PUK count | |
251 * | |
252 * ***************** Version 28 ***************** | |
253 * User: Vo Date: 26.07.99 Time: 14:34 | |
254 * Updated in $/GSM/DEV/MS/SRC/MFW | |
255 * Move include file mfw_cb.h | |
256 * | |
257 * ***************** Version 27 ***************** | |
258 * User: Vo Date: 21.07.99 Time: 14:41 | |
259 * Updated in $/GSM/DEV/MS/SRC/MFW | |
260 * | |
261 * ***************** Version 26 ***************** | |
262 * User: Vo Date: 16.07.99 Time: 13:50 | |
263 * Updated in $/GSM/DEV/MS/SRC/MFW | |
264 * | |
265 * ***************** Version 25 ***************** | |
266 * User: Vo Date: 9.07.99 Time: 14:34 | |
267 * Updated in $/GSM/DEV/MS/SRC/MFW | |
268 * | |
269 * ***************** Version 24 ***************** | |
270 * User: Vo Date: 2.07.99 Time: 19:03 | |
271 * Updated in $/GSM/DEV/MS/SRC/MFW | |
272 * | |
273 * ***************** Version 23 ***************** | |
274 * User: Vo Date: 28.05.99 Time: 9:52 | |
275 * Updated in $/GSM/DEV/MS/SRC/MFW | |
276 * | |
277 * ***************** Version 22 ***************** | |
278 * User: Vo Date: 31.03.99 Time: 14:09 | |
279 * Updated in $/GSM/DEV/MS/SRC/MFW | |
280 * | |
281 * ***************** Version 21 ***************** | |
282 * User: Es Date: 15.03.99 Time: 18:21 | |
283 * Updated in $/GSM/DEV/MS/SRC/MFW | |
284 * recode | |
285 * | |
286 * ***************** Version 20 ***************** | |
287 * User: Vo Date: 25.02.99 Time: 16:47 | |
288 * Updated in $/GSM/DEV/MS/SRC/MFW | |
289 * | |
290 * ***************** Version 19 ***************** | |
291 * User: Vo Date: 17.02.99 Time: 19:03 | |
292 * Updated in $/GSM/DEV/MS/SRC/MFW | |
293 * | |
294 * ***************** Version 18 ***************** | |
295 * User: Vo Date: 12.02.99 Time: 18:05 | |
296 * Updated in $/GSM/DEV/MS/SRC/MFW | |
297 * | |
298 * ***************** Version 17 ***************** | |
299 * User: Vo Date: 12.02.99 Time: 17:46 | |
300 * Updated in $/GSM/DEV/MS/SRC/MFW | |
301 * | |
302 * ***************** Version 16 ***************** | |
303 * User: Vo Date: 9.02.99 Time: 14:54 | |
304 * Updated in $/GSM/DEV/MS/SRC/MFW | |
305 * | |
306 * ***************** Version 15 ***************** | |
307 * User: Vo Date: 12.01.99 Time: 14:27 | |
308 * Updated in $/GSM/DEV/MS/SRC/MFW | |
309 * | |
310 * ***************** Version 14 ***************** | |
311 * User: Es Date: 23.12.98 Time: 15:47 | |
312 * Updated in $/GSM/DEV/MS/SRC/MFW | |
313 * | |
314 * ***************** Version 12 ***************** | |
315 * User: Es Date: 18.12.98 Time: 13:05 | |
316 * Updated in $/GSM/DEV/MS/SRC/MFW | |
317 * | |
318 * ***************** Version 11 ***************** | |
319 * User: Vo Date: 17.12.98 Time: 14:31 | |
320 * Updated in $/GSM/DEV/MS/SRC/MFW | |
321 * | |
322 * ***************** Version 10 ***************** | |
323 * User: Es Date: 8.12.98 Time: 16:53 | |
324 * Updated in $/GSM/DEV/MS/SRC/MFW | |
325 * | |
326 * ***************** Version 8 ***************** | |
327 * User: Vo Date: 24.11.98 Time: 21:40 | |
328 * Updated in $/GSM/DEV/MS/SRC/MFW | |
329 * first successful compilation of MFW | |
330 | | |
331 | ***************** Version 6 ***************** | |
332 | User: Le Date: 11.11.98 Time: 13:35 | |
333 | Updated in $/GSM/DEV/MS/SRC/MFW | |
334 | | |
335 | ***************** Version 5 ***************** | |
336 | User: Le Date: 10.11.98 Time: 16:07 | |
337 | Updated in $/GSM/DEV/MS/SRC/MFW | |
338 | | |
339 | ***************** Version 4 ***************** | |
340 | User: Le Date: 10.11.98 Time: 11:08 | |
341 | Updated in $/GSM/DEV/MS/SRC/MFW | |
342 | | |
343 | ***************** Version 3 ***************** | |
344 | User: Le Date: 27.10.98 Time: 15:59 | |
345 | Updated in $/GSM/DEV/MS/SRC/MFW | |
346 | | |
347 | ***************** Version 2 ***************** | |
348 | User: Le Date: 21.10.98 Time: 16:20 | |
349 | Updated in $/GSM/DEV/MS/SRC/MFW | |
350 */ | |
351 | |
352 #define ENTITY_MFW | |
353 | |
354 #include <string.h> | |
355 #include <stdio.h> | |
356 #include <stdlib.h> | |
357 | |
358 #if defined (NEW_FRAME) | |
359 | |
360 #include "typedefs.h" | |
361 #include "vsi.h" | |
362 #include "pei.h" | |
363 #include "custom.h" | |
364 #include "gsm.h" | |
365 | |
366 #else | |
367 | |
368 #include "STDDEFS.H" | |
369 #include "custom.h" | |
370 #include "gsm.h" | |
371 #include "vsi.h" | |
372 | |
373 #endif | |
374 #if defined (SIM_PERS) && !defined(NEPTUNE_BOARD) | |
375 #include "p_sim.h" | |
376 #endif | |
377 #include "prim.h" | |
378 #include "message.h" | |
379 #include "prim.h" | |
380 #include "aci_cmh.h" | |
381 #include "psa.h" | |
382 #include "psa_sim.h" | |
383 | |
384 #ifndef PCM_2_FFS | |
385 #include "pcm.h" | |
386 #endif | |
387 | |
388 #include "mfw_mfw.h" | |
389 #include "mfw_nm.h" | |
390 #include "mfw_sim.h" | |
391 #include "mfw_sima.h" | |
392 #include "mfw_simi.h" | |
393 #include "mfw_nmi.h" | |
394 #include "mfw_nma.h" | |
395 #include "mfw_phb.h" | |
396 #include "mfw_cm.h" | |
397 #include "mfw_cmi.h" | |
398 #include "mfw_acie.h" | |
399 #include "mfw_sms.h" | |
400 #include "mfw_smsi.h" | |
401 #include "mfw_win.h" | |
402 | |
403 | |
404 #include "ksd.h" | |
405 #include "psa.h" | |
406 | |
407 #if defined (FAX_AND_DATA) | |
408 #include "aci_fd.h" | |
409 #endif | |
410 | |
411 #include "cmh.h" | |
412 #include "phb.h" | |
413 #include "cmh_phb.h" | |
414 | |
415 #include "mfw_ss.h" | |
416 #include "mfw_ssi.h" | |
417 | |
418 #include "aci_ext_pers.h" /*MC, SPR 1351 include ACI simlock files*/ | |
419 #include "aci_slock.h" | |
420 | |
421 #ifdef SIM_TOOLKIT | |
422 #include "mfw_sat.h" | |
423 #endif | |
424 | |
425 | |
426 extern BOOL sima_response_cb (ULONG opc, void * data); | |
427 extern void simDecodeIMSI (UBYTE *ci, UBYTE li, UBYTE *di); | |
428 static int simCommand (ULONG cmd, void *h); /* handle win commands */ | |
429 extern UBYTE mfw_IMSI []; /* expanded IMSI (ASCIIZ) */ | |
430 | |
431 #ifdef SIM_TOOLKIT | |
432 char mfwSATLPRefresh; | |
433 #endif | |
434 | |
435 // Sept 24, 2005 REF: LOCOSTO-ENH-34438, xpradipg | |
436 // required for the new compiler 2.54 | |
437 #ifdef SIM_PERS | |
438 T_ACI_FAC mfw_simlock_return_lock_type(S16 lck); | |
439 T_MFW mfw_simlock_check_status(S16 lcktyp,int *max,int *curr); | |
440 int mfw_simlock_get_lock_status(S16 lcktyp); | |
441 int C_KEY_REQ = 0; | |
442 | |
443 //x0pleela 25 Apr, 2006 DR: OMAPS00067919 | |
444 //Global variable to store the code result of qAT_PlusCPIN() result | |
445 GLOBAL T_ACI_CPIN_RSLT simp_cpin_code; | |
446 GLOBAL UBYTE simp_cpin_flag; //Global to indicate whether Category pwds are asked after qAT_PlusCPIN() | |
447 #endif | |
448 | |
449 static T_MFW_SIM_STATUS sim_status; | |
450 static T_MFW_SIM_CONFIG sim_config; | |
451 static int pin_flag; | |
452 static UBYTE pin_ident; | |
453 | |
454 static UBYTE sim_service_table [0x10]; /* SIM service table *//*a0393213 cphs R4*/ | |
455 static UBYTE sim_stat = SIM_NOT_ACTIVE; | |
456 | |
457 // Sept 24, 2005 REF: LOCOSTO-ENH-34438, xpradipg | |
458 // Fix for the wrong screens in PIN enable/disable/change password | |
459 UBYTE pin1_set = MFW_SIM_DISABLE; | |
460 UBYTE pin2_set = MFW_SIM_ENABLE; | |
461 | |
462 static BOOL sat_update = FALSE; | |
463 | |
464 static int pSlot; /* primitive handler slot */ | |
465 | |
466 CallbackCPRI mmi_cprs_cb; | |
467 | |
468 EXTERN MfwHdr * current_mfw_elem; | |
469 #if defined (WIN32) | |
470 /* | |
471 * Only for windows to check several SIM lock combinations | |
472 */ | |
473 UBYTE sim_lock_mode = 0; | |
474 #endif | |
475 UBYTE sim_lock_field = NOT_PRESENT_8BIT; /* type of sim lock field */ | |
476 | |
477 #ifdef SIM_PERS | |
478 EXTERN UBYTE gsim_status; | |
479 // Nov 03, 2005 DR: OMAPS00052032 - xpradipg | |
480 T_MFW_SIMP_CLCK_FLAG sim_unlock_in_prog = SIMP_NONE; | |
481 | |
482 //x0pleela 20 July, 2006 | |
483 static UBYTE Simp_Busy_State; /* Set to either TRUE or FALSE based on the ACI's busy error */ | |
484 | |
485 #endif | |
486 | |
487 //x0pleela 29 May, 2007 DR: OMAPS00132483 | |
488 #ifdef FF_PHONE_LOCK | |
489 #define Phlock_ResetFlag 0x00 //toset any bit to zero | |
490 #define PhlockStatus 0x01 //for phone lock status | |
491 #define AutoPhlockStatus 0x02 //for automatic phone lock status | |
492 static int Phlock_flag; | |
493 | |
494 //Function Prototypes | |
495 GLOBAL int mfw_get_Phlock_status(void); | |
496 GLOBAL void mfw_set_Phlock_status( int phlock_status); | |
497 GLOBAL int mfw_get_Auto_Phlock_status(void); | |
498 GLOBAL void mfw_set_Auto_Phlock_status( int phlock_status); | |
499 | |
500 #endif //FF_PHONE_LOCK | |
501 | |
502 /* | |
503 +--------------------------------------------------------------------+ | |
504 | PROJECT : MMI-Framework (8417) MODULE : MFW_SIM | | |
505 | STATE : code ROUTINE : sim_init | | |
506 +--------------------------------------------------------------------+ | |
507 | |
508 PURPOSE : initialize SIM manager | |
509 | |
510 */ | |
511 | |
512 int sim_init (void) | |
513 { | |
514 /*a0393213 compiler warnings removal - removed simlck variable*/ | |
515 | |
516 | |
517 TRACE_FUNCTION("sim_init()"); | |
518 | |
519 pin_flag = -1; | |
520 pin_ident = MFW_SIM_UNKNOWN; | |
521 | |
522 /* | |
523 * install prim handler | |
524 */ | |
525 pSlot = aci_create(sima_response_cb,NULL); | |
526 mfwCommand[MfwTypSim] = (MfwCb) simCommand; | |
527 | |
528 return TRUE; | |
529 } | |
530 | |
531 | |
532 /* | |
533 +---------------------------------------------------------------------+ | |
534 | PROJECT : MMI-Framework (8417) MODULE : MFW_SIM | | |
535 | STATE : code ROUTINE : sim_init_sim_insert | | |
536 +---------------------------------------------------------------------+ | |
537 | |
538 PURPOSE : initialize SIM manager | |
539 | |
540 */ | |
541 | |
542 void sim_init_sim_insert() | |
543 { | |
544 } | |
545 | |
546 | |
547 /* | |
548 +--------------------------------------------------------------------+ | |
549 | PROJECT : MMI-Framework (8417) MODULE : MFW_SIM | | |
550 | STATE : code ROUTINE : sim_exit | | |
551 +--------------------------------------------------------------------+ | |
552 | |
553 PURPOSE : finalize SIM manager | |
554 | |
555 */ | |
556 | |
557 void sim_exit (void) | |
558 { | |
559 TRACE_FUNCTION("sim_exit()"); | |
560 | |
561 /* | |
562 * remove prim handler | |
563 */ | |
564 aci_delete(pSlot); | |
565 sim_stat = SIM_NOT_ACTIVE; | |
566 } | |
567 | |
568 | |
569 /* | |
570 +--------------------------------------------------------------------+ | |
571 | PROJECT : MMI-Framework (8417) MODULE : MFW_SIM | | |
572 | STATE : code ROUTINE : sim_create | | |
573 +--------------------------------------------------------------------+ | |
574 | |
575 PURPOSE : create SIM event handler | |
576 | |
577 */ | |
578 | |
579 T_MFW_HND sim_create (MfwHnd hWin, MfwEvt event, MfwCb cbfunc) | |
580 { | |
581 MfwHdr *hdr; | |
582 T_MFW_SIM *sim_para; | |
583 MfwHdr *insert_status =0; | |
584 | |
585 TRACE_FUNCTION("sim_create()"); | |
586 | |
587 hdr = (MfwHdr *) mfwAlloc(sizeof(MfwHdr)); | |
588 sim_para = (T_MFW_SIM *) mfwAlloc(sizeof(T_MFW_SIM)); | |
589 | |
590 if (!hdr || !sim_para) | |
591 { | |
592 TRACE_ERROR("ERROR: sim_create() Mem Alloc Failed."); | |
593 | |
594 if(hdr) | |
595 mfwFree((U8*)hdr,sizeof(MfwHdr)); | |
596 | |
597 if(sim_para) | |
598 mfwFree((U8*)sim_para,sizeof(T_MFW_SIM)); | |
599 | |
600 return 0; | |
601 } | |
602 sim_para->emask = event; | |
603 sim_para->handler = cbfunc; | |
604 | |
605 hdr->data = sim_para; | |
606 hdr->type = MfwTypSim; | |
607 | |
608 insert_status = mfwInsert((MfwHdr *) hWin,hdr); | |
609 | |
610 if(!insert_status) | |
611 { | |
612 TRACE_ERROR("ERROR: sim_create() Failed to Install Handler. "); | |
613 mfwFree((U8*)hdr,sizeof(MfwHdr)); | |
614 mfwFree((U8*)sim_para,sizeof(T_MFW_SIM)); | |
615 return 0; | |
616 } | |
617 return insert_status; | |
618 | |
619 } | |
620 | |
621 | |
622 /* | |
623 +--------------------------------------------------------------------+ | |
624 | PROJECT : MMI-Framework (8417) MODULE : MFW_SIM | | |
625 | STATE : code ROUTINE : sim_delete | | |
626 +--------------------------------------------------------------------+ | |
627 | |
628 PURPOSE : delete SIM event handler | |
629 | |
630 */ | |
631 | |
632 MfwRes sim_delete (MfwHnd h) | |
633 { | |
634 TRACE_FUNCTION("sim_delete()"); | |
635 | |
636 if (!h || !((MfwHdr *) h)->data) | |
637 return MfwResIllHnd; | |
638 | |
639 if (!mfwRemove((MfwHdr *) h)) | |
640 return MfwResIllHnd; | |
641 | |
642 mfwFree((U8 *) ((MfwHdr *) h)->data,sizeof(T_MFW_SIM)); | |
643 mfwFree((U8 *) h,sizeof(MfwHdr)); | |
644 | |
645 return MfwResOk; | |
646 } | |
647 | |
648 | |
649 /* | |
650 +--------------------------------------------------------------------+ | |
651 | PROJECT : MMI-Framework (8417) MODULE : MFW_SIM | | |
652 | STATE : code ROUTINE : sim_signal | | |
653 +--------------------------------------------------------------------+ | |
654 | |
655 PURPOSE : Send a signal | |
656 | |
657 */ | |
658 | |
659 void sim_signal (MfwEvt event, void *para) | |
660 { | |
661 UBYTE temp = dspl_Enable(0); | |
662 TRACE_FUNCTION ("sim_signal()"); | |
663 | |
664 if (mfwSignallingMethod EQ 0) | |
665 { | |
666 if (mfwFocus) | |
667 if (sim_sign_exec(mfwFocus,event,para)) | |
668 { | |
669 dspl_Enable(temp); | |
670 return; | |
671 } | |
672 if (mfwRoot) | |
673 sim_sign_exec(mfwRoot,event,para); | |
674 } | |
675 else | |
676 { | |
677 MfwHdr * h = 0; | |
678 | |
679 /* | |
680 * Focus set, then start here | |
681 */ | |
682 if (mfwFocus) | |
683 h = mfwFocus; | |
684 /* | |
685 * Focus not set, then start root | |
686 */ | |
687 if (!h) | |
688 h = mfwRoot; | |
689 | |
690 /* | |
691 * No elements available, return | |
692 */ | |
693 | |
694 while (h) | |
695 | |
696 | |
697 { | |
698 /* | |
699 * Signal consumed, then return | |
700 */ | |
701 if (sim_sign_exec (h, event, para)) | |
702 { | |
703 dspl_Enable(temp); | |
704 return; | |
705 } | |
706 | |
707 /* | |
708 * All windows tried inclusive root | |
709 */ | |
710 if (h == mfwRoot) | |
711 { | |
712 dspl_Enable(temp); | |
713 return; | |
714 } | |
715 | |
716 /* | |
717 * get parent window | |
718 */ | |
719 h = mfwParent(mfwParent(h)); | |
720 if(h) | |
721 h = ((MfwWin * )(h->data))->elems; | |
722 } | |
723 sim_sign_exec (mfwRoot, event, para); | |
724 } | |
725 dspl_Enable(temp); | |
726 return; | |
727 } | |
728 | |
729 | |
730 /* | |
731 +--------------------------------------------------------------------+ | |
732 | PROJECT : MMI-Framework (8417) MODULE : MFW_SIM | | |
733 | STATE : code ROUTINE : sim_sign_exec | | |
734 +--------------------------------------------------------------------+ | |
735 | |
736 PURPOSE : Send a signal if SIM management handler | |
737 | |
738 */ | |
739 | |
740 int sim_sign_exec (MfwHdr *cur_elem, MfwEvt event, T_MFW_SIM_PARA *para) | |
741 { | |
742 | |
743 TRACE_FUNCTION("sim_sign_exec()"); | |
744 | |
745 while (cur_elem) | |
746 { | |
747 if (cur_elem->type == MfwTypSim) | |
748 { | |
749 T_MFW_SIM *sim_data; | |
750 sim_data = (T_MFW_SIM *) cur_elem->data; | |
751 if (sim_data->emask & event) | |
752 { | |
753 sim_data->event = event; | |
754 switch (event) | |
755 { | |
756 case E_SIM_STATUS: | |
757 #ifdef NEPTUNE_BOARD | |
758 sim_data->para.status.sim_operation_mode = para->status.sim_operation_mode; | |
759 sim_data->para.status.sim_pin_retries = para->status.sim_pin_retries; | |
760 sim_data->para.status.sim_procedure = para->status.sim_procedure; | |
761 sim_data->para.status.sim_status = para->status.sim_status; | |
762 sim_data->para.status.sim_status_type = para->status.sim_status_type; | |
763 #else | |
764 memcpy(&sim_data->para.status, | |
765 para,sizeof(T_MFW_SIM_STATUS)); | |
766 #endif | |
767 break; | |
768 /*MC CONQ5862, 13/06/02*, added new event*/ | |
769 case E_SIM_READ_CALLBACK: | |
770 memcpy(&sim_data->para.callback, | |
771 para,sizeof(T_MFW_READ_CALLBACK)); | |
772 break; | |
773 } | |
774 if (sim_data->handler) | |
775 { | |
776 // PATCH LE 06.06.00 | |
777 // store current mfw elem | |
778 current_mfw_elem = cur_elem; | |
779 // END PATCH LE 06.06.00 | |
780 if ((*(sim_data->handler))(sim_data->event, | |
781 (void *) &sim_data->para)) | |
782 return TRUE; | |
783 } | |
784 } | |
785 } | |
786 cur_elem = cur_elem->next; | |
787 } | |
788 | |
789 return FALSE; | |
790 } | |
791 | |
792 | |
793 /* | |
794 +--------------------------------------------------------------------+ | |
795 | PROJECT : MMI-Framework (8417) MODULE : MFW_SIM | | |
796 | STATE : code ROUTINE : sim_activate | | |
797 +--------------------------------------------------------------------+ | |
798 | |
799 PURPOSE : Start SIM card activation | |
800 | |
801 */ | |
802 | |
803 void sim_activate (void) | |
804 { | |
805 | |
806 T_ACI_RETURN cfun; | |
807 T_ACI_ERR_DESC cfun_err; | |
808 | |
809 TRACE_FUNCTION("sim_activate()"); | |
810 | |
811 /* | |
812 * Full functionality is used don´t reset the ME | |
813 */ | |
814 | |
815 // Nov 24, 2005, a0876501, DR: OMAPS00045909 | |
816 cfun = sAT_PlusCFUN(CMD_SRC_LCL,CFUN_FUN_Full,CFUN_RST_NotPresent); | |
817 | |
818 if (cfun EQ AT_FAIL) | |
819 { | |
820 cfun_err = qAT_ErrDesc(); | |
821 | |
822 if((cfun_err & 0x0000FFFF) EQ EXT_ERR_IMEICheck) | |
823 { | |
824 sim_stat = IMEI_NOT_VALID; | |
825 sim_status.sim_status = MFW_IMEI_NOT_VALID; | |
826 sim_status.sim_operation_mode = sim_config.oper_mode; | |
827 sim_status.sim_pin_retries = 0; | |
828 sim_status.sim_procedure = MFW_SIM_ACTIVATION; | |
829 sim_status.sim_status_type = MFW_SIM_UNKNOWN; | |
830 | |
831 sim_signal(E_SIM_STATUS,&sim_status); | |
832 } | |
833 } | |
834 else if (cfun NEQ AT_EXCT) | |
835 { | |
836 TRACE_ERROR("sAT_PlusCFUN error"); | |
837 } | |
838 } | |
839 | |
840 | |
841 /* | |
842 +--------------------------------------------------------------------+ | |
843 | PROJECT : MMI-Framework (8417) MODULE : MFW_SIM | | |
844 | STATE : code ROUTINE : sim_spn_req | | |
845 +--------------------------------------------------------------------+ | |
846 | |
847 PURPOSE : Request service provider name | |
848 | |
849 */ | |
850 | |
851 void sim_spn_req (void) | |
852 { | |
853 T_EF_SPN spn; | |
854 | |
855 TRACE_FUNCTION("sim_spn_req()"); | |
856 | |
857 memset(&spn,0,sizeof(T_EF_SPN)); | |
858 | |
859 if (sim_check_service(17,sim_service_table) | |
860 EQ ALLOCATED_AND_ACTIVATED) | |
861 sim_read_sim(SIM_SPN,17,17); | |
862 else | |
863 #ifdef FF_2TO1_PS | |
864 nm_spn_cnf(CAUSE_SIM_ACCESS_PROHIBIT, &spn); | |
865 #else | |
866 nm_spn_cnf(SIM_CAUSE_ACCESS_PROHIBIT, &spn); | |
867 #endif | |
868 | |
869 } | |
870 | |
871 | |
872 /* | |
873 +--------------------------------------------------------------------+ | |
874 | PROJECT : MMI-Framework (8417) MODULE : MFW_SIM | | |
875 | STATE : code ROUTINE : sim_ok_cfun | | |
876 +--------------------------------------------------------------------+ | |
877 | |
878 PURPOSE : Notify successful end of SIM card activation | |
879 | |
880 */ | |
881 | |
882 void sim_ok_cfun (void) | |
883 { | |
884 T_ACI_CFUN_FUN fun; | |
885 | |
886 TRACE_FUNCTION ("sim_ok_cfun()"); | |
887 | |
888 qAT_PlusCFUN( CMD_SRC_LCL, &fun ); | |
889 | |
890 if( fun EQ CFUN_FUN_Full ) | |
891 { | |
892 sim_stat = SIM_ACTIVE; | |
893 sim_status.sim_status = MFW_SIM_NO_PIN; | |
894 sim_status.sim_operation_mode = sim_config.oper_mode; | |
895 sim_status.sim_pin_retries = 0; | |
896 sim_status.sim_procedure = MFW_SIM_ACTIVATION; | |
897 sim_status.sim_status_type = pin_ident; | |
898 | |
899 pin_ident = MFW_SIM_UNKNOWN; | |
900 sim_signal(E_SIM_STATUS,&sim_status); | |
901 nm_activate(MFW_SIM_NO_PIN); | |
902 | |
903 pin1_set = MFW_SIM_DISABLE; | |
904 } | |
905 else if( fun EQ CFUN_FUN_Minimum ) | |
906 { | |
907 nm_ok_deregistration(); | |
908 } | |
909 } | |
910 | |
911 | |
912 /* | |
913 +--------------------------------------------------------------------+ | |
914 | PROJECT : MMI-Framework (8417) MODULE : MFW_SIM | | |
915 | STATE : code ROUTINE : sim_error_cfun | | |
916 +--------------------------------------------------------------------+ | |
917 | |
918 PURPOSE : Notify error status of SIM card | |
919 | |
920 */ | |
921 | |
922 /* OMAPS00075177 - 17,Apr-2006 */ | |
923 /* Signature of the function has been changed from U8 to T_ACI_CME_ERR. | |
924 because, when calling this function, it is converting from T_ACI_CME_ERR to U8. | |
925 It is loosing the negative values( the enum T_ACI_CME_ERR has negative values ) | |
926 */ | |
927 void sim_error_cfun (T_ACI_CME_ERR result) | |
928 { | |
929 TRACE_FUNCTION("sim_error_cfun()"); | |
930 | |
931 sim_status.sim_procedure = MFW_SIM_ACTIVATION; | |
932 sim_status.sim_operation_mode = sim_config.oper_mode; | |
933 | |
934 switch (result) | |
935 { | |
936 case CME_ERR_SimPinReq: /* PIN 1 must be entered */ | |
937 sim_status.sim_status = MFW_SIM_PIN_REQ; | |
938 sim_status.sim_pin_retries = sim_pin_count(MFW_SIM_PIN1); | |
939 sim_status.sim_status_type = MFW_SIM_PIN1; | |
940 sim_stat = SIM_ACTIVE; | |
941 break; | |
942 case CME_ERR_SimPin2Req: /* PIN 2 must be entered */ | |
943 sim_status.sim_status = MFW_SIM_PIN2_REQ; | |
944 sim_status.sim_pin_retries = sim_pin_count(MFW_SIM_PIN2); | |
945 sim_status.sim_status_type = MFW_SIM_PIN2; | |
946 sim_stat = SIM_ACTIVE; | |
947 break; | |
948 | |
949 #ifdef SIM_PERS | |
950 case CME_ERR_PhoneFail: | |
951 case CME_ERR_NetworkPersPukReq: | |
952 case CME_ERR_NetworkSubsetPersPukReq: | |
953 case CME_ERR_ProviderPersPukReq: | |
954 case CME_ERR_CorporatePersPukReq: | |
955 //x0pleela 25 Sep, 2006 ER: OMAPS00095524 | |
956 //Update global aciErrDesc with the current CME error code | |
957 ACI_ERR_DESC( ACI_ERR_CLASS_Cme, result ); | |
958 C_KEY_REQ = 1; | |
959 sim_status.sim_status = MFW_SIM_PUK_REQ; | |
960 sim_status.sim_pin_retries = sim_pin_count(MFW_SIM_PUK1); | |
961 sim_status.sim_status_type = MFW_SIM_PUK1; | |
962 sim_stat = SIM_ACTIVE; | |
963 break; | |
964 | |
965 #endif | |
966 // Nov 03, 2005 DR: OMAPS00050595 - xpradipg | |
967 // the setting of C_KEY_REQ is done only for SIM Personalization PUK request | |
968 case CME_ERR_SimPukReq: /* PUK 1 must be entered */ | |
969 #ifdef SIM_PERS | |
970 C_KEY_REQ = 0; | |
971 #endif | |
972 sim_status.sim_status = MFW_SIM_PUK_REQ; | |
973 sim_status.sim_pin_retries = sim_pin_count(MFW_SIM_PUK1); | |
974 sim_status.sim_status_type = MFW_SIM_PUK1; | |
975 sim_stat = SIM_ACTIVE; | |
976 break; | |
977 case CME_ERR_SimPuk2Req: /* PUK 2 must be entered */ | |
978 sim_status.sim_status = MFW_SIM_PUK2_REQ; | |
979 sim_status.sim_pin_retries = sim_pin_count(MFW_SIM_PUK2); | |
980 sim_status.sim_status_type = MFW_SIM_PUK2; | |
981 sim_stat = SIM_ACTIVE; | |
982 break; | |
983 case CME_ERR_NotPresent: /* JVJ -#1580. Unexpected error should be treated as INVALID CARD for FTA*/ | |
984 case CME_ERR_SimFail: /* SIM card is invalid */ | |
985 case CME_ERR_SimWrong: | |
986 sim_status.sim_status = MFW_SIM_INVALID_CARD; | |
987 sim_status.sim_pin_retries = 0; | |
988 sim_status.sim_status_type = MFW_SIM_UNKNOWN; | |
989 sim_stat = SIM_NOT_ACTIVE; | |
990 break; | |
991 case CME_ERR_SimNotIns: /* no SIM card inserted */ | |
992 sim_status.sim_status = MFW_SIM_NO_SIM_CARD; | |
993 sim_status.sim_pin_retries = 0; | |
994 sim_status.sim_status_type = MFW_SIM_UNKNOWN; | |
995 sim_stat = SIM_NOT_ACTIVE; | |
996 break; | |
997 #ifdef SIM_PERS | |
998 //The events are handled that are posted by rAT_PlusCME() | |
999 //for all the five SIM Locks. | |
1000 case CME_ERR_PhSimPinReq: | |
1001 //x0pleela 25 Sep, 2006 ER: OMAPS00095524 | |
1002 //Update global aciErrDesc with the current CME error code | |
1003 ACI_ERR_DESC( ACI_ERR_CLASS_Cme, result ); | |
1004 sim_status.sim_status = MFW_SIM_PLOCK_REQ; | |
1005 sim_status.sim_pin_retries = 0; | |
1006 sim_status.sim_status_type = MFW_SIM_LOCKED ; | |
1007 sim_stat = SIM_ACTIVE; | |
1008 break; | |
1009 case CME_ERR_NetworkPersPinReq: | |
1010 //x0pleela 25 Sep, 2006 ER: OMAPS00095524 | |
1011 //Update global aciErrDesc with the current CME error code | |
1012 ACI_ERR_DESC( ACI_ERR_CLASS_Cme, result ); | |
1013 sim_status.sim_status = MFW_SIM_NLOCK_REQ; | |
1014 sim_status.sim_pin_retries = 0; | |
1015 sim_status.sim_status_type = MFW_SIM_LOCKED; | |
1016 sim_stat = SIM_ACTIVE; | |
1017 gsim_status=sim_stat; | |
1018 break; | |
1019 case CME_ERR_NetworkSubsetPersPinReq: | |
1020 //x0pleela 25 Sep, 2006 ER: OMAPS00095524 | |
1021 //Update global aciErrDesc with the current CME error code | |
1022 ACI_ERR_DESC( ACI_ERR_CLASS_Cme, result ); | |
1023 sim_status.sim_status = MFW_SIM_NSLOCK_REQ; | |
1024 sim_status.sim_pin_retries = 0; | |
1025 sim_status.sim_status_type = MFW_SIM_LOCKED; | |
1026 sim_stat = SIM_ACTIVE; | |
1027 break; | |
1028 case CME_ERR_ProviderPersPinReq: | |
1029 //x0pleela 25 Sep, 2006 ER: OMAPS00095524 | |
1030 //Update global aciErrDesc with the current CME error code | |
1031 ACI_ERR_DESC( ACI_ERR_CLASS_Cme, result ); | |
1032 sim_status.sim_status = MFW_SIM_SPLOCK_REQ; | |
1033 sim_status.sim_pin_retries = 0; | |
1034 sim_status.sim_status_type = MFW_SIM_LOCKED; | |
1035 sim_stat = SIM_ACTIVE; | |
1036 break; | |
1037 case CME_ERR_CorporatePersPinReq: | |
1038 //x0pleela 25 Sep, 2006 ER: OMAPS00095524 | |
1039 //Update global aciErrDesc with the current CME error code | |
1040 ACI_ERR_DESC( ACI_ERR_CLASS_Cme, result ); | |
1041 sim_status.sim_status = MFW_SIM_CLOCK_REQ; | |
1042 sim_status.sim_pin_retries = 0; | |
1043 sim_status.sim_status_type = MFW_SIM_LOCKED; | |
1044 sim_stat = SIM_ACTIVE; | |
1045 break; | |
1046 | |
1047 //x0pleela 27 Apr, 2006 DR: OMAPS00067919 | |
1048 case CME_ERR_WrongPasswd: | |
1049 { | |
1050 TRACE_EVENT("CME_ERR_WrongPasswd"); | |
1051 switch( aciErrDesc & 0x0000FFFF ) | |
1052 { | |
1053 case CME_ERR_PhoneFail: | |
1054 case CME_ERR_NetworkPersPukReq: | |
1055 case CME_ERR_NetworkSubsetPersPukReq: | |
1056 case CME_ERR_ProviderPersPukReq: | |
1057 case CME_ERR_CorporatePersPukReq: | |
1058 C_KEY_REQ = 1; | |
1059 sim_status.sim_status = MFW_SIM_PUK_REQ; | |
1060 sim_status.sim_pin_retries = sim_pin_count(MFW_SIM_PUK1); | |
1061 sim_status.sim_status_type = MFW_SIM_LOCKED; | |
1062 sim_stat = SIM_ACTIVE; | |
1063 break; | |
1064 | |
1065 default: | |
1066 C_KEY_REQ = 0; | |
1067 break; | |
1068 } | |
1069 } | |
1070 break; | |
1071 | |
1072 //x0pleela 23 Aug, 2006 DR: OMAPS00091250 | |
1073 case CME_ERR_Unknown: | |
1074 { | |
1075 if( ((aciErrDesc & 0xFFFF0000) >> 16) EQ ACI_ERR_CLASS_Ext) | |
1076 { | |
1077 switch(aciErrDesc & 0x0000FFFF) | |
1078 { | |
1079 //x0pleela 06 Sep, 2006 DR: OMAPS00091250 | |
1080 //Check for No MEPD Error | |
1081 case EXT_ERR_NoMEPD: | |
1082 sim_status.sim_status = MFW_MEPD_INVALID; | |
1083 sim_status.sim_pin_retries = 0; | |
1084 sim_status.sim_status_type = MFW_SIM_UNKNOWN; | |
1085 sim_stat = SIM_ACTIVE; | |
1086 break; | |
1087 | |
1088 //x0pleela 25 Sep, 2006 ER: OMAPS00095524 | |
1089 //Set the reqd. parameters for Blocked Network Password request | |
1090 case EXT_ERR_BlockedNetworkPersPinReq: | |
1091 sim_status.sim_status = MFW_SIM_PBLOCK_REQ; | |
1092 sim_status.sim_pin_retries = 0; | |
1093 sim_status.sim_status_type = MFW_SIM_LOCKED; | |
1094 sim_stat = SIM_ACTIVE; | |
1095 break; | |
1096 | |
1097 //x0pleela 25 Sep, 2006 ER: OMAPS00095524 | |
1098 //Set the reqd. parameters for Blocked Network Unblock code request | |
1099 case EXT_ERR_BlockedNetworkPersPukReq: | |
1100 C_KEY_REQ = 1; | |
1101 sim_status.sim_status = MFW_SIM_PUK_REQ; | |
1102 sim_status.sim_pin_retries = sim_pin_count(MFW_SIM_PUK1); | |
1103 sim_status.sim_status_type = MFW_SIM_LOCKED; | |
1104 sim_stat = SIM_ACTIVE; | |
1105 break; | |
1106 | |
1107 default: | |
1108 break; | |
1109 } | |
1110 } | |
1111 } | |
1112 break; | |
1113 #endif | |
1114 default: | |
1115 TRACE_ERROR("sim_error_cfun(): result"); | |
1116 return; | |
1117 } | |
1118 | |
1119 sim_signal(E_SIM_STATUS,&sim_status); | |
1120 | |
1121 if ((result == CME_ERR_SimPinReq) | |
1122 OR (result == CME_ERR_SimPukReq)) | |
1123 pin1_set = MFW_SIM_ENABLE; | |
1124 } | |
1125 | |
1126 | |
1127 /* | |
1128 +--------------------------------------------------------------------+ | |
1129 | PROJECT : MMI-Framework (8417) MODULE : MFW_SIM | | |
1130 | STATE : code ROUTINE : sim_error_cpin | | |
1131 +--------------------------------------------------------------------+ | |
1132 | |
1133 PURPOSE : Inform about error of PIN entering or PUK entering | |
1134 | |
1135 */ | |
1136 | |
1137 void sim_error_cpin (T_ACI_CME_ERR reason) | |
1138 { | |
1139 T_ACI_CPIN_RSLT code=CPIN_RSLT_NotPresent; | |
1140 | |
1141 TRACE_FUNCTION("sim_error_cpin()"); | |
1142 | |
1143 sim_status.sim_procedure = pin_flag; | |
1144 sim_status.sim_operation_mode = sim_config.oper_mode; | |
1145 sim_status.sim_status = MFW_SIM_FAILURE; | |
1146 sim_status.sim_status_type = pin_ident; | |
1147 | |
1148 pin_flag = -1; | |
1149 pin_ident = MFW_SIM_UNKNOWN; | |
1150 | |
1151 //x0pleela 26 Sep, 2006 DR: OMAPS00096565 | |
1152 //Reset C_KEY_REQ to 0 | |
1153 #ifdef SIM_PERS | |
1154 C_KEY_REQ = 0; | |
1155 #endif | |
1156 | |
1157 switch (reason) | |
1158 { | |
1159 case CME_ERR_WrongPasswd: | |
1160 if (qAT_PlusCPIN(CMD_SRC_LCL,&code) != AT_CMPL) | |
1161 { | |
1162 TRACE_ERROR("sim_error_cpin():CPIN? failed"); | |
1163 sim_signal(E_SIM_STATUS,&sim_status); | |
1164 return; | |
1165 } | |
1166 break; | |
1167 #ifdef SIM_PERS | |
1168 case CME_ERR_SimPinReq: /* PIN 1 must be entered */ | |
1169 sim_status.sim_status = MFW_SIM_PIN_REQ; | |
1170 sim_status.sim_pin_retries = sim_pin_count(MFW_SIM_PIN1); | |
1171 sim_status.sim_status_type = MFW_SIM_PIN1; | |
1172 sim_status.sim_procedure = MFW_SIM_ACTIVATION; | |
1173 sim_stat = SIM_ACTIVE; | |
1174 sim_signal(E_SIM_STATUS,&sim_status); | |
1175 return; | |
1176 | |
1177 case CME_ERR_SimPin2Req: /* PIN 2 must be entered */ | |
1178 sim_status.sim_status = MFW_SIM_PIN2_REQ; | |
1179 sim_status.sim_pin_retries = sim_pin_count(MFW_SIM_PIN2); | |
1180 sim_status.sim_status_type = MFW_SIM_PIN2; | |
1181 sim_status.sim_procedure = MFW_SIM_ACTIVATION; | |
1182 sim_stat = SIM_ACTIVE; | |
1183 sim_signal(E_SIM_STATUS,&sim_status); | |
1184 return; | |
1185 | |
1186 case CME_ERR_PhoneFail: | |
1187 case CME_ERR_NetworkPersPukReq: | |
1188 case CME_ERR_NetworkSubsetPersPukReq: | |
1189 case CME_ERR_ProviderPersPukReq: | |
1190 case CME_ERR_CorporatePersPukReq: | |
1191 //x0pleela 25 Sep, 2006 ER: OMAPS00095524 | |
1192 //Update global aciErrDesc with the current CME error code | |
1193 ACI_ERR_DESC( ACI_ERR_CLASS_Cme, reason ); | |
1194 C_KEY_REQ = 1; | |
1195 sim_status.sim_status = MFW_SIM_PUK_REQ; | |
1196 sim_status.sim_pin_retries = sim_pin_count(MFW_SIM_PUK1); | |
1197 sim_status.sim_status_type = MFW_SIM_PUK1; | |
1198 sim_status.sim_procedure = MFW_SIM_ACTIVATION; | |
1199 sim_stat = SIM_ACTIVE; | |
1200 sim_signal(E_SIM_STATUS,&sim_status); | |
1201 return; | |
1202 | |
1203 // Nov 03, 2005 DR: OMAPS00050595 - xpradipg | |
1204 case CME_ERR_SimPukReq: /* PUK 1 must be entered */ | |
1205 C_KEY_REQ = 0; | |
1206 sim_status.sim_status = MFW_SIM_PUK_REQ; | |
1207 sim_status.sim_pin_retries = sim_pin_count(MFW_SIM_PUK1); | |
1208 sim_status.sim_status_type = MFW_SIM_PUK1; | |
1209 sim_status.sim_procedure = MFW_SIM_ACTIVATION; | |
1210 sim_stat = SIM_ACTIVE; | |
1211 sim_signal(E_SIM_STATUS,&sim_status); | |
1212 return; | |
1213 case CME_ERR_SimPuk2Req: /* PUK 2 must be entered */ | |
1214 sim_status.sim_status = MFW_SIM_PUK2_REQ; | |
1215 sim_status.sim_pin_retries = sim_pin_count(MFW_SIM_PUK2); | |
1216 sim_status.sim_status_type = MFW_SIM_PUK2; | |
1217 sim_status.sim_procedure = MFW_SIM_ACTIVATION; | |
1218 sim_stat = SIM_ACTIVE; | |
1219 sim_signal(E_SIM_STATUS,&sim_status); | |
1220 return; | |
1221 case CME_ERR_NotPresent: /* JVJ -#1580. Unexpected error should be treated as INVALID CARD for FTA*/ | |
1222 case CME_ERR_SimFail: /* SIM card is invalid */ | |
1223 #endif | |
1224 case CME_ERR_SimWrong: | |
1225 sim_status.sim_status = MFW_SIM_INVALID_CARD; | |
1226 #ifdef SIM_PERS | |
1227 sim_status.sim_pin_retries = 0; | |
1228 sim_status.sim_status_type = MFW_SIM_UNKNOWN; | |
1229 sim_status.sim_procedure = MFW_SIM_ACTIVATION; | |
1230 sim_stat = SIM_NOT_ACTIVE; | |
1231 sim_signal(E_SIM_STATUS,&sim_status); | |
1232 #else | |
1233 sim_signal(E_SIM_STATUS,&sim_status); | |
1234 #endif | |
1235 return; | |
1236 | |
1237 | |
1238 case CME_ERR_SimNotIns: /* no SIM card inserted */ | |
1239 sim_status.sim_status = MFW_SIM_NO_SIM_CARD; | |
1240 sim_status.sim_pin_retries = 0; | |
1241 sim_status.sim_status_type = MFW_SIM_UNKNOWN; | |
1242 sim_status.sim_procedure = MFW_SIM_ACTIVATION; | |
1243 sim_stat = SIM_NOT_ACTIVE; | |
1244 sim_signal(E_SIM_STATUS,&sim_status); | |
1245 return; | |
1246 | |
1247 #ifdef SIM_PERS | |
1248 //The events are handled that are posted by rAT_PlusCME() | |
1249 //for all the five SIM Locks. | |
1250 case CME_ERR_PhSimPinReq: | |
1251 //x0pleela 25 Sep, 2006 ER: OMAPS00095524 | |
1252 //Update global aciErrDesc with the current CME error code | |
1253 ACI_ERR_DESC( ACI_ERR_CLASS_Cme, reason ); | |
1254 sim_status.sim_status = MFW_SIM_PLOCK_REQ; | |
1255 sim_status.sim_pin_retries = 0; | |
1256 sim_status.sim_status_type = MFW_SIM_LOCKED ; | |
1257 sim_status.sim_procedure = MFW_SIM_ACTIVATION; | |
1258 sim_stat = SIM_ACTIVE; | |
1259 sim_signal(E_SIM_STATUS,&sim_status); | |
1260 return; | |
1261 case CME_ERR_NetworkPersPinReq: | |
1262 //x0pleela 25 Sep, 2006 ER: OMAPS00095524 | |
1263 //Update global aciErrDesc with the current CME error code | |
1264 ACI_ERR_DESC( ACI_ERR_CLASS_Cme, reason ); | |
1265 sim_status.sim_status = MFW_SIM_NLOCK_REQ; | |
1266 sim_status.sim_pin_retries = 0; | |
1267 sim_status.sim_status_type = MFW_SIM_LOCKED; | |
1268 sim_status.sim_procedure = MFW_SIM_ACTIVATION; | |
1269 //sim_stat = SIM_NOT_ACTIVE; temporary changes | |
1270 sim_stat = SIM_ACTIVE; | |
1271 sim_signal(E_SIM_STATUS,&sim_status); | |
1272 return; | |
1273 case CME_ERR_NetworkSubsetPersPinReq: | |
1274 //x0pleela 25 Sep, 2006 ER: OMAPS00095524 | |
1275 //Update global aciErrDesc with the current CME error code | |
1276 ACI_ERR_DESC( ACI_ERR_CLASS_Cme, reason ); | |
1277 sim_status.sim_status = MFW_SIM_NSLOCK_REQ; | |
1278 sim_status.sim_pin_retries = 0; | |
1279 sim_status.sim_status_type = MFW_SIM_LOCKED; | |
1280 sim_status.sim_procedure = MFW_SIM_ACTIVATION; | |
1281 sim_stat = SIM_ACTIVE; | |
1282 sim_signal(E_SIM_STATUS,&sim_status); | |
1283 return; | |
1284 case CME_ERR_ProviderPersPinReq: | |
1285 //x0pleela 25 Sep, 2006 ER: OMAPS00095524 | |
1286 //Update global aciErrDesc with the current CME error code | |
1287 ACI_ERR_DESC( ACI_ERR_CLASS_Cme, reason ); | |
1288 sim_status.sim_status = MFW_SIM_SPLOCK_REQ; | |
1289 sim_status.sim_pin_retries = 0; | |
1290 sim_status.sim_status_type = MFW_SIM_LOCKED; | |
1291 sim_status.sim_procedure = MFW_SIM_ACTIVATION; | |
1292 sim_stat = SIM_ACTIVE; | |
1293 sim_signal(E_SIM_STATUS,&sim_status); | |
1294 return; | |
1295 case CME_ERR_CorporatePersPinReq: | |
1296 //x0pleela 25 Sep, 2006 ER: OMAPS00095524 | |
1297 //Update global aciErrDesc with the current CME error code | |
1298 ACI_ERR_DESC( ACI_ERR_CLASS_Cme, reason ); | |
1299 sim_status.sim_status = MFW_SIM_CLOCK_REQ; | |
1300 sim_status.sim_pin_retries = 0; | |
1301 sim_status.sim_status_type = MFW_SIM_LOCKED; | |
1302 sim_status.sim_procedure = MFW_SIM_ACTIVATION; | |
1303 sim_stat = SIM_ACTIVE; | |
1304 sim_signal(E_SIM_STATUS,&sim_status); | |
1305 return; | |
1306 | |
1307 case CME_ERR_Unknown: | |
1308 { | |
1309 //Check for No MEPD Error | |
1310 if( ((aciErrDesc & 0xFFFF0000) >> 16) EQ ACI_ERR_CLASS_Ext) | |
1311 { | |
1312 switch(aciErrDesc & 0x0000FFFF) | |
1313 { | |
1314 //x0pleela 06 Sep, 2006 DR: OMAPS00091250 | |
1315 case EXT_ERR_NoMEPD: | |
1316 sim_status.sim_status = MFW_MEPD_INVALID; | |
1317 sim_status.sim_pin_retries = 0; | |
1318 sim_status.sim_status_type = MFW_SIM_UNKNOWN; | |
1319 sim_stat = SIM_ACTIVE; | |
1320 sim_signal(E_SIM_STATUS,&sim_status); | |
1321 return; | |
1322 | |
1323 //x0pleela 25 Sep, 2006 ER: OMAPS00095524 | |
1324 //Set the reqd. parameters for Blocked Network Password request | |
1325 case EXT_ERR_BlockedNetworkPersPinReq: | |
1326 sim_status.sim_status = MFW_SIM_PBLOCK_REQ; | |
1327 sim_status.sim_pin_retries = 0; | |
1328 sim_status.sim_status_type = MFW_SIM_LOCKED; | |
1329 sim_status.sim_procedure = MFW_SIM_ACTIVATION; | |
1330 sim_stat = SIM_ACTIVE; | |
1331 sim_signal(E_SIM_STATUS,&sim_status); | |
1332 return; | |
1333 | |
1334 //x0pleela 25 Sep, 2006 ER: OMAPS00095524 | |
1335 //Set the reqd. parameters for Blocked Network Unblock code request | |
1336 case EXT_ERR_BlockedNetworkPersPukReq: | |
1337 C_KEY_REQ = 1; | |
1338 sim_status.sim_status = MFW_SIM_PUK_REQ; | |
1339 sim_status.sim_pin_retries = sim_pin_count(MFW_SIM_PUK1); | |
1340 sim_status.sim_status_type = MFW_SIM_PUK1; | |
1341 sim_status.sim_procedure = MFW_SIM_ACTIVATION; | |
1342 sim_stat = SIM_ACTIVE; | |
1343 sim_signal(E_SIM_STATUS,&sim_status); | |
1344 return; | |
1345 | |
1346 default: | |
1347 break; | |
1348 } | |
1349 } | |
1350 } | |
1351 break; | |
1352 #endif | |
1353 | |
1354 default: | |
1355 TRACE_ERROR("sim_error_cpin():Ill reason"); | |
1356 sim_signal(E_SIM_STATUS,&sim_status); | |
1357 return; | |
1358 } | |
1359 | |
1360 switch (code) | |
1361 { | |
1362 case CPIN_RSLT_SimPinReq: | |
1363 sim_status.sim_status = MFW_SIM_PIN_REQ; | |
1364 sim_status.sim_pin_retries = sim_pin_count(MFW_SIM_PIN1); | |
1365 break; | |
1366 case CPIN_RSLT_SimPukReq: | |
1367 #ifdef SIM_PERS | |
1368 C_KEY_REQ = 0; | |
1369 #endif | |
1370 sim_status.sim_status = MFW_SIM_PUK_REQ; | |
1371 sim_status.sim_pin_retries = sim_pin_count(MFW_SIM_PUK1); | |
1372 //x0pleela 10 May, 2006 DR: OMAPS00067919 | |
1373 sim_status.sim_status_type = MFW_SIM_PUK1; | |
1374 sim_status.sim_procedure = MFW_SIM_ACTIVATION; | |
1375 sim_stat = SIM_ACTIVE; | |
1376 break; | |
1377 case CPIN_RSLT_SimPin2Req: | |
1378 sim_status.sim_status = MFW_SIM_PIN2_REQ; | |
1379 sim_status.sim_pin_retries = sim_pin_count(MFW_SIM_PIN2); | |
1380 break; | |
1381 case CPIN_RSLT_SimPuk2Req: | |
1382 sim_status.sim_status = MFW_SIM_PUK2_REQ; | |
1383 sim_status.sim_pin_retries = sim_pin_count(MFW_SIM_PUK2); | |
1384 break; | |
1385 case CPIN_RSLT_NotPresent: | |
1386 case CPIN_RSLT_SimReady: | |
1387 default: | |
1388 TRACE_ERROR("sim_error_cpin():Ill code"); | |
1389 break; | |
1390 } | |
1391 | |
1392 sim_signal(E_SIM_STATUS,&sim_status); | |
1393 } | |
1394 | |
1395 | |
1396 /* | |
1397 +--------------------------------------------------------------------+ | |
1398 | PROJECT : MMI-Framework (8417) MODULE : MFW_SIM | | |
1399 | STATE : code ROUTINE : sim_ok_cpin | | |
1400 +--------------------------------------------------------------------+ | |
1401 | |
1402 PURPOSE : Successful end of PIN entering or PUK entering | |
1403 | |
1404 */ | |
1405 | |
1406 void sim_ok_cpin (void) | |
1407 { | |
1408 | |
1409 | |
1410 switch (pin_flag) | |
1411 { | |
1412 case MFW_SIM_VERIFY: | |
1413 sim_status.sim_procedure = MFW_SIM_VERIFY; | |
1414 sim_status.sim_status = MFW_SIM_NO_PIN; | |
1415 sim_status.sim_status_type = pin_ident; | |
1416 break; | |
1417 case MFW_SIM_UNBLOCK: | |
1418 sim_status.sim_procedure = MFW_SIM_UNBLOCK; | |
1419 sim_status.sim_status = MFW_SIM_SUCCESS; | |
1420 sim_status.sim_status_type = pin_ident; | |
1421 //TISH due to 11.11, if pin is unblock successfully, it should set pin Enabled. | |
1422 //#ifdef SIM_PERS | |
1423 pin1_set = MFW_SIM_ENABLE; | |
1424 //#endif | |
1425 break; | |
1426 //xrashmic 1 Jul, 2006 OMAPS00075784 | |
1427 //To handle the simp lock disable events during bootup | |
1428 case MFW_SIM_ACTIVATION: | |
1429 sim_status.sim_procedure = MFW_SIM_ACTIVATION; | |
1430 sim_status.sim_status = MFW_SIM_NO_PIN; | |
1431 sim_status.sim_status_type = pin_ident; | |
1432 break; | |
1433 | |
1434 default: | |
1435 break; | |
1436 } | |
1437 | |
1438 pin_flag = -1; | |
1439 pin_ident = MFW_SIM_UNKNOWN; | |
1440 sim_status.sim_operation_mode = sim_config.oper_mode; | |
1441 sim_status.sim_pin_retries = 0; | |
1442 | |
1443 sim_signal (E_SIM_STATUS, &sim_status); | |
1444 if (nm_reg_flag_req()) | |
1445 nm_activate(MFW_SIM_NO_PIN); | |
1446 // Sept 24, 2005 REF: LOCOSTO-ENH-34438, xpradipg | |
1447 // removed the flag that was getting set | |
1448 | |
1449 } | |
1450 | |
1451 | |
1452 /* | |
1453 +--------------------------------------------------------------------+ | |
1454 | PROJECT : MMI-Framework (8417) MODULE : MFW_SIM | | |
1455 | STATE : code ROUTINE : sim_ss_unblock | | |
1456 +--------------------------------------------------------------------+ | |
1457 | |
1458 PURPOSE : SIM unblock via SS string | |
1459 | |
1460 */ | |
1461 | |
1462 void sim_ss_unblock(UBYTE result, T_ACI_CME_ERR reason) | |
1463 { | |
1464 TRACE_FUNCTION("sim_ss_unblock()"); | |
1465 | |
1466 pin_flag = MFW_SIM_UNBLOCK; | |
1467 | |
1468 if (result == SIM_UBLK_ERROR) | |
1469 sim_error_cpin (reason); | |
1470 if (result == SIM_UBLK_OK) | |
1471 sim_ok_cpin (); | |
1472 } | |
1473 | |
1474 | |
1475 /* | |
1476 +--------------------------------------------------------------------+ | |
1477 | PROJECT : MMI-Framework (8417) MODULE : MFW_SIM | | |
1478 | STATE : code ROUTINE : sim_verify_pin | | |
1479 +--------------------------------------------------------------------+ | |
1480 | |
1481 PURPOSE : Verify PIN | |
1482 | |
1483 */ | |
1484 | |
1485 void sim_verify_pin (U8 pin_id, char *pin) | |
1486 { | |
1487 TRACE_FUNCTION("sim_verify_pin()"); | |
1488 | |
1489 pin_flag = MFW_SIM_VERIFY; | |
1490 pin_ident = pin_id; | |
1491 switch (pin_id) | |
1492 { | |
1493 case MFW_SIM_PIN1: | |
1494 sAT_PercentPVRF(CMD_SRC_LCL, PVRF_TYPE_Pin1, pin, 0); | |
1495 break; | |
1496 case MFW_SIM_PIN2: | |
1497 sAT_PercentPVRF(CMD_SRC_LCL, PVRF_TYPE_Pin2, pin, 0); | |
1498 break; | |
1499 } | |
1500 } | |
1501 | |
1502 | |
1503 /* | |
1504 +--------------------------------------------------------------------+ | |
1505 | PROJECT : MMI-Framework (8417) MODULE : MFW_SIM | | |
1506 | STATE : code ROUTINE : sim_unblock_pin | | |
1507 +--------------------------------------------------------------------+ | |
1508 | |
1509 PURPOSE : unblock SIM | |
1510 | |
1511 */ | |
1512 | |
1513 void sim_unblock_pin (U8 pin_id, char *puk, char *newpin) | |
1514 { | |
1515 T_ACI_RETURN ret;//xrashmic 6 Jul, 2006 OMAPS00080708 | |
1516 TRACE_FUNCTION("sim_unblock_pin()"); | |
1517 | |
1518 pin_flag = MFW_SIM_UNBLOCK; | |
1519 pin_ident = pin_id; | |
1520 switch (pin_id) | |
1521 { | |
1522 case MFW_SIM_PUK1: | |
1523 ret= sAT_PercentPVRF(CMD_SRC_LCL, PVRF_TYPE_Puk1, puk, newpin); | |
1524 //xrashmic 6 Jul, 2006 OMAPS00080708 | |
1525 // For error return value, bmi has to be informed | |
1526 if(ret==AT_FAIL) | |
1527 { | |
1528 sim_status.sim_status = MFW_SIM_PUK_REQ; | |
1529 sim_status.sim_pin_retries = sim_pin_count(MFW_SIM_PUK1); | |
1530 sim_status.sim_status_type = MFW_SIM_PUK1; | |
1531 sim_status.sim_procedure = MFW_SIM_ACTIVATION; | |
1532 sim_stat = SIM_ACTIVE; | |
1533 sim_signal(E_SIM_STATUS,&sim_status); | |
1534 | |
1535 } | |
1536 break; | |
1537 case MFW_SIM_PUK2: | |
1538 ret= sAT_PercentPVRF(CMD_SRC_LCL, PVRF_TYPE_Puk2, puk, newpin); | |
1539 //xrashmic 6 Jul, 2006 OMAPS00080708 | |
1540 // For error return value, bmi has to be informed | |
1541 if(ret==AT_FAIL) | |
1542 { | |
1543 sim_status.sim_status = MFW_SIM_PUK2_REQ; | |
1544 sim_status.sim_pin_retries = sim_pin_count(MFW_SIM_PUK2); | |
1545 sim_status.sim_status_type = MFW_SIM_PUK2; | |
1546 sim_status.sim_procedure = MFW_SIM_ACTIVATION; | |
1547 sim_stat = SIM_ACTIVE; | |
1548 sim_signal(E_SIM_STATUS,&sim_status); | |
1549 } | |
1550 break; | |
1551 } | |
1552 } | |
1553 | |
1554 | |
1555 /* | |
1556 +--------------------------------------------------------------------+ | |
1557 | PROJECT : MMI-Framework (8417) MODULE : MFW_SIM | | |
1558 | STATE : code ROUTINE : sim_change_pin | | |
1559 +--------------------------------------------------------------------+ | |
1560 | |
1561 PURPOSE : Request of PIN change | |
1562 | |
1563 */ | |
1564 | |
1565 void sim_change_pin (U8 pin_id, U8 *old_pin, U8 *new_pin) | |
1566 { | |
1567 TRACE_FUNCTION("sim_change_pin()"); | |
1568 | |
1569 pin_ident = pin_id; | |
1570 switch (pin_id) | |
1571 { | |
1572 case MFW_SIM_PIN1: | |
1573 /*a0393213 warnings removal - CPWD_FAC_Sc changed to FAC_Sc as a result of ACI enum change*/ | |
1574 sAT_PlusCPWD(CMD_SRC_LCL, FAC_Sc, | |
1575 (char *)old_pin, (char *)new_pin); | |
1576 break; | |
1577 case MFW_SIM_PIN2: | |
1578 sAT_PlusCPWD(CMD_SRC_LCL, FAC_P2, | |
1579 (char *)old_pin, (char *)new_pin); | |
1580 break; | |
1581 } | |
1582 } | |
1583 | |
1584 | |
1585 /* | |
1586 +--------------------------------------------------------------------+ | |
1587 | PROJECT : MMI-Framework (8417) MODULE : MFW_SIM | | |
1588 | STATE : code ROUTINE : sim_ok_cpinc | | |
1589 +--------------------------------------------------------------------+ | |
1590 | |
1591 PURPOSE : Notify successful end of PIN change | |
1592 | |
1593 */ | |
1594 | |
1595 void sim_ok_cpinc (void) | |
1596 { | |
1597 TRACE_FUNCTION("sim_ok_cpinc()"); | |
1598 | |
1599 sim_status.sim_procedure = MFW_SIM_CHANGE; | |
1600 sim_status.sim_status = MFW_SIM_SUCCESS; | |
1601 sim_status.sim_operation_mode = sim_config.oper_mode; | |
1602 sim_status.sim_pin_retries = 0; | |
1603 sim_status.sim_status_type = pin_ident; | |
1604 | |
1605 pin_ident = MFW_SIM_UNKNOWN; | |
1606 sim_signal(E_SIM_STATUS,&sim_status); | |
1607 } | |
1608 | |
1609 | |
1610 /* | |
1611 +--------------------------------------------------------------------+ | |
1612 | PROJECT : MMI-Framework (8417) MODULE : MFW_SIM | | |
1613 | STATE : code ROUTINE : sim_error_cpinc | | |
1614 +--------------------------------------------------------------------+ | |
1615 | |
1616 PURPOSE : Notify failed PIN change | |
1617 | |
1618 */ | |
1619 | |
1620 void sim_error_cpinc (void) | |
1621 { | |
1622 TRACE_FUNCTION("sim_error_cpinc()"); | |
1623 | |
1624 sim_status.sim_procedure = MFW_SIM_CHANGE; | |
1625 sim_status.sim_status = MFW_SIM_FAILURE; | |
1626 sim_status.sim_operation_mode = sim_config.oper_mode; | |
1627 if (pin_ident EQ MFW_SIM_PIN1) | |
1628 sim_status.sim_pin_retries = sim_pin_count(MFW_SIM_PIN1); | |
1629 else if (pin_ident EQ MFW_SIM_PIN2) | |
1630 sim_status.sim_pin_retries = sim_pin_count(MFW_SIM_PIN2); | |
1631 else | |
1632 sim_status.sim_pin_retries = 0; | |
1633 sim_status.sim_status_type = pin_ident; | |
1634 | |
1635 pin_ident = MFW_SIM_UNKNOWN; | |
1636 sim_signal(E_SIM_STATUS,&sim_status); | |
1637 } | |
1638 | |
1639 | |
1640 /* | |
1641 +--------------------------------------------------------------------+ | |
1642 | PROJECT : MMI-Framework (8417) MODULE : MFW_SIM | | |
1643 | STATE : code ROUTINE : sim_disable_pin | | |
1644 +--------------------------------------------------------------------+ | |
1645 | |
1646 PURPOSE : Request PIN disability.SPR 2145 now returns status | |
1647 | |
1648 */ | |
1649 | |
1650 T_MFW sim_disable_pin (U8 *pin) | |
1651 { | |
1652 TRACE_FUNCTION("sim_disable_pin()"); | |
1653 /*a0393213 warnings removal - CLCK_FAC_Sc changed to FAC_Sc as a result of ACI enum change*/ | |
1654 return ss_set_clck(FAC_Sc, CLCK_MOD_Unlock, | |
1655 (char *)pin, CLASS_NotPresent, MFW_SIM_CPIND); /*a0393213 compiler warnings removal - -1 changed to CLASS_NotPresent*/ | |
1656 } | |
1657 | |
1658 | |
1659 /* | |
1660 +--------------------------------------------------------------------+ | |
1661 | PROJECT : MMI-Framework (8417) MODULE : MFW_SIM | | |
1662 | STATE : code ROUTINE : sim_ok_cpind | | |
1663 +--------------------------------------------------------------------+ | |
1664 | |
1665 PURPOSE : Successful end of PIN disability | |
1666 | |
1667 */ | |
1668 | |
1669 void sim_ok_cpind (void) | |
1670 { | |
1671 TRACE_FUNCTION("sim_ok_cpind()"); | |
1672 | |
1673 sim_status.sim_procedure = MFW_SIM_DISABLE; | |
1674 sim_status.sim_status = MFW_SIM_SUCCESS; | |
1675 sim_status.sim_operation_mode = sim_config.oper_mode; | |
1676 sim_status.sim_pin_retries = 0; | |
1677 sim_status.sim_status_type = MFW_SIM_UNKNOWN; // no indication | |
1678 | |
1679 pin1_set = MFW_SIM_DISABLE; | |
1680 sim_signal(E_SIM_STATUS,&sim_status); | |
1681 } | |
1682 | |
1683 | |
1684 /* | |
1685 +--------------------------------------------------------------------+ | |
1686 | PROJECT : MMI-Framework (8417) MODULE : MFW_SIM | | |
1687 | STATE : code ROUTINE : sim_error_cpind | | |
1688 +--------------------------------------------------------------------+ | |
1689 | |
1690 PURPOSE : Failed PIN disability | |
1691 | |
1692 */ | |
1693 | |
1694 void sim_error_cpind (void) | |
1695 { | |
1696 TRACE_FUNCTION("sim_error_cpind()"); | |
1697 | |
1698 sim_status.sim_procedure = MFW_SIM_DISABLE; | |
1699 sim_status.sim_status = MFW_SIM_FAILURE; | |
1700 sim_status.sim_operation_mode = sim_config.oper_mode; | |
1701 sim_status.sim_pin_retries = sim_pin_count(MFW_SIM_PIN1); | |
1702 sim_status.sim_status_type = MFW_SIM_UNKNOWN; // no indication | |
1703 | |
1704 sim_signal(E_SIM_STATUS,&sim_status); | |
1705 } | |
1706 /* | |
1707 +--------------------------------------------------------------------+ | |
1708 | PROJECT : MMI-Framework (8417) MODULE : MFW_SIM | | |
1709 | STATE : code ROUTINE : sim_disable | | |
1710 +--------------------------------------------------------------------+ | |
1711 | |
1712 PURPOSE : To disable the protocol stack | |
1713 xashmic 9 Sep 2006, OMAPS00092732 | |
1714 */ | |
1715 void sim_disable (void) | |
1716 { | |
1717 | |
1718 T_ACI_RETURN cfun; | |
1719 | |
1720 TRACE_FUNCTION("sim_disable()"); | |
1721 /* | |
1722 * Full functionality is used don´t reset the ME | |
1723 */ | |
1724 cfun = sAT_PlusCFUN(CMD_SRC_LCL,CFUN_FUN_Minimum,CFUN_RST_NotPresent); | |
1725 | |
1726 if (cfun NEQ AT_EXCT) | |
1727 { | |
1728 TRACE_ERROR("sAT_PlusCFUN error"); | |
1729 } | |
1730 } | |
1731 /* | |
1732 +--------------------------------------------------------------------+ | |
1733 | PROJECT : MMI-Framework (8417) MODULE : MFW_SIM | | |
1734 | STATE : code ROUTINE : sim_enable | | |
1735 +--------------------------------------------------------------------+ | |
1736 | |
1737 PURPOSE : To enable the protocol stack | |
1738 xashmic 9 Sep 2006, OMAPS00092732 | |
1739 */ | |
1740 void sim_enable (void) | |
1741 { | |
1742 | |
1743 T_ACI_RETURN cfun; | |
1744 | |
1745 TRACE_FUNCTION("sim_enable()"); | |
1746 cfun = sAT_PlusCFUN(CMD_SRC_LCL,CFUN_FUN_Full,CFUN_RST_NotPresent); | |
1747 | |
1748 if (cfun NEQ AT_EXCT) | |
1749 { | |
1750 TRACE_ERROR("sAT_PlusCFUN error"); | |
1751 } | |
1752 } | |
1753 /* | |
1754 +--------------------------------------------------------------------+ | |
1755 | PROJECT : MMI-Framework (8417) MODULE : MFW_SIM | | |
1756 | STATE : code ROUTINE : sim_enable_pin | | |
1757 +--------------------------------------------------------------------+ | |
1758 | |
1759 PURPOSE : Request PIN enability. SPR 2145 now returns status | |
1760 | |
1761 */ | |
1762 | |
1763 T_MFW sim_enable_pin (U8 *pin) | |
1764 { | |
1765 TRACE_FUNCTION("sim_enable_pin()"); | |
1766 /*a0393213 warnings removal - CLCK_FAC_Sc, changed to FAC_Sc as a result of ACI enum change*/ | |
1767 return ss_set_clck(FAC_Sc, CLCK_MOD_Lock, | |
1768 (char *)pin, CLASS_NotPresent, MFW_SIM_CPINE);/*a0393213 compiler warnings removal - -1 changed to CLASS_NotPresent*/ | |
1769 } | |
1770 | |
1771 #ifdef SIM_PERS | |
1772 // Nov 03, 2005 DR: OMAPS00052032 - xpradipg | |
1773 /******************************************************************************* | |
1774 $Function: mfw_simlock_continue | |
1775 $Description: for displaying the sAT_PlusCLCK result | |
1776 $Returns: None | |
1777 $Arguments: state if passed / failed | |
1778 | |
1779 *******************************************************************************/ | |
1780 void mfw_simlock_continue(U8 state) | |
1781 { | |
1782 mmi_display_result(state); | |
1783 } | |
1784 | |
1785 /******************************************************************************* | |
1786 $Function: mfw_simlock_unblockME | |
1787 $Description: for unblocking ME | |
1788 $Returns: SUCCESS or FAILURE | |
1789 $Arguments: PUK | |
1790 | |
1791 *******************************************************************************/ | |
1792 int mfw_simlock_unblockME(char *puk) | |
1793 { | |
1794 TRACE_FUNCTION("mfw_simlock_unblockME"); | |
1795 /*a0393213 warnings removal - CLCK_FAC_Sc, changed to FAC_Sc as a result of ACI enum change*/ | |
1796 if( sAT_PlusCLCK(CMD_SRC_LCL,FAC_Fc,CLCK_MOD_Unlock,(char*)puk,CLASS_NotPresent)==AT_CMPL)/*a0393213 compiler warnings removal - -1 changed to CLASS_NotPresent*/ | |
1797 //return UNBLOCK_SUCESS; | |
1798 return MFW_SS_OK; | |
1799 else | |
1800 //return UNBLOCK_FAILURE; | |
1801 return MFW_SS_FAIL; | |
1802 } | |
1803 | |
1804 /******************************************************************************* | |
1805 $Function: mfw_simlock_check_lock_bootup | |
1806 $Description: checking PIN during bootup | |
1807 $Returns: SUCCESS or FAILURE | |
1808 $Arguments: PIN | |
1809 | |
1810 *******************************************************************************/ | |
1811 int mfw_simlock_check_lock_bootup(char *pin, S16 lcktype) | |
1812 { | |
1813 | |
1814 /* if( sAT_PlusCPIN(CMD_SRC_LCL, pin, NULL)==AT_CMPL) | |
1815 return BOOTUP_LOCK_SUCCESS; | |
1816 else | |
1817 return BOOTUP_LOCK_FAILURE;*/ //Leela for CPIN to CLCK change | |
1818 | |
1819 T_ACI_FAC lckFac;/*a0393213 warnings removal - T_ACI_CLCK_FAC changed to T_ACI_FAC as a result of ACI enum changed*/ | |
1820 /*a0393213 compiler warnings removal- removed variables clsStat,slock_status,status*/ | |
1821 | |
1822 int maxval, curval; | |
1823 T_ACI_RETURN ret; //x0pleela 21 Apr, 2006 DR: OMAPS00067919 | |
1824 T_ACI_CPIN_RSLT code; //x0pleela 21 Apr, 2006 DR: OMAPS00067919 | |
1825 | |
1826 TRACE_FUNCTION("mfw_simlock_check_lock_bootup"); | |
1827 | |
1828 lckFac= mfw_simlock_return_lock_type(lcktype); | |
1829 | |
1830 //x0pleela 27 Apr, 2006 DR: OMAPS00067919 | |
1831 sim_unlock_in_prog = SIMP_BOOTUP; | |
1832 simp_cpin_flag = FALSE; | |
1833 //xrashmic 1 Jul, 2006 OMAPS00075784 | |
1834 //To handle the simp lock disable events during bootup | |
1835 pin_flag=MFW_SIM_ACTIVATION; | |
1836 if(sAT_PlusCLCK(CMD_SRC_LCL,lckFac,CLCK_MOD_Unlock,(char*)pin,CLASS_NotPresent)== AT_FAIL)/*a0393213 compiler warnings removal - -1 changed to CLASS_NotPresent*/ | |
1837 { | |
1838 //x0pleela 11 Sep, 2006 DR: OMASP00094215 | |
1839 //checking for Class type and the ext busy error and update Simp_Busy_State accordingly | |
1840 //x0pleela 06 Sep, 2006 SIMP: fix for ACI | |
1841 if( ( ((aciErrDesc & 0xFFFF0000) >> 16) EQ ACI_ERR_CLASS_Ext) AND | |
1842 (aciErrDesc & 0x0000FFFF) EQ EXT_ERR_Busy) | |
1843 mfw_simlock_set_busy_state(TRUE); | |
1844 else | |
1845 mfw_simlock_set_busy_state(FALSE); | |
1846 | |
1847 mfw_simlock_check_status(lcktype,&maxval,&curval); | |
1848 //set the error descriptor | |
1849 switch( lcktype) | |
1850 { | |
1851 case MFW_SIM_NLOCK: | |
1852 if(curval !=0) | |
1853 { | |
1854 ACI_ERR_DESC( ACI_ERR_CLASS_Cme, CME_ERR_NetworkPersPinReq ); | |
1855 } | |
1856 else | |
1857 { | |
1858 ACI_ERR_DESC( ACI_ERR_CLASS_Cme, CME_ERR_NetworkPersPukReq); | |
1859 } | |
1860 break; | |
1861 | |
1862 case MFW_SIM_NSLOCK: | |
1863 if(curval !=0) | |
1864 { | |
1865 ACI_ERR_DESC( ACI_ERR_CLASS_Cme, CME_ERR_NetworkSubsetPersPinReq ); | |
1866 } | |
1867 else | |
1868 { | |
1869 ACI_ERR_DESC( ACI_ERR_CLASS_Cme, CME_ERR_NetworkSubsetPersPukReq); | |
1870 } | |
1871 break; | |
1872 | |
1873 case MFW_SIM_SPLOCK: | |
1874 | |
1875 if(curval !=0) | |
1876 { | |
1877 ACI_ERR_DESC( ACI_ERR_CLASS_Cme, CME_ERR_ProviderPersPinReq); | |
1878 } | |
1879 else | |
1880 { | |
1881 ACI_ERR_DESC( ACI_ERR_CLASS_Cme, CME_ERR_ProviderPersPukReq ); | |
1882 } | |
1883 break; | |
1884 | |
1885 case MFW_SIM_CLOCK: | |
1886 | |
1887 if(curval !=0) | |
1888 { | |
1889 ACI_ERR_DESC( ACI_ERR_CLASS_Cme, CME_ERR_CorporatePersPinReq); | |
1890 } | |
1891 else | |
1892 { | |
1893 ACI_ERR_DESC( ACI_ERR_CLASS_Cme, CME_ERR_CorporatePersPukReq ); | |
1894 } | |
1895 break; | |
1896 | |
1897 case MFW_SIM_PLOCK: | |
1898 | |
1899 if(curval !=0) | |
1900 { | |
1901 ACI_ERR_DESC( ACI_ERR_CLASS_Cme, CME_ERR_PhSimPinReq ); | |
1902 } | |
1903 else | |
1904 { | |
1905 ACI_ERR_DESC( ACI_ERR_CLASS_Cme, CME_ERR_PhoneFail); | |
1906 } | |
1907 break; | |
1908 | |
1909 //x0pleela 25 Sep, 2006 ER: OMAPS00095524 | |
1910 case MFW_SIM_PBLOCK: | |
1911 if(curval !=0) | |
1912 { | |
1913 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_BlockedNetworkPersPinReq ); | |
1914 } | |
1915 else | |
1916 { | |
1917 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_BlockedNetworkPersPukReq); | |
1918 } | |
1919 break; | |
1920 | |
1921 // default: | |
1922 // ACI_ERR_DESC( ACI_ERR_CLASS_Cme, CME_ERR_WrongPasswd ); | |
1923 // break; | |
1924 | |
1925 } | |
1926 return BOOTUP_LOCK_FAILURE; | |
1927 } | |
1928 //x0pleela 21 Apr, 2006 DR: OMAPS00067919 | |
1929 //Calling qat_plusCPIN for next category check by ACI | |
1930 else | |
1931 { | |
1932 ret = qAT_PlusCPIN( CMD_SRC_LCL, &code ); | |
1933 | |
1934 if( code EQ CPIN_RSLT_SimReady ) | |
1935 { | |
1936 TRACE_EVENT("BOOTUP_LOCK_SUCCESS"); | |
1937 simp_cpin_flag = FALSE; | |
1938 return BOOTUP_LOCK_SUCCESS; | |
1939 } | |
1940 simp_cpin_flag = TRUE; | |
1941 simp_cpin_code = code; | |
1942 switch( ret ) | |
1943 { | |
1944 case AT_FAIL: | |
1945 TRACE_EVENT("qAT_PlusCPIN error"); | |
1946 return BOOTUP_LOCK_FAILURE; | |
1947 | |
1948 case AT_CMPL: | |
1949 // case AT_EXCT: | |
1950 TRACE_EVENT("BOOTUP_OK"); | |
1951 return BOOTUP_OK; | |
1952 | |
1953 default: | |
1954 break; | |
1955 } | |
1956 } | |
1957 return BOOTUP_LOCK_FAILURE; /*a0393213 lint warnings removal - return statement added*/ | |
1958 } | |
1959 | |
1960 /******************************************************************************* | |
1961 $Function: mfw_simlock_get_sup_info | |
1962 $Description: for getting the fc value | |
1963 $Returns: value of the req fc type | |
1964 $Arguments: fc type | |
1965 | |
1966 *******************************************************************************/ | |
1967 int mfw_simlock_get_sup_info(int flag) | |
1968 { | |
1969 T_SUP_INFO sup_info; | |
1970 // sup_info=(T_SUP_INFO *)malloc(sizeof(T_SUP_INFO)); | |
1971 sup_info.infoType=(T_SUP_INFO_TYPE)flag; /*a0393213 compiler warnings removal - explicit typecast*/ | |
1972 if(qAT_PercentMEPD( CMD_SRC_LCL, &sup_info) EQ AT_CMPL) | |
1973 { | |
1974 //TRACE_EVENT_P1("Leela: FC: %d", sup_info.datavalue); | |
1975 return sup_info.datavalue; | |
1976 } | |
1977 else | |
1978 return MFW_FAILURE; | |
1979 } | |
1980 /******************************************************************************* | |
1981 $Function: mfw_simlock_return_lock_type | |
1982 $Description: The lock type is converted to the ACI enum type | |
1983 $Returns: corresponding ACi lock type | |
1984 $Arguments: MMI lock type - (SIM Locks Only) | |
1985 | |
1986 *******************************************************************************/ | |
1987 /*a0393213 warnings removal - return type changed from T_ACI_CLCK_FAC as a result of ACI enum change*/ | |
1988 T_ACI_FAC mfw_simlock_return_lock_type(S16 lck) | |
1989 { | |
1990 switch (lck) | |
1991 { | |
1992 //case 0: | |
1993 case MFW_SIM_NLOCK: | |
1994 return FAC_Pn; | |
1995 //case 1: | |
1996 case MFW_SIM_SPLOCK: | |
1997 return FAC_Pp; | |
1998 //case 2: | |
1999 case MFW_SIM_NSLOCK: | |
2000 return FAC_Pu; | |
2001 //case 3: | |
2002 case MFW_SIM_CLOCK: | |
2003 return FAC_Pc; | |
2004 //case 4: | |
2005 case MFW_SIM_PLOCK: | |
2006 return FAC_Ps; | |
2007 | |
2008 case MFW_SIM_FC: | |
2009 return FAC_Fc; | |
2010 | |
2011 case MFW_SIM_FCM: | |
2012 return FAC_Fcm; | |
2013 | |
2014 //x0pleela 20 July, 2006 | |
2015 //Return coresponding lock type for master unlock | |
2016 case MFW_SIM_MKEY: | |
2017 return FAC_Mu; | |
2018 case MFW_SIM_MKEYM: | |
2019 return FAC_Mum; | |
2020 | |
2021 //x0pleela 25 Sep, 2006 ER: OMAPS00095524 | |
2022 //Return coresponding ACI lock type for Blocked network | |
2023 case MFW_SIM_PBLOCK: | |
2024 return FAC_Bl; | |
2025 | |
2026 default: | |
2027 return FAC_NotPresent; /*a0393213 compiler warnings removal - -1 changed to CLCK_FAC_NotPresent*/ | |
2028 } | |
2029 | |
2030 } | |
2031 | |
2032 | |
2033 /******************************************************************************* | |
2034 $Function: mfw_simlock_check_status | |
2035 $Description: stub function to retireve the maximum and current number of tries | |
2036 for a given lock type | |
2037 $Returns: success or failure | |
2038 $Arguments: input - type of lock, | |
2039 output - *max and *curr to return the values | |
2040 *******************************************************************************/ | |
2041 T_MFW mfw_simlock_check_status(S16 lcktyp,int *max,int *curr) | |
2042 { | |
2043 T_SUP_INFO_TYPE FLAG; | |
2044 int curr_fc, max_fc,FC_Reset_Fail_Max,FC_Reset_Fail_Current,FC_Reset_Success_Max,FC_Reset_Success_Current ; | |
2045 //T_DISPLAY_DATA display_info; | |
2046 | |
2047 // T_MFW_HND win = mfwParent(mfw_header()); | |
2048 // Sept 24, 2005 REF: LOCOSTO-ENH-34438, xpradipg | |
2049 // used new enum value | |
2050 FLAG=FCMAX; /* set flag to current */ | |
2051 max_fc=mfw_simlock_get_sup_info(FLAG); /* get the value of the corresponding flag*/ | |
2052 | |
2053 FLAG=FCATTEMPTSLEFT; /* set flag to current */ | |
2054 curr_fc=mfw_simlock_get_sup_info(FLAG); /* get the value of the corresponding flag*/ | |
2055 | |
2056 // Sept 24, 2005 REF: LOCOSTO-ENH-34438, xpradipg | |
2057 // used new enum value | |
2058 FLAG = FCRESETFAILMAX; | |
2059 FC_Reset_Fail_Max=mfw_simlock_get_sup_info(FLAG); | |
2060 // Sept 24, 2005 REF: LOCOSTO-ENH-34438, xpradipg | |
2061 // used new enum value | |
2062 FLAG =FCRESETFAILATTEMPTSLEFT; | |
2063 FC_Reset_Fail_Current=mfw_simlock_get_sup_info(FLAG); | |
2064 // Sept 24, 2005 REF: LOCOSTO-ENH-34438, xpradipg | |
2065 // used new enum value | |
2066 FLAG =FCRESETSUCCESSMAX; | |
2067 FC_Reset_Success_Max=mfw_simlock_get_sup_info(FLAG); | |
2068 // Sept 24, 2005 REF: LOCOSTO-ENH-34438, xpradipg | |
2069 // used new enum value | |
2070 FLAG =FCRESETSUCCESSATTEMPTSLEFT; | |
2071 FC_Reset_Success_Current=mfw_simlock_get_sup_info(FLAG); | |
2072 | |
2073 if( lcktyp !=0) | |
2074 { | |
2075 *max = max_fc; | |
2076 *curr = curr_fc; | |
2077 } | |
2078 else | |
2079 { | |
2080 *max = FC_Reset_Fail_Current; | |
2081 *curr = FC_Reset_Success_Current; | |
2082 } | |
2083 | |
2084 TRACE_FUNCTION_P4(" FC_Reset_Fail_Max %d FC_Reset_Fail_Current %d FC_Reset_Success_Max %d FC_Reset_Success_Current %d",FC_Reset_Fail_Max,FC_Reset_Fail_Current,FC_Reset_Success_Max,FC_Reset_Success_Current); | |
2085 | |
2086 /* if( lcktyp == 0 ) */ | |
2087 if (curr_fc == 0) | |
2088 { | |
2089 if(( FC_Reset_Fail_Current !=0 )&& (FC_Reset_Success_Current !=0) ) | |
2090 { | |
2091 //temporarily blocked | |
2092 TRACE_FUNCTION("chk_status:MFW_SIM_BLOCKED"); | |
2093 return MFW_SIM_BLOCKED; | |
2094 | |
2095 } | |
2096 else | |
2097 { | |
2098 //permanently blocked | |
2099 TRACE_FUNCTION("check_staus: MFW_SIM_PERM_BLOCKED"); | |
2100 return MFW_SIM_PERM_BLOCKED; | |
2101 } | |
2102 | |
2103 } | |
2104 else | |
2105 { | |
2106 if( curr_fc == 0 ) | |
2107 return MFW_SIM_BLOCKED; | |
2108 else | |
2109 return MFW_SIM_NOT_BLOCKED; | |
2110 } | |
2111 } | |
2112 | |
2113 /******************************************************************************* | |
2114 $Function: mfw_simlock_get_lock_status | |
2115 $Description: returns the status of the lock - enabled / disabled | |
2116 $Returns: lock status | |
2117 $Arguments: lock type | |
2118 | |
2119 *******************************************************************************/ | |
2120 int mfw_simlock_get_lock_status(S16 lcktyp) | |
2121 { | |
2122 /*a0393213 compiler warnings removal - removed variable stat*/ | |
2123 T_ACI_CLSSTAT clsStat; | |
2124 T_ACI_FAC lckfac;/*a0393213 warnings removal - T_ACI_CLCK_FAC changed to T_ACI_FAC as a result of ACI enum change*/ | |
2125 int status; | |
2126 int maxval; | |
2127 int curval; | |
2128 | |
2129 status = mfw_simlock_check_status(lcktyp,&maxval,&curval); | |
2130 if((status == MFW_SIM_BLOCKED)) | |
2131 return MFW_SIM_BLOCKED; | |
2132 if(status == MFW_SIM_PERM_BLOCKED) | |
2133 return MFW_SIM_PERM_BLOCKED; | |
2134 | |
2135 lckfac= mfw_simlock_return_lock_type(lcktyp); | |
2136 if (qAT_PlusCLCK(CMD_SRC_LCL, lckfac, | |
2137 CLASS_NotPresent, &clsStat) EQ AT_CMPL) | |
2138 { | |
2139 TRACE_FUNCTION("Leela:qAT_PlusCLCK->AT_CMPL "); | |
2140 switch (clsStat.status) | |
2141 { | |
2142 case STATUS_NotActive: | |
2143 return MFW_SIM_DISABLE; | |
2144 | |
2145 case STATUS_Active: | |
2146 return MFW_SIM_ENABLE; | |
2147 | |
2148 } | |
2149 } | |
2150 return MFW_SIM_FAILURE; | |
2151 | |
2152 } | |
2153 | |
2154 | |
2155 | |
2156 | |
2157 /******************************************************************************* | |
2158 $Function: mfw_simlock_enable_lock | |
2159 $Description: Changes the oldpassword with the new one for the given | |
2160 lock type | |
2161 $Returns: success or failure | |
2162 $Arguments: type of lock and old and new password | |
2163 | |
2164 *******************************************************************************/ | |
2165 | |
2166 T_MFW_SS_RETURN mfw_simlock_enable_lock(U8 *pin, S16 lcktyp) | |
2167 { | |
2168 | |
2169 T_ACI_FAC lckFac;/*a0393213 warnings removal - T_ACI_CLCK_FAC changed to T_ACI_FAC as a result of ACI enum change*/ | |
2170 // Nov 03, 2005 DR: OMAPS00052032 - xpradipg | |
2171 T_ACI_RETURN ret; | |
2172 TRACE_FUNCTION("mfw_simlock_enable_lock()"); | |
2173 | |
2174 /* return ss_set_clck(FAC_Ps, CLCK_MOD_Lock, | |
2175 (char *)pin, -1, MFW_SIM_CPINE);*/ | |
2176 lckFac= mfw_simlock_return_lock_type(lcktyp); | |
2177 ret = sAT_PlusCLCK(CMD_SRC_LCL,lckFac,CLCK_MOD_Lock,(char*)pin,CLASS_NotPresent); /*a0393213 compiler warnings removal - -1 changed to CLASS_NotPresent*/ | |
2178 // Nov 03, 2005 DR: OMAPS00052032 - xpradipg | |
2179 // handle the AT_EXCT case and set the global to true | |
2180 switch(ret) | |
2181 { | |
2182 case AT_CMPL: | |
2183 return MFW_SS_OK; | |
2184 case AT_EXCT: | |
2185 sim_unlock_in_prog = SIMP_MENU; | |
2186 return MFW_EXCT; | |
2187 case AT_FAIL: | |
2188 return MFW_SS_FAIL; | |
2189 } | |
2190 return MFW_SS_FAIL; /*a0393213 compiler warnings removal - added return statement*/ | |
2191 } | |
2192 | |
2193 /******************************************************************************* | |
2194 $Function: mfw_simlock_disable_lock | |
2195 $Description: disables the lock with the given password for the given lock | |
2196 $Returns: success or failure | |
2197 $Arguments: type of lock and password | |
2198 | |
2199 *******************************************************************************/ | |
2200 T_MFW_SS_RETURN mfw_simlock_disable_lock(U8 *pin, S16 lcktyp) | |
2201 { | |
2202 T_ACI_FAC lckFac;/*a0393213 warnings removal - T_ACI_CLCK_FAC changed to T_ACI_FAC as a result of ACI enum change*/ | |
2203 T_ACI_RETURN ret; | |
2204 | |
2205 TRACE_FUNCTION("mfw_simlock_disable_lock()"); | |
2206 /* return ss_set_clck(FAC_Ps, CLCK_MOD_Lock, | |
2207 (char *)pin, -1, MFW_SIM_CPINE);*/ | |
2208 lckFac= mfw_simlock_return_lock_type(lcktyp); | |
2209 ret = sAT_PlusCLCK(CMD_SRC_LCL,lckFac,CLCK_MOD_Unlock,(char*)pin,CLASS_NotPresent) ; /*a0393213 compiler warnings removal - -1 changed to CLASS_NotPresent*/ | |
2210 if(ret != AT_CMPL) | |
2211 return MFW_SS_FAIL; | |
2212 else | |
2213 return MFW_SS_OK; | |
2214 } | |
2215 | |
2216 T_MFW mfw_simlock_reset_fc_value(U8 *pin, int fc_flag) | |
2217 { | |
2218 | |
2219 T_ACI_FAC lckFac;/*a0393213 warnings removal - T_ACI_CLCK_FAC changed to T_ACI_FAC as a result of ACI enum change*/ | |
2220 T_ACI_RETURN stat; | |
2221 TRACE_FUNCTION("mfw_simlock_reset_fc_value()"); | |
2222 TRACE_EVENT_P1("SimLock_MFW FC Password=%s",pin); | |
2223 lckFac= mfw_simlock_return_lock_type(fc_flag); | |
2224 stat = sAT_PlusCLCK(CMD_SRC_LCL,lckFac,CLCK_MOD_Unlock,(char*)pin,CLASS_NotPresent) ;/*a0393213 compiler warnings removal - -1 changed to CLASS_NotPresent*/ | |
2225 if( stat != AT_CMPL) | |
2226 { | |
2227 TRACE_FUNCTION_P1("Reset Failed %d",stat); | |
2228 return MFW_SS_FAIL; | |
2229 } | |
2230 else | |
2231 { | |
2232 TRACE_FUNCTION("Reset Success"); | |
2233 return MFW_SS_OK; | |
2234 } | |
2235 } | |
2236 | |
2237 /******************************************************************************* | |
2238 $Function: mfw_simlock_master_unlock | |
2239 $Description: This function unlocks(dependent categories) or unblocks ME | |
2240 $Returns: success or failure | |
2241 $Arguments: | |
2242 *******************************************************************************/ | |
2243 //x0pleela 20 July, 2006 ER: OMAPS00087586, OMAPS00087587 | |
2244 T_MFW mfw_simlock_master_unlock(U8 *pin, S16 MK_Unblock_flag) | |
2245 { | |
2246 T_ACI_FAC lckFac;/*a0393213 warnings removal - T_ACI_CLCK_FAC changed to T_ACI_FAC as a result of ACI enum change*/ | |
2247 T_ACI_RETURN stat; | |
2248 | |
2249 TRACE_FUNCTION("mfw_simlock_master_unlock()"); | |
2250 | |
2251 lckFac= mfw_simlock_return_lock_type(MK_Unblock_flag); | |
2252 stat =sAT_PlusCLCK(CMD_SRC_LCL,lckFac,CLCK_MOD_Unlock,(char*)pin,CLASS_NotPresent);/*a0393213 warnings removal - -1 changed to CLASS_NotPresent*/ | |
2253 if( stat != AT_CMPL) | |
2254 { | |
2255 TRACE_EVENT_P1("Master Unlock Failed %d",stat); | |
2256 //x0pleela 13 Nov, 2006 DR: OMAPS00103356 | |
2257 //Check if the master unlock password is wrong | |
2258 //If wrong, displays Wrong password | |
2259 if((aciErrDesc & 0x0000FFFF) EQ CME_ERR_WrongPasswd) | |
2260 return MFW_WRONG_PWD; | |
2261 | |
2262 //x0pleela 13 Nov, 2006 DR: OMAPS00103356 | |
2263 //Check the error code for any of the following categories (non-dependent) being locked/blocked | |
2264 //If yes, return OK as the dependent categories are unblocked using Master unblock password | |
2265 else if ( | |
2266 ( (aciErrDesc & 0x0000FFFF) EQ CME_ERR_NetworkPersPinReq ) OR | |
2267 ( (aciErrDesc & 0x0000FFFF) EQ CME_ERR_NetworkPersPukReq ) OR | |
2268 ( (aciErrDesc & 0x0000FFFF) EQ CME_ERR_NetworkSubsetPersPinReq ) OR | |
2269 ( (aciErrDesc & 0x0000FFFF) EQ CME_ERR_NetworkSubsetPersPukReq ) OR | |
2270 ( (aciErrDesc & 0x0000FFFF) EQ CME_ERR_ProviderPersPinReq ) OR | |
2271 ( (aciErrDesc & 0x0000FFFF) EQ CME_ERR_ProviderPersPukReq ) OR | |
2272 ( (aciErrDesc & 0x0000FFFF) EQ CME_ERR_CorporatePersPinReq ) OR | |
2273 ( (aciErrDesc & 0x0000FFFF) EQ CME_ERR_CorporatePersPukReq ) OR | |
2274 ( (aciErrDesc & 0x0000FFFF) EQ CME_ERR_PhSimPinReq ) OR | |
2275 ( (aciErrDesc & 0x0000FFFF) EQ CME_ERR_PhoneFail ) OR | |
2276 ( ( ((aciErrDesc & 0xFFFF0000) >> 16) EQ ACI_ERR_CLASS_Ext) AND | |
2277 (aciErrDesc & 0x0000FFFF) EQ EXT_ERR_BlockedNetworkPersPinReq) OR | |
2278 ( ( ((aciErrDesc & 0xFFFF0000) >> 16) EQ ACI_ERR_CLASS_Ext) AND | |
2279 (aciErrDesc & 0x0000FFFF) EQ EXT_ERR_BlockedNetworkPersPukReq) | |
2280 ) | |
2281 return MFW_MASTER_OK; | |
2282 else | |
2283 return MFW_SS_FAIL; | |
2284 } | |
2285 else | |
2286 { | |
2287 TRACE_EVENT("Master Unlock Success"); | |
2288 return MFW_SS_OK; | |
2289 } | |
2290 } | |
2291 | |
2292 /******************************************************************************* | |
2293 $Function: mfw_simlock_check_masterkey | |
2294 $Description: This function checks from ACI whether Master Unlock feature is enabled or not | |
2295 If enabled, displays a menu item for the user to select master unlocking option | |
2296 If not enabled, doesn't display master unlocking option in the menu | |
2297 $Arguments: | |
2298 *******************************************************************************/ | |
2299 //x0pleela 20 July, 2006 ER: OMAPS00087586, OMAPS00087587 | |
2300 | |
2301 UBYTE mfw_simlock_check_masterkey( S16 MK_unlock_type) | |
2302 { | |
2303 T_ACI_CLSSTAT clsStat; | |
2304 T_ACI_FAC lckfac;/*a0393213 warnings removal - T_ACI_CLCK_FAC changed to T_ACI_FAC as a result of ACI enum change*/ | |
2305 | |
2306 TRACE_FUNCTION("mfw_simlock_check_masterkey()"); | |
2307 | |
2308 //get the lock type | |
2309 lckfac= mfw_simlock_return_lock_type(MK_unlock_type); | |
2310 | |
2311 //query ACI for master unlocking option | |
2312 qAT_PlusCLCK(CMD_SRC_LCL, lckfac, CLASS_NotPresent, &clsStat); | |
2313 | |
2314 switch( clsStat.status) | |
2315 { | |
2316 case STATUS_Active: | |
2317 return MFW_MASTER_UNLOCK_ACTIVE; | |
2318 | |
2319 case STATUS_NotActive: | |
2320 default: | |
2321 return MFW_MASTER_UNLOCK_DEACTIVE; | |
2322 } | |
2323 } | |
2324 | |
2325 /******************************************************************************* | |
2326 $Function: mfw_simlock_set_busy_state | |
2327 $Description: This function sets Simp_Busy_State to either TRUE or FALSE based on ACI's | |
2328 CME error | |
2329 $Arguments: | |
2330 *******************************************************************************/ | |
2331 //x0pleela 20 July, 2006 ER: OMAPS00087586, OMAPS00087587 | |
2332 void mfw_simlock_set_busy_state( UBYTE state ) | |
2333 { | |
2334 TRACE_FUNCTION("mfw_simlock_set_busy_state()"); | |
2335 Simp_Busy_State = state; | |
2336 } | |
2337 | |
2338 /******************************************************************************* | |
2339 $Function: mfw_simlock_get_busy_state | |
2340 $Description: This function returns the current value of Simp_Busy_State | |
2341 $Arguments: | |
2342 *******************************************************************************/ | |
2343 //x0pleela 20 July, 2006 ER: OMAPS00087586, OMAPS00087587 | |
2344 UBYTE mfw_simlock_get_busy_state( void ) | |
2345 { | |
2346 TRACE_FUNCTION("mfw_simlock_get_busy_state()"); | |
2347 return Simp_Busy_State; | |
2348 } | |
2349 | |
2350 | |
2351 // Sept 24, 2005 REF: LOCOSTO-ENH-34438, xpradipg | |
2352 // this function is never referenced and this inturn calls sAT_PercentSLPVRF | |
2353 // which has been removed at ACI leve | |
2354 #if 0 | |
2355 /******************************************************************************* | |
2356 $Function: mfw_simlock_verify_lock | |
2357 $Description: If locked, it performs unlock + lock, if unlocks, it performs | |
2358 lock + unlock, thus validating if the password provided is correct | |
2359 $Returns: success or failure | |
2360 $Arguments: type of lock and password | |
2361 | |
2362 *******************************************************************************/ | |
2363 | |
2364 int mfw_simlock_verify_lock(char* pwd,S16 lock) | |
2365 { | |
2366 int status; | |
2367 T_ACI_FAC lckfac; | |
2368 | |
2369 TRACE_FUNCTION("mfw_simlock_verify_lock()"); | |
2370 TRACE_EVENT_P1("Vidya: SimLock_MFW Password=%s",pwd); | |
2371 | |
2372 // status = mfw_simlock_get_lock_status(lock); | |
2373 lckfac=mfw_simlock_return_lock_type(lock); | |
2374 if(sAT_PercentSLPVRF(CMD_SRC_LCL, lckfac, pwd)==AT_CMPL) | |
2375 return MFW_SS_OK; | |
2376 else | |
2377 return MFW_SS_FAIL; | |
2378 /* | |
2379 if(status==MFW_SIM_ENABLE) | |
2380 | |
2381 { | |
2382 if( sAT_PlusCLCK(CMD_SRC_LCL,lckfac,CLCK_MOD_Unlock,pwd,CLASS_NotPresent) !=AT_CMPL) | |
2383 { | |
2384 TRACE_EVENT("Vidya: SIM_ENABLE unlock fail"); | |
2385 return MFW_SS_FAIL; | |
2386 } | |
2387 else | |
2388 { | |
2389 if(sAT_PlusCLCK(CMD_SRC_LCL,lckfac,CLCK_MOD_Lock,pwd,CLASS_NotPresent)!=AT_CMPL) | |
2390 { | |
2391 TRACE_EVENT("Vidya: SIM_ENABLE lock fail"); | |
2392 return MFW_SS_FAIL; | |
2393 } | |
2394 else | |
2395 return MFW_SS_OK; | |
2396 } | |
2397 | |
2398 } | |
2399 else if(status==MFW_SIM_DISABLE) | |
2400 { | |
2401 if( sAT_PlusCLCK(CMD_SRC_LCL,lckfac,CLCK_MOD_Lock,pwd,CLASS_NotPresent) !=AT_CMPL) | |
2402 { | |
2403 TRACE_EVENT("Vidya: SIM_DISABLE lock fail"); | |
2404 return MFW_SS_FAIL; | |
2405 } | |
2406 else | |
2407 { | |
2408 if(sAT_PlusCLCK(CMD_SRC_LCL,lckfac,CLCK_MOD_Unlock,pwd,CLASS_NotPresent)!=AT_CMPL) | |
2409 { | |
2410 TRACE_EVENT("Vidya: SIM_DISABLE unlock fail"); | |
2411 return MFW_SS_FAIL; | |
2412 } | |
2413 else | |
2414 return MFW_SS_OK; | |
2415 } | |
2416 | |
2417 | |
2418 } | |
2419 */ | |
2420 /* if(aci_ext_personalisation_MMI_verify_password(pwd) != MMILOCK_VERIFIED) | |
2421 MFW_SS_FAIL; | |
2422 else | |
2423 MFW_SS_OK;*/ | |
2424 | |
2425 } | |
2426 #endif | |
2427 /******************************************************************************* | |
2428 $Function: mfw_simlock_change_lock_code | |
2429 $Description: Changes the oldpassword with the new one for the given | |
2430 lock type | |
2431 $Returns: success or failure | |
2432 $Arguments: type of lock and old and new password | |
2433 | |
2434 *******************************************************************************/ | |
2435 T_MFW mfw_simlock_change_lock_code(int type,char*oldpswd,char* newpswd) | |
2436 { | |
2437 T_ACI_FAC lckType;/*a0393213 warnings removal - T_ACI_CPWD_FAC changed to T_ACI_FAC as a result of ACI enum change*/ | |
2438 | |
2439 switch(type) | |
2440 { | |
2441 case MFW_SIM_NLOCK: | |
2442 lckType = FAC_Pn; | |
2443 break; | |
2444 case MFW_SIM_SPLOCK: | |
2445 lckType = FAC_Pp; | |
2446 break; | |
2447 case MFW_SIM_NSLOCK: | |
2448 lckType = FAC_Pu; | |
2449 break; | |
2450 case MFW_SIM_CLOCK: | |
2451 lckType = FAC_Pc; | |
2452 break; | |
2453 case MFW_SIM_PLOCK: | |
2454 lckType = FAC_Ps; | |
2455 break; | |
2456 default: | |
2457 lckType=FAC_NotPresent; | |
2458 break; | |
2459 } | |
2460 | |
2461 if(sAT_PlusCPWD(CMD_SRC_LCL, lckType, | |
2462 (char *)oldpswd,(char *)newpswd)!=AT_CMPL) | |
2463 return MFW_SS_FAIL; | |
2464 else | |
2465 return MFW_SS_OK; | |
2466 } | |
2467 | |
2468 #endif | |
2469 | |
2470 /* | |
2471 +--------------------------------------------------------------------+ | |
2472 | PROJECT : MMI-Framework (8417) MODULE : MFW_SIM | | |
2473 | STATE : code ROUTINE : sim_ok_cpine | | |
2474 +--------------------------------------------------------------------+ | |
2475 PURPOSE : Successful end of PIN enability | |
2476 */ | |
2477 void sim_ok_cpine() | |
2478 { | |
2479 TRACE_FUNCTION("sim_ok_cpine()"); | |
2480 | |
2481 sim_status.sim_procedure = MFW_SIM_ENABLE; | |
2482 sim_status.sim_status = MFW_SIM_SUCCESS; | |
2483 sim_status.sim_operation_mode = sim_config.oper_mode; | |
2484 sim_status.sim_pin_retries = 0; | |
2485 sim_status.sim_status_type = MFW_SIM_UNKNOWN; // no indication | |
2486 pin1_set = MFW_SIM_ENABLE; | |
2487 sim_signal(E_SIM_STATUS,&sim_status); | |
2488 } | |
2489 | |
2490 | |
2491 /* | |
2492 +--------------------------------------------------------------------+ | |
2493 | PROJECT : MMI-Framework (8417) MODULE : MFW_SIM | | |
2494 | STATE : code ROUTINE : sim_error_cpine | | |
2495 +--------------------------------------------------------------------+ | |
2496 | |
2497 PURPOSE : Failed PIN enability | |
2498 | |
2499 */ | |
2500 | |
2501 void sim_error_cpine (void) | |
2502 { | |
2503 TRACE_FUNCTION("sim_error_cpine()"); | |
2504 | |
2505 sim_status.sim_procedure = MFW_SIM_ENABLE; | |
2506 sim_status.sim_status = MFW_SIM_FAILURE; | |
2507 sim_status.sim_operation_mode = sim_config.oper_mode; | |
2508 sim_status.sim_pin_retries = sim_pin_count(MFW_SIM_PIN1); | |
2509 sim_status.sim_status_type = MFW_SIM_UNKNOWN; // no indication | |
2510 | |
2511 sim_signal(E_SIM_STATUS,&sim_status); | |
2512 } | |
2513 | |
2514 | |
2515 /* | |
2516 +--------------------------------------------------------------------+ | |
2517 | PROJECT : MMI-Framework (8417) MODULE : MFW_SIM | | |
2518 | STATE : code ROUTINE : sim_check_service | | |
2519 +--------------------------------------------------------------------+ | |
2520 | |
2521 PURPOSE : Checks a service status | |
2522 | |
2523 */ | |
2524 | |
2525 U8 sim_check_service (U8 nr, U8 *serv_table) | |
2526 { | |
2527 U8 value; | |
2528 | |
2529 TRACE_FUNCTION("sim_check_service()"); | |
2530 | |
2531 value = *(serv_table + (nr - 1) / 4); | |
2532 value >>= (((nr - 1) & 3) * 2); | |
2533 | |
2534 return (value & 3); | |
2535 } | |
2536 | |
2537 | |
2538 /* | |
2539 +-----------------------------------------------------------------------+ | |
2540 | PROJECT : MMI-Framework (8417) MODULE : MFW_SIM | | |
2541 | STATE : code ROUTINE : sim_serv_table_check | | |
2542 +-----------------------------------------------------------------------+ | |
2543 | |
2544 PURPOSE : Checks a service status in SIM service table | |
2545 | |
2546 */ | |
2547 | |
2548 T_MFW sim_serv_table_check(UBYTE serv_num) | |
2549 { | |
2550 TRACE_FUNCTION("sim_serv_table_check()"); | |
2551 return sim_check_service(serv_num, sim_service_table); | |
2552 } | |
2553 | |
2554 | |
2555 /* | |
2556 +--------------------------------------------------------------------+ | |
2557 | PROJECT : MMI-Framework (8417) MODULE : MFW_SIM | | |
2558 | STATE : code ROUTINE : rAT_PlusCFUNP | | |
2559 +--------------------------------------------------------------------+ | |
2560 | |
2561 PURPOSE : MMI relevant parameters from the SIM card | |
2562 | |
2563 */ | |
2564 | |
2565 void rAT_PlusCFUNP (T_SIM_MMI_INSERT_IND *mmi_insert_ind) | |
2566 { | |
2567 TRACE_FUNCTION("rAT_PlusCFUNP()"); | |
2568 | |
2569 sim_stat = SIM_ACTIVE; | |
2570 | |
2571 sim_config.oper_mode = mmi_insert_ind->func; | |
2572 | |
2573 #ifdef FF_2TO1_PS | |
2574 nm_mmi_parameters(&mmi_insert_ind->imsi_field, | |
2575 &mmi_insert_ind->pref_plmn); | |
2576 | |
2577 memcpy(sim_service_table,mmi_insert_ind->serv_table, | |
2578 #else | |
2579 nm_mmi_parameters(&mmi_insert_ind->imsi_field); | |
2580 memcpy(sim_service_table,mmi_insert_ind->sim_serv, | |
2581 #endif | |
2582 sizeof(sim_service_table)); | |
2583 sim_config.phase = mmi_insert_ind->phase; | |
2584 sim_config.access_acm = mmi_insert_ind->access_acm; | |
2585 sim_config.access_acmmax = mmi_insert_ind->access_acmmax; | |
2586 sim_config.access_puct = mmi_insert_ind->access_puct; | |
2587 | |
2588 | |
2589 /* Apr 13, 2004 REF: CRR 16303 JuanVi Jativa-Villoldo */ | |
2590 /* SPN must always be read, not only when nm_registration is called */ | |
2591 sim_spn_req(); | |
2592 | |
2593 if (sim_check_service(15,sim_service_table) | |
2594 == ALLOCATED_AND_ACTIVATED) | |
2595 sim_read_sim(SIM_GID1, NOT_PRESENT_8BIT, 5); | |
2596 #ifdef BMI_TEST_MC_SIM_EVENT | |
2597 TRACE_EVENT("Reading SIM_ICCID"); | |
2598 sim_read_sim(SIM_ICCID, NOT_PRESENT_8BIT, 5); | |
2599 #endif | |
2600 } | |
2601 | |
2602 | |
2603 /* | |
2604 +--------------------------------------------------------------------+ | |
2605 | PROJECT : MMI-Framework (8417) MODULE : MFW_SIM | | |
2606 | STATE : code ROUTINE : sim_mmi_parameter | | |
2607 +--------------------------------------------------------------------+ | |
2608 | |
2609 PURPOSE : MMI relevant parameters from the SIM card | |
2610 | |
2611 */ | |
2612 | |
2613 void sim_mmi_parameter(T_SIM_ACTIVATE_CNF *sim_act_cnf) | |
2614 { | |
2615 TRACE_FUNCTION("sim_mmi_parameter()"); | |
2616 | |
2617 memcpy( sim_config.pref_lang, sim_act_cnf->pref_lang, 5); | |
2618 } | |
2619 | |
2620 | |
2621 /* | |
2622 +--------------------------------------------------------------------+ | |
2623 | PROJECT : MMI-Framework (8417) MODULE : MFW_SIM | | |
2624 | STATE : code ROUTINE : sim_gid1_cnf | | |
2625 +--------------------------------------------------------------------+ | |
2626 | |
2627 PURPOSE : read SIM group identifier 1 from SIM card | |
2628 | |
2629 */ | |
2630 | |
2631 void sim_gid1_cnf(USHORT error, UBYTE *data) | |
2632 { | |
2633 TRACE_FUNCTION("sim_gid1_cnf()"); | |
2634 | |
2635 #ifdef FF_2TO1_PS | |
2636 if (error EQ CAUSE_SIM_NO_ERROR) | |
2637 #else | |
2638 if (error EQ SIM_NO_ERROR) | |
2639 #endif | |
2640 memcpy(sim_config.sim_gidl1, data, 5); | |
2641 | |
2642 if (!sat_update) | |
2643 { | |
2644 if (sim_check_service(16,sim_service_table) | |
2645 == ALLOCATED_AND_ACTIVATED) | |
2646 sim_read_sim(SIM_GID2, NOT_PRESENT_8BIT, 5); | |
2647 } | |
2648 #ifdef SIM_TOOLKIT | |
2649 else | |
2650 { | |
2651 sat_update = FALSE; | |
2652 satUpdateFiles ( TRUE, SIM_GID1 ); | |
2653 } | |
2654 #endif | |
2655 } | |
2656 | |
2657 | |
2658 /* | |
2659 +--------------------------------------------------------------------+ | |
2660 | PROJECT : MMI-Framework (8417) MODULE : MFW_SIM | | |
2661 | STATE : code ROUTINE : sim_gid2_cnf | | |
2662 +--------------------------------------------------------------------+ | |
2663 | |
2664 PURPOSE : read SIM group identifier 2 from SIM card | |
2665 | |
2666 */ | |
2667 | |
2668 void sim_gid2_cnf(USHORT error, UBYTE *data) | |
2669 { | |
2670 TRACE_FUNCTION("sim_gid2_cnf()"); | |
2671 #ifdef FF_2TO1_PS | |
2672 if (error EQ CAUSE_SIM_NO_ERROR) | |
2673 #else | |
2674 if (error EQ SIM_NO_ERROR) | |
2675 #endif | |
2676 memcpy(sim_config.sim_gidl2, data, 5); | |
2677 | |
2678 #ifdef SIM_TOOLKIT | |
2679 if ( sat_update ) | |
2680 { | |
2681 sat_update = FALSE; | |
2682 satUpdateFiles ( TRUE, SIM_GID2 ); | |
2683 } | |
2684 #endif | |
2685 } | |
2686 | |
2687 | |
2688 /* | |
2689 +--------------------------------------------------------------------+ | |
2690 | PROJECT : MMI-Framework (8417) MODULE : MFW_SIM | | |
2691 | STATE : code ROUTINE : sim_save_pref_lang | | |
2692 +--------------------------------------------------------------------+ | |
2693 | |
2694 PURPOSE : save preferred language | |
2695 | |
2696 */ | |
2697 | |
2698 void sim_save_pref_lang (UBYTE *lang, UBYTE len) | |
2699 { | |
2700 UBYTE sim_data[7]; | |
2701 UBYTE i; | |
2702 | |
2703 TRACE_FUNCTION("sim_save_pref_lang()"); | |
2704 | |
2705 // | |
2706 // copy a maximum of 5 bytes for storing on the SIM card | |
2707 // | |
2708 for (i=0;i<len AND i<5;i++) | |
2709 sim_data[i] = lang[i]; | |
2710 | |
2711 // | |
2712 // if less than 5 bytes fill with dummy values | |
2713 // | |
2714 for (i=len; i<5;i++) | |
2715 sim_data[i] = 0xFF; | |
2716 | |
2717 // | |
2718 // write to the SIM card | |
2719 // | |
2720 sim_write_sim(SIM_LP, sim_data, 5); | |
2721 } | |
2722 | |
2723 | |
2724 /* | |
2725 +--------------------------------------------------------------------+ | |
2726 | PROJECT : MMI-Framework (8417) MODULE : MFW_SIM | | |
2727 | STATE : code ROUTINE : rAT_PercentSIMREM | | |
2728 +--------------------------------------------------------------------+ | |
2729 | |
2730 PURPOSE : call back for SIM removed | |
2731 | |
2732 */ | |
2733 | |
2734 void rAT_PercentSIMREM( T_ACI_SIMREM_TYPE srType ) | |
2735 { | |
2736 TRACE_FUNCTION("rAT_PercentSIMREM()"); | |
2737 | |
2738 /* Dec 13, 2006 DR: OMAPS00105640 x0039928 | |
2739 Fix: sim_stat is updated */ | |
2740 sim_stat = SIM_NOT_ACTIVE; | |
2741 if ( srType EQ SIMREM_FAILURE ) | |
2742 { | |
2743 sim_status.sim_procedure = MFW_SIM_REMOVED; | |
2744 sim_status.sim_status = MFW_SIM_NO_SIM_CARD; | |
2745 sim_status.sim_operation_mode = sim_config.oper_mode; | |
2746 sim_status.sim_pin_retries = 0; | |
2747 sim_status.sim_status_type = MFW_SIM_UNKNOWN; | |
2748 sim_signal(E_SIM_STATUS,&sim_status); | |
2749 } | |
2750 else if ( srType EQ SIMREM_RESET ) | |
2751 { | |
2752 #ifdef SIM_TOOLKIT | |
2753 sim_signal(E_SIM_RESET, 0); | |
2754 #endif | |
2755 } | |
2756 } | |
2757 | |
2758 | |
2759 /* | |
2760 +--------------------------------------------------------------------+ | |
2761 | PROJECT : MMI-Framework (8417) MODULE : MFW_SIM | | |
2762 | STATE : code ROUTINE : rAT_percentSIMINS | | |
2763 +--------------------------------------------------------------------+ | |
2764 | |
2765 PURPOSE : call back for SIM inserted | |
2766 | |
2767 */ | |
2768 | |
2769 void rAT_PercentSIMINS( T_ACI_CME_ERR err ) | |
2770 { | |
2771 TRACE_FUNCTION("rAT_percentSIMINS()"); | |
2772 | |
2773 sim_signal(E_SIM_INSERTED, 0); | |
2774 | |
2775 switch ( err ) | |
2776 { | |
2777 case CME_ERR_SimPinReq: | |
2778 sim_status.sim_status = MFW_SIM_PIN_REQ; | |
2779 sim_status.sim_pin_retries = sim_pin_count(MFW_SIM_PIN1); | |
2780 sim_status.sim_status_type = MFW_SIM_PIN1; | |
2781 sim_stat = SIM_ACTIVE; | |
2782 sim_signal(E_SIM_STATUS, &sim_status); | |
2783 break; | |
2784 | |
2785 case CME_ERR_SimPukReq: | |
2786 sim_status.sim_status = MFW_SIM_PUK_REQ; | |
2787 sim_status.sim_pin_retries = sim_pin_count(MFW_SIM_PUK1); | |
2788 sim_status.sim_status_type = MFW_SIM_PUK1; | |
2789 sim_stat = SIM_ACTIVE; | |
2790 sim_signal(E_SIM_STATUS, &sim_status); | |
2791 break; | |
2792 case CME_ERR_SimResetNeeded: /*OMAPS00115179 -a0393213 (R.Prabakar*/ | |
2793 { | |
2794 T_ACI_RETURN cfun; | |
2795 /*This event is not passed to BMI as there is no need currently*/ | |
2796 cfun = sAT_PlusCFUN(CMD_SRC_LCL,CFUN_FUN_Full,CFUN_RST_NotPresent); | |
2797 if (cfun NEQ AT_EXCT) | |
2798 { | |
2799 TRACE_ERROR("rAT_PercentSIMINS() : sAT_PlusCFUN error"); | |
2800 } | |
2801 break; | |
2802 } | |
2803 | |
2804 default: | |
2805 break; | |
2806 } | |
2807 } | |
2808 | |
2809 /* | |
2810 +--------------------------------------------------------------------+ | |
2811 | PROJECT : MMI-Framework (8417) MODULE : MFW_SIM | | |
2812 | STATE : code ROUTINE : sim_configuration | | |
2813 +--------------------------------------------------------------------+ | |
2814 | |
2815 PURPOSE : Request the configuration of SIM card | |
2816 | |
2817 */ | |
2818 | |
2819 UBYTE sim_cvt_access_status(UBYTE acs) | |
2820 { | |
2821 TRACE_FUNCTION("sim_cvt_access_status()"); | |
2822 | |
2823 switch(acs) | |
2824 { | |
2825 #ifdef FF_2TO1_PS | |
2826 case SIM_ACCESS_ALWAYS: return MFW_SIM_NO_PIN; | |
2827 case SIM_ACCESS_PIN_1: return MFW_SIM_PIN1; | |
2828 case SIM_ACCESS_PIN_2: return MFW_SIM_PIN2; | |
2829 #else | |
2830 case ACCESS_ALWAYS: return MFW_SIM_NO_PIN; | |
2831 case ACCESS_PIN_1: return MFW_SIM_PIN1; | |
2832 case ACCESS_PIN_2: return MFW_SIM_PIN2; | |
2833 #endif | |
2834 default: return MFW_SIM_UNKNOWN; | |
2835 } | |
2836 } | |
2837 | |
2838 | |
2839 /* | |
2840 +--------------------------------------------------------------------+ | |
2841 | PROJECT : MMI-Framework (8417) MODULE : MFW_SIM | | |
2842 | STATE : code ROUTINE : sim_configuration | | |
2843 +--------------------------------------------------------------------+ | |
2844 | |
2845 PURPOSE : Request the configuration of SIM card | |
2846 | |
2847 */ | |
2848 | |
2849 MfwRes sim_configuration (U8 *phase, U8 *serv, U8 *slen, | |
2850 U8 *lang, U8 *llen, | |
2851 T_MFW_AOC_ACCESS *access) | |
2852 { | |
2853 U8 l; | |
2854 TRACE_FUNCTION("sim_configuration()"); | |
2855 | |
2856 //PATCH2 TB 1310: Add test of NULL parameter to avoid to declare parameter of unwanted data | |
2857 if (sim_stat != SIM_ACTIVE) | |
2858 return MfwResErr;/*a0393213 warnings removal-MFW_SIM_FAILURE changed to MfwResErr*/ | |
2859 | |
2860 if (phase != NULL) | |
2861 *phase = sim_config.phase; | |
2862 | |
2863 if ((serv != NULL) && (slen != NULL)) | |
2864 { | |
2865 l = sizeof(sim_service_table); | |
2866 if (l < *slen) | |
2867 *slen = l; | |
2868 memcpy(serv,sim_service_table,*slen); | |
2869 } | |
2870 | |
2871 //PATCH1 TB 1310: replace slen by llen | |
2872 if ((lang != NULL) && (llen != NULL)) | |
2873 { | |
2874 l = sizeof(sim_config.pref_lang); | |
2875 if (l < *llen) | |
2876 *llen = l; | |
2877 memcpy(lang, sim_config.pref_lang, *llen); | |
2878 } | |
2879 //END PATCH1 TB | |
2880 | |
2881 if (access != NULL) | |
2882 { | |
2883 access->access_acm = sim_cvt_access_status(sim_config.access_acm); | |
2884 access->access_acmmax = sim_cvt_access_status(sim_config.access_acmmax); | |
2885 access->access_puct = sim_cvt_access_status(sim_config.access_puct); | |
2886 } | |
2887 //END PATCH2 TB | |
2888 | |
2889 return MfwResDone;/*a0393213 warnings removal-MFW_SIM_SUCCESS changed to MfwResDone*/ | |
2890 } | |
2891 | |
2892 | |
2893 /* | |
2894 +--------------------------------------------------------------------+ | |
2895 | PROJECT : MMI-Framework (8417) MODULE : MFW_SIM | | |
2896 | STATE : code ROUTINE : sim_status_check | | |
2897 +--------------------------------------------------------------------+ | |
2898 | |
2899 PURPOSE : check activation of SIM card | |
2900 | |
2901 */ | |
2902 | |
2903 int sim_status_check (void) | |
2904 { | |
2905 TRACE_FUNCTION("sim_status_check()"); | |
2906 | |
2907 return sim_stat; | |
2908 } | |
2909 | |
2910 | |
2911 /* | |
2912 +--------------------------------------------------------------------+ | |
2913 | PROJECT : MMI-Framework (8417) MODULE : MFW_SIM | | |
2914 | STATE : code ROUTINE : sim_pin_count | | |
2915 +--------------------------------------------------------------------+ | |
2916 | |
2917 PURPOSE : Request PIN/PUK count | |
2918 | |
2919 */ | |
2920 | |
2921 int sim_pin_count(U8 pin_id) | |
2922 { | |
2923 SHORT pn1Cnt; | |
2924 SHORT pn2Cnt; | |
2925 SHORT pk1Cnt; | |
2926 SHORT pk2Cnt; | |
2927 T_ACI_PVRF_STAT ps1; | |
2928 T_ACI_PVRF_STAT ps2; | |
2929 | |
2930 TRACE_FUNCTION("sim_pin_count()"); | |
2931 | |
2932 | |
2933 if (qAT_PercentPVRF(CMD_SRC_LCL, &pn1Cnt, | |
2934 &pn2Cnt, &pk1Cnt, &pk2Cnt, &ps1, &ps2) != AT_CMPL) | |
2935 return -1; | |
2936 | |
2937 switch (pin_id) | |
2938 { | |
2939 case MFW_SIM_PIN1: return pn1Cnt; | |
2940 case MFW_SIM_PIN2: return pn2Cnt; | |
2941 case MFW_SIM_PUK1: return pk1Cnt; | |
2942 case MFW_SIM_PUK2: return pk2Cnt; | |
2943 default: return -1; | |
2944 } | |
2945 } | |
2946 | |
2947 int SimHasPin(U8 pin_id) | |
2948 { | |
2949 SHORT pn1Cnt; | |
2950 SHORT pn2Cnt; | |
2951 SHORT pk1Cnt; | |
2952 SHORT pk2Cnt; | |
2953 T_ACI_PVRF_STAT ps1; | |
2954 T_ACI_PVRF_STAT ps2; | |
2955 | |
2956 TRACE_FUNCTION("sim_pin_count()"); | |
2957 | |
2958 | |
2959 if (qAT_PercentPVRF(CMD_SRC_LCL, &pn1Cnt, | |
2960 &pn2Cnt, &pk1Cnt, &pk2Cnt, &ps1, &ps2) != AT_CMPL) | |
2961 return -1; | |
2962 /***************************Go-lite Optimization changes Start***********************/ | |
2963 //Aug 16, 2004 REF: CRR 24323 Deepa M.D | |
2964 TRACE_EVENT_P1("PIN2 STATUS: %d", ps2); | |
2965 /***************************Go-lite Optimization changes end***********************/ | |
2966 switch (pin_id) | |
2967 { | |
2968 case MFW_SIM_PIN1: | |
2969 { if (ps1 ==PVRF_STAT_NotPresent) | |
2970 return 0; | |
2971 else | |
2972 return 1; | |
2973 } // break; // RAVI | |
2974 case MFW_SIM_PIN2: | |
2975 { if (ps2 ==PVRF_STAT_NotPresent) | |
2976 return 0; | |
2977 else | |
2978 return 1; | |
2979 }// break; // RAVI | |
2980 default: return -1; | |
2981 } | |
2982 } | |
2983 | |
2984 /*SPR 1351, added new function*/ | |
2985 /* | |
2986 +---------------------------------------------------------------------+ | |
2987 | PROJECT : MMI-Framework (8417) MODULE : MFW_SIM | | |
2988 | STATE : code ROUTINE : sim_convert_simlock_status| | |
2989 +---------------------------------------------------------------------+ | |
2990 | |
2991 PURPOSE : Conversion of ACI simlock status to MFW simlock status codes for | |
2992 compatibility with existing MMI layer. | |
2993 | |
2994 */ | |
2995 UBYTE sim_convert_simlock_status(T_SIMLOCK_STATUS aci_status) | |
2996 { | |
2997 switch(aci_status) | |
2998 { | |
2999 case(SIMLOCK_DISABLED): return MFW_SIM_DISABLE; //break; // RAVI | |
3000 case(SIMLOCK_ENABLED): return MFW_SIM_ENABLE; //break; // RAVI | |
3001 case(SIMLOCK_BLOCKED): return MFW_SIM_BLOCKED; // break; // RAVI | |
3002 case(SIMLOCK_LOCKED): return MFW_SIM_LOCKED; //break; // RAVI | |
3003 case (SIMLOCK_FAIL): return MFW_SIM_FAILURE; // break; // RAVI | |
3004 default: return MFW_SIM_FAILURE; | |
3005 } | |
3006 | |
3007 } | |
3008 /* | |
3009 +---------------------------------------------------------------------+ | |
3010 | PROJECT : MMI-Framework (8417) MODULE : MFW_SIM | | |
3011 | STATE : code ROUTINE : sim_unlock_sim_lock | | |
3012 +---------------------------------------------------------------------+ | |
3013 | |
3014 PURPOSE : de-personalisation(unlocking) for SIM lock. | |
3015 Returns code for lock type if successful, or return MFW_SIM_UNLOCK_ERR if not. | |
3016 | |
3017 */ | |
3018 /*MC SPR1351, replaced previous implemnetation with wrapper for aci implementation*/ | |
3019 T_MFW sim_unlock_sim_lock(UBYTE type, UBYTE *passwd) | |
3020 { | |
3021 | |
3022 T_SIMLOCK_STATUS simlock_status=SIMLOCK_DISABLED;/*status from ACI */ | |
3023 /*for CQ-34324 -- While Integrating of VLE5 ME personalization code aci_slock_unlock | |
3024 function is moved under SIM_PERS flag and this function is never called . So variable | |
3025 simlock_status is hardcoded to default value */ | |
3026 UBYTE mfw_simlock_status;/*status converted to MFW encoding*/ | |
3027 | |
3028 TRACE_EVENT_P1("sim_unlock_sim_lock(): %d", type); | |
3029 | |
3030 | |
3031 switch (type) | |
3032 { | |
3033 /* | |
3034 * N-Lock | |
3035 */ | |
3036 case MFW_SIM_NLOCK: | |
3037 #ifdef MMI_34324 | |
3038 simlock_status= aci_slock_unlock(SIMLOCK_NETWORK, (char*)passwd); | |
3039 #endif | |
3040 mfw_simlock_status = sim_convert_simlock_status(simlock_status); | |
3041 switch(mfw_simlock_status) | |
3042 { | |
3043 case (MFW_SIM_DISABLE): return MFW_SIM_NLOCK; | |
3044 case(MFW_SIM_LOCKED): return MFW_SIM_UNLOCK_ERR; | |
3045 default: return MFW_SIM_UNLOCK_ERR; | |
3046 } | |
3047 // break; // RAVI | |
3048 | |
3049 /* | |
3050 * SP-Lock | |
3051 */ | |
3052 case MFW_SIM_SPLOCK: | |
3053 #ifdef MMI_34324 | |
3054 simlock_status = aci_slock_unlock(SIMLOCK_SERVICE_PROVIDER, (char*)passwd); | |
3055 #endif | |
3056 mfw_simlock_status = sim_convert_simlock_status(simlock_status); | |
3057 switch(mfw_simlock_status) | |
3058 { | |
3059 | |
3060 case (MFW_SIM_DISABLE): return MFW_SIM_SPLOCK; | |
3061 case(MFW_SIM_LOCKED): return MFW_SIM_UNLOCK_ERR; | |
3062 default: return MFW_SIM_UNLOCK_ERR; | |
3063 } | |
3064 // break; // RAVI | |
3065 | |
3066 /* | |
3067 * NS-Lock | |
3068 */ | |
3069 case MFW_SIM_NSLOCK: | |
3070 #ifdef MMI_34324 | |
3071 simlock_status = aci_slock_unlock(SIMLOCK_NETWORK_SUBSET, (char*)passwd); | |
3072 #endif | |
3073 mfw_simlock_status = sim_convert_simlock_status(simlock_status); | |
3074 switch(mfw_simlock_status) | |
3075 { | |
3076 | |
3077 case (MFW_SIM_DISABLE): return MFW_SIM_NSLOCK; | |
3078 case(MFW_SIM_LOCKED): return MFW_SIM_UNLOCK_ERR; | |
3079 default: return MFW_SIM_UNLOCK_ERR; | |
3080 } | |
3081 // break; // RAVI | |
3082 | |
3083 /* | |
3084 * C-Lock | |
3085 */ | |
3086 case MFW_SIM_CLOCK: | |
3087 #ifdef MMI_34324 | |
3088 simlock_status = aci_slock_unlock(SIMLOCK_CORPORATE, (char*)passwd); | |
3089 #endif | |
3090 mfw_simlock_status = sim_convert_simlock_status(simlock_status); | |
3091 switch(mfw_simlock_status) | |
3092 { | |
3093 | |
3094 case (MFW_SIM_DISABLE): return MFW_SIM_CLOCK; | |
3095 case(MFW_SIM_LOCKED): return MFW_SIM_UNLOCK_ERR; | |
3096 default: return MFW_SIM_UNLOCK_ERR; | |
3097 } | |
3098 // break; // RAVI | |
3099 | |
3100 /* | |
3101 * P-Lock | |
3102 */ | |
3103 case MFW_SIM_PLOCK: | |
3104 | |
3105 #ifdef MMI_34324 | |
3106 simlock_status = aci_slock_unlock( SIMLOCK_SIM, (char*)passwd); | |
3107 #endif | |
3108 mfw_simlock_status = sim_convert_simlock_status(simlock_status); | |
3109 switch(mfw_simlock_status) | |
3110 { | |
3111 case (MFW_SIM_DISABLE): return MFW_SIM_PLOCK; | |
3112 case(MFW_SIM_LOCKED): return MFW_SIM_UNLOCK_ERR; | |
3113 default:return MFW_SIM_UNLOCK_ERR; | |
3114 } | |
3115 // break; // RAVI | |
3116 | |
3117 } | |
3118 | |
3119 return MFW_SIM_UNLOCK_ERR; | |
3120 } | |
3121 | |
3122 /* | |
3123 +---------------------------------------------------------------------+ | |
3124 | PROJECT : MMI-Framework (8417) MODULE : MFW_SIM | | |
3125 | STATE : code ROUTINE : sim_check_sim_Plock | | |
3126 +---------------------------------------------------------------------+ | |
3127 | |
3128 PURPOSE : check SIM lock | |
3129 | |
3130 */ | |
3131 /*MC SPR1351, replaced previous implemnetation with wrapper for aci implementation*/ | |
3132 int sim_check_sim_Plock (void) | |
3133 { T_SIMLOCK_STATUS simlock_status = SIMLOCK_DISABLED; | |
3134 /*ACI set default value for CQ-34324--While Integrating of VLE5 ME personalization code | |
3135 aci_slock_checklock function is removed and this function is never called. So variable | |
3136 simlock_status is hardcoded to default value | |
3137 */ | |
3138 | |
3139 TRACE_EVENT ("sim_check_sim_Plock"); | |
3140 #ifdef MMI_34324 | |
3141 simlock_status =aci_slock_checklock(SIMLOCK_SIM); | |
3142 #endif | |
3143 TRACE_EVENT_P1("PLock: %d", simlock_status); | |
3144 /*convert status from ACI to MFW encoding*/ | |
3145 return sim_convert_simlock_status(simlock_status); | |
3146 | |
3147 } | |
3148 | |
3149 | |
3150 /* | |
3151 +---------------------------------------------------------------------+ | |
3152 | PROJECT : MMI-Framework (8417) MODULE : MFW_SIM | | |
3153 | STATE : code ROUTINE : sim_check_sim_Nlock | | |
3154 +---------------------------------------------------------------------+ | |
3155 | |
3156 PURPOSE : Check network lock | |
3157 | |
3158 */ | |
3159 /*MC SPR1351, replaced previous implemnetation with wrapper for aci implementation*/ | |
3160 int sim_check_sim_Nlock (void) | |
3161 { T_SIMLOCK_STATUS simlock_status = SIMLOCK_DISABLED; | |
3162 /*ACI set default value for CQ-34324--While Integrating of VLE5 ME personalization code | |
3163 aci_slock_checklock function is removed and this function is never called. So variable | |
3164 simlock_status is hardcoded to default value | |
3165 */ | |
3166 TRACE_EVENT ("sim_check_sim_Nlock()"); | |
3167 #ifdef MMI_34324 | |
3168 simlock_status =aci_slock_checklock(SIMLOCK_NETWORK); | |
3169 #endif | |
3170 TRACE_EVENT_P1("NLock: %d", simlock_status); | |
3171 /*convert status from ACI to MFW encoding*/ | |
3172 return sim_convert_simlock_status(simlock_status); | |
3173 | |
3174 | |
3175 } | |
3176 | |
3177 | |
3178 /* | |
3179 +---------------------------------------------------------------------+ | |
3180 | PROJECT : MMI-Framework (8417) MODULE : MFW_SIM | | |
3181 | STATE : code ROUTINE : sim_check_sim_SPlock| | |
3182 +---------------------------------------------------------------------+ | |
3183 | |
3184 PURPOSE : Check SIM service provider lock. It only works with SIMs | |
3185 which support GID1 file. | |
3186 | |
3187 */ | |
3188 /*MC SPR1351, replaced previous implemnetation with wrapper for aci implementation*/ | |
3189 int sim_check_sim_SPlock (void) | |
3190 { T_SIMLOCK_STATUS simlock_status = SIMLOCK_DISABLED; | |
3191 /*ACI set default value for CQ-34324--While Integrating of VLE5 ME personalization code | |
3192 aci_slock_checklock function is removed and this function is never called. So variable | |
3193 simlock_status is hardcoded to default value | |
3194 */ | |
3195 TRACE_EVENT ("sim_check_sim_SPlock()"); | |
3196 | |
3197 #ifdef MMI_34324 | |
3198 simlock_status =aci_slock_checklock(SIMLOCK_SERVICE_PROVIDER); | |
3199 #endif | |
3200 | |
3201 TRACE_EVENT_P1("NLock: %d", simlock_status); | |
3202 /*convert status from ACI to MFW encoding*/ | |
3203 return sim_convert_simlock_status(simlock_status); | |
3204 | |
3205 } | |
3206 | |
3207 | |
3208 /* | |
3209 +---------------------------------------------------------------------+ | |
3210 | PROJECT : MMI-Framework (8417) MODULE : MFW_SIM | | |
3211 | STATE : code ROUTINE : sim_check_sim_NSlock| | |
3212 +---------------------------------------------------------------------+ | |
3213 | |
3214 PURPOSE : Check network subset lock | |
3215 | |
3216 */ | |
3217 /*MC SPR1351, replaced previous implementation with wrapper for aci implementation*/ | |
3218 int sim_check_sim_NSlock (void) | |
3219 { T_SIMLOCK_STATUS simlock_status = SIMLOCK_DISABLED; | |
3220 /*ACI set default value for CQ-34324--While Integrating of VLE5 ME personalization code | |
3221 aci_slock_checklock function is removed and this function is never called. So variable | |
3222 simlock_status is hardcoded to default value | |
3223 */ | |
3224 TRACE_EVENT ("sim_check_sim_NSlock()"); | |
3225 | |
3226 #ifdef MMI_34324 | |
3227 simlock_status =aci_slock_checklock(SIMLOCK_NETWORK_SUBSET); | |
3228 #endif | |
3229 TRACE_EVENT_P1("NSLock: %d", simlock_status); | |
3230 | |
3231 /*convert status from ACI to MFW encoding*/ | |
3232 return sim_convert_simlock_status(simlock_status); | |
3233 } | |
3234 | |
3235 /* | |
3236 +---------------------------------------------------------------------+ | |
3237 | PROJECT : MMI-Framework (8417) MODULE : MFW_SIM | | |
3238 | STATE : code ROUTINE : sim_check_sim_Clock | | |
3239 +---------------------------------------------------------------------+ | |
3240 | |
3241 PURPOSE : Check corporate lock. It only works with SIMs | |
3242 which support GID1 and GID2 files. | |
3243 | |
3244 */ | |
3245 /*MC SPR1351, replaced previous implemnetation with wrapper for aci implementation*/ | |
3246 int sim_check_sim_Clock (void) | |
3247 { T_SIMLOCK_STATUS simlock_status = SIMLOCK_DISABLED; | |
3248 /*ACI set default value for CQ-34324--While Integrating of VLE5 ME personalization code | |
3249 aci_slock_checklock function is removed and this function is never called. So variable | |
3250 simlock_status is hardcoded to default value | |
3251 */ | |
3252 TRACE_EVENT ("sim_check_sim_Clock()"); | |
3253 #ifdef MMI_34324 | |
3254 simlock_status =aci_slock_checklock(SIMLOCK_CORPORATE); | |
3255 #endif | |
3256 TRACE_EVENT_P1("CLock: %d", simlock_status); | |
3257 /*convert status from ACI to MFW encoding*/ | |
3258 return sim_convert_simlock_status(simlock_status); | |
3259 } | |
3260 | |
3261 | |
3262 | |
3263 /* | |
3264 +--------------------------------------------------------------------+ | |
3265 | PROJECT : MMI-Framework (8417) MODULE : MFW_SIM | | |
3266 | STATE : code ROUTINE : sim_pin_status | | |
3267 +--------------------------------------------------------------------+ | |
3268 | |
3269 PURPOSE : Request PIN1/PIN2 status | |
3270 | |
3271 */ | |
3272 | |
3273 void sim_pin_status(T_MFW_SIM_PIN_STATUS *status) | |
3274 { | |
3275 SHORT pn1Cnt; | |
3276 SHORT pn2Cnt; | |
3277 SHORT pk1Cnt; | |
3278 SHORT pk2Cnt; | |
3279 T_ACI_PVRF_STAT ps1; | |
3280 T_ACI_PVRF_STAT ps2; | |
3281 // char debug[30]; // RAVI | |
3282 TRACE_FUNCTION("sim_pin_status()"); | |
3283 | |
3284 status->stat = MFW_SIM_UNKNOWN; | |
3285 status->set = MFW_SIM_UNKNOWN; | |
3286 | |
3287 if (qAT_PercentPVRF(CMD_SRC_LCL, &pn1Cnt, | |
3288 &pn2Cnt, &pk1Cnt, &pk2Cnt, &ps1, &ps2) == AT_CMPL) | |
3289 { | |
3290 switch (status->type) | |
3291 { | |
3292 case MFW_SIM_PIN1: | |
3293 /*CONQ 5578, check service table to see if allowed to disable PIN1*/ | |
3294 if (!psaSIM_ChkSIMSrvSup(SRV_CHV1_Disable)) | |
3295 { | |
3296 status->stat = MFW_SIM_NO_DISABLE; | |
3297 } | |
3298 else | |
3299 { | |
3300 status->stat = sim_cvtPINstatus(ps1, MFW_SIM_PIN1); | |
3301 } | |
3302 status->set = pin1_set; | |
3303 break; | |
3304 case MFW_SIM_PIN2: | |
3305 status->stat = sim_cvtPINstatus(ps2, MFW_SIM_PIN2); | |
3306 status->set = pin2_set; | |
3307 break; | |
3308 } | |
3309 } | |
3310 } | |
3311 | |
3312 | |
3313 /* | |
3314 +--------------------------------------------------------------------+ | |
3315 | PROJECT : MMI-Framework (8417) MODULE : MFW_SIM | | |
3316 | STATE : code ROUTINE : sim_cvtPINstatus | | |
3317 +--------------------------------------------------------------------+ | |
3318 | |
3319 PURPOSE : | |
3320 | |
3321 */ | |
3322 | |
3323 UBYTE sim_cvtPINstatus(T_ACI_PVRF_STAT ps, UBYTE type) | |
3324 { | |
3325 TRACE_FUNCTION("sim_cvtPINstatus()"); | |
3326 | |
3327 switch (ps) | |
3328 { | |
3329 case PVRF_STAT_NotRequired: | |
3330 return MFW_SIM_NO_PIN; | |
3331 case PVRF_STAT_Required: | |
3332 if (type EQ MFW_SIM_PIN1) | |
3333 return MFW_SIM_PIN_REQ; | |
3334 if (type EQ MFW_SIM_PIN2) | |
3335 return MFW_SIM_PIN2_REQ; | |
3336 return MFW_SIM_UNKNOWN; | |
3337 default: | |
3338 return MFW_SIM_UNKNOWN; | |
3339 } | |
3340 } | |
3341 | |
3342 | |
3343 /* | |
3344 +--------------------------------------------------------------------+ | |
3345 | PROJECT : MMI-Framework (8417) MODULE : MFW_SIM | | |
3346 | STATE : code ROUTINE : simDecodeIMSI | | |
3347 +--------------------------------------------------------------------+ | |
3348 | |
3349 PURPOSE : convert imsi (packed bcd to ASCIIZ; ->11.11) | |
3350 | |
3351 */ | |
3352 | |
3353 void simDecodeIMSI (UBYTE * imsi_field, | |
3354 UBYTE imsi_c_field, | |
3355 UBYTE * imsi_extracted) | |
3356 { | |
3357 UBYTE length; | |
3358 UBYTE i; | |
3359 UBYTE digit; | |
3360 | |
3361 TRACE_FUNCTION ("simDecodeImsi()"); | |
3362 | |
3363 /* | |
3364 * calculate number of digits | |
3365 */ | |
3366 length = (imsi_c_field-1)*2; | |
3367 | |
3368 /* | |
3369 * if odd number of digits add one | |
3370 */ | |
3371 if (imsi_field[0] & 0x08) | |
3372 length++; | |
3373 | |
3374 /* | |
3375 * extract all digits | |
3376 */ | |
3377 for (i = 0; i < length; i++) | |
3378 { | |
3379 digit = (i & 1) ? | |
3380 imsi_field[(i + 1) / 2] & 0x0f : | |
3381 (imsi_field[(i + 1) / 2] & 0xf0) >> 4; | |
3382 | |
3383 #if defined (WIN32) | |
3384 { | |
3385 /***************************Go-lite Optimization changes Start***********************/ | |
3386 //Aug 16, 2004 REF: CRR 24323 Deepa M.D | |
3387 TRACE_EVENT_P2("DIGIT [%d] = %d",i, digit); | |
3388 /***************************Go-lite Optimization changes end***********************/ | |
3389 } | |
3390 #endif | |
3391 if (i < LONG_NAME) | |
3392 imsi_extracted [i] = digit + 0x30; | |
3393 else | |
3394 { | |
3395 imsi_extracted [i] = 0; | |
3396 return; | |
3397 } | |
3398 } | |
3399 } | |
3400 | |
3401 /* | |
3402 +--------------------------------------------------------------------+ | |
3403 | PROJECT : MMI-Framework (8417) MODULE : MFW_SIM | | |
3404 | STATE : code ROUTINE : sim_pin_ident | | |
3405 +--------------------------------------------------------------------+ | |
3406 | |
3407 PURPOSE : handle mfw windows command | |
3408 | |
3409 */ | |
3410 | |
3411 void sim_pin_ident(UBYTE id) | |
3412 { | |
3413 TRACE_FUNCTION("sim_pin_ident()"); | |
3414 pin_ident = id; | |
3415 } | |
3416 | |
3417 | |
3418 | |
3419 /* | |
3420 +--------------------------------------------------------------------+ | |
3421 | PROJECT : MMI-Framework (8417) MODULE : MFW_SIM | | |
3422 | STATE : code ROUTINE : simCommand | | |
3423 +--------------------------------------------------------------------+ | |
3424 | |
3425 PURPOSE : handle mfw windows command | |
3426 | |
3427 */ | |
3428 | |
3429 static int simCommand (U32 cmd, void *h) | |
3430 { | |
3431 switch (cmd) | |
3432 { | |
3433 case MfwCmdDelete: /* delete me */ | |
3434 if (!h) | |
3435 return 0; | |
3436 sim_delete(h); | |
3437 return 1; | |
3438 default: | |
3439 break; | |
3440 } | |
3441 | |
3442 return 0; | |
3443 } | |
3444 | |
3445 | |
3446 | |
3447 | |
3448 | |
3449 | |
3450 | |
3451 /* | |
3452 +--------------------------------------------------------------------+ | |
3453 | PROJECT : MMI-Framework (8417) MODULE : MFW_SIM | | |
3454 | STATE : code ROUTINE : sim_simlock_ok | | |
3455 +--------------------------------------------------------------------+ | |
3456 | |
3457 PURPOSE : The function checks all simlocks and returns SIMLOCK_DISABLED | |
3458 if none are set. | |
3459 | |
3460 */ | |
3461 /*spr 1351, replaced previous implemntation with a wrapper for aci implentation*/ | |
3462 UBYTE sim_simlock_ok (void) | |
3463 { | |
3464 T_SIMLOCK_STATUS simlock_status = SIMLOCK_ENABLED; | |
3465 /*ACI set default value for CQ-34324 -- While Integrating of VLE5 ME personalization code | |
3466 aci_slock_checkpersonalisation function is moved under SIM_PERS flag and this function is | |
3467 never called . So variable simlock_status is hardcoded to default value */ | |
3468 #ifdef MMI_34324 | |
3469 simlock_status = aci_slock_checkpersonalisation(); | |
3470 #endif | |
3471 return sim_convert_simlock_status(simlock_status); | |
3472 | |
3473 } | |
3474 | |
3475 void mfwSimRestartPinEntry(void) | |
3476 { | |
3477 sim_signal(E_SIM_STATUS, &sim_status); | |
3478 return; | |
3479 } | |
3480 | |
3481 /* | |
3482 +--------------------------------------------------------------------+ | |
3483 | PROJECT : MMI-Framework (8417) MODULE : MFW_SIM | | |
3484 | STATE : code ROUTINE : sim_get_imsi | | |
3485 +--------------------------------------------------------------------+ | |
3486 | |
3487 PURPOSE : Request IMSI number in SIM card | |
3488 | |
3489 */ | |
3490 | |
3491 UBYTE * sim_get_imsi (void) | |
3492 { | |
3493 return mfw_IMSI; | |
3494 } | |
3495 | |
3496 /* | |
3497 +---------------------------------------------------------------------+ | |
3498 | PROJECT : MMI-Framework (8417) MODULE : MFW_SIM | | |
3499 | STATE : code ROUTINE : sim_mmi_update_parameter | | |
3500 +---------------------------------------------------------------------+ | |
3501 | |
3502 PURPOSE : MMI relevant parameters from the SIM card | |
3503 | |
3504 */ | |
3505 | |
3506 void sim_mmi_update_parameter(T_SIM_ACTIVATE_IND *sim_act_ind) | |
3507 { | |
3508 TRACE_FUNCTION("sim_mmi_update_parameter()"); | |
3509 | |
3510 memcpy( sim_config.pref_lang, sim_act_ind->pref_lang, 5); | |
3511 } | |
3512 | |
3513 #ifdef SIM_TOOLKIT | |
3514 /* | |
3515 +---------------------------------------------------------------------+ | |
3516 | PROJECT : MMI-Framework (8417) MODULE : MFW_SIM | | |
3517 | STATE : code ROUTINE : sim_sat_file_update | | |
3518 +---------------------------------------------------------------------+ | |
3519 | |
3520 PURPOSE : SIM file change indication | |
3521 | |
3522 */ | |
3523 | |
3524 void sim_sat_file_update(USHORT dataId) | |
3525 { | |
3526 TRACE_FUNCTION("sim_sat_file_update()"); | |
3527 | |
3528 sat_update = TRUE; | |
3529 switch (dataId) | |
3530 { | |
3531 case SIM_SST: | |
3532 sim_read_sim(SIM_SST, NOT_PRESENT_8BIT, 10); | |
3533 break; | |
3534 case SIM_GID1: | |
3535 sim_read_sim(SIM_GID1, NOT_PRESENT_8BIT, 5); | |
3536 break; | |
3537 case SIM_GID2: | |
3538 sim_read_sim(SIM_GID2, NOT_PRESENT_8BIT, 5); | |
3539 break; | |
3540 case SIM_LP: | |
3541 { | |
3542 T_ACI_LAN_SUP lngCde; | |
3543 CHAR lang_buffer[3]; | |
3544 | |
3545 memset(lang_buffer, 0, sizeof(lang_buffer)); | |
3546 lngCde.str = lang_buffer; | |
3547 if (qAT_PlusCLAN(CMD_SRC_LCL, &lngCde) == AT_EXCT) | |
3548 return; | |
3549 #ifdef SIM_TOOLKIT | |
3550 else | |
3551 if (mfwSATLPRefresh) | |
3552 { | |
3553 sat_update = FALSE; | |
3554 mfwSATLPRefresh =FALSE; | |
3555 psaSAT_FUConfirm (0, SIM_FU_ERROR); /*If not possible, notify to the SIM */ | |
3556 } | |
3557 #endif | |
3558 } | |
3559 break; | |
3560 default: | |
3561 break; | |
3562 } | |
3563 } | |
3564 #endif | |
3565 | |
3566 /* | |
3567 +---------------------------------------------------------------------+ | |
3568 | PROJECT : MMI-Framework (8417) MODULE : MFW_SIM | | |
3569 | STATE : code ROUTINE : sim_read_sst_cnf | | |
3570 +---------------------------------------------------------------------+ | |
3571 | |
3572 PURPOSE : SIM file change indication | |
3573 | |
3574 */ | |
3575 | |
3576 void sim_read_sst_cnf (USHORT error, UBYTE *data) | |
3577 { | |
3578 TRACE_FUNCTION("sim_read_sst_cnf()"); | |
3579 | |
3580 #ifdef FF_2TO1_PS | |
3581 if (error EQ CAUSE_SIM_NO_ERROR) | |
3582 #else | |
3583 if (error EQ SIM_NO_ERROR) | |
3584 #endif | |
3585 memcpy(sim_service_table, data, sizeof(sim_service_table)); | |
3586 else | |
3587 TRACE_EVENT("SST read error"); | |
3588 | |
3589 #ifdef SIM_TOOLKIT | |
3590 if (sat_update) | |
3591 { | |
3592 sat_update = FALSE; | |
3593 satUpdateFiles ( TRUE, SIM_SST ); | |
3594 } | |
3595 #endif | |
3596 } | |
3597 | |
3598 //TISH, patch for ASTec32515/OMAPS00134509 | |
3599 //start | |
3600 void sim_invalid_ind(void) | |
3601 { | |
3602 sim_status.sim_status = MFW_SIM_INVALID_CARD; | |
3603 sim_signal(E_SIM_STATUS,&sim_status); | |
3604 } | |
3605 //end | |
3606 /* | |
3607 +--------------------------------------------------------------------+ | |
3608 | PROJECT : MMI-Framework (8417) MODULE : MFW_SIM | | |
3609 | STATE : code ROUTINE : sim_init_CPRS | | |
3610 +--------------------------------------------------------------------+ | |
3611 | |
3612 PURPOSE : initialize the ciphering indication | |
3613 | |
3614 */ | |
3615 | |
3616 UBYTE sim_init_CPRS (CallbackCPRI func, UBYTE CPRImode ) | |
3617 { | |
3618 | |
3619 //UBYTE getCPRImode; // RAVI | |
3620 | |
3621 TRACE_FUNCTION("sim_init_CPRS()"); | |
3622 | |
3623 //keep the callback function from MMI | |
3624 if (func != NULL) | |
3625 mmi_cprs_cb = func; | |
3626 else | |
3627 return FALSE; | |
3628 | |
3629 //now set the mode | |
3630 sAT_PercentCPRI (CMD_SRC_LCL, CPRImode); | |
3631 | |
3632 return TRUE; | |
3633 } | |
3634 | |
3635 | |
3636 /* | |
3637 +--------------------------------------------------------------------+ | |
3638 | PROJECT : MMI-Framework (8417) MODULE : MFW_SIM | | |
3639 | STATE : code ROUTINE : rAT_PercentCPRI | | |
3640 +--------------------------------------------------------------------+ | |
3641 | |
3642 PURPOSE : is called to inform the application about a received ciphering indication. | |
3643 gsm_ciph and gprs_ciph are used to inform the application about a change in ciphering | |
3644 mode in GSM or GPRS. | |
3645 | |
3646 */ | |
3647 | |
3648 | |
3649 void rAT_PercentCPRI (UBYTE gsm_ciph, UBYTE gprs_ciph) | |
3650 { | |
3651 | |
3652 //call here the function from MMI | |
3653 mmi_cprs_cb(gsm_ciph, gprs_ciph); | |
3654 } | |
3655 | |
3656 /* | |
3657 +---------------------------------------------------------------------+ | |
3658 | PROJECT : MMI-Framework (8417) MODULE : MFW_SIM | | |
3659 | STATE : code ROUTINE : sim_read_lp_cnf | | |
3660 +---------------------------------------------------------------------+ | |
3661 | |
3662 PURPOSE : | |
3663 | |
3664 */ | |
3665 | |
3666 void sim_read_lp_cnf (USHORT error, T_ACI_LAN_SUP *CLang) | |
3667 { | |
3668 TRACE_FUNCTION("sim_read_lp_cnf()"); | |
3669 | |
3670 | |
3671 #ifdef SIM_TOOLKIT | |
3672 if ((mfwSATLPRefresh)&&(sat_update)) | |
3673 { | |
3674 mfwSATLPRefresh= FALSE; | |
3675 sat_update = FALSE; | |
3676 #ifdef FF_2TO1_PS | |
3677 if (error EQ CAUSE_SIM_NO_ERROR) | |
3678 #else | |
3679 if (error EQ SIM_NO_ERROR) | |
3680 #endif | |
3681 satUpdateFiles ( TRUE, SIM_SST ); | |
3682 else | |
3683 psaSAT_FUConfirm (0, SIM_FU_ERROR); /*If not possible, notify to the SIM */ | |
3684 } | |
3685 #endif | |
3686 } | |
3687 | |
3688 /* | |
3689 +---------------------------------------------------------------------+ | |
3690 | PROJECT : MMI-Framework (8417) MODULE : MFW_SIM | | |
3691 | STATE : code ROUTINE : sim_simlock_cpin_code | | |
3692 +---------------------------------------------------------------------+ | |
3693 | |
3694 PURPOSE : This function checks for the code and take action for SIMP category unlocking | |
3695 */ | |
3696 #ifdef SIM_PERS | |
3697 void sim_simlock_cpin_code (T_ACI_CPIN_RSLT code) | |
3698 { | |
3699 TRACE_FUNCTION("sim_simlock_cpin_code()"); | |
3700 | |
3701 sim_status.sim_procedure = MFW_SIM_ACTIVATION; | |
3702 sim_status.sim_operation_mode = sim_config.oper_mode; | |
3703 sim_status.sim_pin_retries = 0; | |
3704 sim_stat = SIM_ACTIVE; | |
3705 pin_flag = -1; | |
3706 pin_ident = MFW_SIM_UNKNOWN; | |
3707 | |
3708 if( code EQ CPIN_RSLT_SimReady ) | |
3709 { | |
3710 TRACE_EVENT("CPIN_RSLT_SimReady"); | |
3711 sim_status.sim_status = MFW_SIM_NO_PIN; | |
3712 sim_status.sim_status_type = pin_ident; | |
3713 pin_ident = MFW_SIM_UNKNOWN; | |
3714 simp_cpin_flag = FALSE; | |
3715 sim_signal(E_SIM_STATUS,&sim_status); | |
3716 return ; | |
3717 } | |
3718 switch ( code ) | |
3719 { | |
3720 case CPIN_RSLT_PhSimPinReq: | |
3721 sim_status.sim_status = MFW_SIM_PLOCK_REQ; | |
3722 sim_status.sim_status_type = MFW_SIM_LOCKED ; | |
3723 sim_signal(E_SIM_STATUS,&sim_status); | |
3724 break; | |
3725 | |
3726 case CPIN_RSLT_PhNetPinReq: | |
3727 sim_status.sim_status = MFW_SIM_NLOCK_REQ; | |
3728 sim_status.sim_status_type = MFW_SIM_LOCKED; | |
3729 sim_signal(E_SIM_STATUS,&sim_status); | |
3730 break; | |
3731 | |
3732 case CPIN_RSLT_PhNetSubPinReq: | |
3733 sim_status.sim_status = MFW_SIM_NSLOCK_REQ; | |
3734 sim_status.sim_status_type = MFW_SIM_LOCKED; | |
3735 sim_signal(E_SIM_STATUS,&sim_status); | |
3736 break; | |
3737 | |
3738 case CPIN_RSLT_PhSPPinReq: | |
3739 sim_status.sim_status = MFW_SIM_SPLOCK_REQ; | |
3740 sim_status.sim_status_type = MFW_SIM_LOCKED; | |
3741 sim_signal(E_SIM_STATUS,&sim_status); | |
3742 break; | |
3743 | |
3744 case CPIN_RSLT_PhCorpPinReq: | |
3745 sim_status.sim_status = MFW_SIM_CLOCK_REQ; | |
3746 sim_status.sim_status_type = MFW_SIM_LOCKED; | |
3747 sim_signal(E_SIM_STATUS,&sim_status); | |
3748 break; | |
3749 | |
3750 case CPIN_RSLT_PhNetPukReq: | |
3751 case CPIN_RSLT_PhNetSubPukReq: | |
3752 case CPIN_RSLT_PhSPPukReq: | |
3753 case CPIN_RSLT_PhCorpPukReq: | |
3754 case CPIN_RSLT_PhSimFail: | |
3755 C_KEY_REQ = 1; | |
3756 sim_status.sim_status = MFW_SIM_PUK_REQ; | |
3757 sim_status.sim_pin_retries = sim_pin_count(MFW_SIM_PUK1); | |
3758 sim_status.sim_status_type = MFW_SIM_PUK1; | |
3759 sim_status.sim_procedure = MFW_SIM_ACTIVATION; | |
3760 sim_signal(E_SIM_STATUS,&sim_status); | |
3761 break; | |
3762 | |
3763 //x0pleela 25 Sep, 2006 ER: OMAPS00095524 | |
3764 //Set the reqd. parameters for Blocked Network Password request | |
3765 case CPIN_RSLT_PhBlockedNetPinReq: | |
3766 sim_status.sim_status = MFW_SIM_PBLOCK_REQ; | |
3767 sim_status.sim_status_type = MFW_SIM_LOCKED; | |
3768 sim_signal(E_SIM_STATUS,&sim_status); | |
3769 break; | |
3770 | |
3771 //x0pleela 25 Sep, 2006 ER: OMAPS00095524 | |
3772 //Set the reqd. parameters for Blocked Network Unblock code request | |
3773 case CPIN_RSLT_PhBlockedNetPukReq: | |
3774 C_KEY_REQ = 1; | |
3775 sim_status.sim_status = MFW_SIM_PUK_REQ; | |
3776 sim_status.sim_pin_retries = sim_pin_count(MFW_SIM_PUK1); | |
3777 sim_status.sim_status_type = MFW_SIM_PUK1; | |
3778 sim_status.sim_procedure = MFW_SIM_ACTIVATION; | |
3779 sim_signal(E_SIM_STATUS,&sim_status); | |
3780 break; | |
3781 | |
3782 default: | |
3783 TRACE_ERROR("sim_simlock_cpin_code (): result"); | |
3784 break; | |
3785 } | |
3786 return ; | |
3787 } | |
3788 #endif | |
3789 | |
3790 //x0pleela 19 Feb, 2007 ER: OMAPS00122561 | |
3791 #ifdef FF_PHONE_LOCK | |
3792 | |
3793 /******************************************************************************* | |
3794 $Function: mfw_phlock_get_lock_status | |
3795 $Description: returns the status of the lock - enabled / disabled | |
3796 $Returns: lock status | |
3797 $Arguments: lock type | |
3798 | |
3799 *******************************************************************************/ | |
3800 int mfw_phlock_get_lock_status(S16 lcktyp) | |
3801 { | |
3802 T_ACI_CLSSTAT clsStat; | |
3803 T_ACI_FAC lckfac; | |
3804 | |
3805 TRACE_FUNCTION("mfw_phlock_get_lock_status()"); | |
3806 | |
3807 lckfac = FAC_Pl; | |
3808 | |
3809 if (qAT_PlusCLCK(CMD_SRC_LCL, lckfac, | |
3810 CLASS_NotPresent, &clsStat) EQ AT_CMPL) | |
3811 { | |
3812 TRACE_FUNCTION("qAT_PlusCLCK->AT_CMPL "); | |
3813 switch (clsStat.status) | |
3814 { | |
3815 case STATUS_NotActive: | |
3816 TRACE_FUNCTION("MFW_PH_LOCK_DISABLE "); | |
3817 | |
3818 //x0pleela 29 May, 2007 DR: OMAPS00132483 | |
3819 //set the phone lock status to FALSE | |
3820 mfw_set_Phlock_status(FALSE); | |
3821 return MFW_PH_LOCK_DISABLE; | |
3822 | |
3823 case STATUS_Active: | |
3824 TRACE_FUNCTION("MFW_PH_LOCK_ENABLE "); | |
3825 | |
3826 //x0pleela 29 May, 2007 DR: OMAPS00132483 | |
3827 //set the phone lock status to TRUE | |
3828 mfw_set_Phlock_status(TRUE); | |
3829 | |
3830 return MFW_PH_LOCK_ENABLE; | |
3831 } | |
3832 } | |
3833 return MFW_PH_LOCK_FAILURE; | |
3834 | |
3835 } | |
3836 | |
3837 /******************************************************************************* | |
3838 $Function: mfw_autophlock_get_lock_status | |
3839 $Description: returns the status of the lock - enabled / disabled | |
3840 $Returns: lock status | |
3841 $Arguments: lock type | |
3842 | |
3843 *******************************************************************************/ | |
3844 int mfw_phlock_get_autolock_status(S16 lcktyp) | |
3845 { | |
3846 T_ACI_CLSSTAT clsStat; | |
3847 T_ACI_FAC lckfac=FAC_NotPresent; | |
3848 | |
3849 TRACE_FUNCTION("mfw_phlock_get_lock_status()"); | |
3850 | |
3851 if( lcktyp == MFW_AUTO_PH_LOCK) | |
3852 lckfac = FAC_Apl; | |
3853 | |
3854 if (qAT_PlusCLCK(CMD_SRC_LCL, lckfac, | |
3855 CLASS_NotPresent, &clsStat) EQ AT_CMPL) | |
3856 { | |
3857 TRACE_FUNCTION("qAT_PlusCLCK->AT_CMPL "); | |
3858 switch (clsStat.status) | |
3859 { | |
3860 case STATUS_NotActive: | |
3861 TRACE_FUNCTION("MFW_PH_LOCK_DISABLE "); | |
3862 | |
3863 //x0pleela 29 May, 2007 DR: OMAPS00132483 | |
3864 //set the auto phone lock status to FALSE | |
3865 mfw_set_Auto_Phlock_status(FALSE); | |
3866 return MFW_PH_LOCK_DISABLE; | |
3867 | |
3868 case STATUS_Active: | |
3869 TRACE_FUNCTION("MFW_PH_LOCK_ENABLE "); | |
3870 | |
3871 //x0pleela 29 May, 2007 DR: OMAPS00132483 | |
3872 //set the auto phone lock status to TRUE | |
3873 mfw_set_Auto_Phlock_status(TRUE); | |
3874 return MFW_PH_LOCK_ENABLE; | |
3875 } | |
3876 } | |
3877 return MFW_PH_LOCK_FAILURE; | |
3878 | |
3879 } | |
3880 /******************************************************************************* | |
3881 $Function: mfw_phlock_enable_lock | |
3882 $Description: disables the lock with the given password for the given lock | |
3883 $Returns: success or failure | |
3884 $Arguments: type of lock and password | |
3885 | |
3886 *******************************************************************************/ | |
3887 T_MFW_SS_RETURN mfw_phlock_enable_lock(U8 *pin, S16 lcktyp) | |
3888 { | |
3889 T_ACI_FAC lckFac=FAC_NotPresent; | |
3890 T_ACI_RETURN ret; | |
3891 TRACE_FUNCTION("mfw_phlock_enable_lock()"); | |
3892 if( lcktyp == MFW_AUTO_PH_LOCK ) | |
3893 lckFac = FAC_Apl; | |
3894 else if ( lcktyp == MFW_PH_LOCK ) | |
3895 lckFac = FAC_Pl; | |
3896 | |
3897 ret = sAT_PlusCLCK(CMD_SRC_LCL,lckFac,CLCK_MOD_Lock,(char*)pin,CLASS_NotPresent); | |
3898 switch(ret) | |
3899 { | |
3900 case AT_CMPL: | |
3901 return MFW_SS_OK; | |
3902 case AT_FAIL: | |
3903 return MFW_SS_FAIL; | |
3904 } | |
3905 return MFW_SS_FAIL; | |
3906 } | |
3907 | |
3908 /******************************************************************************* | |
3909 $Function: mfw_phlock_disable_lock | |
3910 $Description: disables the lock with the given password for the given lock | |
3911 $Returns: success or failure | |
3912 $Arguments: type of lock and password | |
3913 | |
3914 *******************************************************************************/ | |
3915 T_MFW_SS_RETURN mfw_phlock_disable_lock(U8 *pin, S16 lcktyp) | |
3916 { | |
3917 T_ACI_FAC lckFac=FAC_NotPresent; | |
3918 T_ACI_RETURN ret; | |
3919 | |
3920 TRACE_FUNCTION("mfw_phlock_disable_lock()"); | |
3921 if( lcktyp == MFW_PH_LOCK ) | |
3922 lckFac = FAC_Pl; | |
3923 | |
3924 ret = sAT_PlusCLCK(CMD_SRC_LCL,lckFac,CLCK_MOD_Unlock,(char*)pin,CLASS_NotPresent) ; | |
3925 if(ret != AT_CMPL) | |
3926 return MFW_SS_FAIL; | |
3927 else | |
3928 return MFW_SS_OK; | |
3929 } | |
3930 | |
3931 /******************************************************************************* | |
3932 $Function: mfw_phlock_disable_autoLock | |
3933 $Description: disables the auto lock when user selects Autolock Off option from menu | |
3934 $Returns: success or failure | |
3935 $Arguments: type of lock and password | |
3936 | |
3937 *******************************************************************************/ | |
3938 T_MFW_SS_RETURN mfw_phlock_disable_autoLock( S16 lcktyp) | |
3939 { | |
3940 T_ACI_FAC lckFac=FAC_NotPresent; | |
3941 T_ACI_RETURN ret; | |
3942 | |
3943 TRACE_FUNCTION("mfw_phlock_disable_lock()"); | |
3944 if( lcktyp == MFW_AUTO_PH_LOCK ) | |
3945 lckFac = FAC_Apl; | |
3946 | |
3947 if( mfw_phlock_get_autolock_status(MFW_AUTO_PH_LOCK) == MFW_PH_LOCK_ENABLE ) | |
3948 { | |
3949 ret = sAT_PlusCLCK(CMD_SRC_LCL,lckFac,CLCK_MOD_Unlock,NULL,CLASS_NotPresent) ; | |
3950 | |
3951 if(ret != AT_CMPL) | |
3952 return MFW_SS_FAIL; | |
3953 else | |
3954 return MFW_SS_OK; | |
3955 } | |
3956 else | |
3957 { | |
3958 return MFW_SS_ALRDY_DIS; | |
3959 } | |
3960 } | |
3961 | |
3962 /******************************************************************************* | |
3963 $Function: mfw_phlock_change_lock_code | |
3964 $Description: Changes the oldpassword with the new one for the given | |
3965 lock type | |
3966 $Returns: success or failure | |
3967 $Arguments: type of lock and old and new password | |
3968 | |
3969 *******************************************************************************/ | |
3970 T_MFW mfw_phlock_change_lock_code(int type,char*oldpswd,char* newpswd) | |
3971 { | |
3972 T_ACI_FAC lckType=FAC_NotPresent; | |
3973 T_ACI_RETURN ret; | |
3974 | |
3975 TRACE_FUNCTION("mfw_phlock_change_lock_code()"); | |
3976 if(type == MFW_PH_LOCK ) | |
3977 lckType= FAC_Pl; | |
3978 | |
3979 ret = sAT_PlusCPWD(CMD_SRC_LCL, lckType, (char *)oldpswd,(char *)newpswd); | |
3980 TRACE_EVENT_P1("mfw_phlock_change_lock_code:ret: %d", ret); | |
3981 if( ret != AT_CMPL ) | |
3982 { | |
3983 TRACE_FUNCTION("mfw_phlock_change_lock_code: FAILED"); | |
3984 return MFW_SS_FAIL; | |
3985 } | |
3986 else | |
3987 { | |
3988 TRACE_FUNCTION("mfw_phlock_change_lock_code: SUCCESS"); | |
3989 return MFW_SS_OK; | |
3990 } | |
3991 } | |
3992 | |
3993 /******************************************************************************* | |
3994 | |
3995 $Function: mfw_set_Auto_Phlock_status | |
3996 | |
3997 $Description: set /resets the AutoPhlockStatus bit in Phlock_flag | |
3998 | |
3999 $Returns: none. | |
4000 | |
4001 $Arguments: | |
4002 | |
4003 *******************************************************************************/ | |
4004 //x0pleela 29 May, 2007 DR: OMAPS00132483 | |
4005 GLOBAL void mfw_set_Auto_Phlock_status( int phlock_status) | |
4006 { | |
4007 TRACE_FUNCTION("mfw_set_Auto_Phlock_status()"); | |
4008 if( phlock_status ) | |
4009 Phlock_flag |= AutoPhlockStatus; | |
4010 else | |
4011 Phlock_flag &= Phlock_ResetFlag; | |
4012 return; | |
4013 } | |
4014 | |
4015 /******************************************************************************* | |
4016 | |
4017 $Function: mfw_get_Auto_Phlock_status | |
4018 | |
4019 $Description: returns the AutoPhlockStatus status from Phlock_flag | |
4020 | |
4021 $Returns: none. | |
4022 | |
4023 $Arguments: | |
4024 | |
4025 *******************************************************************************/ | |
4026 //x0pleela 29 May, 2007 DR: OMAPS00132483 | |
4027 GLOBAL int mfw_get_Auto_Phlock_status(void) | |
4028 { | |
4029 TRACE_FUNCTION("mfw_get_Auto_Phlock_status()"); | |
4030 if( (Phlock_flag & AutoPhlockStatus) == AutoPhlockStatus) | |
4031 return TRUE; | |
4032 else | |
4033 return FALSE; | |
4034 } | |
4035 | |
4036 | |
4037 /******************************************************************************* | |
4038 | |
4039 $Function: mfw_set_Phlock_status | |
4040 | |
4041 $Description: set /resets the PhlockStatus bit in Phlock_flag | |
4042 | |
4043 $Returns: none. | |
4044 | |
4045 $Arguments: | |
4046 | |
4047 *******************************************************************************/ | |
4048 //x0pleela 29 May, 2007 DR: OMAPS00132483 | |
4049 GLOBAL void mfw_set_Phlock_status( int phlock_status) | |
4050 { | |
4051 TRACE_FUNCTION("mfw_set_Phlock_status()"); | |
4052 if( phlock_status ) | |
4053 Phlock_flag |= PhlockStatus; | |
4054 else | |
4055 Phlock_flag &= Phlock_ResetFlag; | |
4056 return; | |
4057 } | |
4058 | |
4059 /******************************************************************************* | |
4060 | |
4061 $Function: mfw_get_Phlock_status | |
4062 | |
4063 $Description: returns the PhlockStatus status from Phlock_flag | |
4064 | |
4065 $Returns: none. | |
4066 | |
4067 $Arguments: | |
4068 | |
4069 *******************************************************************************/ | |
4070 //x0pleela 29 May, 2007 DR: OMAPS00132483 | |
4071 GLOBAL int mfw_get_Phlock_status(void) | |
4072 { | |
4073 TRACE_FUNCTION("mfw_get_Phlock_status()"); | |
4074 if( (Phlock_flag & PhlockStatus) == PhlockStatus) | |
4075 return TRUE; | |
4076 else | |
4077 return FALSE; | |
4078 } | |
4079 #endif /* FF_PHONE_LOCK */ | |
4080 |