FreeCalypso > hg > fc-magnetite
comparison src/ui3/bmi/AUIPinEditor.c @ 420:e8ddbb0837ed
src/ui3: initial import of TCS3/LoCosto BMI & MFW code
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sun, 21 Jan 2018 03:09:00 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
419:59143cd42ec7 | 420:e8ddbb0837ed |
---|---|
1 /******************************************************************************* | |
2 | |
3 CONDAT (UK) | |
4 | |
5 ******************************************************************************** | |
6 | |
7 This software product is the property of Condat (UK) Ltd and may not be | |
8 disclosed to any third party without the express permission of the owner. | |
9 | |
10 ******************************************************************************** | |
11 | |
12 $Project name: Basic MMI | |
13 $Project code: BMI (6349) | |
14 $Module: MMI | |
15 $File: AUIPinEditor.c | |
16 $Revision: 1.0 | |
17 | |
18 $Author: Condat(UK) | |
19 $Date: 22/02/01 | |
20 | |
21 ******************************************************************************** | |
22 | |
23 Description: Editor for PIN entry | |
24 | |
25 | |
26 ******************************************************************************** | |
27 | |
28 $History: AUIPinEditor.c | |
29 | |
30 xreddymn 4, Jul, 2006 OMAPS00083495 | |
31 Resolved issues reported in PIN and PUK input through BPM. | |
32 | |
33 xrashmic 1 Jul, 2006 OMAPS00075784 | |
34 The password mode to be turned on while entering the gsm string to | |
35 unblock PUK during bootup | |
36 | |
37 July 09, 2005 REF : MMI - 22565 - a0876501 | |
38 Description: Proper display of IMEI with CD byte. | |
39 Solution: Increased the IMEI length from 16 to 18. | |
40 | |
41 June 16, 2005 REF: CRR 31267 x0021334 | |
42 Description: Handset ignore the initializtion of the PIN1/PIN2 | |
43 Fix: Cheking is done to ascertain if PIN1/PIN2 are initialised. If not, appropriate | |
44 message is displayed to the user. | |
45 | |
46 May 02, 2005 REF : LOCOSTO-ENH-30818 - xpradipg | |
47 Description: IMEI retreival by posting a call to ACI sAT_xx API | |
48 Solution: The direct call to cl_get_imeisv() is replaced with the | |
49 call to the mmi_imei_retrieve() which inturn calls sAT_Dn() and | |
50 retrieves the IMEI info and stores it onto the global | |
51 variable "imei" | |
52 14/11/02 Original Condat(UK) BMI version. | |
53 $End | |
54 | |
55 *******************************************************************************/ | |
56 | |
57 #define ENTITY_MFW | |
58 | |
59 /* includes */ | |
60 #include <string.h> | |
61 #include <stdio.h> | |
62 #include <stdlib.h> | |
63 | |
64 #if defined (NEW_FRAME) | |
65 | |
66 #include "typedefs.h" | |
67 #include "vsi.h" | |
68 #include "pei.h" | |
69 #include "custom.h" | |
70 #include "gsm.h" | |
71 | |
72 #else | |
73 | |
74 #include "STDDEFS.H" | |
75 #include "custom.h" | |
76 #include "gsm.h" | |
77 #include "vsi.h" | |
78 | |
79 #endif | |
80 | |
81 #include "mfw_mfw.h" | |
82 #include "mfw_win.h" | |
83 #include "mfw_kbd.h" | |
84 #include "mfw_tim.h" | |
85 #include "mfw_phb.h" | |
86 #include "mfw_sms.h" | |
87 #include "mfw_ss.h" | |
88 #include "mfw_icn.h" | |
89 #include "mfw_mnu.h" | |
90 #include "mfw_lng.h" | |
91 #include "mfw_sat.h" | |
92 #include "mfw_kbd.h" | |
93 #include "mfw_nm.h" | |
94 #include "mfw_cm.h" | |
95 #include "mfw_sim.h" | |
96 #include "mfw_ssi.h" | |
97 | |
98 #include "dspl.h" | |
99 | |
100 #include "ksd.h" | |
101 #include "psa.h" | |
102 | |
103 #include "MmiDummy.h" | |
104 #include "MmiMmi.h" | |
105 | |
106 #include "MmiDialogs.h" | |
107 #include "MmiLists.h" | |
108 #include "MmiMenu.h" | |
109 #include "MmiSoftKeys.h" | |
110 #include "MmiIdle.h" | |
111 #include "MmiResources.h" | |
112 #include "MmiPins.h" | |
113 #include "cus_aci.h" | |
114 #include "prim.h" | |
115 #ifndef PCM_2_FFS | |
116 #include "pcm.h" | |
117 #endif | |
118 | |
119 | |
120 #include "mmiColours.h" | |
121 | |
122 #include "ATBCommon.h" | |
123 #include "ATBDisplay.h" | |
124 #include "ATBEditor.h" | |
125 #include "AUIEditor.h" | |
126 #include "AUITextEntry.h" | |
127 | |
128 #include "AUIPinEditor.h" | |
129 | |
130 //Nov 17, 2005 REF : OMAPS00045901 - a0876501 | |
131 #define IMEI_DISP_LEN 18 /* IMEI display now includes CD byte. Hence the size has been increased from 16 to 18 */ | |
132 | |
133 typedef struct | |
134 { | |
135 T_MMI_CONTROL mmi_control; | |
136 T_MFW_HND parent; // The parent window | |
137 T_MFW_HND win; // The edit window | |
138 T_MFW_HND kbd; // The keyboard handler | |
139 T_MFW_HND kbd_long; // The longpress keyboard handler | |
140 T_MFW_HND timer; // The timer for timeouts | |
141 | |
142 T_ED_DATA *editor; /* The ATB editor */ | |
143 T_AUI_EDITOR_DATA editor_data; /* The MMI editor data, provided by caller */ | |
144 T_AUI_ENTRY_DATA *entry_data; /* The MMI text entry data */ | |
145 | |
146 BOOL haveTitle; /* TRUE if a title is supplied */ | |
147 T_ATB_TEXT title; /* Title of editor */ | |
148 | |
149 BOOL hidden; | |
150 | |
151 BOOL doNextLongPress; /* Flag used to notice/not notice long keypress */ | |
152 BOOL enteredMinChars; /* Set to TRUE when at least min_enter characters have been entered */ | |
153 BOOL enteredSomeChars; /* Set to TRUE if the length of the entered data is non-zero */ | |
154 UBYTE emergency_call; /* Set to TRUE if number is an emergency call number */ | |
155 UBYTE ss_string; | |
156 char imei[IMEI_DISP_LEN];/* IMEI display now includes CD byte. Hence the size has been increased from 16 to 18 */ | |
157 } | |
158 T_AUI_PIN_DATA; | |
159 | |
160 #define AUI_MAX_PIN 16 | |
161 | |
162 // June 16, 2005 REF: CRR 31267 x0021334 | |
163 extern BOOL pin1Flag; // This flag will be needed here | |
164 | |
165 typedef struct | |
166 { | |
167 U8 pin_id; | |
168 char puk_code[AUI_MAX_PIN + 1]; | |
169 char new_pin[AUI_MAX_PIN + 1]; | |
170 char cnf_pin[AUI_MAX_PIN + 1]; | |
171 } | |
172 T_AUI_PINS; | |
173 /* LOCAL FUNCTION PROTOTYPES */ | |
174 static T_MFW_HND AUI_pin_Create(T_MFW_HND parent, T_AUI_EDITOR_DATA *editor_data); | |
175 static void AUI_pin_ExecCb(T_MFW_HND win, USHORT event, SHORT value, void *parameter); | |
176 static int AUI_pin_WinCb(T_MFW_EVENT event, T_MFW_WIN *win_data); | |
177 static int AUI_pin_KbdCb(T_MFW_EVENT event, T_MFW_KBD *keyboard); | |
178 static int AUI_pin_KbdLongCb(T_MFW_EVENT event, T_MFW_KBD *keyboard); | |
179 static UBYTE AUI_pin_CheckEmergency(T_AUI_PIN_DATA *data); | |
180 T_MFW_SS_RETURN AUI_pin_CheckSSString(T_AUI_PIN_DATA *data); | |
181 static BOOL AUI_pin_StripSSUnblock(char *cmd_string, T_AUI_PINS *pin_data); | |
182 | |
183 | |
184 | |
185 | |
186 /******************************************************************************* | |
187 | |
188 $Function: AUI_pin_Start | |
189 | |
190 $Description: Start the PIN editor. | |
191 | |
192 $Returns: None. | |
193 | |
194 $Arguments: None. | |
195 | |
196 *******************************************************************************/ | |
197 | |
198 T_MFW_HND AUI_pin_Start(T_MFW_HND parent, T_AUI_EDITOR_DATA *editor_data) | |
199 { | |
200 T_MFW_HND win; | |
201 | |
202 TRACE_FUNCTION ("AUI_pin_Start()"); | |
203 | |
204 win = AUI_pin_Create(parent, editor_data); | |
205 | |
206 return win; | |
207 } | |
208 | |
209 | |
210 /******************************************************************************* | |
211 | |
212 $Function: AUI_pin_Create | |
213 | |
214 $Description: Create the PIN editor. | |
215 | |
216 $Returns: Pointer to the editor's window. | |
217 | |
218 $Arguments: parent - The parent window. | |
219 | |
220 *******************************************************************************/ | |
221 | |
222 static T_MFW_HND AUI_pin_Create(T_MFW_HND parent, T_AUI_EDITOR_DATA *editor_data) | |
223 { | |
224 T_AUI_PIN_DATA *data; | |
225 T_MFW_WIN *win_data; | |
226 | |
227 TRACE_FUNCTION ("AUI_pin_Create()"); | |
228 TRACE_EVENT_P1("Memory left (start): %d", mfwCheckMemoryLeft()); | |
229 | |
230 data = (T_AUI_PIN_DATA *)ALLOC_MEMORY(sizeof (T_AUI_PIN_DATA)); | |
231 TRACE_EVENT_P1("Memory left (data): %d", mfwCheckMemoryLeft()); | |
232 | |
233 /* Create window handler */ | |
234 | |
235 data->win = win_create(parent, 0, E_WIN_VISIBLE, (T_MFW_CB)AUI_pin_WinCb); // Create window | |
236 TRACE_EVENT_P1("Memory left (win): %d", mfwCheckMemoryLeft()); | |
237 | |
238 if (data->win==NULL) // Make sure window exists | |
239 { | |
240 return NULL; | |
241 } | |
242 | |
243 /* Connect the dialog data to the MFW-window */ | |
244 | |
245 data->mmi_control.dialog = (T_DIALOG_FUNC)AUI_pin_ExecCb; /* Setup the destination for events */ | |
246 data->mmi_control.data = data; | |
247 data->parent = parent; | |
248 win_data = ((T_MFW_HDR *)data->win)->data; | |
249 win_data->user = (void *)data; | |
250 | |
251 data->kbd = kbd_create(data->win, KEY_ALL,(T_MFW_CB)AUI_pin_KbdCb); | |
252 data->kbd_long = kbd_create(data->win, KEY_ALL|KEY_LONG,(T_MFW_CB)AUI_pin_KbdLongCb); | |
253 data->editor = ATB_edit_Create(&data->editor_data.editor_attr,0); | |
254 TRACE_EVENT_P1("Memory left (editor): %d", mfwCheckMemoryLeft()); | |
255 data->editor_data = *editor_data; | |
256 data->entry_data = AUI_entry_Create(data->win, data->editor, E_PIN_UPDATE); | |
257 TRACE_EVENT_P1("Memory left (entry): %d", mfwCheckMemoryLeft()); | |
258 SEND_EVENT(data->win, E_PIN_INIT, 0, 0); | |
259 | |
260 /* Return window handle */ | |
261 | |
262 return data->win; | |
263 } | |
264 | |
265 | |
266 /******************************************************************************* | |
267 | |
268 $Function: AUI_pin_Destroy | |
269 | |
270 $Description: Destroy the PIN editor. | |
271 | |
272 $Returns: None. | |
273 | |
274 $Arguments: window - The editor window. | |
275 | |
276 *******************************************************************************/ | |
277 | |
278 void AUI_pin_Destroy(T_MFW_HND win) | |
279 { | |
280 T_MFW_WIN *win_data = ((T_MFW_HDR *)win)->data; | |
281 T_AUI_PIN_DATA *data = (T_AUI_PIN_DATA *)win_data->user; | |
282 | |
283 TRACE_FUNCTION("AUI_pin_Destroy"); | |
284 TRACE_EVENT_P1("Memory left at start: %d", mfwCheckMemoryLeft()); | |
285 | |
286 if (data) | |
287 { | |
288 /* Free memory allocated for title */ | |
289 | |
290 if (data->haveTitle) | |
291 { | |
292 FREE_MEMORY(data->title.data, (data->title.len+1)*ATB_string_Size(&data->title)); | |
293 TRACE_EVENT_P1("Memory left (title dest): %d", mfwCheckMemoryLeft()); | |
294 } | |
295 | |
296 /* Free text entry memory */ | |
297 | |
298 AUI_entry_Destroy(data->entry_data); | |
299 TRACE_EVENT_P1("Memory left (entry dest): %d", mfwCheckMemoryLeft()); | |
300 /* Delete window */ | |
301 | |
302 win_delete (data->win); | |
303 TRACE_EVENT_P1("Memory left (win dest): %d", mfwCheckMemoryLeft()); | |
304 /* Free editor memory */ | |
305 | |
306 ATB_edit_Destroy(data->editor); | |
307 TRACE_EVENT_P1("Memory left (editor dest): %d", mfwCheckMemoryLeft()); | |
308 /* Free Memory */ | |
309 | |
310 FREE_MEMORY ((void *)data, sizeof (T_AUI_PIN_DATA)); | |
311 TRACE_EVENT_P1("Memory left (data dest): %d", mfwCheckMemoryLeft()); | |
312 } | |
313 | |
314 return; | |
315 } | |
316 | |
317 | |
318 /******************************************************************************* | |
319 | |
320 $Function: AUI_pin_ExecCb | |
321 | |
322 $Description: Dialog function for PIN editor. | |
323 | |
324 $Returns: None. | |
325 | |
326 $Arguments: None. | |
327 | |
328 *******************************************************************************/ | |
329 | |
330 static void AUI_pin_ExecCb(T_MFW_HND win, USHORT event, SHORT value, void *parameter) | |
331 { | |
332 T_MFW_WIN *win_data = ((T_MFW_HDR *)win)->data; | |
333 T_AUI_PIN_DATA *data = (T_AUI_PIN_DATA *)win_data->user; | |
334 T_MFW_HND parent_win = data->parent; | |
335 T_ATB_TEXT text={0,0,NULL}; | |
336 /* Store these in case editor is destroyed on callback */ | |
337 USHORT Identifier = data->editor_data.Identifier; | |
338 T_AUI_EDIT_CB Callback = data->editor_data.Callback; | |
339 UBYTE destroyEditor = data->editor_data.destroyEditor; | |
340 T_AUI_PINS *pin_unblock_data; | |
341 | |
342 TRACE_FUNCTION ("AUI_pin_ExecCb()"); | |
343 | |
344 switch (event) | |
345 { | |
346 /* Initialise */ | |
347 | |
348 case E_PIN_INIT: | |
349 TRACE_EVENT("E_PIN_INIT"); | |
350 ATB_edit_Init(data->editor); | |
351 | |
352 data->haveTitle = FALSE; | |
353 | |
354 /* If we require an output line, shrink editor to fit it at bottom | |
355 * NB TitleString is assumed here to be a numeric string of ascii digits */ | |
356 | |
357 if (data->editor_data.TitleString) | |
358 { | |
359 data->haveTitle = TRUE; | |
360 text.data = data->editor_data.TitleString; | |
361 } | |
362 | |
363 /* Set up title */ | |
364 | |
365 if (data->editor_data.TitleId!=NULL) | |
366 { | |
367 data->haveTitle = TRUE; | |
368 text.data = (UBYTE *)MmiRsrcGetText(data->editor_data.TitleId); | |
369 } | |
370 | |
371 /* If title exists, get its dcs and length */ | |
372 | |
373 if (data->haveTitle) | |
374 { | |
375 if (text.data[0]==0x80) | |
376 { | |
377 text.data += 2; /* Skip over two unicode indicator bytes */ | |
378 text.dcs = ATB_DCS_UNICODE; | |
379 } | |
380 #ifdef EASY_TEXT_ENABLED | |
381 else if (Mmi_getCurrentLanguage() == CHINESE_LANGUAGE) | |
382 { | |
383 text.dcs = ATB_DCS_UNICODE; | |
384 } | |
385 #endif | |
386 else | |
387 { | |
388 text.dcs = ATB_DCS_ASCII; | |
389 } | |
390 | |
391 text.len = ATB_string_Length(&text); | |
392 /* Allocate memory for the title and copy the text there */ | |
393 data->title.data = (UBYTE *)ALLOC_MEMORY((text.len+1)*ATB_string_Size(&text)); | |
394 TRACE_EVENT_P1("Memory left (title): %d", mfwCheckMemoryLeft()); | |
395 ATB_string_Copy(&data->title, &text); | |
396 } | |
397 | |
398 /* Set flag if min_enter characters are in buffer */ | |
399 | |
400 if (data->editor_data.editor_attr.text.len >= data->editor_data.min_enter) | |
401 data->enteredMinChars = TRUE; | |
402 else | |
403 data->enteredMinChars = FALSE; | |
404 | |
405 /* Set flag if some characters are in the buffer */ | |
406 if (data->editor_data.editor_attr.text.len > 0 ) | |
407 data->enteredSomeChars = TRUE; | |
408 else | |
409 data->enteredSomeChars = FALSE; | |
410 | |
411 /* Show the window */ | |
412 win_show(data->win); | |
413 break; | |
414 | |
415 case E_PIN_UPDATE: | |
416 TRACE_EVENT("E_PIN_UPDATE"); | |
417 win_show(data->win); | |
418 break; | |
419 | |
420 case E_PIN_DEINIT: | |
421 TRACE_EVENT("E_PIN_DEINIT"); | |
422 | |
423 if (Callback) | |
424 (Callback) (parent_win, Identifier, value); | |
425 | |
426 if (destroyEditor) | |
427 AUI_pin_Destroy(data->win); | |
428 | |
429 break; | |
430 | |
431 case E_PUK1_COMPLETE: | |
432 TRACE_EVENT("E_PIN_COMPLETE"); | |
433 | |
434 pin_unblock_data = (T_AUI_PINS *)parameter; | |
435 | |
436 sim_unblock_pin(pin_unblock_data->pin_id, | |
437 pin_unblock_data->puk_code, | |
438 pin_unblock_data->new_pin); /* unblock pin1 */ | |
439 | |
440 if (destroyEditor) | |
441 AUI_pin_Destroy(data->win); | |
442 | |
443 break; | |
444 | |
445 } | |
446 | |
447 return; | |
448 } | |
449 | |
450 /******************************************************************************* | |
451 | |
452 $Function: AUI_pin_WinCb | |
453 | |
454 $Description: PIN editor window event handler. | |
455 | |
456 $Returns: None. | |
457 | |
458 $Arguments: event - the event | |
459 win - the editor window | |
460 | |
461 *******************************************************************************/ | |
462 | |
463 static int AUI_pin_WinCb(T_MFW_EVENT event, T_MFW_WIN *win_data) | |
464 { | |
465 T_AUI_PIN_DATA *data = (T_AUI_PIN_DATA *)win_data->user; | |
466 T_ED_DATA *editor = data->editor; | |
467 T_ATB_WIN_SIZE *win_size = &data->editor->attr->win_size; | |
468 T_ATB_TEXT text; | |
469 T_DS_TEXTFORMAT format; | |
470 // USHORT titleLen; // RAVI | |
471 | |
472 if (!data) | |
473 return MFW_EVENT_CONSUMED; | |
474 | |
475 switch(event) | |
476 { | |
477 case E_WIN_VISIBLE: /* window is visible */ | |
478 if (win_data->flags & E_WIN_VISIBLE) | |
479 { | |
480 if (editor->update==ED_UPDATE_TRIVIAL) | |
481 { | |
482 TRACE_EVENT("Only updating editor."); | |
483 ATB_edit_Show(data->editor); | |
484 } | |
485 else | |
486 { | |
487 TRACE_EVENT("Updating whole screen."); | |
488 | |
489 ATB_edit_Show(data->editor); | |
490 | |
491 /* Set the colour for drawing title */ | |
492 | |
493 resources_setTitleColour(COLOUR_EDITOR); | |
494 | |
495 /* TITLE - only display if update type is FULL or DEFAULT*/ | |
496 | |
497 if (editor->update!=ED_UPDATE_PARTIAL) | |
498 { | |
499 dspl_Clear(0,0, SCREEN_SIZE_X-1, win_size->py-1); | |
500 | |
501 if (data->haveTitle) | |
502 { | |
503 ATB_display_SetFormatAttr(&format, 0, FALSE); | |
504 | |
505 /* Display "Emergency?" prompt in title if emergency call */ | |
506 if (data->emergency_call) | |
507 { | |
508 text.dcs = data->title.dcs; | |
509 text.data = (UBYTE *)MmiRsrcGetText(TxtEmergency); | |
510 text.len = ATB_string_Length(&text); | |
511 ATB_display_Text(0,0,&format, &text); | |
512 } | |
513 /* Otherwise, show title */ | |
514 else | |
515 { | |
516 ATB_display_Text(0,0,&format, &data->title); | |
517 } | |
518 } | |
519 } | |
520 | |
521 /* Display Soft Keys */ | |
522 | |
523 if (data->emergency_call) | |
524 { | |
525 displaySoftKeys(TxtSoftCall, data->editor_data.RightSoftKey); | |
526 } | |
527 else | |
528 { | |
529 if (data->editor_data.editor_attr.text.len < data->editor_data.min_enter) | |
530 { | |
531 /* entered less than the required number of chars: Alternate Softkey appears */ | |
532 if (data->editor_data.editor_attr.text.len > 0) | |
533 displaySoftKeys(data->editor_data.AltLeftSoftKey,data->editor_data.RightSoftKey); | |
534 else | |
535 displaySoftKeys(data->editor_data.AltLeftSoftKey,TxtNull); | |
536 } | |
537 else | |
538 { | |
539 /* entered sufficient number of chars: Normal Softkey appears */ | |
540 | |
541 if (data->editor_data.editor_attr.text.len > 0) | |
542 displaySoftKeys(data->editor_data.LeftSoftKey,data->editor_data.RightSoftKey); | |
543 else | |
544 displaySoftKeys(data->editor_data.LeftSoftKey, TxtNull); | |
545 } | |
546 } | |
547 } | |
548 } | |
549 break; | |
550 } | |
551 | |
552 data->editor->update = ED_UPDATE_DEFAULT; | |
553 | |
554 /* x0045876, 14-Aug-2006 (WR - non-void function "AUI_pin_WinCb" should return a value) */ | |
555 return MFW_EVENT_CONSUMED ; | |
556 } | |
557 | |
558 | |
559 /******************************************************************************* | |
560 | |
561 $Function: AUI_pin_KbdCb | |
562 | |
563 $Description: PIN editor keyboard event handler | |
564 | |
565 $Returns: None. | |
566 | |
567 $Arguments: event - the keyboard event | |
568 keyboard | |
569 | |
570 *******************************************************************************/ | |
571 | |
572 static int AUI_pin_KbdCb(T_MFW_EVENT event, T_MFW_KBD *keyboard) | |
573 { | |
574 T_MFW_HND win = mfw_parent (mfw_header()); | |
575 T_MFW_WIN *win_data = ((T_MFW_HDR *)win)->data; | |
576 T_AUI_PIN_DATA *data = (T_AUI_PIN_DATA *)win_data->user; | |
577 // ED_RES result; // RAVI | |
578 UBYTE *edit_data_buf; | |
579 BOOL bRetVal; | |
580 T_AUI_PINS pin_unblock_data; | |
581 T_DISPLAY_DATA display_info; | |
582 | |
583 TRACE_FUNCTION("AUI_pin_KbdCb()"); | |
584 | |
585 /* Suppress unwanted long keypresses */ | |
586 | |
587 data->doNextLongPress = TRUE; /* next Key_long event is correct */ | |
588 data->editor->update = ED_UPDATE_DEFAULT; /* Default behaviour is just to update text */ | |
589 | |
590 switch (keyboard->code) | |
591 { | |
592 case KCD_STAR: | |
593 /* Only possible when the first digit is a '*' */ | |
594 if ((data->editor_data.editor_attr.text.len==0) || | |
595 (data->ss_string)) | |
596 { | |
597 if (data->editor_data.editor_attr.text.len==0) | |
598 { | |
599 data->hidden = FALSE; | |
600 data->ss_string = TRUE; | |
601 /* The string should now be visible on screen */ | |
602 if (ATB_edit_Mode(data->editor, ED_MODE_HIDDEN)) | |
603 { | |
604 data->hidden = TRUE; | |
605 ATB_edit_ResetMode(data->editor, ED_MODE_HIDDEN); | |
606 } | |
607 } | |
608 | |
609 AUI_entry_EventKey(data->entry_data, event, keyboard); | |
610 win_show(data->win); | |
611 } | |
612 //xrashmic 1 Jul, 2006 OMAPS00075784 | |
613 //The password mode to be turned on while entering the gsm string to | |
614 //unblock PUK during bootup | |
615 if(data->editor_data.editor_attr.text.len >=4 ) | |
616 { | |
617 if((strncmp((char*)data->editor_data.editor_attr.text.data, "**05*", 5) == 0) || | |
618 (strncmp((char*)data->editor_data.editor_attr.text.data, "**052*", 6) == 0) || | |
619 (strncmp((char*)data->editor_data.editor_attr.text.data, "**04*", 5) == 0) || | |
620 (strncmp((char*)data->editor_data.editor_attr.text.data, "**042*", 6) == 0)) | |
621 { | |
622 ATB_edit_SetMode(data->editor, ED_MODE_HIDDEN); | |
623 } | |
624 } | |
625 break; | |
626 | |
627 case KCD_HASH: | |
628 /* Send SS string if we're entering one */ | |
629 if(data->ss_string) | |
630 { | |
631 AUI_entry_EventKey(data->entry_data, event, keyboard); | |
632 //xrashmic 1 Jul, 2006 OMAPS00075784 | |
633 //The password mode to be turned on while entering the gsm string to | |
634 //unblock PUK during bootup | |
635 | |
636 if(ATB_edit_Mode(data->editor, ED_MODE_HIDDEN)) | |
637 { | |
638 if((strncmp((char*)data->editor_data.editor_attr.text.data, "**05*", 5) == 0) || | |
639 (strncmp((char*)data->editor_data.editor_attr.text.data, "**04*", 5) == 0)) | |
640 { | |
641 strncpy((char*)&data->editor_data.editor_attr.text.data[5],(char*)&data->editor->hiddenText->data[5], data->editor_data.editor_attr.text.len - 5); | |
642 } | |
643 else if ((strncmp((char*)data->editor_data.editor_attr.text.data, "**052*", 6)== 0) || | |
644 (strncmp((char*)data->editor_data.editor_attr.text.data, "**042*", 6) == 0)) | |
645 { | |
646 strncpy((char*)&data->editor_data.editor_attr.text.data[6], | |
647 (char*)&data->editor->hiddenText->data[6], data->editor_data.editor_attr.text.len - 6); | |
648 } | |
649 } | |
650 | |
651 edit_data_buf = ALLOC_MEMORY(data->editor_data.editor_attr.size); | |
652 | |
653 strcpy((char *)edit_data_buf, (char *)data->editor_data.editor_attr.text.data); | |
654 | |
655 switch (AUI_pin_CheckSSString(data)) | |
656 { | |
657 case MFW_SS_MMI: | |
658 // May 02, 2005 REF : LOCOSTO-ENH-30818 - xpradipg | |
659 // replace the call to get_imei() with callNumber | |
660 #ifdef FF_MMI_ATC_MIGRATION | |
661 mmi_imei_retrieve(); | |
662 #else | |
663 get_imei((char*)data->imei); | |
664 showIMEI(win,(char*)data->imei); | |
665 #endif | |
666 ATB_edit_ClearAll(data->editor); | |
667 | |
668 /* Set back to the default */ | |
669 data->ss_string = FALSE; | |
670 | |
671 if (data->hidden == TRUE) | |
672 { | |
673 /* go back in the hide mode */ | |
674 ATB_edit_SetMode(data->editor, ED_MODE_HIDDEN); | |
675 } | |
676 | |
677 FREE_MEMORY((void *)edit_data_buf, data->editor_data.editor_attr.size); | |
678 win_show(data->win); | |
679 return MFW_EVENT_CONSUMED; | |
680 // break; // RAVI | |
681 | |
682 case MFW_SS_SIM_UNBLCK_PIN: | |
683 bRetVal = AUI_pin_StripSSUnblock((char *)edit_data_buf, &pin_unblock_data); | |
684 | |
685 FREE_MEMORY((void *)edit_data_buf, data->editor_data.editor_attr.size); | |
686 | |
687 if (bRetVal == FALSE) | |
688 { | |
689 /* | |
690 ** Clear the entered string, reset the editor and display a "failed" dialog | |
691 */ | |
692 ATB_edit_ClearAll(data->editor); | |
693 | |
694 /* Set back to the default */ | |
695 data->ss_string = FALSE; | |
696 | |
697 if (data->hidden == TRUE) | |
698 { | |
699 /* go back in the hide mode */ | |
700 ATB_edit_SetMode(data->editor, ED_MODE_HIDDEN); | |
701 } | |
702 | |
703 dlg_initDisplayData_TextId(&display_info, TxtNull, TxtNull, TxtFailed, TxtNull, COLOUR_POPUP); | |
704 dlg_initDisplayData_events(&display_info, NULL, THREE_SECS, 0); | |
705 info_dialog(0, &display_info); | |
706 | |
707 } | |
708 else | |
709 { | |
710 SEND_EVENT (win, E_PUK1_COMPLETE, INFO_KCD_LEFT, &pin_unblock_data); | |
711 } | |
712 | |
713 return MFW_EVENT_CONSUMED; | |
714 // break; // RAVI | |
715 | |
716 default: | |
717 /* xreddymn OMAPS00083495 Jul-04-2006 | |
718 * Display error dialog for BPM strings that are not handled. | |
719 */ | |
720 ATB_edit_ClearAll(data->editor); | |
721 data->ss_string = FALSE; | |
722 if (data->hidden == TRUE) | |
723 { | |
724 ATB_edit_SetMode(data->editor, ED_MODE_HIDDEN); | |
725 } | |
726 dlg_initDisplayData_TextId(&display_info, TxtNull, TxtNull, TxtNotAllowed, TxtNull, COLOUR_POPUP); | |
727 dlg_initDisplayData_events(&display_info, NULL, THREE_SECS, 0); | |
728 info_dialog(0, &display_info); | |
729 FREE_MEMORY((void *)edit_data_buf, data->editor_data.editor_attr.size); | |
730 break; | |
731 } | |
732 win_show(data->win); | |
733 | |
734 } | |
735 else if (data->editor_data.editor_attr.text.len >= data->editor_data.min_enter) | |
736 { | |
737 if (ATB_edit_Mode(data->editor, ED_MODE_HIDDEN)) | |
738 { | |
739 ATB_edit_HiddenExit(data->editor); | |
740 } | |
741 SEND_EVENT (win, E_PIN_DEINIT, INFO_KCD_LEFT, NULL); | |
742 } | |
743 | |
744 break; | |
745 | |
746 #ifdef COLOURDISPLAY | |
747 /* Menu select has same effect as left soft key */ | |
748 case KCD_MNUSELECT: | |
749 #endif /* COLOURDISPLAY */ | |
750 | |
751 case KCD_LEFT: | |
752 /* Make an emergency call if an appropriate number entered */ | |
753 if ( data->emergency_call ) | |
754 { | |
755 /* Copy the actual typed text into the buffer */ | |
756 if (ATB_edit_Mode(data->editor, ED_MODE_HIDDEN)) | |
757 { | |
758 ATB_edit_HiddenExit(data->editor); | |
759 } | |
760 SEND_EVENT (win, E_PIN_DEINIT, INFO_EMERGENCY, NULL); | |
761 } | |
762 /* Submit PIN if sufficient characters entered */ | |
763 else if (data->editor_data.editor_attr.text.len >= data->editor_data.min_enter) | |
764 { | |
765 // June 16, 2005 REF: CRR 31267 x0021334 | |
766 // If PIN1/PUK1 =0, Show info dialog that SIM is blocked | |
767 if (pin1Flag EQ TRUE) | |
768 { | |
769 dlg_initDisplayData_TextId(&display_info, NULL, NULL, TxtSimBlocked, TxtDealer, COLOUR_STATUS); | |
770 dlg_initDisplayData_events(&display_info, (T_VOID_FUNC)NULL, THREE_SECS, KEY_LEFT | KEY_RIGHT); | |
771 info_dialog (NULL, &display_info); | |
772 break; | |
773 } | |
774 /* Left Softkey is enabled (and entered sufficient number of chars): execute it. */ | |
775 /* Copy the actual typed text into the buffer */ | |
776 if (ATB_edit_Mode(data->editor, ED_MODE_HIDDEN)) | |
777 { | |
778 ATB_edit_HiddenExit(data->editor); | |
779 } | |
780 SEND_EVENT (win, E_PIN_DEINIT, INFO_KCD_LEFT, NULL); | |
781 } | |
782 break; | |
783 | |
784 case KCD_HUP: | |
785 break; | |
786 | |
787 case KCD_CALL: | |
788 /* Make an emergency call if an appropriate number entered */ | |
789 if ( data->emergency_call ) | |
790 { | |
791 /* Copy the actual typed text into the buffer */ | |
792 if (ATB_edit_Mode(data->editor, ED_MODE_HIDDEN)) | |
793 { | |
794 ATB_edit_HiddenExit(data->editor); | |
795 } | |
796 SEND_EVENT (win, E_PIN_DEINIT, INFO_EMERGENCY, NULL); | |
797 } | |
798 break; | |
799 | |
800 case KCD_RIGHT: | |
801 if(data->editor_data.editor_attr.text.len!=0) | |
802 { | |
803 //xrashmic 1 Jul, 2006 OMAPS00075784 | |
804 //The password mode to be turned on while entering the gsm string to | |
805 //unblock PUK during bootup | |
806 if(ATB_edit_Mode(data->editor, ED_MODE_HIDDEN) && | |
807 (((data->editor_data.editor_attr.text.len == 5) && | |
808 ((strncmp((char*)data->editor_data.editor_attr.text.data, "**05*", 5) == 0) || | |
809 (strncmp((char*)data->editor_data.editor_attr.text.data, "**04*", 5) == 0))) || | |
810 ((data->editor_data.editor_attr.text.len == 6) && | |
811 ((strncmp((char*)data->editor_data.editor_attr.text.data, "**052*", 6) == 0) || | |
812 (strncmp((char*)data->editor_data.editor_attr.text.data, "**042*", 6) == 0))))) | |
813 { | |
814 ATB_edit_ResetMode(data->editor, ED_MODE_HIDDEN); | |
815 } | |
816 | |
817 ATB_edit_DeleteLeft(data->editor, TRUE); /* SPR#2342 - SH */ | |
818 | |
819 /* For a SS string */ | |
820 if ( !ATB_edit_Mode(data->editor,ED_MODE_HIDDEN) ) | |
821 { | |
822 if (data->editor_data.editor_attr.text.len==0 && data->ss_string) | |
823 { | |
824 data->ss_string = FALSE; | |
825 if (data->hidden == TRUE) | |
826 { | |
827 /* The string should not be visible on screen */ | |
828 ATB_edit_SetMode(data->editor, ED_MODE_HIDDEN); | |
829 } | |
830 } | |
831 } | |
832 | |
833 /* is it a emergency call number ?!*/ | |
834 AUI_pin_CheckEmergency(data); | |
835 win_show(data->win); | |
836 } | |
837 break; | |
838 | |
839 case KCD_0: | |
840 case KCD_1: | |
841 case KCD_2: | |
842 case KCD_3: | |
843 case KCD_4: | |
844 case KCD_5: | |
845 case KCD_6: | |
846 case KCD_7: | |
847 case KCD_8: | |
848 case KCD_9: | |
849 /* xreddymn OMAPS00083495 Jul-04-2006 | |
850 * Limit PIN1, PIN2 entries to 8 digits. | |
851 */ | |
852 if(((data->editor_data.Identifier==PIN1_REQ) || | |
853 (data->editor_data.Identifier==PIN2_REQ)) && | |
854 (data->editor_data.editor_attr.text.len>=8) && | |
855 (!data->ss_string)) | |
856 return MFW_EVENT_CONSUMED; | |
857 else | |
858 { | |
859 AUI_entry_EventKey(data->entry_data, event, keyboard); | |
860 /* is it a emergency call number ?!*/ | |
861 AUI_pin_CheckEmergency(data); | |
862 win_show(data->win); | |
863 } | |
864 break; | |
865 } | |
866 | |
867 return MFW_EVENT_CONSUMED; | |
868 } | |
869 | |
870 | |
871 /******************************************************************************* | |
872 | |
873 $Function: AUI_pin_KbdLongCb | |
874 | |
875 $Description: PIN editor long keypress keyboard event handler | |
876 | |
877 $Returns: None. | |
878 | |
879 $Arguments: event - the keyboard event | |
880 keyboard | |
881 | |
882 *******************************************************************************/ | |
883 | |
884 static int AUI_pin_KbdLongCb(T_MFW_EVENT event, T_MFW_KBD *keyboard) | |
885 { | |
886 T_MFW_HND win = mfw_parent (mfw_header()); | |
887 T_MFW_WIN *win_data = ((T_MFW_HDR *)win)->data; | |
888 T_AUI_PIN_DATA *data = (T_AUI_PIN_DATA *)win_data->user; | |
889 ED_RES result; | |
890 | |
891 /* Suppress unwanted long keypresses */ | |
892 | |
893 if ( data->doNextLongPress ) | |
894 data->doNextLongPress = FALSE; /* mark Key_long event as consumed but do current long press */ | |
895 else | |
896 return MFW_EVENT_CONSUMED; /* don't do current long press */ | |
897 | |
898 switch (keyboard->code) | |
899 { | |
900 case KCD_RIGHT: | |
901 /* Long press of RSK deletes buffer */ | |
902 result = ATB_edit_ClearAll(data->editor); | |
903 | |
904 /* If we've deleted on an empty buffer, exit editor */ | |
905 if (result==ED_DONE) | |
906 { | |
907 SEND_EVENT(data->win, E_PIN_DEINIT, INFO_KCD_RIGHT, 0); | |
908 } | |
909 else | |
910 { | |
911 win_show(data->win); | |
912 } | |
913 break; | |
914 } | |
915 | |
916 return MFW_EVENT_CONSUMED; | |
917 | |
918 } | |
919 | |
920 | |
921 /******************************************************************************* | |
922 | |
923 $Function: AUI_pin_CheckEmergency | |
924 | |
925 $Description: Check number to see if it's an emergency number | |
926 | |
927 $Returns: None. | |
928 | |
929 $Arguments: data - The editor data | |
930 | |
931 *******************************************************************************/ | |
932 | |
933 static UBYTE AUI_pin_CheckEmergency(T_AUI_PIN_DATA *data) | |
934 { | |
935 UBYTE previous_emergency = data->emergency_call; | |
936 UBYTE previous_entered = data->enteredMinChars; | |
937 UBYTE previous_someentered = data->enteredSomeChars; | |
938 UBYTE emergency_call; | |
939 | |
940 /*SPR#2235 - DS - If the edit mode is 'hidden' then pass | |
941 *the 'hidden buffer' as the parameter to cm_check_emergency. | |
942 *If the edit mode is not 'hidden' then pass the normal editor | |
943 *text buffer as the parameter. | |
944 */ | |
945 if (ATB_edit_Mode(data->editor, ED_MODE_HIDDEN)) | |
946 emergency_call = cm_check_emergency(data->editor->hiddenText->data); | |
947 else | |
948 emergency_call = cm_check_emergency(data->editor_data.editor_attr.text.data); | |
949 | |
950 if(emergency_call == TRUE) | |
951 { | |
952 TRACE_EVENT(" it is a emergency number !"); | |
953 data->emergency_call = TRUE; | |
954 } | |
955 else | |
956 { | |
957 data->emergency_call = FALSE; | |
958 } | |
959 | |
960 /* Check if we've entered min_enter characters */ | |
961 | |
962 if (data->editor_data.editor_attr.text.len >= data->editor_data.min_enter) | |
963 data->enteredMinChars = TRUE; | |
964 else | |
965 data->enteredMinChars = FALSE; | |
966 | |
967 if (data->editor_data.editor_attr.text.len > 0) | |
968 data->enteredSomeChars = TRUE; | |
969 else | |
970 data->enteredSomeChars = FALSE; | |
971 | |
972 /* Check if the softkeys have changed */ | |
973 | |
974 if (data->emergency_call!=previous_emergency) | |
975 { | |
976 data->editor->update = ED_UPDATE_FULL; /* Update softkeys, title and editor */ | |
977 } | |
978 else if (data->enteredMinChars!=previous_entered || data->enteredSomeChars!=previous_someentered) | |
979 { | |
980 data->editor->update = ED_UPDATE_PARTIAL; /* Update softkeys and editor */ | |
981 } | |
982 else | |
983 { | |
984 data->editor->update = ED_UPDATE_TRIVIAL; /* Just update editor */ | |
985 } | |
986 | |
987 return data->emergency_call; | |
988 } | |
989 | |
990 | |
991 /******************************************************************************* | |
992 | |
993 $Function: AUI_pin_CheckSSString | |
994 | |
995 $Description: Check number to see if it's an ss string | |
996 | |
997 $Returns: None. | |
998 | |
999 $Arguments: event - the keyboard event | |
1000 keyboard | |
1001 | |
1002 *******************************************************************************/ | |
1003 | |
1004 T_MFW_SS_RETURN AUI_pin_CheckSSString(T_AUI_PIN_DATA *data) | |
1005 { | |
1006 return ss_check_ss_string(data->editor_data.editor_attr.text.data); | |
1007 } | |
1008 | |
1009 | |
1010 static BOOL AUI_pin_StripSSUnblock(char *cmd_string, T_AUI_PINS *pin_data) | |
1011 { | |
1012 T_MFW_SS_RETURN retVal; | |
1013 char *rest; | |
1014 T_KSD_SEQPARAM ss_params; | |
1015 | |
1016 TRACE_EVENT_P2("AUI_pin_StripSSUnblock : &cmd_string = 0x%08lx, &pin_data = 0x%08lx", cmd_string, pin_data); | |
1017 | |
1018 /* | |
1019 ** The incoming parameters chould not be NULL | |
1020 */ | |
1021 if ((cmd_string == NULL) || | |
1022 (pin_data == NULL)) | |
1023 return FALSE; | |
1024 | |
1025 retVal = ss_decode((UBYTE *)cmd_string, &rest, &ss_params); | |
1026 | |
1027 if (retVal == MFW_SS_SIM_UNBLCK_PIN) | |
1028 { | |
1029 if (ss_params.ublk.ssCd == KSD_SS_PIN1) | |
1030 { | |
1031 pin_data->pin_id = MFW_SIM_PUK1; | |
1032 strcpy(pin_data->puk_code, (char *)ss_params.ublk.puk); | |
1033 strcpy(pin_data->new_pin, (char *)ss_params.ublk.pin); | |
1034 strcpy(pin_data->cnf_pin, (char *)ss_params.ublk.pin); | |
1035 | |
1036 return TRUE; | |
1037 } | |
1038 else | |
1039 { | |
1040 TRACE_EVENT("AUI_pin_StripSSUnblock : Not unblocking PIN1"); | |
1041 return FALSE; | |
1042 } | |
1043 } | |
1044 else | |
1045 { | |
1046 TRACE_EVENT_P1("AUI_pin_StripSSUnblock : ss_decode returned %d", retVal); | |
1047 return FALSE; | |
1048 } | |
1049 } | |
1050 |