comparison src/ui/bmi/mmiMain.c @ 3:67bfe9f274f6

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