|
52 | 52 | import com.edw590.visor_c_a.Modules.CmdsExecutor.CmdsList.CmdsList;
|
53 | 53 | import com.edw590.visor_c_a.Modules.CmdsExecutor.CmdsList.UtilsCmdsList;
|
54 | 54 | import com.edw590.visor_c_a.Modules.Speech.Speech2;
|
55 |
| -import com.edw590.visor_c_a.Modules.Speech.UtilsSpeech2; |
56 | 55 | import com.edw590.visor_c_a.Modules.Speech.UtilsSpeech2BC;
|
57 | 56 | import com.edw590.visor_c_a.Modules.SpeechRecognitionCtrl.UtilsSpeechRecognizersBC;
|
58 | 57 | import com.edw590.visor_c_a.Modules.TelephonyManagement.TelephonyManagement;
|
59 | 58 | import com.edw590.visor_c_a.ModulesList;
|
60 |
| -import com.edw590.visor_c_a.Registry.UtilsRegistry; |
61 | 59 | import com.edw590.visor_c_a.Registry.RegistryKeys;
|
| 60 | +import com.edw590.visor_c_a.Registry.UtilsRegistry; |
62 | 61 | import com.edw590.visor_c_a.TasksList;
|
63 | 62 |
|
64 | 63 | import ACD.ACD;
|
@@ -824,45 +823,40 @@ int processTask(@NonNull final String sentence_str, final boolean partial_result
|
824 | 823 | final String contact_name = contacts_list[contact_index][0];
|
825 | 824 | final String contact_number = contacts_list[contact_index][1];
|
826 | 825 |
|
827 |
| - final Runnable do_after_confirm = () -> { |
828 |
| - final Runnable runnable = () -> { |
829 |
| - final int return_code = UtilsAndroidTelephony.makePhoneCall(contact_number); |
| 826 | + final Runnable runnable = () -> { |
| 827 | + final int return_code = UtilsAndroidTelephony.makePhoneCall(contact_number); |
830 | 828 |
|
831 |
| - switch (return_code) { |
832 |
| - case (UtilsAndroid.NO_CALL_EMERGENCY): { |
833 |
| - final String speak = "Insufficient privileges to call " + contact_number + |
834 |
| - ", since it is an emergency number. " + |
835 |
| - "Instead, it was only dialed and requires your manual confirmation " + |
836 |
| - "to proceed the call."; |
837 |
| - UtilsSpeech2BC.speak(speak, speech_priority, speech_mode2, UtilsSpeech2BC.GPT_DUMB, false, null); |
838 |
| - |
839 |
| - break; |
840 |
| - } |
841 |
| - case (UtilsAndroid.NO_CALL_ANY): { |
842 |
| - final String speak = "Insufficient privileges to call numbers. The number " + |
843 |
| - "was instead only dialed and requires your manual confirmation " + |
844 |
| - "to proceed the call."; |
845 |
| - UtilsSpeech2BC.speak(speak, speech_priority, speech_mode2, UtilsSpeech2BC.GPT_DUMB, false, null); |
| 829 | + switch (return_code) { |
| 830 | + case (UtilsAndroid.NO_CALL_EMERGENCY): { |
| 831 | + final String speak = "Insufficient privileges to call " + contact_number + |
| 832 | + ", since it is an emergency number. " + |
| 833 | + "Instead, it was only dialed and requires your manual confirmation " + |
| 834 | + "to proceed the call."; |
| 835 | + UtilsSpeech2BC.speak(speak, speech_priority, speech_mode2, UtilsSpeech2BC.GPT_DUMB, false, null); |
846 | 836 |
|
847 |
| - break; |
848 |
| - } |
849 |
| - case (UtilsAndroid.NOT_AVAILABLE): { |
850 |
| - final String speak = "Phone calls not supported on the device."; |
851 |
| - UtilsSpeech2BC.speak(speak, speech_priority, speech_mode2, UtilsSpeech2BC.GPT_DUMB, false, null); |
| 837 | + break; |
| 838 | + } |
| 839 | + case (UtilsAndroid.NO_CALL_ANY): { |
| 840 | + final String speak = "Insufficient privileges to call numbers. The number " + |
| 841 | + "was instead only dialed and requires your manual confirmation " + |
| 842 | + "to proceed the call."; |
| 843 | + UtilsSpeech2BC.speak(speak, speech_priority, speech_mode2, UtilsSpeech2BC.GPT_DUMB, false, null); |
852 | 844 |
|
853 |
| - break; |
854 |
| - } |
| 845 | + break; |
855 | 846 | }
|
856 |
| - }; |
| 847 | + case (UtilsAndroid.NOT_AVAILABLE): { |
| 848 | + final String speak = "Phone calls not supported on the device."; |
| 849 | + UtilsSpeech2BC.speak(speak, speech_priority, speech_mode2, UtilsSpeech2BC.GPT_DUMB, false, null); |
857 | 850 |
|
858 |
| - final String speak = "Calling " + contact_name + " now, sir."; |
859 |
| - UtilsSpeech2BC.speak(speak, speech_priority, speech_mode2, UtilsSpeech2BC.GPT_NONE, false, runnable); |
| 851 | + break; |
| 852 | + } |
| 853 | + } |
860 | 854 | };
|
861 | 855 |
|
862 |
| - final String spoken_action = "phone call " + contact_name; |
863 |
| - requestConfirmation(spoken_action, speech_mode2); |
| 856 | + final String speak = "Calling " + contact_name + " now, sir."; |
| 857 | + UtilsSpeech2BC.speak(speak, speech_priority, speech_mode2, UtilsSpeech2BC.GPT_NONE, false, runnable); |
864 | 858 |
|
865 |
| - previous_cmd = new Command(command, spoken_action, do_after_confirm); |
| 859 | + previous_cmd = new Command(command, "phone call " + contact_name, null); |
866 | 860 | break;
|
867 | 861 | }
|
868 | 862 | case (CmdsList.CmdIds.CMD_STOP_RECORD_MEDIA): {
|
@@ -1005,29 +999,6 @@ int processTask(@NonNull final String sentence_str, final boolean partial_result
|
1005 | 999 | previous_cmd = new Command(command, "stop media", null);
|
1006 | 1000 | break;
|
1007 | 1001 | }
|
1008 |
| - case (CmdsList.CmdIds.CMD_CONFIRM): |
1009 |
| - case (CmdsList.CmdIds.CMD_REJECT): { |
1010 |
| - some_cmd_detected = true; |
1011 |
| - if (only_returning) continue; |
1012 |
| - |
1013 |
| - if (previous_cmd.task_id < 0 || |
1014 |
| - (previous_cmd.detection_when > (System.currentTimeMillis() + 60_000))) { |
1015 |
| - // No runnable to execute (no command needing confirmation then) or the previous command was |
1016 |
| - // more than a minute ago. |
1017 |
| - final String speak = "There is nothing to confirm or reject, sir."; |
1018 |
| - UtilsSpeech2BC.speak(speak, speech_priority, speech_mode2, UtilsSpeech2BC.GPT_NONE, false, null); |
1019 |
| - } else { |
1020 |
| - if (cmd_id.equals(CmdsList.CmdIds.CMD_CONFIRM)) { |
1021 |
| - new Thread(TasksList.removeTask(previous_cmd.task_id).runnable).start(); |
1022 |
| - } else { |
1023 |
| - UtilsSpeech2BC.speak(previous_cmd.cmd_spoken_action + " rejected, sir.", speech_priority, |
1024 |
| - speech_mode2, UtilsSpeech2BC.GPT_NONE, false, null); |
1025 |
| - } |
1026 |
| - } |
1027 |
| - |
1028 |
| - previous_cmd = new Command(); |
1029 |
| - break; |
1030 |
| - } |
1031 | 1002 | case (CmdsList.CmdIds.CMD_STOP_LISTENING): {
|
1032 | 1003 | some_cmd_detected = true;
|
1033 | 1004 | if (only_returning) continue;
|
@@ -1243,19 +1214,6 @@ int processTask(@NonNull final String sentence_str, final boolean partial_result
|
1243 | 1214 | }
|
1244 | 1215 | }
|
1245 | 1216 |
|
1246 |
| - /** |
1247 |
| - * <p>Makes VISOR speak "Do you confirm to [action]?".</p> |
1248 |
| - * |
1249 |
| - * @param action the action mentioned above |
1250 |
| - * @param mode same as in {@link Speech2#speak(String, int, int)} |
1251 |
| - */ |
1252 |
| - private void requestConfirmation(@NonNull final String action, final int mode) { |
1253 |
| - ask_anything_else = false; |
1254 |
| - |
1255 |
| - final String speak = "Do you confirm to " + action + "?"; |
1256 |
| - UtilsSpeech2BC.speak(speak, Speech2.PRIORITY_USER_ACTION, mode, UtilsSpeech2BC.GPT_NONE, false, UtilsSpeech2.CALL_COMMANDS_RECOG); |
1257 |
| - } |
1258 |
| - |
1259 | 1217 | private void sendToGPT(final String sentence_str) {
|
1260 | 1218 | if (!UtilsSWA.isCommunicatorConnectedSERVER()) {
|
1261 | 1219 | String speak = "GPT unavailable. Not connected to the server.";
|
|
0 commit comments