changeset 80:46bab586c09b

mmiMain.c:keyAction() handler cleanup
author Mychaela Falconia <falcon@freecalypso.org>
date Mon, 26 Oct 2020 04:12:05 +0000
parents e5e2af0ca91c
children 0f7c6eab667b
files src/ui/bmi/mmiMain.c
diffstat 1 files changed, 53 insertions(+), 210 deletions(-) [+]
line wrap: on
line diff
--- a/src/ui/bmi/mmiMain.c	Mon Oct 26 01:57:56 2020 +0000
+++ b/src/ui/bmi/mmiMain.c	Mon Oct 26 04:12:05 2020 +0000
@@ -771,33 +771,19 @@
 *******************************************************************************/
 static int keyAction (MfwEvt e, MfwKbd *res)
 {
-  /* this function "keyAction" is called 4*times from MFW per each keypress */
-  /* twice for keypress and twice for keyrelease */
-  /* the variable "toggle" is using to avoid to play the keypadtone twice ! */
-    static UBYTE toggle = TRUE;
-
-    /* OMAPS00151698, x0056422 */
-    #ifdef FF_MMI_A2DP_AVRCP
-    if(tGlobalBmiBtStruct.bConnected == BMI_BT_CONNECTED && tGlobalBmiBtStruct.tCmdSrc == BMI_BT_HEADSET_COMMAND)
-    {}
-    else
-    {
-    #endif
-
-#ifdef NEPTUNE_BOARD    /*  OMAPS00033660   */
-    static unsigned char cKeySound = 0;
-#endif
-
-  /* this mask is use to filter the keyevent "e" */
-  /* want to use KEY_0, KEY_1,......  KEY_HASH */
-  USHORT  mask = 0x0FFF;
-
-    /* Initialize - RAVI - 23-12-2005 */
-    /*a0393213 warnings removal-variable conditionally removed*/
-#if ((!defined(FF_MIDI_RINGER)) || defined(NEPTUNE_BOARD))
-  UBYTE currentRinger = 0;
-#endif
-
+    int res_int = (int) res;
+
+    /* this mask is use to filter the keyevent "e" */
+    /* want to use KEY_0, KEY_1,......  KEY_HASH */
+    USHORT  mask = 0x0FFF;
+    UBYTE currentRinger;
+
+    /*
+     * Only do anything when we are called at the beginning of
+     * sigDistribute() in mfw_kbd.c, rather than at the end.
+     */
+    if (res_int != -1)
+	return;
 
   /* terminate the ringing in all situation (it doesnt matter where the user is */
   if ( (e & KEY_HUP) && (e & KEY_MAKE) )
@@ -844,9 +830,6 @@
   HUPKeyOrigin = 0;
 
 
-  /* every other calls */
-  if(toggle)
-  {
 #ifdef SIM_TOOLKIT
        /*SPR#2121 - DS - Only download event to SAT if the event has been registered
         * by the SAT Setup Event List command
@@ -857,197 +840,57 @@
       }
 #endif
 
-/* Stop Playing ring tone - RAVI - 23-12-2005 */
- #ifdef NEPTUNE_BOARD
-    if(idle_data.new_sms == TRUE)
-    {
-        currentRinger = getcurrentSMSTone();
-        audio_StopSoundbyID( AUDIO_BUZZER, currentRinger );
-
-        /* Till this audio is stopped and next is played. */
-        vsi_t_sleep( 0, 10 );
-    }
-
-    cKeySound = 1;  /*  OMAPS00033660   */
-    if( idle_data.edt_buf[0] != '\0' )
-    {
-        if( idle_data.edt_buf[0] == '*'  ||  idle_data.edt_buf[0] == '#' )
-            {
-                cKeySound = 0;
-        }
-    }
-    else
-    {
-        if ( (e & KEY_HASH) || ( e & KEY_STAR ) )
-        {
-            cKeySound = 0;
-        }
-    }
-
-    if( cKeySound == 1 )
-    {
-
- #endif   /*  OMAPS00033660   */
- /* END RAVI - 23-12-2005 */
-
     if ((FFS_flashData.settings_status & SettingsKeypadClick) && (e & KEY_MAKE))
     {
       TRACE_EVENT ("Keypad Click activ");
-/* Start Playing key tones on key press - RAVI 23-12-2005 */
-#ifndef NEPTUNE_BOARD
-     audio_PlaySoundID(0, TONES_KEYBEEP, 200, AUDIO_PLAY_ONCE ); /* GW#2355 /CQ11341 */
-#else
-        /* RAVI - 20-1-2006 */
-    /* Silent Implementation */
-       /* Changed 0 to getCurrentVolumeSetting () */
-    audio_PlaySoundID(0, (TONES_KEYBEEP), getCurrentVoulmeSettings(),
-                                     AUDIO_PLAY_ONCE ); /* GW#2355 /CQ11341 */
-#endif
-/* END RAVI */
+      audio_PlaySoundID(0, TONES_KEYBEEP, 200, AUDIO_PLAY_ONCE );
     }
     else if ((FFS_flashData.settings_status & SettingsKeypadDTMF) && (e & KEY_MAKE))
     {
       TRACE_EVENT ("Keypad DTMF activ");
       switch (e &= mask)
-    {
-    case KEY_0:
-/* RAVI - 20-1-2006 */
-#ifdef NEPTUNE_BOARD
-       audio_PlaySoundID(0, (TONES_DTMF_0), getCurrentVoulmeSettings(), AUDIO_PLAY_ONCE ); /* GW#2355 /CQ11341 */
-#else
-      audio_PlaySoundID(0, (TONES_DTMF_0), 0, AUDIO_PLAY_ONCE ); /* GW#2355 /CQ11341 */
-#endif
-/* END RAVI */
-    break;
-    case KEY_1:
-/* RAVI - 20-1-2006 */
-#ifdef NEPTUNE_BOARD
-       audio_PlaySoundID(0, (TONES_DTMF_1), getCurrentVoulmeSettings(), AUDIO_PLAY_ONCE ); /* GW#2355 /CQ11341 */
-#else
-      audio_PlaySoundID(0, TONES_DTMF_1, 0, AUDIO_PLAY_ONCE ); /* GW#2355 /CQ11341 */
-#endif
-/* END RAVI */
-    break;
-    case KEY_2:
-/* RAVI - 20-1-2006 */
-#ifdef NEPTUNE_BOARD
-       audio_PlaySoundID(0, (TONES_DTMF_2), getCurrentVoulmeSettings(), AUDIO_PLAY_ONCE ); /* GW#2355 /CQ11341 */
-#else
-      audio_PlaySoundID(0, TONES_DTMF_2, 0, AUDIO_PLAY_ONCE ); /* GW#2355 /CQ11341 */
-#endif
-/* END RAVI */
-    break;
-    case KEY_3:
-/* RAVI - 20-1-2006 */
-#ifdef NEPTUNE_BOARD
-       audio_PlaySoundID(0, (TONES_DTMF_3), getCurrentVoulmeSettings(), AUDIO_PLAY_ONCE ); /* GW#2355 /CQ11341 */
-#else
-      audio_PlaySoundID(0, TONES_DTMF_3, 0, AUDIO_PLAY_ONCE ); /* GW#2355 /CQ11341 */
-#endif
-/* END RAVI */
-    break;
-    case KEY_4:
-/* RAVI - 20-1-2006 */
-#ifdef NEPTUNE_BOARD
-       audio_PlaySoundID(0, (TONES_DTMF_4), getCurrentVoulmeSettings(), AUDIO_PLAY_ONCE ); /* GW#2355 /CQ11341 */
-#else
-      audio_PlaySoundID(0, TONES_DTMF_4, 0, AUDIO_PLAY_ONCE ); /* GW#2355 /CQ11341 */
-#endif
-/* END RAVI */
-    break;
-    case KEY_5:
-/* RAVI - 20-1-2006 */
-#ifdef NEPTUNE_BOARD
-       audio_PlaySoundID(0, (TONES_DTMF_5), getCurrentVoulmeSettings(), AUDIO_PLAY_ONCE ); /* GW#2355 /CQ11341 */
-#else
-      audio_PlaySoundID(0, TONES_DTMF_5, 0, AUDIO_PLAY_ONCE ); /* GW#2355 /CQ11341 */
-#endif
-/* END RAVI */
-    break;
-    case KEY_6:
-/* RAVI - 20-1-2006 */
-#ifdef NEPTUNE_BOARD
-       audio_PlaySoundID(0, (TONES_DTMF_6), getCurrentVoulmeSettings(), AUDIO_PLAY_ONCE ); /* GW#2355 /CQ11341 */
-#else
-      audio_PlaySoundID(0, TONES_DTMF_6, 0, AUDIO_PLAY_ONCE ); /* GW#2355 /CQ11341 */
-#endif
-/* END RAVI */
-    break;
-    case KEY_7:
-/* RAVI - 20-1-2006 */
-#ifdef NEPTUNE_BOARD
-       audio_PlaySoundID(0, (TONES_DTMF_7), getCurrentVoulmeSettings(), AUDIO_PLAY_ONCE ); /* GW#2355 /CQ11341 */
-#else
-      audio_PlaySoundID(0, TONES_DTMF_7, 0, AUDIO_PLAY_ONCE ); /* GW#2355 /CQ11341 */
-#endif
-/* END RAVI */
-    break;
-    case KEY_8:
-/* RAVI - 20-1-2006 */
-#ifdef NEPTUNE_BOARD
-       audio_PlaySoundID(0, (TONES_DTMF_8), getCurrentVoulmeSettings(), AUDIO_PLAY_ONCE ); /* GW#2355 /CQ11341 */
-#else
-      audio_PlaySoundID(0, TONES_DTMF_8, 0, AUDIO_PLAY_ONCE ); /* GW#2355 /CQ11341 */
-#endif
-/* END RAVI */
-    break;
-    case KEY_9:
-/* RAVI - 20-1-2006 */
-#ifdef NEPTUNE_BOARD
-       audio_PlaySoundID(0, (TONES_DTMF_9), getCurrentVoulmeSettings(), AUDIO_PLAY_ONCE ); /* GW#2355 /CQ11341 */
- #else
-      audio_PlaySoundID(0, TONES_DTMF_9, 0,AUDIO_PLAY_ONCE ); /* GW#2355 /CQ11341 */
-#endif
-/* END RAVI */
-    break;
-    case KEY_STAR:
-/* RAVI  - 20-1-2006 */
-#ifdef NEPTUNE_BOARD
-       audio_PlaySoundID(0, (TONES_DTMF_STAR), getCurrentVoulmeSettings(), AUDIO_PLAY_ONCE ); /* GW#2355 /CQ11341 */
-#else
-      audio_PlaySoundID(0, TONES_DTMF_STAR, 0, AUDIO_PLAY_ONCE ); /* GW#2355 /CQ11341 */
-#endif
-/* END RAVI */
-    break;
-    case KEY_HASH:
-/* RAVI - 20-1-2006 */
-#ifdef NEPTUNE_BOARD
-       audio_PlaySoundID(0, (TONES_DTMF_HASH), getCurrentVoulmeSettings(), AUDIO_PLAY_ONCE ); /* GW#2355 /CQ11341 */
-#else
-      audio_PlaySoundID(0, TONES_DTMF_HASH, 0, AUDIO_PLAY_ONCE ); /* GW#2355 /CQ11341 */
-#endif
-/* END RAVI */
-    break;
-    default:
-      break;
-
+      {
+      case KEY_0:
+        audio_PlaySoundID(0, TONES_DTMF_0, 0, AUDIO_PLAY_ONCE );
+        break;
+      case KEY_1:
+        audio_PlaySoundID(0, TONES_DTMF_1, 0, AUDIO_PLAY_ONCE );
+        break;
+      case KEY_2:
+        audio_PlaySoundID(0, TONES_DTMF_2, 0, AUDIO_PLAY_ONCE );
+        break;
+      case KEY_3:
+        audio_PlaySoundID(0, TONES_DTMF_3, 0, AUDIO_PLAY_ONCE );
+        break;
+      case KEY_4:
+        audio_PlaySoundID(0, TONES_DTMF_4, 0, AUDIO_PLAY_ONCE );
+        break;
+      case KEY_5:
+        audio_PlaySoundID(0, TONES_DTMF_5, 0, AUDIO_PLAY_ONCE );
+        break;
+      case KEY_6:
+        audio_PlaySoundID(0, TONES_DTMF_6, 0, AUDIO_PLAY_ONCE );
+        break;
+      case KEY_7:
+        audio_PlaySoundID(0, TONES_DTMF_7, 0, AUDIO_PLAY_ONCE );
+        break;
+      case KEY_8:
+        audio_PlaySoundID(0, TONES_DTMF_8, 0, AUDIO_PLAY_ONCE );
+        break;
+      case KEY_9:
+        audio_PlaySoundID(0, TONES_DTMF_9, 0, AUDIO_PLAY_ONCE );
+        break;
+      case KEY_STAR:
+        audio_PlaySoundID(0, TONES_DTMF_STAR, 0, AUDIO_PLAY_ONCE );
+        break;
+      case KEY_HASH:
+        audio_PlaySoundID(0, TONES_DTMF_HASH, 0, AUDIO_PLAY_ONCE );
+        break;
+      default:
+        break;
       }
     }
 
-#ifdef NEPTUNE_BOARD
-        }
- #endif
-
-  }
-
-    /* OMAPS00151698, x0056422 */
-    #ifdef FF_MMI_A2DP_AVRCP
-    }
-    #endif
-
-
-
-  /* toggle the variable */
-  if(toggle)
-  {
-    toggle = FALSE;
-  }
-  else
-  {
-    toggle = TRUE;
-  }
-
-
   return 0;
 }