Add sending error callback when start fail 72/117872/1
authorWonnam Jang <wn.jang@samsung.com>
Wed, 25 Jan 2017 10:39:51 +0000 (19:39 +0900)
committerSuyeon Hwang <stom.hwang@samsung.com>
Wed, 8 Mar 2017 01:46:36 +0000 (17:46 -0800)
Change-Id: I6b77f84fc5def8a7c1c8f1ca72f4da9884721792
Signed-off-by: Wonnam Jang <wn.jang@samsung.com>
(cherry picked from commit 8baba0e56ea2c0e4da3a02cda25bb89daaa72ada)

server/vcd_server.c

index c8b4169..de53304 100755 (executable)
@@ -1455,13 +1455,21 @@ static int __start_internal_recognition()
 
        if (0 != vcd_client_command_collect_command()) {
                SLOG(LOG_ERROR, TAG_VCD, "[Client Data ERROR] Fail to collect command");
+               /* Send error cb to manager */
+               int pid = vcd_client_widget_get_foreground_pid();
+               if (-1 != pid)
+                       vcdc_send_error_signal_to_manager(vcd_client_manager_get_pid(), VCD_ERROR_OPERATION_FAILED, "voice_engine.error.proc_fail");
                return VCD_ERROR_OPERATION_FAILED;
        }
 
        /* 3. Set command to engine */
        ret = vcd_engine_set_commands();
        if (0 != ret) {
-               SLOG(LOG_ERROR, TAG_VCD, "[Server ERROR] Fail to collect command : %d", ret);
+               SLOG(LOG_ERROR, TAG_VCD, "[Server ERROR] Fail to set commands : %d", ret);
+               /* Send error cb to manager */
+               int pid = vcd_client_widget_get_foreground_pid();
+               if (-1 != pid)
+                       vcdc_send_error_signal_to_manager(vcd_client_manager_get_pid(), VCD_ERROR_OPERATION_FAILED, "voice_engine.error.proc_fail");
                return VCD_ERROR_OPERATION_FAILED;
        }
 
@@ -1478,6 +1486,10 @@ static int __start_internal_recognition()
        ret = vcd_engine_recognize_start(stop_by_silence);
        if (0 != ret) {
                SLOG(LOG_ERROR, TAG_VCD, "[Server ERROR] Fail to start recognition : result(%d)", ret);
+               /* Send error cb to manager */
+               int pid = vcd_client_widget_get_foreground_pid();
+               if (-1 != pid)
+                       vcdc_send_error_signal_to_manager(vcd_client_manager_get_pid(), VCD_ERROR_OPERATION_FAILED, "voice_engine.error.proc_fail");
                return VCD_ERROR_OPERATION_FAILED;
        }
 
@@ -1488,6 +1500,10 @@ static int __start_internal_recognition()
        if (0 != ret) {
                SLOG(LOG_ERROR, TAG_VCD, "[Server ERROR] Fail to start recorder : result(%d)", ret);
                vcd_engine_recognize_cancel();
+               /* Send error cb to manager */
+               int pid = vcd_client_widget_get_foreground_pid();
+               if (-1 != pid)
+                       vcdc_send_error_signal_to_manager(vcd_client_manager_get_pid(), VCD_ERROR_OPERATION_FAILED, "voice_engine.error.proc_fail");
                return ret;
        }