comparison src/ui3/bmi/mmiMain.c @ 421:6a4d9f47793e

src/ui3/bmi: file renames to make the case consistent
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 21 Jan 2018 03:28:53 +0000
parents src/ui3/bmi/MmiMain.c@e8ddbb0837ed
children 2d1cf296fd16
comparison
equal deleted inserted replaced
420:e8ddbb0837ed 421:6a4d9f47793e
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: MmiMain.c
16 $Revision: 1.0
17
18 $Author: Condat(UK)
19 $Date: 22/02/01
20
21 ********************************************************************************
22
23 Description:
24
25
26
27 ********************************************************************************
28
29 $History: MmiMain.c
30
31 Nov 06, 2007 ER: OMAPS00151698 x0056422
32 Description:
33 Solution 1) Need to suppress key beep sound for the commands that originated from the
34 BT headset and were simulated as key events. This is done by adding a check
35 for BMI_BT_HEADSET_COMMAND in keyAction function, and do nothing inside if
36 it is true.
37
38 May 24, 2007 DR: OMAPS00132483 x0pleela
39 Description: MM: While playing an AAC, unplug USB freezes the audio
40 Solution: 1) Changed the function names to get and set the status of headset, usb insertion
41 and removal
42 2) In function globalmme(), removed the function call to get the phonelock status during
43 USB plug/unplug and headset plug/unplug event and inturn using a static variable
44 which gives the phonelock status. Replaced the function call mfw_get_phlock_status
45 with mfw_get_Phlock_status to get the phone lock status
46
47 Apr 03, 2007 ER: OMAPS00122561 x0pleela
48 Description: [ACI] Phone lock feature has to be supported by ACI
49 Solution: Phone Lock ER implementation
50
51 Mar 22, 2007 DVT: OMAPS00121916 x0039928(sumanth)
52 Description: T-Flash hot swap.
53
54 Jan 05, 2007 OMAPS00084665 x0039928(sumanth)
55 Description: Boot time exceed UCSD estimations
56
57 Oct 30, 2006 ER:OMAPS00098881 x0039928(sumanth)
58 Removal of power variant
59
60 Oct 30, 2006 ER:OMAPS00091029 x0039928(sumanth)
61 Bootup time measurement
62
63 Oct 05, 2006 ER: OMAPS00094496 x0061088(Prachi)
64 Description:Enhance RSSI to 3 parameters: Strength, quality, min-access-level
65 Solution: NAPTUNE flag is removed from globalSignalUpdate().
66
67 Sep 11, 2006 DR: OMAPS00094182 xrashmic
68 Description: midi and mp3 files is not being populated on accessing corresponding menu, but only during bootup
69 Solution: Populate files on accessing the "browse files" list
70
71 xashmic 9 Sep 2006, OMAPS00092732
72 USBMS ER: Handles the connect and disconnect event.
73
74 Aug 03, 2006 REF:OMAPS00088329 x0039928
75 Description : TTY> When TTY is ON Headset insertion detection / profile download should not happen
76 Solution : TTY ON condition is checked before downloading the headset profile.
77
78 Jun 09, 2006 REF:OMAPS00079650 a0393213 (R.Prabakar)
79 Description : CPHS Roaming indication feature implementation
80 Solution : As part of the implementation, in this file, type of GlobalIconStatus is changed
81
82 Jun 02, 2006 DRT OMAPS00079213 x0039928(sumanth)
83 Description: Triton PG2.2 impacts on Locosto program
84 Solution: Software workaround is done to register headset-hook dynamically
85 during/before call is established and unregister it after the call is ended/disconnected.
86
87 Apr 17, 2006 REF: ER OMAPS00075178 x0pleela
88 Description: When the charger connect to phone(i-sample), the charger driver works, but the MMI and App don't work
89 Solution: Defined new functions "charging_start_cb()": Callback after dialog "Charging" is displayed
90 and "charging_start_info()" : function to display the dialog "charging" when charger is connected
91 Handling battery/charger events in globalmme()
92
93 Nov 09, 2005 REF: DVT OMAPS00056873 xdeepadh
94 Description: Deactivating Bright Light on I-Sample
95 Solution: On Isample boards the backlight is set off, since the bright LEDS are very disturbing.
96
97 xpradipg - LOCOSTO-ENH-31895 : 23 June 2005
98 Description: Support for various audio profiles
99 Solution: The support for audio device's carkit/headset/loudspeaker/handheld.
100 The audio device is enabled as per the user actions.
101 Jul 05, 2005 REF: SPR 31894 xdeepadh
102 Description: Proposed chnages for Locosto-live sign off
103 Solution: UICC SIM API will be used for Locosto.
104
105 x0018858 24 Mar, 2005 MMI-FIX-11321
106 Issue Description :- If the inbox is full and a new message is receivd, no indication is received.
107 Fix: Added support for handling indication when message box is full and
108 there is a pending message.
109 Apr 05, 2005 REF: ENH 29994 xdeepadh
110 Description: Implementation of Generic Midi Ringer and Modification of existing Midi Test Application
111 Solution: Generic Midi Ringer and Midi Test Application were implemented.
112
113 Jan 07, 2005 REF: CRR 26394 xkundadu
114 Issue description:Logo of the operator not displayed
115 Solution: Set the network operator logo display option to enbled state.
116
117 Oct 19, 2004 REF: CRR MMI-SPR-26002 xkundadu
118 Issue description: Golite booting problem.
119 Solution: If the FFS is not formatted, prevent writing into the FFS.
120
121 Aug 16, 2004 REF: CRR 24323 Deepa M.D
122 Bug:Clenup of sprintf used for tracing
123 Fix:Replace the char buf[]; sprintf (buf, "...", ...); TRACE_EVENT (buf); statements by TRACE_EVENT_PX
124
125 Jul 22,2004 CRR:20896 xrashmic - SASKEN
126 Description: The current time format is not highlighted
127 Fix: The time format is written into flash. Instead of providing the submenu
128 directly we call a function where we set the menu and also higlight the
129 previously selected menu item
130
131
132 May 10, 2004 REF: CRR 15753 Deepa M.D
133 Menuitem provided to set the validity period to maximum.
134
135 25/10/00 Original Condat(UK) BMI version.
136
137 Dec 23, 2005 REF: SR13873 x0020906
138 Description: To stop playing ringtone when new sms arrives - when user is in any menu screen.
139 Fix : Fix is done in keyAction ().
140
141 $End
142
143 *******************************************************************************/
144
145 #include <stdio.h>
146 #define ENTITY_MFW
147
148 /* includes */
149 #include <string.h>
150 #include <stdio.h>
151 #include <stdlib.h>
152
153 #include "typedefs.h"
154 #include "vsi.h"
155 #include "pei.h"
156 #include "custom.h"
157 #include "gsm.h"
158
159 #include "gdi.h"
160 #include "audio.h"
161
162 #include "mfw_sys.h"
163
164 #include "mfw_mfw.h"
165 #include "mfw_kbd.h"
166 #include "mfw_tim.h"
167 #include "mfw_lng.h"
168 #include "mfw_win.h"
169 #include "mfw_icn.h"
170 #include "mfw_sim.h"
171 #include "mfw_nm.h"
172 #include "mfw_ffs.h"
173 /* SPR#1428 - SH - New Editor changes */
174 #ifndef NEW_EDITOR
175 #include "mfw_edt.h"
176 #endif
177 #include "mfw_mnu.h"
178 #include "mfw_phb.h"
179 #include "mfw_sms.h"
180 #include "Mfw_td.h"/*SPR 1725*/
181 #ifdef SIM_TOOLKIT
182 #include "mfw_sat.h"
183 #endif
184 #include "dspl.h"
185
186
187 #include "p_mmi.h"
188 #include "message.h"
189 #include "prim.h"
190 #include "aci_cmh.h"
191 #include "mfw_mme.h"
192
193 #ifndef _SIMULATION_
194 /* BEGIN ADD: Neptune Alignment */
195 #ifndef NEPTUNE_BOARD
196 /* END ADD: Neptune Alignment */
197 #include "sys_types.h"
198 /* BEGIN ADD: Neptune Alignment */
199 #else
200 #include "bmi_integ_misc.h"
201 #endif
202 /* END ADD: Neptune Alignment */
203 #endif
204
205 #include "MmiMmi.h"
206 /* SPR#1428 - SH - New Editor changes */
207 #ifdef NEW_EDITOR
208 #include "ATBCommon.h"
209 #include "ATBDisplay.h"
210 #include "ATBEditor.h"
211 #include "AUIEditor.h"
212 #endif
213
214 #include "Mmiicons.h"
215 #include "MmiPins.h"
216 #include "MmiMain.h"
217 #include "MmiDialogs.h"
218 #include "MmiIdle.h"
219 #include "MmiStart.h"
220 #include "mmiCall.h"
221 #include "MmiSimToolkit.h"
222
223 #include "MmiLists.h"
224 #include "MmiSounds.h"
225 #include "MmiResources.h"
226 #include "MmiSettings.h"
227 #include "MmiTimeDate.h"
228
229 #include "cus_aci.h"
230 #include "prim.h"
231 #ifndef PCM_2_FFS
232 #include "pcm.h"
233 #endif
234
235 /* OMAPS00151698, x0056422 */
236
237 #ifdef FF_MMI_A2DP_AVRCP
238 #include "mfw_bt_api.h"
239 #include "mfw_bt_private.h"
240 #endif
241
242 //x0pleela 21 Apr, 2006 DR: OMAPS00075178
243 //Removing the AUDIO_PROFILE flag as Mmicolours.h is also required for Battery/charger indication fix
244 //#ifdef FF_MMI_AUDIO_PROFILE
245 #include "MmiColours.h"
246 //#endif
247 static MfwHnd times; /* clock via software timer */
248 static MfwHnd times_switchoff; /* timer switch off (GB)*/
249
250 /* GLOBAL CONTROL DATA */
251 LngInfo mainLngInfo; /* language control block */
252 MfwHnd mainMmiLng; /* global language handler */
253
254
255 //x0pleela 11 Apr, 2006 ER: OMAPS00075178
256 //Timer for battery charging animation
257 extern MfwHnd battery_charging_animate;
258
259 /* Taking idle data - RAVI - 23-12-2005 */
260 #ifdef NEPTUNE_BOARD
261 extern T_idle idle_data;
262 #endif
263 /* END RAVI - 23-12-2005 */
264
265 #ifndef _SIMULATION_
266 extern void AI_Power(SYS_UWORD8 power);
267 #endif
268
269 #ifdef NEPTUNE_BOARD /* Removal of linker errors */
270 void SIM_PowerOff (void);
271 #endif
272
273 static int keyAction (MfwEvt e, MfwKbd *res);
274 /* x0039928 - Lint warning removal
275 static int key (MfwEvt e, MfwKbd *kc); */
276 static int timer (MfwEvt e, MfwTim *t);
277 /* x0039928 - Lint warning removal
278 static void backlight (void); */
279 static int timesEvent (MfwEvt e, MfwTim *t);
280 static void showGoodBye (T_MFW_HND win);
281 static void goodbye_cb (void);
282
283
284 static MfwHnd mme; /* our MME manager */
285
286 /* Jun 09, 2006 REF:OMAPS00079650 a0393213 (R.Prabakar)
287 Description : CPHS Roaming indication feature implementation
288 Solution : As part of the implementation, type of GlobalIconStatus is changed from U16 to U32 as number of
289 bits in the variable is not sufficient to store details about all the icons*/
290 U32 GlobalIconStatus;
291 UBYTE globalMobileMode;
292 int MmiModule;
293
294 // ADDED BY RAVI - 28-11-2005
295 EXTERN int flash_formatted(void);
296 EXTERN void time_date_init(void);
297 EXTERN void sms_cb_exit (void);
298 EXTERN void time_date_delete(void);
299 EXTERN UBYTE getCurrentRingerSettings(void);
300 EXTERN UBYTE CphsPresent(void);
301 EXTERN void cphs_support_check(void);
302 // END RAVI
303
304 /* batterie and signal start */
305 int globalBatteryUpdate(U8 value);
306 int globalSignalUpdate(U8 value);
307
308 // xpradipg - LOCOSTO-ENH-31895 : 23 June 2005
309 #ifdef FF_MMI_AUDIO_PROFILE
310 extern void mfw_audio_device_indication(U8 notify);
311 extern void mmi_hook_handle();
312 void mmi_device_status_info(T_MFW_HND parent, int str1, int str2, T_VOID_FUNC callback);
313 #endif
314
315
316 void globalFlashBattery (void);
317
318 UBYTE globalBatteryPicNumber;
319 UBYTE globalSignalPicNumber;
320
321 UBYTE globalBatteryMode; /* */
322 int globalMme(MfwEvt e, void *para);
323 /* batterie and signal end */
324
325 /*MC SPR 1725 removed current clock and date variables*/
326
327 /* x0039928 - Lint warning removal
328 static LONG second; */
329 static U8 deregis = FALSE; /* status deregistration */
330
331 // SH 6/03/02 - HUPKeyOrigin is 1 if POWER_KEY is pressed in idle screen, 0 otherwise
332 // Means that long press of HUP key will go to idle screen, not just shut down
333 UBYTE HUPKeyOrigin;
334 int off_switch; /* distinguish between on- and off switching to display a goodbye message*/
335 /* SPR877 - SH - set to TRUE if welcome animation has finished */
336 extern UBYTE animation_complete;
337
338 T_MFW_CFLAG_STATUS DivertStatus = MFW_CFLAG_NOTSet;
339 #define TIME_MINUTE 60000
340 #define TIMEDOWN 120000L /* time for powerdown 2min */
341 #define TIME_SWITCH_OFF 3000 /* switch off time delay */
342 //Jul 05, 2005 REF: SPR 31894 xdeepadh
343 //The reader_id BSP_UICC_DEFAULT_READER_ID will be 0x01.
344 #ifdef TI_PS_UICC_CHIPSET_15
345 #define BSP_UICC_DEFAULT_READER_ID 0x01
346 #endif
347
348 static UBYTE buffer[100];
349 /* Amounts to: 128 (format mode) + 8 (overwrite mode) */
350
351
352 extern BMI_BT_STRUCTTYPE tGlobalBmiBtStruct;
353
354 /*******************************************************************************
355
356 $Function:
357
358 $Description: general editor control
359
360 $Returns: none.
361
362 $Arguments:
363
364 *******************************************************************************/
365
366 /* SPR#1428 - SH - New Editor changes - this version of editControls used
367 * by new editor. The rest is now in AUITextEntry */
368
369 #ifdef NEW_EDITOR
370
371 UBYTE editControls [KCD_MAX] = /* edit control keys: */
372 {
373 '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
374 '*', '#', ctrlNone, ctrlNone, ctrlUp, ctrlDown, ctrlLeft, ctrlRight,
375 ctrlNone, ctrlNone, ctrlEnter, ctrlNone, ctrlNone, ctrlNone,
376 ctrlNone, ctrlNone, ctrlEnter
377 };
378
379 #else /* NEW_EDITOR */
380
381 static MfwHnd myHandle = 0; /* editors handle */
382 static MfwHnd editTim = 0; /* the editor timer */
383 static char *formatHandle; // SH - pointer to format string, so that editEventKey can see it
384 static int *formatIndex; // SH - pointer to format index
385 static int *fieldIndex; // SH - pointer to field position
386 static char *tmpBuf; // SH - pointer to temporary buffer for hidden alphanumeric entry
387
388 #define KEY_PAD_MAX 5
389
390 UBYTE editControls [KCD_MAX] = /* edit control keys: */
391 {
392 '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
393 '*', '#', ecNone, ecNone, ecUp, ecDown, ecLeft, ecRight,
394 ecNone, ecNone, ecEnter, ecNone, ecNone, ecNone,
395 ecNone, ecNone, ecEnter
396 };
397
398 static UBYTE editAlphaMode; /* alpha mode flag */
399 static UBYTE editCalcMode; /* calculator mode flag */
400 static UBYTE editFormatMode; /* format mode flag */
401 static UBYTE editHiddenMode; /* hidden alphanumeric mode */
402 static UBYTE editAlphaLevel; /* alpha level selected */
403 static UBYTE editAlphaKey; /* alpha mode current key */
404
405
406
407 static UBYTE editAlpha [12][KEY_PAD_MAX] = /* alpha mode characters */
408 {
409 {'.','+','-','=','0'}, //0 key
410 {' ','?','!','1',':'}, {'a','b','c','2',')'}, {'d','e','f','3','('}, // 1 2 3
411 {'g','h','i','4','$'}, {'j','k','l','5',' '}, {'m','n','o','6',','}, // 4 5 6
412 {'p','q','r','s','7'}, {'t','u','v','8',';'}, {'w','x','y','z','9'}, // 7 8 9
413 {'*','#','%','&',' '}, {' ','\'','\"','@','/'} // star and hash keys
414 };
415
416 static UBYTE editAlphaU [12][KEY_PAD_MAX] = /* upCase alpha mode characters*/
417 {
418 {'.','+','-','=','0'}, //0 key
419 {' ','?','!','1',':'}, {'A','B','C','2',')'}, {'D','E','F','3','('}, // 1 2 3
420 {'G','H','I','4','$'}, {'J','K','L','5',' '}, {'M','N','O','6',','}, // 4 5 6
421 {'P','Q','R','S','7'}, {'T','U','V','8',';'}, {'W','X','Y','Z','9'}, // 7 8 9
422 {'*','#','%','&',' '}, {' ','\'','\"','@','/'} // star and hash keys
423 };
424
425
426 int upCase= TRUE;
427
428
429 static int editEventTim (MfwEvt e, MfwTim *t);
430 static void editShowHeader (void);
431
432 #endif /* NEW_EDITOR */
433
434 #ifdef FF_MMI_AUDIO_PROFILE
435 extern T_call call_data;
436 #endif
437
438 #ifdef NEPTUNE_BOARD
439 #ifdef MMI_POWER_MANAGEMENT_TEST
440 #define Bool unsigned char
441 EXTERN unsigned char Screen_Update;
442 EXTERN void SVC_SCN_EnablePM(Bool enable );
443 #endif
444 #endif
445 EXTERN MfwHnd timer_handle;
446
447 //x0pleela 19 Mar, 2007 ER: OMAPS00122561
448 #ifdef FF_PHONE_LOCK
449 static int ph_lock_status;
450
451 #define ResetFlag 0x00 //toset any bit to zero
452 #define UsbMsEnum 0x01 //for USB MS enum/de-enum
453 #define HeadsetReg 0x02 //For Headset Plug/Unplug
454
455 //x0pleela 29 May, 2007 DR: OMAPS00132483
456 EXTERN int mfw_get_Phlock_status(void);
457 EXTERN void mfw_set_Phlock_status( int phlock_status);
458 EXTERN int mfw_get_Auto_Phlock_status(void);
459 EXTERN void mfw_set_Auto_Phlock_status( int phlock_status);
460
461 #endif
462
463 //x0pleela 19 Mar, 2007 ER: OMAPS00122561
464 #ifdef FF_PHONE_LOCK
465 /*******************************************************************************
466
467 $Function: mmi_set_Headset_Reg
468
469 $Description: set /resets the HeadsetReg bit in ph_lock_status
470
471 $Returns: none.
472
473 $Arguments:
474
475 *******************************************************************************/
476 //x0pleela 23 May, 2007 DR: OMAPS00132483
477 GLOBAL void mmi_set_Headset_Reg( int headset_reg)
478 {
479 TRACE_FUNCTION("mmi_set_Headset_Reg()");
480 if( headset_reg )
481 ph_lock_status |= HeadsetReg;
482 else
483 ph_lock_status &= ResetFlag;
484 return;
485 }
486
487 /*******************************************************************************
488
489 $Function: mmi_get_Headset_Reg
490
491 $Description: returns the HeadsetReg status from ph_lock_status
492
493 $Returns: none.
494
495 $Arguments:
496
497 *******************************************************************************/
498 //x0pleela 23 May, 2007 DR: OMAPS00132483
499 GLOBAL int mmi_get_Headset_Reg(void)
500 {
501 TRACE_FUNCTION("mmi_get_Headset_Reg()");
502 if( (ph_lock_status & HeadsetReg) == HeadsetReg)
503 return TRUE;
504 else
505 return FALSE;
506 }
507
508
509 /*******************************************************************************
510
511 $Function: mmi_set_usbms_enum
512
513 $Description: set /resets the UsbMsEnum bit in ph_lock_status
514
515 $Returns: none.
516
517 $Arguments:
518
519 *******************************************************************************/
520 //x0pleela 23 May, 2007 DR: OMAPS00132483
521 GLOBAL void mmi_set_usbms_enum( int usb_enum)
522 {
523 TRACE_FUNCTION("mmi_set_usbms_enum()");
524 if( usb_enum )
525 ph_lock_status |= UsbMsEnum;
526 else
527 ph_lock_status &= ResetFlag;
528 return;
529 }
530
531 /*******************************************************************************
532
533 $Function: mmi_get_usbms_enum
534
535 $Description: returns the UsbMsEnum status from ph_lock_status
536
537 $Returns: none.
538
539 $Arguments:
540
541 *******************************************************************************/
542 //x0pleela 23 May, 2007 DR: OMAPS00132483
543 GLOBAL int mmi_get_usbms_enum(void)
544 {
545 TRACE_FUNCTION("mmi_get_usbms_enum()");
546 if(( ph_lock_status & UsbMsEnum ) == UsbMsEnum)
547 return TRUE;
548 else
549 return FALSE;
550 }
551 #endif /*FF_PHONE_LOCK*/
552
553 /*******************************************************************************
554
555 $Function: mainInit
556
557 $Description: init MMI main module
558
559 $Returns: none.
560
561 $Arguments:
562
563 *******************************************************************************/
564 void mainInit (UBYTE InitCause)
565 {
566 int i;
567 T_MFW_SMS_INFO sms_settings;
568 //x0018858 24 Mar, 2005 MMI-FIX-11321
569 //added structures for storing the indication settings and CMER settings.
570 T_ACI_MM_CIND_VAL_TYPE cindSettings;
571 T_ACI_MM_CMER_VAL_TYPE cmerSettings;
572 TRACE_FUNCTION("maininit");
573
574 mfwSetSignallingMethod(1);
575 winAutoFocus(TRUE);
576 mfwSetFocus(0); /* reset focus */
577
578
579 /*MC SPR 1111*/
580 /*MC check to see if language already selected and saved to FFS*/
581
582 // Oct 19, 2004 REF: CRR MMI-SPR-26002 xkundadu
583 // Issue description: Golite booting problem.
584 // Solution: If the FFS is not formatted, dont write into the FFS.
585 // In that case just set the langauge to English and do the mmi
586 // layout settings.
587 if(flash_formatted() == TRUE)
588 {
589 if (flash_read() >= EFFS_OK)
590 { TRACE_EVENT_P1("FFS_flashData.language: %d", FFS_flashData.language);
591
592 /*MC SPR 1150 if language is not 0 and not greater than the maximum language code*/
593 if (FFS_flashData.language != NULL && FFS_flashData.language<= NO_OF_LANGUAGES)
594 MmiRsrcSetLang(FFS_flashData.language);/*MC, change to stored language*/
595 else
596 MmiRsrcSetLang(ENGLISH_LANGUAGE);
597
598 /*API - 28/07/03 - CQ10203 - If the flash value not set set to default VP_REL_24_HOURS*/
599 if((FFS_flashData.vp_rel != VP_REL_1_HOUR) &&
600 (FFS_flashData.vp_rel != VP_REL_12_HOURS) &&
601 (FFS_flashData.vp_rel != VP_REL_24_HOURS) &&
602 (FFS_flashData.vp_rel != VP_REL_1_WEEK)&&
603 (FFS_flashData.vp_rel != VP_REL_MAXIMUM)) // May 10, 2004 REF: CRR 15753 Deepa M.D
604 {
605 FFS_flashData.vp_rel = VP_REL_24_HOURS;
606 }
607 /*API - 28/07/03 - CQ10203 - END */
608
609 /*NDH - 13/01/04 - CQ16753 - Propogate the Validity Period Settings to the ACI */
610 sms_settings.vp_rel = FFS_flashData.vp_rel;
611 (void)sms_set_val_period(&sms_settings);
612 /*NDH - 13/01/04 - CQ16753 - END */
613 }
614 else
615 {
616 /* GW If flash read fails set up default settings. */
617 /* This will also save the settings to flash */
618 memset(&FFS_flashData, 0x00, sizeof(FFS_flashData));
619 /*default language is english*/
620 setUserSettings2Default();
621 }
622 }
623 // Oct 19, 2004 REF: CRR MMI-SPR-26002 xkundadu
624 // Issue description: Golite booting problem.
625 // Solution: If the FFS is not formatted, dont write into the FFS.
626 // In that case just set the langauge to English and mmi
627 // layout settings.
628 else
629 {
630 // Set the default language to English.
631 MmiRsrcSetLang(ENGLISH_LANGUAGE);
632
633 // Jan 07, 2005 REF: CRR 26394 xkundadu
634 // Issue description:Logo of the operator not displayed
635 // Solution: Set the network operator logo display option to enbled state.
636 // Set other user settings also to default values.
637
638 #ifndef MMI_LITE
639 memset(&FFS_flashData, 0x00, sizeof(FFS_flashData));
640 setUserSettings2Default();
641 #endif
642 }
643 /*mc end*/
644 HUPKeyOrigin = 0; // sbh
645 off_switch=0; /* 0 is stands for mobile is swiched on */
646 animation_complete = FALSE;
647
648 kbdAlways((MfwCb)keyAction); /* global keyboard access */
649 kbdTime(2000,1000,400); /* long / repeat timeouts */
650
651 mainMmiLng = lngCreate(0,0,&mainLngInfo,0); /* language handler */
652
653 // times clock event
654
655 /*OMAPS00098881 (removing power variant) - a0393213(Prabakar)
656 Removed #ifndef FF_POWER_MANAGEMENT.
657 Timer is created irrespective of LCD refresh state.
658 It would be started when LCD refresh is needed else it would be stopped*/
659 times = timCreate(0,TIME_MINUTE,(MfwCb)timesEvent);
660
661
662 // xpradipg - LOCOSTO-ENH-31895 : 23 June 2005
663 // additional events addes for carkit and headset
664 //xashmic 9 Sep 2006, OMAPS00092732
665 //Added MfwMmeUSBMS for handling USB MS events
666 #if defined(FF_MMI_AUDIO_PROFILE) && defined( FF_MMI_USBMS)
667 mme = mmeCreate(0, MfwMmeSignal|MfwMmeBattery|MfwMmeBaState|MfwMmeHeadset|MfwMmeCarkit|MfwMmeUSBMS, (MfwCb)globalMme);
668 #else
669 #ifdef FF_MMI_AUDIO_PROFILE
670 mme = mmeCreate(0, MfwMmeSignal|MfwMmeBattery|MfwMmeBaState|MfwMmeHeadset|MfwMmeCarkit, (MfwCb)globalMme);
671 #else
672 #ifdef FF_MMI_USBMS
673 mme = mmeCreate(0, MfwMmeSignal|MfwMmeBattery|MfwMmeBaState|MfwMmeUSBMS, (MfwCb)globalMme);
674 #else
675 mme = mmeCreate(0, MfwMmeSignal|MfwMmeBattery|MfwMmeBaState, (MfwCb)globalMme);
676 #endif
677 #endif
678 #endif
679
680 /*Setup when we want the backlight to come on*/
681 // Nov 09, 2005 REF: DVT OMAPS00056873 xdeepadh
682 //On Isample boards the backlight is set off, since the bright LEDS are very disturbing.
683
684 for (i=0;i<BL_LAST_OPTION;i++)
685 #if (BOARD == 71)
686 mme_setBacklightEvent(i,BL_NO_LIGHT);
687 #else
688 mme_setBacklightEvent(i,BL_MAX_LIGHT);
689 #endif
690
691 #if (BOARD == 71)
692 mme_setBacklightEvent(BL_IDLE_TIMER,BL_NO_LIGHT);
693 #else
694 mme_setBacklightEvent(BL_IDLE_TIMER,BL_SET_IDLE);
695 #endif
696
697 mme_setBacklightEvent(BL_KEY_PRESS,BL_MAX_LIGHT);
698 mme_setBacklightEvent(BL_INCOMING_CALL,BL_MAX_LIGHT);
699 mme_setBacklightEvent(BL_EXIT,BL_NO_LIGHT);
700
701 /*and tell the backlight that the init event has happened */
702 mme_backlightEvent(BL_INIT);
703
704 //x0018858 24 Mar, 2005 MMI-FIX-11321
705 //Added two functions to set the indication and CMER values.
706 //begin
707 sms_set_cind_values(&cindSettings);
708 sms_set_cmer_values(&cmerSettings);
709 //end.
710
711 //RM test 14-07 second = 0;
712 /*SPR 1725, replace FFS clock data with RTC*/
713
714 /*OMAPS00098881 (removing power variant) a0393213(R.Prabakar)
715 Removed #ifndef FF_POWER_MANAGEMENT flag*/
716 time_date_init();
717
718 deregis = FALSE;
719
720 /*OMAPS00098881 (removing power variant) a0393213(R.Prabakar)
721 If FF_POWER_MANAGEMENT is not enabled the timer is started only when the lcd refresh is needed*/
722 #ifndef FF_POWER_MANAGEMENT
723 timStart(times); /* start clock */
724 #else
725 if(FFS_flashData.refresh==1)
726 timStart(times);
727 #endif
728
729 startExec(PhoneInit,0); /* get it rolling */
730
731 }
732
733 /*******************************************************************************
734
735 $Function: mainExit
736
737 $Description: exit MMI main module
738
739 $Returns: none.
740
741 $Arguments:
742
743 *******************************************************************************/
744 void mainExit (UBYTE InitCause)
745 {
746 TRACE_FUNCTION("mainExit");
747
748 startExit();
749 sim_exit(); /* finit SIM handler */
750 lngDelete(mainMmiLng); mainMmiLng = 0;
751 timDelete(times);
752 sms_cb_exit ();/*MC SPR1920 clean up cell broadcast*/
753 mmeDelete(mme); mme = 0;
754 kbdAlways(0);
755 dspl_ClearAll();
756 time_date_delete();/*SPR 1725*/
757 }
758
759 /*******************************************************************************
760
761 $Function: keyAction
762
763 $Description: handler called on every keyboard action
764
765 $Returns:
766
767 $Arguments:
768
769 *******************************************************************************/
770 static int keyAction (MfwEvt e, MfwKbd *res)
771 {
772 /* this function "keyAction" is called 4*times from MFW per each keypress */
773 /* twice for keypress and twice for keyrelease */
774 /* the variable "toggle" is using to avoid to play the keypadtone twice ! */
775 static UBYTE toggle = TRUE;
776
777 /* OMAPS00151698, x0056422 */
778 #ifdef FF_MMI_A2DP_AVRCP
779 if(tGlobalBmiBtStruct.bConnected == BMI_BT_CONNECTED && tGlobalBmiBtStruct.tCmdSrc == BMI_BT_HEADSET_COMMAND)
780 {}
781 else
782 {
783 #endif
784
785 #ifdef NEPTUNE_BOARD /* OMAPS00033660 */
786 static unsigned char cKeySound = 0;
787 #endif
788
789 /* this mask is use to filter the keyevent "e" */
790 /* want to use KEY_0, KEY_1,...... KEY_HASH */
791 USHORT mask = 0x0FFF;
792
793 /* Initialize - RAVI - 23-12-2005 */
794 /*a0393213 warnings removal-variable conditionally removed*/
795 #if ((!defined(FF_MIDI_RINGER)) || defined(NEPTUNE_BOARD))
796 UBYTE currentRinger = 0;
797 #endif
798
799
800 /* terminate the ringing in all situation (it doesnt matter where the user is */
801 if ( (e & KEY_HUP) && (e & KEY_MAKE) )
802 {
803 /* Apr 05, 2005 REF: ENH 29994 xdeepadh */
804 /* terminate the ringing */
805 #ifndef FF_MIDI_RINGER
806 currentRinger = getCurrentRingerSettings();
807 audio_StopSoundbyID( AUDIO_BUZZER, currentRinger );
808 #endif
809
810 }
811
812 /* the power-off-key ! */
813 if ( (e & KEY_POWER) && (e & KEY_MAKE))
814 {
815 TRACE_EVENT("KEY_POWER pressed !!!!");
816
817 if (pinsIsFocussed() EQ FOCUSSED_PINS)
818 {
819 pin_exit();
820 HUPKeyOrigin=1;
821 }
822 else if (idleIsFocussed())
823 {
824 HUPKeyOrigin=1;
825 }
826
827 if ((HUPKeyOrigin==1) && (off_switch == 0))
828 {
829 /*
830 ** Only pass through this once, off_switch must be 0 because Key_Action is called twice
831 ** for each key press.
832 */
833 TRACE_EVENT("In idle window.");
834 showGoodBye ( idle_get_window () );
835 times_switchoff = timCreate(0,THREE_SECS,(MfwCb)goodbye_cb);
836 timStart(times_switchoff);
837 off_switch++;
838 deregis = TRUE;
839 }
840 }
841
842 HUPKeyOrigin = 0;
843
844
845 /* every other calls */
846 if(toggle)
847 {
848 #ifdef SIM_TOOLKIT
849 /*SPR#2121 - DS - Only download event to SAT if the event has been registered
850 * by the SAT Setup Event List command
851 */
852 if (satEvtRegistered(SatEvtUserActionActivated) == TRUE)
853 {
854 satEvtDownload(SatEvtUserAction);
855 }
856 #endif
857
858 /* Stop Playing ring tone - RAVI - 23-12-2005 */
859 #ifdef NEPTUNE_BOARD
860 if(idle_data.new_sms == TRUE)
861 {
862 currentRinger = getcurrentSMSTone();
863 audio_StopSoundbyID( AUDIO_BUZZER, currentRinger );
864
865 /* Till this audio is stopped and next is played. */
866 vsi_t_sleep( 0, 10 );
867 }
868
869 cKeySound = 1; /* OMAPS00033660 */
870 if( idle_data.edt_buf[0] != '\0' )
871 {
872 if( idle_data.edt_buf[0] == '*' || idle_data.edt_buf[0] == '#' )
873 {
874 cKeySound = 0;
875 }
876 }
877 else
878 {
879 if ( (e & KEY_HASH) || ( e & KEY_STAR ) )
880 {
881 cKeySound = 0;
882 }
883 }
884
885 if( cKeySound == 1 )
886 {
887
888 #endif /* OMAPS00033660 */
889 /* END RAVI - 23-12-2005 */
890
891 if ((FFS_flashData.settings_status & SettingsKeypadClick) && (e & KEY_MAKE))
892 {
893 TRACE_EVENT ("Keypad Click activ");
894 /* Start Playing key tones on key press - RAVI 23-12-2005 */
895 #ifndef NEPTUNE_BOARD
896 audio_PlaySoundID(0, TONES_KEYBEEP, 200, AUDIO_PLAY_ONCE ); /* GW#2355 /CQ11341 */
897 #else
898 /* RAVI - 20-1-2006 */
899 /* Silent Implementation */
900 /* Changed 0 to getCurrentVolumeSetting () */
901 audio_PlaySoundID(0, (TONES_KEYBEEP), getCurrentVoulmeSettings(),
902 AUDIO_PLAY_ONCE ); /* GW#2355 /CQ11341 */
903 #endif
904 /* END RAVI */
905 }
906 else if ((FFS_flashData.settings_status & SettingsKeypadDTMF) && (e & KEY_MAKE))
907 {
908 TRACE_EVENT ("Keypad DTMF activ");
909 switch (e &= mask)
910 {
911 case KEY_0:
912 /* RAVI - 20-1-2006 */
913 #ifdef NEPTUNE_BOARD
914 audio_PlaySoundID(0, (TONES_DTMF_0), getCurrentVoulmeSettings(), AUDIO_PLAY_ONCE ); /* GW#2355 /CQ11341 */
915 #else
916 audio_PlaySoundID(0, (TONES_DTMF_0), 0, AUDIO_PLAY_ONCE ); /* GW#2355 /CQ11341 */
917 #endif
918 /* END RAVI */
919 break;
920 case KEY_1:
921 /* RAVI - 20-1-2006 */
922 #ifdef NEPTUNE_BOARD
923 audio_PlaySoundID(0, (TONES_DTMF_1), getCurrentVoulmeSettings(), AUDIO_PLAY_ONCE ); /* GW#2355 /CQ11341 */
924 #else
925 audio_PlaySoundID(0, TONES_DTMF_1, 0, AUDIO_PLAY_ONCE ); /* GW#2355 /CQ11341 */
926 #endif
927 /* END RAVI */
928 break;
929 case KEY_2:
930 /* RAVI - 20-1-2006 */
931 #ifdef NEPTUNE_BOARD
932 audio_PlaySoundID(0, (TONES_DTMF_2), getCurrentVoulmeSettings(), AUDIO_PLAY_ONCE ); /* GW#2355 /CQ11341 */
933 #else
934 audio_PlaySoundID(0, TONES_DTMF_2, 0, AUDIO_PLAY_ONCE ); /* GW#2355 /CQ11341 */
935 #endif
936 /* END RAVI */
937 break;
938 case KEY_3:
939 /* RAVI - 20-1-2006 */
940 #ifdef NEPTUNE_BOARD
941 audio_PlaySoundID(0, (TONES_DTMF_3), getCurrentVoulmeSettings(), AUDIO_PLAY_ONCE ); /* GW#2355 /CQ11341 */
942 #else
943 audio_PlaySoundID(0, TONES_DTMF_3, 0, AUDIO_PLAY_ONCE ); /* GW#2355 /CQ11341 */
944 #endif
945 /* END RAVI */
946 break;
947 case KEY_4:
948 /* RAVI - 20-1-2006 */
949 #ifdef NEPTUNE_BOARD
950 audio_PlaySoundID(0, (TONES_DTMF_4), getCurrentVoulmeSettings(), AUDIO_PLAY_ONCE ); /* GW#2355 /CQ11341 */
951 #else
952 audio_PlaySoundID(0, TONES_DTMF_4, 0, AUDIO_PLAY_ONCE ); /* GW#2355 /CQ11341 */
953 #endif
954 /* END RAVI */
955 break;
956 case KEY_5:
957 /* RAVI - 20-1-2006 */
958 #ifdef NEPTUNE_BOARD
959 audio_PlaySoundID(0, (TONES_DTMF_5), getCurrentVoulmeSettings(), AUDIO_PLAY_ONCE ); /* GW#2355 /CQ11341 */
960 #else
961 audio_PlaySoundID(0, TONES_DTMF_5, 0, AUDIO_PLAY_ONCE ); /* GW#2355 /CQ11341 */
962 #endif
963 /* END RAVI */
964 break;
965 case KEY_6:
966 /* RAVI - 20-1-2006 */
967 #ifdef NEPTUNE_BOARD
968 audio_PlaySoundID(0, (TONES_DTMF_6), getCurrentVoulmeSettings(), AUDIO_PLAY_ONCE ); /* GW#2355 /CQ11341 */
969 #else
970 audio_PlaySoundID(0, TONES_DTMF_6, 0, AUDIO_PLAY_ONCE ); /* GW#2355 /CQ11341 */
971 #endif
972 /* END RAVI */
973 break;
974 case KEY_7:
975 /* RAVI - 20-1-2006 */
976 #ifdef NEPTUNE_BOARD
977 audio_PlaySoundID(0, (TONES_DTMF_7), getCurrentVoulmeSettings(), AUDIO_PLAY_ONCE ); /* GW#2355 /CQ11341 */
978 #else
979 audio_PlaySoundID(0, TONES_DTMF_7, 0, AUDIO_PLAY_ONCE ); /* GW#2355 /CQ11341 */
980 #endif
981 /* END RAVI */
982 break;
983 case KEY_8:
984 /* RAVI - 20-1-2006 */
985 #ifdef NEPTUNE_BOARD
986 audio_PlaySoundID(0, (TONES_DTMF_8), getCurrentVoulmeSettings(), AUDIO_PLAY_ONCE ); /* GW#2355 /CQ11341 */
987 #else
988 audio_PlaySoundID(0, TONES_DTMF_8, 0, AUDIO_PLAY_ONCE ); /* GW#2355 /CQ11341 */
989 #endif
990 /* END RAVI */
991 break;
992 case KEY_9:
993 /* RAVI - 20-1-2006 */
994 #ifdef NEPTUNE_BOARD
995 audio_PlaySoundID(0, (TONES_DTMF_9), getCurrentVoulmeSettings(), AUDIO_PLAY_ONCE ); /* GW#2355 /CQ11341 */
996 #else
997 audio_PlaySoundID(0, TONES_DTMF_9, 0,AUDIO_PLAY_ONCE ); /* GW#2355 /CQ11341 */
998 #endif
999 /* END RAVI */
1000 break;
1001 case KEY_STAR:
1002 /* RAVI - 20-1-2006 */
1003 #ifdef NEPTUNE_BOARD
1004 audio_PlaySoundID(0, (TONES_DTMF_STAR), getCurrentVoulmeSettings(), AUDIO_PLAY_ONCE ); /* GW#2355 /CQ11341 */
1005 #else
1006 audio_PlaySoundID(0, TONES_DTMF_STAR, 0, AUDIO_PLAY_ONCE ); /* GW#2355 /CQ11341 */
1007 #endif
1008 /* END RAVI */
1009 break;
1010 case KEY_HASH:
1011 /* RAVI - 20-1-2006 */
1012 #ifdef NEPTUNE_BOARD
1013 audio_PlaySoundID(0, (TONES_DTMF_HASH), getCurrentVoulmeSettings(), AUDIO_PLAY_ONCE ); /* GW#2355 /CQ11341 */
1014 #else
1015 audio_PlaySoundID(0, TONES_DTMF_HASH, 0, AUDIO_PLAY_ONCE ); /* GW#2355 /CQ11341 */
1016 #endif
1017 /* END RAVI */
1018 break;
1019 default:
1020 break;
1021
1022 }
1023 }
1024
1025 #ifdef NEPTUNE_BOARD
1026 }
1027 #endif
1028
1029 }
1030
1031 /* OMAPS00151698, x0056422 */
1032 #ifdef FF_MMI_A2DP_AVRCP
1033 }
1034 #endif
1035
1036
1037
1038 /* toggle the variable */
1039 if(toggle)
1040 {
1041 toggle = FALSE;
1042 }
1043 else
1044 {
1045 toggle = TRUE;
1046 }
1047
1048
1049 return 0;
1050 }
1051
1052 #if(0)/* x0039928 -Lint warning removal */
1053 /*******************************************************************************
1054
1055 $Function: key
1056
1057 $Description: keyboard event handler
1058
1059 $Returns: none.
1060
1061 $Arguments:
1062
1063 *******************************************************************************/
1064 // switching the mobile on
1065 static int key (MfwEvt e, MfwKbd *kc)
1066 {
1067
1068 TRACE_FUNCTION("Initial key");
1069 //---------------start : Mobile On-------------------
1070 TRACE_EVENT(" Mobile ON");
1071 /* set the state of mobile on */
1072 globalMobileMode = (globalMobileMode | GlobalMobileOn);
1073
1074
1075 //startExec(PhoneInit,0); /* get it rolling */
1076
1077 return 1;
1078 }
1079
1080 #endif
1081 //Callback after dialog "Charging" is displayed
1082 //x0pleela 14 Apr, 2006 ER: OMAPS00075178
1083 static void charging_start_cb(T_MFW_HND win, UBYTE identifier, UBYTE reason)
1084 {
1085 TRACE_FUNCTION("charging_start_cb()");
1086 /*
1087 ** Send an Idle Update to trigger the idle screen to be updated if required,
1088 */
1089 idleEvent(IdleUpdate);
1090
1091 return;
1092 }
1093
1094 //function to display the dialog "charging" when charger is connected
1095 //x0pleela 14 Apr, 2006 ER: OMAPS00075178
1096 static void charging_start_info(void)
1097 {
1098 T_DISPLAY_DATA display_info;
1099
1100 TRACE_FUNCTION("charging_start_info()");
1101
1102 dlg_initDisplayData_TextId( &display_info, TxtNull, TxtNull, TxtCharging, TxtNull, COLOUR_STATUS);
1103 /*a0393213 warnings removal-callback fn typecasted*/
1104 dlg_initDisplayData_events( &display_info, (T_VOID_FUNC)charging_start_cb, TWO_SECS, KEY_CLEAR );
1105 /*
1106 * Call Info Screen
1107 */
1108 info_dialog (idle_get_window(), &display_info);
1109
1110
1111 return;
1112 }
1113 /*******************************************************************************
1114
1115 $Function: globalMme
1116
1117 $Description: MME event handler
1118
1119 $Returns: none.
1120
1121 $Arguments:
1122
1123 *******************************************************************************/
1124 int globalMme(MfwEvt e, MfwHnd para)
1125 {
1126 MfwMme* mc = (MfwMme*)para;
1127
1128 U8 value;
1129 #ifdef FF_MMI_AUDIO_PROFILE
1130 MfwHnd win = call_data.win_incoming;
1131 MfwWin * win_data ;
1132 T_dialog_info * data;
1133 T_MFW_HND parent_win = NULL;
1134 USHORT Identifier = 0;
1135 void (* Callback)() = NULL;
1136
1137 if( win != NULL)
1138 {
1139 win_data = (MfwWin*)((T_MFW_HDR *)win)->data;
1140 data = (T_dialog_info *)win_data->user;
1141 parent_win = data->parent_win;
1142 Identifier = data->Identifier;
1143 Callback= data->Callback;
1144 }
1145 #endif
1146
1147 TRACE_FUNCTION("globalMme");
1148
1149 switch(e) {
1150 case MfwMmeSignal :
1151 TRACE_EVENT("Mme Event: Signal");
1152 value = (U8)mc->value;//JVJE
1153 /***************************Go-lite Optimization changes Start***********************/
1154 //Aug 16, 2004 REF: CRR 24323 Deepa M.D
1155 TRACE_EVENT_P1 ("Event MfwMmeSignal %d", value);
1156 /***************************Go-lite Optimization changes end***********************/
1157 globalSignalUpdate(value); /*Update the value of the fieldstrength */
1158
1159 break;
1160
1161 case MfwMmeBattery:
1162 TRACE_EVENT("Mme Event: Battery....");
1163 TRACE_EVENT_P1("MfwMmeBattery:mc->value: %d", mc->value);
1164 globalBatteryUpdate(mc->value); //x0pleela 10 Apr, 2006 ER: OMAPS00075178
1165 break;
1166
1167
1168 case MfwMmeBaState:
1169 TRACE_EVENT("Mme Event: State....");
1170
1171 value = (U8)mc->value;
1172 TRACE_EVENT_P1("MfwMmeBaState:mc->value: %d", mc->value);
1173 switch(value)
1174 {
1175 //x0pleela 10 Apr, 2006 ER: OMAPS00075178
1176 case PWR_CHG_PLUG:
1177 TRACE_EVENT("Mme Event:PWR_CHG_PLUG");
1178 charging_start_info();
1179 break;
1180 /* External Power Plugged Off */
1181 //case 0: //x0pleela 10 Apr, 2006
1182 case PWR_CHG_UNPLUG://x0pleela 10 Apr, 2006 ER: OMAPS00075178
1183 TRACE_EVENT("Mme Event:Discharging");
1184 globalMobileMode = globalMobileMode & (~GlobalCharging);
1185 globalMobileMode = globalMobileMode & (~GlobalBatteryPower);
1186 globalBatteryMode = GlobalBatteryGreater5; //x0pleela 10 Apr, 2006
1187 timStop(battery_charging_animate ); //x0pleela 11 Apr, 2006
1188 idleEvent(IdleUpdate); //x0pleela 10 Apr, 2006
1189 break;
1190
1191 /* Mme Event: External Power Connected or End of Charge */
1192 // case 1: //x0pleela 10 Apr, 2006
1193 case PWR_CHG_STOP: //x0pleela 10 Apr, 2006 ER: OMAPS00075178
1194 TRACE_EVENT("Mme Event:GlobalBatteryPower");
1195 // globalMobileMode = globalMobileMode & (~GlobalCharging);
1196 globalMobileMode = (globalMobileMode | GlobalBatteryPower);
1197 /* indicate that the battery is full*/
1198 globalBatteryMode = GlobalBatteryFull;
1199 timStop(battery_charging_animate ); //x0pleela 11 Apr, 2006
1200 idleEvent(IdleUpdate); //x0pleela 10 Apr, 2006
1201 TRACE_EVENT("globalBatteryPicNumber = GlobalBatteryFull");
1202 break;
1203 /* Mme Event: Start of Charge */
1204 // case 2: //x0pleela 10 Apr, 2006
1205 case PWR_CHG_BEGIN: //x0pleela 10 Apr, 2006 ER: OMAPS00075178
1206 TRACE_EVENT("Mme Event:Charging");
1207 globalMobileMode = globalMobileMode & (~GlobalBatteryPower);
1208 globalMobileMode = (globalMobileMode | GlobalCharging);
1209 globalBatteryMode = GlobalBatteryGreater5; //x0pleela 10 Apr, 2006
1210 idleEvent(IdleUpdate); //x0pleela 10 Apr, 2006
1211 //globalFlashBattery (); //x0pleela 10 Apr, 2006 : included to show animation of battery charging
1212 break;
1213 default:
1214 break;
1215 }
1216 break;
1217 // xpradipg - LOCOSTO-ENH-31895 : 23 June 2005
1218 #ifdef FF_MMI_AUDIO_PROFILE
1219 //indicates the events related to the headset
1220 case MfwMmeHeadset:
1221 // Aug 03, 2006 REF:OMAPS00088329 x0039928
1222 #ifdef MMI_TTY_ENABLED
1223
1224 if(FFS_flashData.ttyAlwaysOn == FALSE && call_data.tty == CALL_TTY_OFF)
1225
1226 #endif
1227 {
1228 value = (U8)mc->value;
1229 switch(value)
1230 {
1231 case AUDIO_HEADSET_HOOK_DETECT:
1232 {
1233 TRACE_EVENT("AUDIO_HEADSET_HOOK_DETECT");
1234 if( winIsFocussed(call_data.win_incoming))
1235 {
1236 dialog_info_destroy(win);
1237 if(Callback != NULL) /* x0039928 - Lint warning fix */
1238 (Callback)(parent_win,Identifier, INFO_KCD_LEFT);
1239 }
1240 else if(call_data.win)
1241 mmi_hook_handle();
1242 }
1243 break;
1244 case AUDIO_HEADSET_UNPLUGGED:
1245 TRACE_EVENT("AUDIO_HEADSET_UNPLUGGED");
1246 //x0pleela 20 Mar, 2007 ER: OMAPS00122561
1247 #ifdef FF_PHONE_LOCK
1248 //Set headset connect to FALSE
1249 mmi_set_Headset_Reg(FALSE);
1250
1251 //x0pleela 23 May, 2007 DR: OMAPS00132483
1252 //get the phone lock status
1253 if( !mfw_get_Phlock_status() )
1254 {
1255 #endif /*FF_PHONE_LOCK*/
1256
1257 mmi_device_status_info(NULL,TxtHeadset,TxtRemoved,NULL);
1258 // Jun 02, 2006 DRT OMAPS00079213 x0039928(sumanth)
1259 // Fix: Hook is unregistered when headset is plugged off.
1260 mfw_hook_unregister();
1261
1262 //x0pleela 20 Mar, 2007 ER: OMAPS00122561
1263 #ifdef FF_PHONE_LOCK
1264 }
1265 #endif /*FF_PHONE_LOCK*/
1266
1267 mfw_audio_device_indication(value);
1268 break;
1269
1270 case AUDIO_HEADSET_PLUGGED:
1271 TRACE_EVENT("AUDIO_HEADSET_PLUGGED");
1272 //x0pleela 20 Mar, 2007 ER: OMAPS00122561
1273 #ifdef FF_PHONE_LOCK
1274 //set headset connect to TRUE
1275 mmi_set_Headset_Reg(TRUE);
1276
1277 //x0pleela 23 May, 2007 DR: OMAPS00132483
1278 //get the phone lock status
1279 if( !mfw_get_Phlock_status() )
1280 #endif /*FF_PHONE_LOCK*/
1281
1282 mmi_device_status_info(NULL,TxtHeadset,TxtInserted,NULL);
1283
1284 mfw_audio_device_indication(value);
1285
1286 //x0pleela 20 Mar, 2007 ER: OMAPS00122561
1287 #ifdef FF_PHONE_LOCK
1288 //x0pleela 23 May, 2007 DR: OMAPS00132483
1289 //get the phone lock status
1290 if( !mfw_get_Phlock_status() )
1291 {
1292 #endif /*FF_PHONE_LOCK*/
1293 // Jun 02, 2006 DRT OMAPS00079213 x0039928(sumanth)
1294 // Fix: Hook is registered when headset is plugged in during call.
1295 if(call_data.win_calling OR call_data.win_incoming OR call_data.calls.numCalls)
1296 mfw_hook_register();
1297
1298 //x0pleela 20 Mar, 2007 ER: OMAPS00122561
1299 #ifdef FF_PHONE_LOCK
1300 }
1301 #endif /*FF_PHONE_LOCK*/
1302 break;
1303 }
1304 }
1305
1306 break;
1307 //indicates the events related to the carkit
1308 case MfwMmeCarkit:
1309 value = (U8) mc->value;
1310 switch(value)
1311 {
1312 case AUDIO_CARKIT_UNPLUGGED:
1313 TRACE_EVENT("AUDIO_CARKIT_UNPLUGGED");
1314 mmi_device_status_info(NULL,TxtCarkit,TxtRemoved,NULL);
1315 mfw_audio_device_indication(value);
1316 break;
1317 case AUDIO_CARKIT_PLUGGED:
1318 TRACE_EVENT("AUDIO_CARKIT_PLUGGED");
1319 mmi_device_status_info(NULL,TxtCarkit,TxtInserted,NULL);
1320 mfw_audio_device_indication(value);
1321 break;
1322 }
1323 break;
1324 #endif
1325 //Handler for connect and disconnect event of the USB cable.
1326 #ifdef FF_MMI_USBMS
1327 case MfwMmeUSBMS:
1328 {
1329 value = (U8) mc->value;
1330 switch(value)
1331 {
1332 case MFW_USB_CABLE_CONNECT_EVENT :
1333 //x0pleela 16 Mar, 2007 ER: OMAPS00122561
1334 #ifdef FF_PHONE_LOCK
1335 //set usb_ms_enum to TRUE
1336 mmi_set_usbms_enum( TRUE);
1337 //x0pleela 23 May, 2007 DR: OMAPS00132483
1338 //get the phone lock status
1339 if( !mfw_get_Phlock_status() )
1340 #endif /*FF_PHONE_LOCK*/
1341
1342 mmi_usb_enumeration_options();
1343 break;
1344
1345 case MFW_USB_CABLE_DISCONNECT_EVENT :
1346 //x0pleela 16 Mar, 2007 ER: OMAPS00122561
1347 #ifdef FF_PHONE_LOCK
1348 //set usb_ms_enum to FALSE
1349 mmi_set_usbms_enum( FALSE );
1350 //x0pleela 23 May, 2007 DR: OMAPS00132483
1351 //get the phone lock status
1352 if( !mfw_get_Phlock_status() )
1353 #endif /*FF_PHONE_LOCK*/
1354
1355 mmi_usbms_mode_disconnect();
1356 break;
1357 /* Mar 22, 2007 DVT: OMAPS00121916 x0039928 */
1358 #ifdef FF_MMI_FILEMANAGER
1359 case MFW_TFLASH_INSERTED_EVENT:
1360 mmi_device_status_info(NULL,TxtTflash,TxtInserted,NULL);
1361 break;
1362 case MFW_TFLASH_REMOVED_EVENT:
1363 mmi_device_status_info(NULL,TxtTflash,TxtRemoved,NULL);
1364 break;
1365 #endif
1366 }
1367
1368 }
1369 break;
1370 #endif
1371
1372 default:
1373 return 1;
1374 }
1375 return 1;
1376 }
1377
1378 #if(0) /* x0039928 - Lint warning removal */
1379 /*******************************************************************************
1380
1381 $Function: backlight
1382
1383 $Description: switch on backlight for certain time
1384
1385 $Returns: none.
1386
1387 $Arguments:
1388
1389 *******************************************************************************/
1390 static void backlight (void)
1391 {
1392
1393
1394 }
1395 #endif
1396 /*******************************************************************************
1397
1398 $Function: timesEvent
1399
1400 $Description: times event clock
1401
1402 $Returns: none.
1403
1404 $Arguments:
1405
1406 *******************************************************************************/
1407 static int timesEvent (MfwEvt e, MfwTim *t)
1408 {
1409
1410 //RM only for PC testing
1411 /* x0039928 -Lint warning removal
1412 second += 60; */
1413
1414
1415 idleEvent(IdleUpdate);
1416
1417 /*MC CONQUEST 5999->6007,21/05/02 if CPHS reading didn't work on switch-on, try again*/
1418 if (CphsPresent() == CPHS_ERR)
1419 cphs_support_check();
1420
1421
1422 mme_backlightEvent(BL_IDLE_TIMER);
1423
1424 timStart(times);
1425
1426 return 1;
1427 }
1428
1429
1430 /*******************************************************************************
1431
1432 $Function: showCLOCK
1433
1434 $Description: display clock
1435
1436 $Returns: none.
1437
1438 $Arguments:
1439
1440 *******************************************************************************/
1441 void showCLOCK(void)
1442 { /*SPR 1725, use new function to get clock string*/
1443 dspl_TextOut(30,24,0,(char *)mfw_td_get_clock_str());
1444 }
1445 /*******************************************************************************
1446
1447 $Function: setClockFormat
1448
1449 $Description: used to switch between 24 hour and 12 hour display format
1450
1451 $Returns: none.
1452
1453 $Arguments: format enum
1454
1455 *******************************************************************************/
1456 void setClockFormat(UBYTE format)
1457 {/*SPR 1725, use new function to set clock format*/
1458 if (format == MFW_TIME_FORMAT_12HOUR)
1459 FFS_flashData.time_format = MFW_TIME_FORMAT_12HOUR;
1460 else
1461 FFS_flashData.time_format = MFW_TIME_FORMAT_24HOUR;
1462 // Jul 22,2004 CRR:20896 xrashmic - SASKEN
1463 // The timeformat was not being written into the flash.
1464 flash_write();
1465
1466 mfw_td_set_time_format((T_MFW_TIME_FORMAT)format);
1467 }
1468 // Issue Number : MMI-SPR-12159 on 07/04/04 by Rashmi C N and Deepa M D
1469 // change by Sasken ( Rashmi C N and Deepa M D) on April 07th 2004
1470 // Bug : The AM PM for 12 hour fomrat was not being shown
1471 // Solution : Added the following function to get the current time format from flash
1472 UBYTE getClockFormat()
1473 {
1474 return FFS_flashData.time_format;
1475 }
1476
1477 /*SPR 1725, removed ClockSet and DateSet functions*/
1478
1479 /*******************************************************************************
1480
1481 $Function: showDATE
1482
1483 $Description: display date
1484
1485 $Returns:
1486
1487 $Arguments:
1488
1489 *******************************************************************************/
1490 void showDATE(void)
1491 {/*SPR 1725, use new function to get date string*/
1492 dspl_TextOut(0,10,0,mfw_td_get_date_str());
1493
1494 }
1495
1496
1497 /*******************************************************************************
1498
1499 $Function: displayAlignedText
1500
1501 $Description: Display text horizontally aligned [left|right|center] in specified row.
1502
1503
1504 $Returns: none.
1505
1506 $Arguments:
1507
1508 *******************************************************************************/
1509 void displayAlignedText( T_MMI_ALIGN x_alignment, USHORT y_lineNum, UBYTE attrib, char* string )
1510 {
1511 int stringLength = 0;
1512 USHORT startXPos = 0; // starting X pos for display
1513
1514 dspl_DevCaps deviceCaps;
1515
1516 dspl_GetDeviceCaps(&deviceCaps);
1517
1518 /* SPR#1983 - SH - Shouldn't use strlen for unicode string.
1519 * 0 means whole string will be used. */
1520
1521 stringLength = (int)dspl_GetTextExtent(string, 0);
1522
1523 TRACE_EVENT_P2("aligned %d, extent = %d", x_alignment, stringLength);
1524
1525 switch ( x_alignment )
1526 {
1527 case LEFT:
1528
1529 break;
1530
1531 case RIGHT:
1532 startXPos = (USHORT) deviceCaps.Width - stringLength /*- OneCharLen*/ ;
1533 break;
1534
1535 case CENTER:
1536 startXPos = (USHORT) (deviceCaps.Width - stringLength) / 2;
1537 break;
1538
1539 }
1540
1541 dspl_TextOut(startXPos, y_lineNum, attrib, (char*)string );
1542 }
1543 /*******************************************************************************
1544
1545 $Function: displayAlignedPrompt
1546
1547 $Description: Display prompt horizontally aligned [left|right|center] in specified row.
1548
1549 $Returns:
1550
1551 $Arguments:
1552
1553 *******************************************************************************/
1554 void displayAlignedPrompt( T_MMI_ALIGN x_alignment, USHORT y_lineNum, UBYTE attrib, int string_id )
1555 {
1556 int stringLength = 0;
1557 USHORT startXPos = 0; // starting X pos for display
1558
1559 dspl_DevCaps deviceCaps;
1560
1561 dspl_GetDeviceCaps(&deviceCaps);
1562
1563
1564 /* Marcus: Issue 1123: 12/09/2002: Replaced use of strlen with dspl_str_length for Unicode */
1565 stringLength=dspl_str_length((char*)MmiRsrcGetText( string_id ));
1566 switch ( x_alignment )
1567 {
1568 case LEFT:
1569
1570 break;
1571
1572 case RIGHT:
1573 startXPos = (USHORT) deviceCaps.Width - stringLength /*- OneCharLen*/ ;
1574 break;
1575
1576 case CENTER:
1577 startXPos = (USHORT) (deviceCaps.Width - stringLength) / 2;
1578 break;
1579
1580 }
1581
1582 PROMPT(startXPos, y_lineNum, attrib, string_id );
1583 }
1584 /*******************************************************************************
1585
1586 $Function: mainShutdown
1587
1588 $Description:
1589
1590 $Returns: none.
1591
1592 $Arguments:
1593
1594 *******************************************************************************/
1595 void mainShutdown(void)
1596 {
1597
1598 TRACE_FUNCTION("mainShutdown ()");
1599
1600 if(deregis)
1601 {
1602 //---------------start: Mobile OFF-------------------
1603 TRACE_EVENT(" Mobile OFF");
1604 /* delete the state of mobile on */
1605 globalMobileMode = globalMobileMode & (~GlobalMobileOn);
1606
1607 deregis = FALSE;
1608
1609 mmiExit();/* RM 20-07 */
1610
1611 //Jul 05, 2005 REF: SPR 31894 xdeepadh
1612 // SIM functionality has been replaced by UICC in Locosto.
1613 #ifdef TI_PS_UICC_CHIPSET_15
1614 simdrv_poweroff(BSP_UICC_DEFAULT_READER_ID);
1615 #else
1616 SIM_PowerOff();
1617 #endif
1618 #ifndef _SIMULATION_
1619 AI_Power(0);
1620 #endif
1621
1622 }
1623 }
1624 /*******************************************************************************
1625
1626 $Function: globalBatteryUpdate
1627
1628 $Description: Update the value of the battery after the MME event
1629
1630 $Returns:
1631
1632 $Arguments:
1633
1634 *******************************************************************************/
1635 int globalBatteryUpdate (U8 value)
1636 {
1637
1638 MmiModuleDel (ModuleBattLow); /* delete the state */
1639
1640 globalBatteryMode = GlobalBatteryGreater5;
1641
1642
1643 switch (value)
1644 {
1645 case 0: /* battery low */
1646 globalBatteryPicNumber = 0;
1647 globalBatteryMode = GlobalBatteryLesser5;
1648
1649 /* is just a global status */
1650 MmiModuleSet (ModuleBattLow); /* set the state */
1651 break;
1652
1653 case 1:
1654 globalBatteryPicNumber = 1;
1655 break;
1656
1657 case 2:
1658 globalBatteryPicNumber = 2;
1659 break;
1660
1661 case 3:
1662 globalBatteryPicNumber = 3;
1663 break;
1664
1665 case 4:
1666 globalBatteryPicNumber = 4;
1667 break;
1668
1669 default:
1670 globalBatteryPicNumber = 2;
1671 break;
1672 }
1673
1674 idleEvent(IdleUpdate);
1675
1676 return 0;
1677 }
1678
1679
1680 /*******************************************************************************
1681
1682 $Function: globalSignalUpdate
1683
1684 $Description:Update the value of the fieldstrength after the MME event
1685
1686 $Returns:
1687
1688 $Arguments:
1689
1690 *******************************************************************************/
1691 int globalSignalUpdate (U8 value)
1692 {
1693
1694 globalSignalPicNumber = value;
1695
1696 idleEvent(IdleUpdate);
1697 #ifdef NEPTUNE_BOARD
1698 dspl_Enable(1);
1699 #endif
1700 return 0;
1701 }
1702
1703
1704
1705 /*******************************************************************************
1706
1707 $Function: globalFlashBattery
1708
1709 $Description: exit MMI main module
1710
1711 $Returns: none.
1712
1713 $Arguments:
1714
1715 *******************************************************************************/
1716 void globalFlashBattery (void)
1717 {
1718 TRACE_EVENT(" globalFlashBattery ");
1719
1720 globalBatteryPicNumber++;
1721
1722 if(globalBatteryPicNumber > 4)
1723 globalBatteryPicNumber = 0;
1724
1725 idleEvent(IdleUpdate);
1726 TRACE_EVENT(" start the timer for Blink ");
1727
1728
1729 }
1730
1731 /* SPR#1428 - SH - New Editor: this is all obsolete with new editor. Equivalent
1732 * functionality can be found in AUITextEntry.c */
1733
1734 #ifndef NEW_EDITOR
1735 /*******************************************************************************
1736
1737 $Function: editShowHeader
1738
1739 $Description: displays the new character over the cursor
1740
1741 $Returns: none.
1742
1743 $Arguments:
1744
1745 *******************************************************************************/
1746 /*MC SPR 1242 merged in b-sample version of this function */
1747 static void editShowHeader (void)
1748 {
1749 int alphachar;
1750 MfwEdt *edit = ((MfwHdr *) myHandle)->data;
1751
1752 TRACE_FUNCTION("editShowHeader");
1753
1754 edtChar(myHandle,ecDel);
1755 if (upCase)
1756 alphachar = editAlphaU[editAlphaKey][editAlphaLevel];
1757 else
1758 alphachar = editAlpha[editAlphaKey][editAlphaLevel];
1759
1760 if (!(editAlphaMode && editAlphaKey != KCD_MAX))
1761 alphachar= ' ';
1762 else if (editHiddenMode) // SH - in hidden mode...
1763 tmpBuf[edit->cp] = alphachar; // store character in buffer
1764 #ifdef NO_ASCIIZ
1765 /*MC, SPR 940/2 01/08/02, don't need to check for language, tag should be enough*/
1766 if (edit->attr->text[0] == 0x80/*MC 22/07/02*/)
1767 alphachar = alphachar << 8;
1768 #endif
1769 {/*NM p025*/
1770 edit->attr->alphaMode = TRUE;
1771 }
1772
1773 edtChar(myHandle,alphachar);
1774
1775 /*
1776 is this actually useless after insert a
1777 character to call "ecRight" and then "ecLeft"
1778 For the multitap we need only two steps:
1779 "ecDel" plus insert the character
1780
1781 edtChar(myHandle,ecLeft);*/
1782
1783
1784 {edit->attr->alphaMode = FALSE;}
1785
1786 /*p025 end*/
1787
1788 }
1789
1790 /*******************************************************************************
1791
1792 $Function: editEventTim
1793
1794 $Description: executes the timer event from the edit component
1795
1796 $Returns: none.
1797
1798 $Arguments:
1799
1800 *******************************************************************************/
1801 /*MC SPR 1242 merged in b-sample version of this function */
1802 static int editEventTim (MfwEvt e, MfwTim *t)
1803 {
1804 char *format = formatHandle; // SH - temporary format template
1805
1806 TRACE_FUNCTION("editEventTim");
1807
1808 if (!(editAlphaMode || editFormatMode))
1809 return 1;
1810
1811
1812 /*MC, SPR925 23/07/02, removed variable assignment for chinese */
1813
1814 // SH - modifications for format mode & hidden mode
1815 if (editFormatMode) // SH - advance format pointer when
1816 {
1817 if (editHiddenMode)
1818 {
1819 editCharFindNext('*');
1820 }
1821 else
1822 editCharFindNext(ecRight);
1823 }
1824 else if (editHiddenMode)
1825 {
1826 edtChar(myHandle,'*');
1827 }
1828 // end of modifications
1829
1830 else
1831 edtChar(myHandle,ecRight);
1832
1833 editAlphaLevel = KEY_PAD_MAX-1;
1834 editAlphaKey = KCD_MAX;
1835
1836 return 1;
1837 }
1838
1839
1840 /*******************************************************************************
1841
1842 $Function: editEventKey
1843
1844 $Description: executes the timer event form the edit component
1845
1846 $Returns: none.
1847
1848 $Arguments:
1849
1850 *******************************************************************************/
1851 int editEventKey (MfwEvt e, MfwKbd *k)
1852 {
1853 /*MC SPR 1242 merged in b-sample version of this function */
1854 MfwEdt *edit;
1855 char *tb;
1856 UBYTE ch = '.';
1857
1858 char *format = formatHandle; // SH - temporary format template
1859 char formatchar; // SH - Current format character
1860 char alphachar; // SH - Current multi-tap character
1861 int safetycounter; // SH - Stops searching forever to find compatible character
1862 BOOL validCharacter; // SH - flag to indicate whether character is accepted
1863
1864 BOOL unicode; /* SPR957 - SH - TRUE if string is unicode */
1865
1866 /*NM p026*/
1867 if (!myHandle) // If we've reached the end of the format string, don't allow input
1868 return 1;
1869
1870 /* Over the editor handle "e" we have now the access to
1871 * the editor buffer "tb". We need it e.g "editCalcMode"
1872 * to check the buffer */
1873
1874 edit = ((MfwHdr *) myHandle)->data;
1875 tb = edit->attr->text;
1876 /*p026 end*/
1877
1878 /* SPR957 - SH - TRUE if string is unicode */
1879 if (tb[0]==0x80)
1880 unicode = TRUE;
1881 else
1882 unicode = FALSE;
1883
1884 /* SH - formatted input mode (for WAP) */
1885
1886 if (editFormatMode)
1887 {
1888 if (k->code==KCD_HUP) // Escape from edit screen
1889 return 0;
1890
1891 if (edit->cp >= (edit->attr->size)) // If at last character of editor, don't
1892 {
1893 return 1; // print character
1894 }
1895
1896 formatchar = format[*formatIndex];
1897
1898 if (formatchar == NULL) // If we've reached the end of the format string, don't allow input
1899 return 1;
1900
1901 if ((formatchar>'0' && formatchar<='9') || formatchar=='*') // Delimiter for format field
1902 {
1903 (*formatIndex)++;
1904 *fieldIndex = 0;
1905 formatchar = format[*formatIndex]; // Next character is the format for the field
1906 }
1907
1908 /* Multi-tap input
1909 *
1910 * The user presses a different key, meaning the previous character must be entered */
1911
1912 if (editAlphaKey != KCD_MAX && editAlphaKey != k->code)
1913 {
1914 timStop(editTim);
1915
1916 alphachar = NULL;
1917
1918 switch(formatchar)
1919 {
1920 case 'X': // Uppercase alphabetic only
1921 case 'A': // Uppercase alphabetic or punctuation
1922 alphachar = editAlphaU[editAlphaKey][editAlphaLevel];
1923 break;
1924
1925 case 'x': // Lowercase alphabetic only
1926 case 'a': // Lowercase alphabetic or punctuation
1927 alphachar = editAlpha[editAlphaKey][editAlphaLevel];
1928 break;
1929
1930 case 'M':
1931 case 'm':
1932 if (upCase)
1933 alphachar = editAlphaU[editAlphaKey][editAlphaLevel];
1934 else
1935 alphachar = editAlpha[editAlphaKey][editAlphaLevel];
1936 break;
1937 }
1938
1939 if (alphachar!=NULL)
1940 {
1941 if (editHiddenMode) // SH - in hidden mode...
1942 {
1943 tmpBuf[edit->cp] = alphachar; // store character in buffer
1944 alphachar = '*'; // ...and show star
1945 }
1946 editCharFindNext(alphachar); // Add number to buffer & advance cursor
1947 editAlphaLevel = KEY_PAD_MAX-1;
1948 editAlphaKey = KCD_MAX;
1949 if (edit->cp >= (edit->attr->size)) // If at last character of editor, don't
1950 return 1; // allow another character
1951 }
1952 }
1953
1954 formatchar = format[*formatIndex];
1955
1956 if (k->code <= KCD_9) // Key pressed is 0 - 9.
1957 {
1958
1959 /* Numeric */
1960
1961 if (formatchar == 'N') // A numeric digit is expected
1962 {
1963 if (editHiddenMode)
1964 {
1965 tmpBuf[edit->cp] = editControls[k->code];
1966 editCharFindNext('*');
1967 }
1968 else
1969 editCharFindNext(editControls[k->code]); // Add number to buffer & advance cursor
1970 editAlphaLevel = KEY_PAD_MAX-1; // Reset multi-tap settings
1971 editAlphaKey = KCD_MAX;
1972 return 1;
1973 }
1974
1975 /* Multi-tap alphanumeric */
1976
1977 alphachar = NULL;
1978
1979 if (!strchr("XxAaMm",formatchar)) // If not a valid format code, exit
1980 return 1;
1981
1982 if (strchr("Xx",formatchar) && k->code<KCD_2) // 0 and 1 keys not valid in these modes
1983 return 1;
1984
1985 editAlphaKey = k->code; // Store the key pressed
1986 editAlphaLevel++; // Increment through list of symbols
1987 if (editAlphaLevel > (KEY_PAD_MAX-1)) // List wraps round
1988 editAlphaLevel = 0;
1989
1990 safetycounter = 0;
1991 while (alphachar==NULL && safetycounter<KEY_PAD_MAX)
1992 {
1993 validCharacter = FALSE;
1994
1995 switch(formatchar)
1996 {
1997 case 'X':
1998 alphachar = editAlphaU[editAlphaKey][editAlphaLevel]; // Uppercase...
1999 validCharacter = (alphachar>='A' && alphachar<='Z'); // ...alphabetic only
2000 break;
2001
2002 case 'x':
2003 alphachar = editAlpha[editAlphaKey][editAlphaLevel]; // Lowercase
2004 validCharacter = (alphachar>='a' && alphachar<='z'); // ...alphabetic only
2005 break;
2006
2007 case 'A':
2008 alphachar = editAlphaU[editAlphaKey][editAlphaLevel]; // Uppercase...
2009 validCharacter = (alphachar<'0' || alphachar>'9'); // ..non-numeric
2010 break;
2011
2012 case 'a':
2013 alphachar = editAlpha[editAlphaKey][editAlphaLevel]; // Lowercase...
2014 validCharacter = (alphachar<'0' || alphachar>'9'); // ..non-numeric
2015 break;
2016
2017 case 'M':
2018 case 'm':
2019 if (upCase) // User-selected case...
2020 alphachar = editAlphaU[editAlphaKey][editAlphaLevel];
2021 else
2022 alphachar = editAlpha[editAlphaKey][editAlphaLevel];
2023 validCharacter = TRUE; // ...any character accepted
2024 break;
2025 }
2026
2027 if (!validCharacter) // If character isn't uppercase alphabetic,
2028 { // find the next one that is,
2029 alphachar = NULL;
2030 safetycounter++; // (but don't search forever)
2031 editAlphaLevel++;
2032 if (editAlphaLevel > (KEY_PAD_MAX-1))
2033 editAlphaLevel = 0;
2034 }
2035 }
2036
2037 if (alphachar!=NULL) // If we've found a character, and string isn't max size
2038 {
2039 if (editHiddenMode)
2040 {
2041 tmpBuf[edit->cp] = alphachar;
2042 }
2043 edtChar(myHandle,alphachar);
2044 edtChar(myHandle,ecLeft);
2045 timStart(editTim);
2046 }
2047 else
2048 editAlphaKey = KEY_MAX;
2049 return 1;
2050 }
2051
2052 if (k->code==KCD_HASH) // Hash key
2053 {
2054 if (strchr("AaMm",formatchar))
2055 {
2056 if (editHiddenMode)
2057 {
2058 tmpBuf[edit->cp] = ' ';
2059 editCharFindNext('*');
2060 }
2061 else
2062 editCharFindNext(' '); // Prints a space in this mode
2063 }
2064 return 1;
2065 }
2066
2067 if (k->code==KCD_STAR) // Star key
2068 {
2069 if (strchr("AaMm",formatchar))
2070 {
2071 if (editHiddenMode)
2072 {
2073 tmpBuf[edit->cp] = '*';
2074 }
2075 editCharFindNext('*');
2076 }
2077 return 1;
2078 }
2079
2080 return 1;
2081 }
2082
2083 /************************/
2084 /* Normal multi-tap mode */
2085 /************************/
2086
2087 if (editAlphaMode)
2088 {
2089 if (editAlphaKey != KCD_MAX && editAlphaKey != k->code)
2090 {
2091 timStop(editTim);
2092
2093 /*MC SPR 925, 23/07/02, removed editshowheader for chinese*/
2094 edtChar(myHandle,ecRight);
2095 /*MC SPR 925, 23/07/02,removed shifting of alphachar, not needed here, merged from ealier code*/
2096
2097 editAlphaLevel = KEY_PAD_MAX-1;
2098 editAlphaKey = KCD_MAX;
2099 }
2100
2101 if (k->code <= KCD_HASH)
2102 {
2103 editAlphaLevel++;
2104 if (editAlphaLevel > (KEY_PAD_MAX-1))
2105 editAlphaLevel = 0;
2106 if (editAlphaKey == KCD_MAX) // Inserting a new character
2107 {
2108 TRACE_EVENT("Inserting character.");
2109 /*MC, SPR 925, 23/07/02 removed insert space and ecLeft if Chinese*/
2110
2111 /* NM p01306
2112 the patch p027 to reduce calling the edtChar as less as possible
2113 was not working for inserting characters.
2114 This additional change should work now:
2115 */
2116 if (unicode) /*SPR957 - SH - use new unicode flag */
2117 {
2118 moveRightUnicode((U16 *)&edit->attr->text[edit->cp*2],1);
2119 }
2120 else
2121 {
2122 moveRight(&edit->attr->text[edit->cp],strlen(&edit->attr->text[edit->cp]),1);
2123 }
2124 /* NM p01306 END */
2125 }
2126 }
2127 editAlphaKey = k->code;
2128 editShowHeader();
2129 timStart(editTim);
2130 return 1;
2131 }
2132
2133 alphachar = NULL;
2134
2135 switch (k->code)
2136 {
2137 case KCD_HUP:
2138 return 0;
2139 case KCD_HASH:
2140 /* KGT: If not in an alpha mode insert blanc.
2141 But in numeric mode insert '#'. */
2142 if (editAlphaMode)
2143 {
2144 alphachar = ' ';
2145 editShowHeader();
2146 }
2147 else
2148 {
2149 if (editCalcMode)
2150 {
2151 if(!(strchr(tb, ch ))) /* set '.' only once ! */
2152 alphachar = '.';
2153 }
2154 else
2155 alphachar = '#';
2156 }
2157 /* end KGT */
2158
2159 /* SH - hidden mode */
2160 if (editHiddenMode)
2161 {
2162 tmpBuf[edit->cp] = alphachar;
2163 alphachar = '*';
2164 }
2165 /* end of hidden mode */
2166
2167 /* SPR957 - In unicode mode, character is shifted to second byte */
2168 if (unicode)
2169 alphachar = alphachar << 8;
2170
2171 edtChar(myHandle,alphachar);
2172 return 1;
2173
2174 case KCD_STAR:
2175
2176 if (editCalcMode)
2177 {
2178 if(!(strchr(tb, ch ))) /* set '.' only once ! */
2179 alphachar = '.'; /* SPR957 - SH*/
2180 /*edtChar(myHandle,'.');*/
2181 }
2182 else
2183 {
2184 /*if (!editAlphaMode)
2185 edtChar(myHandle,'*');
2186 else */
2187 if (editAlphaMode)
2188 {
2189 editShowHeader();
2190 }
2191
2192 alphachar = '*';
2193
2194 /* SH - hidden mode */
2195 if (editHiddenMode)
2196 {
2197 tmpBuf[edit->cp] = '*';
2198 }
2199 /* end of hidden mode */
2200
2201 /* SPR957 - SH - In unicode mode, character is shifted to second byte */
2202 if (unicode)
2203 alphachar = alphachar << 8;
2204 edtChar(myHandle,alphachar);
2205 }
2206 return 2; // SH - 2 indicates that character WAS printed
2207
2208 case KCD_ABC:
2209 editAlphaMode = (UBYTE) !editAlphaMode;
2210 if (editAlphaMode)
2211 {
2212 editAlphaLevel = KEY_PAD_MAX-1;
2213 editAlphaKey = KCD_MAX;
2214 }
2215 editShowHeader();
2216 return 1;
2217 default:
2218 if (editAlphaMode){
2219 timStop(editTim);
2220 edtChar(myHandle,ecRight);
2221 return 1;
2222 }
2223 break;
2224 }
2225
2226 /* SH - hidden mode */
2227 if (editHiddenMode)
2228 {
2229 tmpBuf[edit->cp] = editControls[k->code];
2230 alphachar = '*'; /* SPR957 - SH*/
2231 /* SPR957 - In unicode mode, character is shifted to second byte */
2232 if (unicode)
2233 alphachar = alphachar << 8;
2234
2235 edtChar(myHandle,alphachar);
2236 }
2237 /* end of hidden mode */
2238 else
2239 { /*MC SPR 964, sets alphamode to FALSE when in digits mode, so that cursor moves right*/
2240 edit->attr->alphaMode = editAlphaMode;
2241 edtChar(myHandle,editControls[k->code]);
2242 }
2243
2244 return 1;
2245 }
2246
2247
2248 /*******************************************************************************
2249
2250 $Function: editClear
2251
2252 $Description: SH - For formatted input, clears everything except fixed characters
2253
2254 $Returns:
2255
2256 $Arguments:
2257
2258 *******************************************************************************/
2259 /*MC SPR 1242 merged in b-sample version of this function */
2260 void editClear()
2261 {
2262 int editIndex = 0;
2263 MfwEdt *edit = ((MfwHdr *) myHandle)->data;
2264 char *tb = edit->attr->text;
2265
2266 *formatIndex = -1; // Find first non-fixed character,
2267 edtChar(myHandle,ecTop); // starting from the top.
2268 editCharFindNext(NULL);
2269
2270 while (edit->cp <strlen(tb))
2271 {
2272 editCharFindNext(' '); // Overwrite everything with spaces
2273 }
2274 edtChar(myHandle,ecTop);
2275 *formatIndex = -1;
2276 editCharFindNext(NULL); // Return to the first non-fixed character
2277
2278 return;
2279 }
2280
2281
2282 /*******************************************************************************
2283
2284 $Function: editCharFindNext
2285
2286 $Description: SH - For formatted input, adds a character to the input buffer then finds
2287 the next non-fixed character space for the cursor to occupy
2288
2289 $Returns:
2290
2291 $Arguments: character - the character (or code) to print
2292
2293 *******************************************************************************/
2294 /*MC SPR 1242 merged in b-sample version of this function */
2295 void editCharFindNext(char character)
2296 {
2297 char *format = formatHandle; // SH - temporary format template
2298 char formatchar;
2299 MfwEdt *edit = ((MfwHdr *) myHandle)->data;
2300 UBYTE inField = 0; // =1 if entering field, =2 if in field
2301
2302 TRACE_EVENT("editCharFindNext");
2303
2304 // Check for delimited field
2305
2306 if (*formatIndex>0)
2307 {
2308 formatchar = format[*formatIndex-1];
2309 if ((formatchar>'0' && formatchar<='9') || formatchar=='*')
2310 inField = 2;
2311 }
2312
2313 formatchar = format[*formatIndex];
2314 if ((formatchar>'0' && formatchar<='9') || formatchar=='*')
2315 inField = 1;
2316
2317 // Check for cursor right at end of string - don't allow
2318
2319 if (character == ecRight && edit->cp >= strlen(edit->attr->text) && *formatIndex>-1 && inField==0)
2320 {
2321 TRACE_EVENT("End of string.");
2322 return;
2323 }
2324
2325 if (character!=NULL) // First add the required character
2326 {
2327 edtChar(myHandle, character); // to the buffer
2328 }
2329
2330 // Check for start of fixed input field
2331
2332 if (inField==1)
2333 {
2334 TRACE_EVENT("Entering field.");
2335 (*formatIndex)++; // Get us into the field...
2336 *fieldIndex = 0; // ...and reset the field index
2337 formatchar = *(format+*formatIndex);
2338 if (formatchar=='M')
2339 upCase = TRUE;
2340 if (formatchar=='m')
2341 upCase = FALSE;
2342 inField = 2;
2343 }
2344
2345 // Check whether we're in a fixed input field, e.g. "4N" or "8X"
2346
2347 if (inField==2) // So we don't look back beyond start of string
2348 {
2349 TRACE_EVENT("Move on in field.");
2350 (*fieldIndex)++; // Increment the position in the field
2351 if (*fieldIndex==(int)(formatchar-'0')) // If we've entered the number of characters specified (note- will never happen for the '*' !)
2352 {
2353 TRACE_EVENT("Exiting field.");
2354 (*formatIndex)++; // point to NULL at end of string (no more input)
2355 }
2356 return;
2357 }
2358
2359 // If not, just look at next format character as usual
2360
2361 (*formatIndex)++; // Point to next character
2362
2363 while (*formatIndex<strlen(format) && *(format+*formatIndex) == '\\') // Fixed characters encountered
2364 {
2365 edtChar(myHandle,ecRight); // Skip over them
2366 (*formatIndex)+=2;
2367 }
2368
2369 if (*formatIndex>(strlen(format))) // Don't look beyond end of string
2370 *formatIndex = strlen(format);
2371 /***************************Go-lite Optimization changes Start***********************/
2372 //Aug 16, 2004 REF: CRR 24323 Deepa M.D
2373 TRACE_EVENT_P2("formatIndex, fieldIndex: %d, %d", *formatIndex, *fieldIndex);
2374 /***************************Go-lite Optimization changes end***********************/
2375 return;
2376 }
2377
2378 /*******************************************************************************
2379
2380 $Function: editFindPrev
2381
2382 $Description: SH - For formatted input, finds the previous non-fixed character and
2383 moves the cursor there if possible
2384
2385 $Returns: 0 if the cursor position is not changed (nowhere to go)
2386 1 if the previous character has been found
2387 2 if the cursor was over the first non-fixed character
2388
2389 $Arguments:
2390
2391 *******************************************************************************/
2392 /*MC SPR 1242 merged in b-sample version of this function */
2393 int editFindPrev()
2394 {
2395 char *format = formatHandle; // SH - temporary format template
2396 int editIndex;
2397 char formatchar;
2398 MfwEdt *edit = ((MfwHdr *) myHandle)->data;
2399
2400 TRACE_EVENT("editFindPrev");
2401
2402 if (edit->cp == 0) // If cursor is at start of string, return 2
2403 {
2404 TRACE_EVENT("Exit - start of string found");
2405 /***************************Go-lite Optimization changes Start***********************/
2406 //Aug 16, 2004 REF: CRR 24323 Deepa M.D
2407 TRACE_EVENT_P2("formatIndex, fieldIndex: %d, %d", *formatIndex, *fieldIndex);
2408 /***************************Go-lite Optimization changes end***********************/
2409 return 2;
2410 }
2411 // First check whether we're in a fixed input field, e.g. "4N" or "8X"
2412
2413 if (*formatIndex>0) // So we don't look back beyond start of string
2414 {
2415 formatchar = *(format+*formatIndex-1);
2416 if ((formatchar>'0' && formatchar<='9') || formatchar=='*') // If it's a number between 1 and 9, or a *
2417 {
2418 TRACE_EVENT("In delimited field.");
2419 edtChar(myHandle,ecLeft);
2420 if (edit->cp < edit->attr->size-1) // (Don't decrement if at last char in string)
2421 (*fieldIndex)--; // Decrement the position in the field
2422
2423 if (*fieldIndex==0) // If we've reached the beginning of the field
2424 {
2425 TRACE_EVENT("Getting out of field.");
2426 (*formatIndex)--; // Get out of the field
2427 }
2428
2429
2430 TRACE_EVENT_P2("formatIndex, fieldIndex: %d, %d", *formatIndex, *fieldIndex);
2431
2432 if (edit->cp==(strlen(edit->attr->text)-1)) // Special case if last character - tell editor to shorten the string
2433 {
2434 TRACE_EVENT("Shorten string");
2435 return 3;
2436 }
2437
2438 return 1; // then we're done
2439 }
2440 }
2441
2442 // If not (or if we've just come out of one) just look at next format character as usual
2443
2444 editIndex = *formatIndex-1; // Make copy of format position, starting off to left
2445
2446 while (editIndex>0)
2447 {
2448 if (*(format+editIndex-1)=='\\') // If there's a fixed char
2449 editIndex -=2; // Look back a further 2 characters
2450 else // If there's a non-fixed character
2451 break; // then exit loop
2452 }
2453
2454 if (editIndex==-1) // Go back from 1st character in editor
2455 {
2456 TRACE_EVENT("Exit - skipped over fixed character");
2457 /***************************Go-lite Optimization changes Start***********************/
2458 //Aug 16, 2004 REF: CRR 24323 Deepa M.D
2459 TRACE_EVENT_P2("formatIndex, fieldIndex: %d, %d", *formatIndex, *fieldIndex);
2460 /***************************Go-lite Optimization changes end***********************/
2461 return 2;
2462 }
2463
2464 formatchar = format[editIndex-1];
2465 if ((formatchar>'0' && formatchar<='9') || formatchar=='*')
2466 (*fieldIndex)--;
2467
2468 if (editIndex>-1) // Provided there is somewhere to go....
2469 {
2470 while(*formatIndex>editIndex)
2471 {
2472 if (edtChar(myHandle,ecLeft)==MfwResOk) // move cursor there
2473 (*formatIndex)--;
2474 if (format[*formatIndex]=='\\')
2475 (*formatIndex)--;
2476 }
2477 TRACE_EVENT("Found new position.");
2478 /***************************Go-lite Optimization changes Start***********************/
2479 //Aug 16, 2004 REF: CRR 24323 Deepa M.D
2480 TRACE_EVENT_P2("formatIndex, fieldIndex: %d, %d", *formatIndex, *fieldIndex);
2481 /***************************Go-lite Optimization changes end***********************/
2482 return 1; // Found new position
2483 }
2484 TRACE_EVENT("Position unchanged.");
2485 /***************************Go-lite Optimization changes Start***********************/
2486 //Aug 16, 2004 REF: CRR 24323 Deepa M.D
2487 TRACE_EVENT_P2("formatIndex, fieldIndex: %d, %d", *formatIndex, *fieldIndex);
2488 /***************************Go-lite Optimization changes end***********************/
2489 return 0; // Position unchanged
2490 }
2491
2492
2493 /*******************************************************************************
2494
2495 $Function: editActivate
2496
2497 $Description: Activates the edit component
2498
2499 $Returns: none.
2500
2501 $Arguments:
2502
2503 *******************************************************************************/
2504 void editActivate (MfwHnd e, int AlphaMode)
2505 {
2506 TRACE_FUNCTION("editActivate");
2507
2508 myHandle = e;
2509 /*NM p028*/
2510 if (!editTim)
2511 editTim = timCreate(0,1000,(MfwCb) editEventTim);
2512 editAlphaMode = ((AlphaMode != 0) && (AlphaMode != 4) && (AlphaMode != 5));
2513 editCalcMode = (AlphaMode == 4);
2514 editFormatMode = (AlphaMode == 6);
2515 editHiddenMode = FALSE;
2516 editAlphaLevel = KEY_PAD_MAX-1;
2517 editAlphaKey = KCD_MAX;
2518 }
2519
2520
2521 /*******************************************************************************
2522
2523 $Function: editHiddenActivate
2524
2525 $Description: SH - Activates the edit component for hidden alphanumeric entry
2526
2527 $Returns: none.
2528
2529 $Arguments:
2530
2531 *******************************************************************************/
2532 void editHiddenActivate (char *buffer)
2533 {
2534 TRACE_FUNCTION("editHiddenActivate");
2535 tmpBuf = buffer;
2536 editHiddenMode = 1;
2537 return;
2538 }
2539
2540 /*******************************************************************************
2541
2542 $Function: editDeactivate
2543
2544 $Description: deactivates the edit component
2545
2546 $Returns: none.
2547
2548 $Arguments:
2549
2550 *******************************************************************************/
2551 void editDeactivate (void)
2552 {
2553 //myHandle = 0; //SPR#1014 - DS - Commented out.
2554
2555 if (editTim){
2556 timStop(editTim);
2557 timDelete(editTim);
2558 }
2559 editTim = 0;
2560 }
2561 /*******************************************************************************
2562
2563 $Function: activeEditor
2564
2565 $Description: deactivates the edit component
2566
2567 $Returns: none.
2568
2569 $Arguments:
2570
2571 *******************************************************************************/
2572 MfwHnd activeEditor (void)
2573 {
2574 return myHandle;
2575 }
2576
2577 /*******************************************************************************
2578
2579 $Function: setformatpointers
2580
2581 $Description: SH - Sets static variables formatHandle and formatIndex, so thet editEventKey
2582 can access the format string
2583
2584 $Returns:
2585
2586 $Arguments: Pointer to format string, pointer to format index
2587
2588 *******************************************************************************/
2589
2590
2591 void setFormatPointers (char *format, int *index, int *index2)
2592 {
2593
2594 TRACE_FUNCTION("setFormatPointers");
2595 formatHandle = format;
2596 formatIndex = index;
2597 fieldIndex = index2;
2598 return;
2599 }
2600
2601 #endif /* NEW_EDITOR */
2602
2603 /*******************************************************************************
2604
2605 $Function: MmiModuleSet
2606
2607 $Description: Set the status
2608
2609 $Returns: none.
2610
2611 $Arguments:
2612
2613 *******************************************************************************/
2614 void MmiModuleSet (int module)
2615 {
2616 switch(module)
2617 {
2618 case ModuleIdle:
2619 MmiModule = MmiModule & ModuleBattLow;
2620 MmiModule = MmiModule | ModuleIdle;
2621 break;
2622 case ModuleInCall:
2623 MmiModuleDel(ModuleIdle);
2624 MmiModule=MmiModule | ModuleInCall;
2625 break;
2626 case ModuleCall:
2627 MmiModuleDel(ModuleIdle);
2628 MmiModule=MmiModule | ModuleCall;
2629 break;
2630 case ModuleMenu:
2631 MmiModuleDel(ModuleIdle);
2632 MmiModule=MmiModule | ModuleMenu;
2633 break;
2634 case ModulePhon:
2635 MmiModuleDel(ModuleIdle);
2636 MmiModule=MmiModule | ModulePhon;
2637 break;
2638 case ModuleSms:
2639 MmiModuleDel(ModuleIdle);
2640 MmiModule=MmiModule | ModuleSms;
2641 break;
2642 case ModuleBattLow:
2643 MmiModule=MmiModule | ModuleBattLow;
2644 break;
2645 case ModuleSAT:
2646 MmiModuleDel(ModuleIdle);
2647 MmiModule=MmiModule | ModuleSAT;
2648 break;
2649 case ModuleAlarm:
2650 MmiModuleDel(ModuleIdle);
2651 MmiModule=MmiModule | ModuleAlarm;
2652 break;
2653 case ModuleFax:
2654 MmiModule=MmiModule | ModuleFax;
2655 break;
2656 case ModuleDialling:
2657 MmiModuleDel(ModuleIdle);
2658 MmiModule=MmiModule | ModuleDialling;
2659 break;
2660 default:
2661 break;
2662 }
2663
2664 return;
2665
2666 }
2667
2668 /*******************************************************************************
2669
2670 $Function: MmiModuleDel
2671
2672 $Description: Delete the status
2673
2674 $Returns: none.
2675
2676 $Arguments:
2677
2678 *******************************************************************************/
2679 void MmiModuleDel (int module)
2680 {
2681 switch(module)
2682 {
2683 case ModuleIdle:
2684
2685 MmiModule = MmiModule & (~ModuleIdle);
2686 break;
2687 case ModuleInCall:
2688 MmiModule=MmiModule & (~ModuleInCall);
2689 break;
2690 case ModuleCall:
2691 MmiModule=MmiModule & (~ModuleCall);
2692 break;
2693 case ModuleMenu:
2694 MmiModule=MmiModule & (~ModuleMenu);
2695 break;
2696 case ModulePhon:
2697 MmiModule=MmiModule & (~ModulePhon);
2698 break;
2699 case ModuleSms:
2700 MmiModule=MmiModule & (~ModuleSms);
2701 break;
2702 case ModuleBattLow:
2703 MmiModule=MmiModule & (~ModuleBattLow);
2704 break;
2705 case ModuleSAT:
2706 MmiModule=MmiModule & (~ModuleSAT);
2707 break;
2708 case ModuleAlarm:
2709 MmiModule=MmiModule & (~ModuleAlarm);
2710 break;
2711 case ModuleFax:
2712 MmiModule=MmiModule & (~ModuleFax);
2713 break;
2714 case ModuleDialling:
2715 MmiModule=MmiModule & (~ModuleDialling);
2716 default:
2717 break;
2718 }
2719
2720 return;
2721
2722 }
2723
2724 /*******************************************************************************
2725
2726 $Function: showGoodBye
2727
2728 $Description: shows a goodbye Message when swiching off the mobile
2729
2730 $Returns: none
2731
2732 $Arguments:
2733
2734 *******************************************************************************/
2735
2736
2737 static void showGoodBye (T_MFW_HND win)
2738 {
2739 T_DISPLAY_DATA display_info;
2740
2741 TRACE_FUNCTION("showGoodBye ()");
2742 dlg_zeroDisplayData(&display_info);
2743 dlg_initDisplayData_events( &display_info, (T_VOID_FUNC)goodbye_cb, FOREVER, 0 );
2744
2745 /*
2746 * Call Icon
2747 */
2748
2749 mmi_dialogs_insert_animation (info_dialog (win, &display_info), 400 ,(MfwIcnAttr*)&goodbye_Attr,animGoodbye);
2750
2751
2752 }
2753
2754 /*******************************************************************************
2755
2756 $Function: goodbye_cb
2757
2758 $Description:
2759
2760 $Returns:
2761
2762 $Arguments:
2763
2764 *******************************************************************************/
2765
2766
2767 static void goodbye_cb (void)
2768 {
2769 TRACE_FUNCTION("goodbye_cb ()");
2770 nm_deregistration(); /* start deregistration procedure */
2771 }
2772
2773 #ifdef FF_MMI_AUDIO_PROFILE
2774 void mmi_device_status_info(T_MFW_HND parent, int str1, int str2, T_VOID_FUNC callback)
2775 {
2776 T_DISPLAY_DATA display_info;
2777
2778 TRACE_FUNCTION("mmi_device_status_info");
2779 dlg_initDisplayData_TextId( &display_info, TxtNull, TxtNull, str1,str2, COLOUR_STATUS);
2780 dlg_initDisplayData_events( &display_info, callback, THREE_SECS, KEY_LEFT | KEY_CLEAR | KEY_HUP);
2781 info_dialog(parent,&display_info);
2782 }
2783 #endif
2784
2785
2786 /*******************************************************************************
2787
2788 $Function: menuBootTimeMsmt
2789
2790 $Description: menu handler for 'Boot Time' menu. Shows time taken for various boot events
2791
2792 $Returns:
2793
2794 $Arguments:
2795
2796 *******************************************************************************/
2797 int menuBootTimeMsmt(MfwMnu* m, MfwMnuItem* i)
2798 {
2799 int boot_time[4];
2800 T_AUI_EDITOR_DATA editor_data;
2801 T_MFW_HND win = (T_MFW_HND)bookCurrentWindow();
2802
2803 memset(buffer,0,sizeof(buffer));
2804 get_boot_time(&boot_time);
2805 TRACE_EVENT_P4("pre boot %d, app init %d, ti logo %d, conn log %d",boot_time[0],boot_time[1],boot_time[2],boot_time[3]);
2806 sprintf((char*)buffer,"\nPre boot -%d ms \nApp init - %d ms \nModem Boot - %d ms \nNetwork sync - %d ms",boot_time[0],boot_time[1],boot_time[2],boot_time[3]);
2807 AUI_edit_SetDefault(&editor_data);
2808 AUI_edit_SetDisplay(&editor_data, ZONE_FULL_SK_TITLE, COLOUR_EDITOR, EDITOR_FONT);
2809 AUI_edit_SetTextStr(&editor_data, TxtSoftOK, TxtSoftBack, TxtBootTime, NULL);
2810 AUI_edit_SetEvents(&editor_data, 0, TRUE, FOREVER, NULL);
2811 AUI_edit_SetBuffer(&editor_data, ATB_DCS_ASCII, buffer, 100);
2812 AUI_edit_SetMode(&editor_data, ED_MODE_READONLY, ED_CURSOR_NONE);
2813
2814 AUI_edit_Start(win, &editor_data);
2815
2816 return 1;
2817 }
2818 /* ****************************************************************** */
2819 #ifdef NEPTUNE_BOARD
2820 void AI_Power(SYS_UWORD8 power)
2821 {
2822
2823 }
2824
2825 void SIM_PowerOff (void)
2826 {
2827 TRACE_FUNCTION ("SIM_PowerOff()");
2828 }
2829
2830 #ifdef MMI_POWER_MANAGEMENT_TEST
2831
2832 /*******************************************************************************
2833
2834 $Function: mmi_PowerManagement_screen_forever
2835
2836 $Description: This will be executed when closing Power Management Screen
2837
2838 $Returns:
2839 $Arguments: window, Idetifier, reason
2840
2841 *******************************************************************************/
2842
2843 void mmi_PowerManagementStatus(T_MFW_HND win, USHORT identifier, SHORT reason)
2844 {
2845 timStart( timer_handle );
2846 SVC_SCN_EnablePM( 0 );
2847 Screen_Update = 1;
2848 }
2849
2850
2851 /*******************************************************************************
2852
2853 $Function: mmi_PowerManagement_screen_forever
2854
2855 $Description: Used to display Power Management running Screen
2856
2857 $Returns: 0 - Success
2858 1 - Error
2859
2860
2861 $Arguments: window, textId/TestString, color
2862
2863 *******************************************************************************/
2864 T_MFW_HND mmi_PowerManagement_screen_forever( MfwHnd win,int TextId, char* TextStr, int colour )
2865 {
2866 T_DISPLAY_DATA DisplayInfo;
2867 dlg_initDisplayData_TextId( &DisplayInfo, TxtNull, TxtCancel, TxtNull, TxtNull, colour);
2868 dlg_initDisplayData_events( &DisplayInfo, (T_VOID_FUNC)mmi_PowerManagementStatus, FOREVER, KEY_ALL );
2869 DisplayInfo.TextString = TextStr;
2870 return info_dialog(win, &DisplayInfo);
2871 }
2872
2873 /*******************************************************************************
2874
2875 $Function: mmi_PowerManagement
2876
2877 $Description: Used to test the power Management
2878
2879 $Returns: 0 - Success
2880 1 - Error
2881
2882
2883 $Arguments: menu, menu item
2884
2885 *******************************************************************************/
2886 int mmi_PowerManagement(MfwMnu* m, MfwMnuItem* i)
2887 {
2888 mmi_PowerManagement_screen_forever(0, NULL, "Power Management Running...\n", 1 );
2889 timStop( timer_handle );
2890 dspl_Enable(1);
2891 Screen_Update = 0;
2892 SVC_SCN_EnablePM( 1 );
2893 return 0;
2894 }
2895
2896 #endif
2897
2898
2899 #endif
2900
2901 /*OMAPS00098881(removing power variant) a0393213(prabakar) - screenUpdateOn() and screenUpdateOff() added*/
2902 #ifdef FF_POWER_MANAGEMENT
2903 /*******************************************************************************
2904
2905 $Function: screenUpdateOn
2906
2907 $Description: menu handler for Phone settings --> screen update --> on
2908
2909 $Returns:
2910
2911 $Arguments:
2912
2913 *******************************************************************************/
2914 int screenUpdateOn(MfwMnu* m, MfwMnuItem* i)
2915 {
2916 if(FFS_flashData.refresh!=1)
2917 {
2918 /*Update the screen, start the timer (which is responsible for time update in idle screen) and save the status*/
2919 idleEvent(IdleUpdate);
2920 timStart(times);
2921 timStart(timer_handle);/*starting mfw timer also*/
2922 FFS_flashData.refresh=1;
2923 flash_write();
2924 }
2925 mmi_dialog_information_screen(0, TxtDone, NULL, NULL, 0);
2926 return MFW_EVENT_CONSUMED;
2927 }
2928 /*******************************************************************************
2929
2930 $Function: mmi_PowerManagement
2931
2932 $Description: menu handler for Phone settings --> screen update --> off
2933
2934 $Returns:
2935
2936 $Arguments: menu, menu item
2937
2938 *******************************************************************************/
2939 int screenUpdateOff(MfwMnu* m, MfwMnuItem* i)
2940 {
2941 if(FFS_flashData.refresh!=0)
2942 {
2943 /*Stop the timer(so no time update occurs in idle screen) and save the status in flash*/
2944 timStop(times);
2945 timStop(timer_handle); /*stoping mfw timer also*/
2946 FFS_flashData.refresh=0;
2947 flash_write();
2948 }
2949 mmi_dialog_information_screen(0, TxtDone, NULL, NULL, 0);
2950 return MFW_EVENT_CONSUMED;
2951 }
2952
2953 #endif
2954