FreeCalypso > hg > fc-tourmaline
comparison src/ui/bmi/mmiMain.c @ 80:46bab586c09b
mmiMain.c:keyAction() handler cleanup
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Mon, 26 Oct 2020 04:12:05 +0000 |
parents | 77321341946c |
children | 7160f0d005d2 |
comparison
equal
deleted
inserted
replaced
79:e5e2af0ca91c | 80:46bab586c09b |
---|---|
769 $Arguments: | 769 $Arguments: |
770 | 770 |
771 *******************************************************************************/ | 771 *******************************************************************************/ |
772 static int keyAction (MfwEvt e, MfwKbd *res) | 772 static int keyAction (MfwEvt e, MfwKbd *res) |
773 { | 773 { |
774 /* this function "keyAction" is called 4*times from MFW per each keypress */ | 774 int res_int = (int) res; |
775 /* twice for keypress and twice for keyrelease */ | 775 |
776 /* the variable "toggle" is using to avoid to play the keypadtone twice ! */ | 776 /* this mask is use to filter the keyevent "e" */ |
777 static UBYTE toggle = TRUE; | 777 /* want to use KEY_0, KEY_1,...... KEY_HASH */ |
778 | 778 USHORT mask = 0x0FFF; |
779 /* OMAPS00151698, x0056422 */ | 779 UBYTE currentRinger; |
780 #ifdef FF_MMI_A2DP_AVRCP | 780 |
781 if(tGlobalBmiBtStruct.bConnected == BMI_BT_CONNECTED && tGlobalBmiBtStruct.tCmdSrc == BMI_BT_HEADSET_COMMAND) | 781 /* |
782 {} | 782 * Only do anything when we are called at the beginning of |
783 else | 783 * sigDistribute() in mfw_kbd.c, rather than at the end. |
784 { | 784 */ |
785 #endif | 785 if (res_int != -1) |
786 | 786 return; |
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 | 787 |
802 /* terminate the ringing in all situation (it doesnt matter where the user is */ | 788 /* terminate the ringing in all situation (it doesnt matter where the user is */ |
803 if ( (e & KEY_HUP) && (e & KEY_MAKE) ) | 789 if ( (e & KEY_HUP) && (e & KEY_MAKE) ) |
804 { | 790 { |
805 /* Apr 05, 2005 REF: ENH 29994 xdeepadh */ | 791 /* Apr 05, 2005 REF: ENH 29994 xdeepadh */ |
842 } | 828 } |
843 | 829 |
844 HUPKeyOrigin = 0; | 830 HUPKeyOrigin = 0; |
845 | 831 |
846 | 832 |
847 /* every other calls */ | |
848 if(toggle) | |
849 { | |
850 #ifdef SIM_TOOLKIT | 833 #ifdef SIM_TOOLKIT |
851 /*SPR#2121 - DS - Only download event to SAT if the event has been registered | 834 /*SPR#2121 - DS - Only download event to SAT if the event has been registered |
852 * by the SAT Setup Event List command | 835 * by the SAT Setup Event List command |
853 */ | 836 */ |
854 if (satEvtRegistered(SatEvtUserActionActivated) == TRUE) | 837 if (satEvtRegistered(SatEvtUserActionActivated) == TRUE) |
855 { | 838 { |
856 satEvtDownload(SatEvtUserAction); | 839 satEvtDownload(SatEvtUserAction); |
857 } | 840 } |
858 #endif | 841 #endif |
859 | 842 |
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)) | 843 if ((FFS_flashData.settings_status & SettingsKeypadClick) && (e & KEY_MAKE)) |
894 { | 844 { |
895 TRACE_EVENT ("Keypad Click activ"); | 845 TRACE_EVENT ("Keypad Click activ"); |
896 /* Start Playing key tones on key press - RAVI 23-12-2005 */ | 846 audio_PlaySoundID(0, TONES_KEYBEEP, 200, AUDIO_PLAY_ONCE ); |
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 } | 847 } |
908 else if ((FFS_flashData.settings_status & SettingsKeypadDTMF) && (e & KEY_MAKE)) | 848 else if ((FFS_flashData.settings_status & SettingsKeypadDTMF) && (e & KEY_MAKE)) |
909 { | 849 { |
910 TRACE_EVENT ("Keypad DTMF activ"); | 850 TRACE_EVENT ("Keypad DTMF activ"); |
911 switch (e &= mask) | 851 switch (e &= mask) |
912 { | 852 { |
913 case KEY_0: | 853 case KEY_0: |
914 /* RAVI - 20-1-2006 */ | 854 audio_PlaySoundID(0, TONES_DTMF_0, 0, AUDIO_PLAY_ONCE ); |
915 #ifdef NEPTUNE_BOARD | 855 break; |
916 audio_PlaySoundID(0, (TONES_DTMF_0), getCurrentVoulmeSettings(), AUDIO_PLAY_ONCE ); /* GW#2355 /CQ11341 */ | 856 case KEY_1: |
917 #else | 857 audio_PlaySoundID(0, TONES_DTMF_1, 0, AUDIO_PLAY_ONCE ); |
918 audio_PlaySoundID(0, (TONES_DTMF_0), 0, AUDIO_PLAY_ONCE ); /* GW#2355 /CQ11341 */ | 858 break; |
919 #endif | 859 case KEY_2: |
920 /* END RAVI */ | 860 audio_PlaySoundID(0, TONES_DTMF_2, 0, AUDIO_PLAY_ONCE ); |
921 break; | 861 break; |
922 case KEY_1: | 862 case KEY_3: |
923 /* RAVI - 20-1-2006 */ | 863 audio_PlaySoundID(0, TONES_DTMF_3, 0, AUDIO_PLAY_ONCE ); |
924 #ifdef NEPTUNE_BOARD | 864 break; |
925 audio_PlaySoundID(0, (TONES_DTMF_1), getCurrentVoulmeSettings(), AUDIO_PLAY_ONCE ); /* GW#2355 /CQ11341 */ | 865 case KEY_4: |
926 #else | 866 audio_PlaySoundID(0, TONES_DTMF_4, 0, AUDIO_PLAY_ONCE ); |
927 audio_PlaySoundID(0, TONES_DTMF_1, 0, AUDIO_PLAY_ONCE ); /* GW#2355 /CQ11341 */ | 867 break; |
928 #endif | 868 case KEY_5: |
929 /* END RAVI */ | 869 audio_PlaySoundID(0, TONES_DTMF_5, 0, AUDIO_PLAY_ONCE ); |
930 break; | 870 break; |
931 case KEY_2: | 871 case KEY_6: |
932 /* RAVI - 20-1-2006 */ | 872 audio_PlaySoundID(0, TONES_DTMF_6, 0, AUDIO_PLAY_ONCE ); |
933 #ifdef NEPTUNE_BOARD | 873 break; |
934 audio_PlaySoundID(0, (TONES_DTMF_2), getCurrentVoulmeSettings(), AUDIO_PLAY_ONCE ); /* GW#2355 /CQ11341 */ | 874 case KEY_7: |
935 #else | 875 audio_PlaySoundID(0, TONES_DTMF_7, 0, AUDIO_PLAY_ONCE ); |
936 audio_PlaySoundID(0, TONES_DTMF_2, 0, AUDIO_PLAY_ONCE ); /* GW#2355 /CQ11341 */ | 876 break; |
937 #endif | 877 case KEY_8: |
938 /* END RAVI */ | 878 audio_PlaySoundID(0, TONES_DTMF_8, 0, AUDIO_PLAY_ONCE ); |
939 break; | 879 break; |
940 case KEY_3: | 880 case KEY_9: |
941 /* RAVI - 20-1-2006 */ | 881 audio_PlaySoundID(0, TONES_DTMF_9, 0, AUDIO_PLAY_ONCE ); |
942 #ifdef NEPTUNE_BOARD | 882 break; |
943 audio_PlaySoundID(0, (TONES_DTMF_3), getCurrentVoulmeSettings(), AUDIO_PLAY_ONCE ); /* GW#2355 /CQ11341 */ | 883 case KEY_STAR: |
944 #else | 884 audio_PlaySoundID(0, TONES_DTMF_STAR, 0, AUDIO_PLAY_ONCE ); |
945 audio_PlaySoundID(0, TONES_DTMF_3, 0, AUDIO_PLAY_ONCE ); /* GW#2355 /CQ11341 */ | 885 break; |
946 #endif | 886 case KEY_HASH: |
947 /* END RAVI */ | 887 audio_PlaySoundID(0, TONES_DTMF_HASH, 0, AUDIO_PLAY_ONCE ); |
948 break; | 888 break; |
949 case KEY_4: | 889 default: |
950 /* RAVI - 20-1-2006 */ | 890 break; |
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 } | 891 } |
1025 } | 892 } |
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 | 893 |
1051 return 0; | 894 return 0; |
1052 } | 895 } |
1053 | 896 |
1054 #if(0)/* x0039928 -Lint warning removal */ | 897 #if(0)/* x0039928 -Lint warning removal */ |