comparison src/aci2/bmi/mmiMain.c @ 120:3c2acfa1a72f

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