From: sooyeon Date: Mon, 1 Aug 2022 11:20:41 +0000 (+0900) Subject: Fix tidl error handling codes X-Git-Tag: submit/tizen/20220802.012937^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F66%2F279066%2F1;p=platform%2Fcore%2Fuifw%2Fvoice-control.git Fix tidl error handling codes Change-Id: I2d4662c41d486335b597d5f3930164150873f5d9 Signed-off-by: sooyeon --- diff --git a/client/vc_mgr_tidl.c b/client/vc_mgr_tidl.c index 18b7ac8..a6218ba 100644 --- a/client/vc_mgr_tidl.c +++ b/client/vc_mgr_tidl.c @@ -635,6 +635,15 @@ int vc_mgr_tidl_close_connection() return VC_ERROR_NONE; } +static int __convert_unhandled_error(int ret) +{ + if (RPC_PORT_ERROR_IO_ERROR == ret || RPC_PORT_ERROR_OUT_OF_MEMORY == ret) { + return VC_ERROR_OPERATION_FAILED; + } + + return ret; +} + static void __request_tidl_connect() { if (g_proxy_tidl_info->connection_requesting) { @@ -755,7 +764,12 @@ int vc_mgr_tidl_request_initialize(int pid, int audio_streaming_mode, int* servi } int ret = rpc_port_proxy_vc_mgr_proxy_vc_mgr_invoke_initialize(g_proxy_tidl_info->rpc_h, pid, audio_streaming_mode, &tmp_service_state, &tmp_forground, &tmp_daemon_pid); - if (RPC_PORT_ERROR_NONE != ret) { + int exception = get_last_result(); + if (RPC_PORT_ERROR_NONE != exception) { + ret = __convert_unhandled_error(exception); + } + + if (VC_ERROR_NONE != ret) { SLOG(LOG_ERROR, TAG_VCM, "[TIDL ERROR] Request vc manager initialize : Fail to invoke message, error(%d)", ret); return ret; } @@ -784,7 +798,12 @@ int vc_mgr_tidl_request_finalize(int pid) } int ret = rpc_port_proxy_vc_mgr_proxy_vc_mgr_invoke_finalize(g_proxy_tidl_info->rpc_h, pid); - if (RPC_PORT_ERROR_NONE != ret) { + int exception = get_last_result(); + if (RPC_PORT_ERROR_NONE != exception) { + ret = __convert_unhandled_error(exception); + } + + if (VC_ERROR_NONE != ret) { SLOG(LOG_ERROR, TAG_VCM, "[TIDL ERROR] Request vc manager finalize : Fail to invoke message, error(%d)", ret); return ret; } @@ -807,7 +826,12 @@ int vc_mgr_tidl_request_set_command(int pid) } int ret = rpc_port_proxy_vc_mgr_proxy_vc_mgr_invoke_set_command(g_proxy_tidl_info->rpc_h, pid); - if (RPC_PORT_ERROR_NONE != ret) { + int exception = get_last_result(); + if (RPC_PORT_ERROR_NONE != exception) { + ret = __convert_unhandled_error(exception); + } + + if (VC_ERROR_NONE != ret) { SLOG(LOG_ERROR, TAG_VCM, "[TIDL ERROR] Request vc manager set command : Fail to invoke message, error(%d)", ret); return ret; } @@ -830,7 +854,12 @@ int vc_mgr_tidl_request_unset_command(int pid) } int ret = rpc_port_proxy_vc_mgr_proxy_vc_mgr_invoke_unset_command(g_proxy_tidl_info->rpc_h, pid); - if (RPC_PORT_ERROR_NONE != ret) { + int exception = get_last_result(); + if (RPC_PORT_ERROR_NONE != exception) { + ret = __convert_unhandled_error(exception); + } + + if (VC_ERROR_NONE != ret) { SLOG(LOG_ERROR, TAG_VCM, "[TIDL ERROR] Request vc manager unset command : Fail to invoke message, error(%d)", ret); return ret; } @@ -853,7 +882,12 @@ int vc_mgr_tidl_request_demandable_client(int pid) } int ret = rpc_port_proxy_vc_mgr_proxy_vc_mgr_invoke_demandable_client(g_proxy_tidl_info->rpc_h, pid); - if (RPC_PORT_ERROR_NONE != ret) { + int exception = get_last_result(); + if (RPC_PORT_ERROR_NONE != exception) { + ret = __convert_unhandled_error(exception); + } + + if (VC_ERROR_NONE != ret) { SLOG(LOG_ERROR, TAG_VCM, "[TIDL ERROR] Request vc manager demandable client : Fail to invoke message, error(%d)", ret); return ret; } @@ -876,7 +910,12 @@ int vc_mgr_tidl_request_set_audio_type(int pid, const char* audio_type) } int ret = rpc_port_proxy_vc_mgr_proxy_vc_mgr_invoke_set_audio_type(g_proxy_tidl_info->rpc_h, pid, audio_type); - if (RPC_PORT_ERROR_NONE != ret) { + int exception = get_last_result(); + if (RPC_PORT_ERROR_NONE != exception) { + ret = __convert_unhandled_error(exception); + } + + if (VC_ERROR_NONE != ret) { SLOG(LOG_ERROR, TAG_VCM, "[TIDL ERROR] Request vc manager set audio type : Fail to invoke message, error(%d)", ret); return ret; } @@ -900,7 +939,12 @@ int vc_mgr_tidl_request_get_audio_type(int pid, char** audio_type) char *tmp = NULL; int ret = rpc_port_proxy_vc_mgr_proxy_vc_mgr_invoke_get_audio_type(g_proxy_tidl_info->rpc_h, pid, &tmp); - if (RPC_PORT_ERROR_NONE != ret) { + int exception = get_last_result(); + if (RPC_PORT_ERROR_NONE != exception) { + ret = __convert_unhandled_error(exception); + } + + if (VC_ERROR_NONE != ret) { SLOG(LOG_ERROR, TAG_VCM, "[TIDL ERROR] Request vc manager get audio type : Fail to invoke message, error(%d)", ret); return ret; } @@ -946,7 +990,12 @@ int vc_mgr_tidl_request_get_private_data(int pid, const char* key, char** data) char *tmp = NULL; int ret = rpc_port_proxy_vc_mgr_proxy_vc_mgr_invoke_get_private_data(g_proxy_tidl_info->rpc_h, pid, key, &tmp); - if (RPC_PORT_ERROR_NONE != ret) { + int exception = get_last_result(); + if (RPC_PORT_ERROR_NONE != exception) { + ret = __convert_unhandled_error(exception); + } + + if (VC_ERROR_NONE != ret) { SLOG(LOG_ERROR, TAG_VCM, "[TIDL ERROR] Request vc manager get private data : Fail to invoke message, error(%d)", ret); return ret; } @@ -972,7 +1021,12 @@ int vc_mgr_tidl_request_set_client_info(int pid) } int ret = rpc_port_proxy_vc_mgr_proxy_vc_mgr_invoke_set_client_info(g_proxy_tidl_info->rpc_h, pid); - if (RPC_PORT_ERROR_NONE != ret) { + int exception = get_last_result(); + if (RPC_PORT_ERROR_NONE != exception) { + ret = __convert_unhandled_error(exception); + } + + if (VC_ERROR_NONE != ret) { SLOG(LOG_ERROR, TAG_VCM, "[TIDL ERROR] Request vc manager set client info : Fail to invoke message, error(%d)", ret); return ret; } @@ -995,7 +1049,12 @@ int vc_mgr_tidl_request_set_domain(int pid, const char* domain) } int ret = rpc_port_proxy_vc_mgr_proxy_vc_mgr_invoke_set_domain(g_proxy_tidl_info->rpc_h, pid, domain); - if (RPC_PORT_ERROR_NONE != ret) { + int exception = get_last_result(); + if (RPC_PORT_ERROR_NONE != exception) { + ret = __convert_unhandled_error(exception); + } + + if (VC_ERROR_NONE != ret) { SLOG(LOG_ERROR, TAG_VCM, "[TIDL ERROR] Request vc manager set domain : Fail to invoke message, error(%d)", ret); return ret; } @@ -1037,7 +1096,12 @@ int vc_mgr_tidl_request_start(int pid, int recognition_mode, bool exclusive_comm } int ret = rpc_port_proxy_vc_mgr_proxy_vc_mgr_invoke_start(g_proxy_tidl_info->rpc_h, pid, recognition_mode, exclusive_command_option, start_by_client, disabled_cmd_type); - if (RPC_PORT_ERROR_NONE != ret) { + int exception = get_last_result(); + if (RPC_PORT_ERROR_NONE != exception) { + ret = __convert_unhandled_error(exception); + } + + if (VC_ERROR_NONE != ret) { SLOG(LOG_ERROR, TAG_VCM, "[TIDL ERROR] Request vc manager start : Fail to invoke message, error(%d)", ret); return ret; } @@ -1060,7 +1124,12 @@ int vc_mgr_tidl_request_stop(int pid) } int ret = rpc_port_proxy_vc_mgr_proxy_vc_mgr_invoke_stop(g_proxy_tidl_info->rpc_h, pid); - if (RPC_PORT_ERROR_NONE != ret) { + int exception = get_last_result(); + if (RPC_PORT_ERROR_NONE != exception) { + ret = __convert_unhandled_error(exception); + } + + if (VC_ERROR_NONE != ret) { SLOG(LOG_ERROR, TAG_VCM, "[TIDL ERROR] Request vc manager stop : Fail to invoke message, error(%d)", ret); return ret; } @@ -1083,7 +1152,12 @@ int vc_mgr_tidl_request_cancel(int pid) } int ret = rpc_port_proxy_vc_mgr_proxy_vc_mgr_invoke_cancel(g_proxy_tidl_info->rpc_h, pid); - if (RPC_PORT_ERROR_NONE != ret) { + int exception = get_last_result(); + if (RPC_PORT_ERROR_NONE != exception) { + ret = __convert_unhandled_error(exception); + } + + if (VC_ERROR_NONE != ret) { SLOG(LOG_ERROR, TAG_VCM, "[TIDL ERROR] Request vc manager cancel : Fail to invoke message, error(%d)", ret); return ret; } diff --git a/client/vc_setting_tidl.c b/client/vc_setting_tidl.c index e2c8b10..4f33b25 100644 --- a/client/vc_setting_tidl.c +++ b/client/vc_setting_tidl.c @@ -286,7 +286,7 @@ int vc_setting_tidl_request_hello() } -static int __covert_unhandled_error(int ret) +static int __convert_unhandled_error(int ret) { if (RPC_PORT_ERROR_IO_ERROR == ret || RPC_PORT_ERROR_OUT_OF_MEMORY == ret) { return VC_ERROR_OPERATION_FAILED; @@ -304,9 +304,14 @@ int vc_setting_tidl_request_set_language(int pid, const char* language) RETVM_IF(false == info->connected, VC_ERROR_OPERATION_FAILED, TAG_VCC, "[ERROR] Not Connected"); int ret = rpc_port_proxy_vc_setting_proxy_vc_setting_invoke_set_language(info->rpc_h, pid, language); - if (RPC_PORT_ERROR_NONE != ret) { - SLOG(LOG_ERROR, TAG_VCC, ">>>> Request vc setting set language : Fail to invoke message"); - return __covert_unhandled_error(ret); + int exception = get_last_result(); + if (RPC_PORT_ERROR_NONE != exception) { + ret = __convert_unhandled_error(exception); + } + + if (VC_ERROR_NONE != ret) { + SLOG(LOG_ERROR, TAG_VCC, ">>>> Request vc setting set language : Fail to invoke message (%d)", ret); + return ret; } SLOG(LOG_DEBUG, TAG_VCC, "@@ vc setting set language : pid(%d), language(%s)", pid, language); diff --git a/client/vc_tidl.c b/client/vc_tidl.c index 2601636..46fc18a 100644 --- a/client/vc_tidl.c +++ b/client/vc_tidl.c @@ -421,7 +421,7 @@ int vc_tidl_request_hello() } -static int __covert_unhandled_error(int ret) +static int __convert_unhandled_error(int ret) { if (RPC_PORT_ERROR_IO_ERROR == ret || RPC_PORT_ERROR_OUT_OF_MEMORY == ret) { return VC_ERROR_OPERATION_FAILED; @@ -439,9 +439,14 @@ int vc_tidl_request_initialize(int pid, int* mgr_pid, int* service_state, int* d RETVM_IF(false == info->connected, VC_ERROR_OPERATION_FAILED, TAG_VCC, "[ERROR] Not Connected"); int ret = rpc_port_proxy_vc_proxy_vc_invoke_initialize(info->rpc_h, pid, mgr_pid, service_state, daemon_pid); - if (RPC_PORT_ERROR_NONE != ret) { + int exception = get_last_result(); + if (RPC_PORT_ERROR_NONE != exception) { + ret = __convert_unhandled_error(exception); + } + + if (VC_ERROR_NONE != ret) { SLOG(LOG_ERROR, TAG_VCC, ">>>> Request vc initialize : Fail to invoke message. err(%d)", ret); - return __covert_unhandled_error(ret); + return ret; } SLOG(LOG_DEBUG, TAG_VCC, "@@ vc initialize : mgr = %d service = %d daemon_pid = %d", *mgr_pid, *service_state, *daemon_pid); //LCOV_EXCL_LINE @@ -458,9 +463,14 @@ int vc_tidl_request_finalize(int pid) RETVM_IF(false == info->connected, VC_ERROR_OPERATION_FAILED, TAG_VCC, "[ERROR] Not Connected"); int ret = rpc_port_proxy_vc_proxy_vc_invoke_finalize(info->rpc_h, pid); - if (RPC_PORT_ERROR_NONE != ret) { + int exception = get_last_result(); + if (RPC_PORT_ERROR_NONE != exception) { + ret = __convert_unhandled_error(exception); + } + + if (VC_ERROR_NONE != ret) { SLOG(LOG_ERROR, TAG_VCC, ">>>> Request vc finalize : Fail to invoke message. err(%d)", ret); - return __covert_unhandled_error(ret); + return ret; } SLOG(LOG_DEBUG, TAG_VCC, "@@ vc finalize : result = %d", ret); @@ -477,9 +487,14 @@ int vc_tidl_request_set_command(int pid, vc_cmd_type_e cmd_type) RETVM_IF(false == info->connected, VC_ERROR_OPERATION_FAILED, TAG_VCC, "[ERROR] Not Connected"); int ret = rpc_port_proxy_vc_proxy_vc_invoke_set_command(info->rpc_h, pid, cmd_type); - if (RPC_PORT_ERROR_NONE != ret) { + int exception = get_last_result(); + if (RPC_PORT_ERROR_NONE != exception) { + ret = __convert_unhandled_error(exception); + } + + if (VC_ERROR_NONE != ret) { SLOG(LOG_ERROR, TAG_VCC, ">>>> Request vc set command : Fail to invoke message. err(%d)", ret); - return __covert_unhandled_error(ret); + return ret; } SLOG(LOG_DEBUG, TAG_VCC, "@@ vc set command : pid(%d), cmd_type(%d)", pid, cmd_type); @@ -496,9 +511,14 @@ int vc_tidl_request_unset_command(int pid, vc_cmd_type_e cmd_type) RETVM_IF(false == info->connected, VC_ERROR_OPERATION_FAILED, TAG_VCC, "[ERROR] Not Connected"); int ret = rpc_port_proxy_vc_proxy_vc_invoke_unset_command(info->rpc_h, pid, cmd_type); - if (RPC_PORT_ERROR_NONE != ret) { + int exception = get_last_result(); + if (RPC_PORT_ERROR_NONE != exception) { + ret = __convert_unhandled_error(exception); + } + + if (VC_ERROR_NONE != ret) { SLOG(LOG_ERROR, TAG_VCC, ">>>> Request vc unset command : Fail to invoke message. err(%d)", ret); - return __covert_unhandled_error(ret); + return ret; } SLOG(LOG_DEBUG, TAG_VCC, "@@ vc unset command : pid(%d), cmd_type(%d)", pid, cmd_type); @@ -516,9 +536,14 @@ int vc_tidl_request_set_foreground(int pid, bool value) RETVM_IF(false == info->connected, VC_ERROR_OPERATION_FAILED, TAG_VCC, "[ERROR] Not Connected"); int ret = rpc_port_proxy_vc_proxy_vc_invoke_set_foreground(info->rpc_h, pid, value); - if (RPC_PORT_ERROR_NONE != ret) { + int exception = get_last_result(); + if (RPC_PORT_ERROR_NONE != exception) { + ret = __convert_unhandled_error(exception); + } + + if (VC_ERROR_NONE != ret) { SLOG(LOG_ERROR, TAG_VCC, ">>>> Request vc set foreground : Fail to invoke message. err(%d)", ret); - return __covert_unhandled_error(ret); + return ret; } SLOG(LOG_DEBUG, TAG_VCC, "@@ vc set foreground : pid(%d), value(%d)", pid, value); @@ -535,9 +560,14 @@ int vc_tidl_request_set_server_dialog(int pid, const char* app_id, const char* c RETVM_IF(false == info->connected, VC_ERROR_OPERATION_FAILED, TAG_VCC, "[ERROR] Not Connected"); int ret = rpc_port_proxy_vc_proxy_vc_invoke_set_server_dialog(info->rpc_h, pid, app_id, credential); - if (RPC_PORT_ERROR_NONE != ret) { + int exception = get_last_result(); + if (RPC_PORT_ERROR_NONE != exception) { + ret = __convert_unhandled_error(exception); + } + + if (VC_ERROR_NONE != ret) { SLOG(LOG_ERROR, TAG_VCC, ">>>> Request vc set server dialog : Fail to invoke message. err(%d)", ret); - return __covert_unhandled_error(ret); + return ret; } SLOG(LOG_DEBUG, TAG_VCC, "@@ vc set server dialog : pid(%d), app_id(%s), credential(%s)", pid, app_id, credential); @@ -555,9 +585,14 @@ int vc_tidl_request_request_dialog(int pid, const char* disp_text, const char* u RETVM_IF(false == info->connected, VC_ERROR_OPERATION_FAILED, TAG_VCC, "[ERROR] Not Connected"); int ret = rpc_port_proxy_vc_proxy_vc_invoke_request_dialog(info->rpc_h, pid, disp_text, utt_text, continuous); - if (RPC_PORT_ERROR_NONE != ret) { + int exception = get_last_result(); + if (RPC_PORT_ERROR_NONE != exception) { + ret = __convert_unhandled_error(exception); + } + + if (VC_ERROR_NONE != ret) { SLOG(LOG_ERROR, TAG_VCC, ">>>> Request vc request dialog : Fail to invoke message. err(%d)", ret); - return __covert_unhandled_error(ret); + return ret; } SLOG(LOG_DEBUG, TAG_VCC, "@@ vc request dialog : pid(%d), disp_text(%s), utt_text(%s), continuous(%d)", pid, disp_text, utt_text, continuous); @@ -574,9 +609,14 @@ int vc_tidl_request_is_system_command_valid(int pid, bool* is_sys_cmd_valid) RETVM_IF(false == info->connected, VC_ERROR_OPERATION_FAILED, TAG_VCC, "[ERROR] Not Connected"); int ret = rpc_port_proxy_vc_proxy_vc_invoke_is_system_command_valid(info->rpc_h, pid, is_sys_cmd_valid); - if (RPC_PORT_ERROR_NONE != ret) { + int exception = get_last_result(); + if (RPC_PORT_ERROR_NONE != exception) { + ret = __convert_unhandled_error(exception); + } + + if (VC_ERROR_NONE != ret) { SLOG(LOG_ERROR, TAG_VCC, ">>>> Request vc is system command valid : Fail to invoke message. err(%d)", ret); - return __covert_unhandled_error(ret); + return ret; } SLOG(LOG_DEBUG, TAG_VCC, "@@ vc is system command valid : pid(%d), is_sys_cmd_valid(%d)", pid, *is_sys_cmd_valid); @@ -594,9 +634,14 @@ int vc_tidl_request_auth_enable(int pid, int mgr_pid) RETVM_IF(false == info->connected, VC_ERROR_OPERATION_FAILED, TAG_VCC, "[ERROR] Not Connected"); int ret = rpc_port_proxy_vc_proxy_vc_invoke_auth_enable(info->rpc_h, pid, mgr_pid); - if (RPC_PORT_ERROR_NONE != ret) { + int exception = get_last_result(); + if (RPC_PORT_ERROR_NONE != exception) { + ret = __convert_unhandled_error(exception); + } + + if (VC_ERROR_NONE != ret) { SLOG(LOG_ERROR, TAG_VCC, ">>>> Request vc auth enable : Fail to invoke message. err(%d)", ret); - return __covert_unhandled_error(ret); + return ret; } SLOG(LOG_DEBUG, TAG_VCC, "@@ vc auth enable : pid(%d), mgr_pid(%d)", pid, mgr_pid); @@ -613,9 +658,14 @@ int vc_tidl_request_auth_disable(int pid, int mgr_pid) RETVM_IF(false == info->connected, VC_ERROR_OPERATION_FAILED, TAG_VCC, "[ERROR] Not Connected"); int ret = rpc_port_proxy_vc_proxy_vc_invoke_auth_disable(info->rpc_h, pid, mgr_pid); - if (RPC_PORT_ERROR_NONE != ret) { + int exception = get_last_result(); + if (RPC_PORT_ERROR_NONE != exception) { + ret = __convert_unhandled_error(exception); + } + + if (VC_ERROR_NONE != ret) { SLOG(LOG_ERROR, TAG_VCC, ">>>> Request vc auth disable : Fail to invoke message. err(%d)", ret); - return __covert_unhandled_error(ret); + return ret; } SLOG(LOG_DEBUG, TAG_VCC, "@@ vc auth disable : pid(%d), mgr_pid(%d)", pid, mgr_pid); @@ -632,9 +682,14 @@ int vc_tidl_request_auth_start(int pid, int mgr_pid) RETVM_IF(false == info->connected, VC_ERROR_OPERATION_FAILED, TAG_VCC, "[ERROR] Not Connected"); int ret = rpc_port_proxy_vc_proxy_vc_invoke_auth_start(info->rpc_h, pid, mgr_pid); - if (RPC_PORT_ERROR_NONE != ret) { + int exception = get_last_result(); + if (RPC_PORT_ERROR_NONE != exception) { + ret = __convert_unhandled_error(exception); + } + + if (VC_ERROR_NONE != ret) { SLOG(LOG_ERROR, TAG_VCC, ">>>> Request vc auth start : Fail to invoke message. err(%d)", ret); - return __covert_unhandled_error(ret); + return ret; } SLOG(LOG_DEBUG, TAG_VCC, "@@ vc auth start : pid(%d), mgr_pid(%d)", pid, mgr_pid); @@ -651,9 +706,14 @@ int vc_tidl_request_auth_stop(int pid, int mgr_pid) RETVM_IF(false == info->connected, VC_ERROR_OPERATION_FAILED, TAG_VCC, "[ERROR] Not Connected"); int ret = rpc_port_proxy_vc_proxy_vc_invoke_auth_stop(info->rpc_h, pid, mgr_pid); - if (RPC_PORT_ERROR_NONE != ret) { + int exception = get_last_result(); + if (RPC_PORT_ERROR_NONE != exception) { + ret = __convert_unhandled_error(exception); + } + + if (VC_ERROR_NONE != ret) { SLOG(LOG_ERROR, TAG_VCC, ">>>> Request vc auth stop : Fail to invoke message. err(%d)", ret); - return __covert_unhandled_error(ret); + return ret; } SLOG(LOG_DEBUG, TAG_VCC, "@@ vc auth stop : pid(%d), mgr_pid(%d)", pid, mgr_pid); @@ -670,9 +730,14 @@ int vc_tidl_request_auth_cancel(int pid, int mgr_pid) RETVM_IF(false == info->connected, VC_ERROR_OPERATION_FAILED, TAG_VCC, "[ERROR] Not Connected"); int ret = rpc_port_proxy_vc_proxy_vc_invoke_auth_cancel(info->rpc_h, pid, mgr_pid); - if (RPC_PORT_ERROR_NONE != ret) { + int exception = get_last_result(); + if (RPC_PORT_ERROR_NONE != exception) { + ret = __convert_unhandled_error(exception); + } + + if (VC_ERROR_NONE != ret) { SLOG(LOG_ERROR, TAG_VCC, ">>>> Request vc auth cancel : Fail to invoke message. err(%d)", ret); - return __covert_unhandled_error(ret); + return ret; } SLOG(LOG_DEBUG, TAG_VCC, "@@ vc auth cancel : pid(%d), mgr_pid(%d)", pid, mgr_pid); @@ -695,9 +760,14 @@ int vc_tidl_request_request_tts(int pid, const char* text, const char* language, } int ret = rpc_port_proxy_vc_proxy_vc_invoke_request_tts(info->rpc_h, pid, text, language, to_vcm, utt_id); - if (RPC_PORT_ERROR_NONE != ret) { + int exception = get_last_result(); + if (RPC_PORT_ERROR_NONE != exception) { + ret = __convert_unhandled_error(exception); + } + + if (VC_ERROR_NONE != ret) { SLOG(LOG_ERROR, TAG_VCC, ">>>> Request vc request tts : Fail to invoke message. err(%d)", ret); - return __covert_unhandled_error(ret); + return ret; } SLOG(LOG_DEBUG, TAG_VCC, "@@ vc request tts : pid(%d)", pid); @@ -714,9 +784,14 @@ int vc_tidl_request_cancel_tts(int pid, int utt_id) RETVM_IF(false == info->connected, VC_ERROR_OPERATION_FAILED, TAG_VCC, "[ERROR] Not Connected"); int ret = rpc_port_proxy_vc_proxy_vc_invoke_cancel_tts(info->rpc_h, pid, utt_id); - if (RPC_PORT_ERROR_NONE != ret) { + int exception = get_last_result(); + if (RPC_PORT_ERROR_NONE != exception) { + ret = __convert_unhandled_error(exception); + } + + if (VC_ERROR_NONE != ret) { SLOG(LOG_ERROR, TAG_VCC, ">>>> Request vc cancel tts : Fail to invoke message. err(%d)", ret); - return __covert_unhandled_error(ret); + return ret; } SLOG(LOG_DEBUG, TAG_VCC, "@@ vc cancel tts : pid(%d), utt_id(%d)", pid, utt_id); @@ -733,9 +808,14 @@ int vc_tidl_request_get_tts_audio_format(int pid, int* rate, vc_audio_channel_e* RETVM_IF(false == info->connected, VC_ERROR_OPERATION_FAILED, TAG_VCC, "[ERROR] Not Connected"); int ret = rpc_port_proxy_vc_proxy_vc_invoke_get_tts_audio_format(info->rpc_h, pid, rate, (int*)channel, (int*)audio_type); - if (RPC_PORT_ERROR_NONE != ret) { + int exception = get_last_result(); + if (RPC_PORT_ERROR_NONE != exception) { + ret = __convert_unhandled_error(exception); + } + + if (VC_ERROR_NONE != ret) { SLOG(LOG_ERROR, TAG_VCC, ">>>> Request vc get tts audio format: Fail to invoke message. err(%d)", ret); - return __covert_unhandled_error(ret); + return ret; } SLOG(LOG_DEBUG, TAG_VCC, "@@ vc get tts audio format : pid(%d), rate(%d), channel(%d), audio_type(%d)", pid, *rate, *channel, *audio_type); diff --git a/client/vc_widget_tidl.c b/client/vc_widget_tidl.c index dbe49de..f1203ff 100644 --- a/client/vc_widget_tidl.c +++ b/client/vc_widget_tidl.c @@ -347,6 +347,15 @@ int vc_widget_tidl_close_connection() return VC_ERROR_NONE; } +static int __convert_unhandled_error(int ret) +{ + if (RPC_PORT_ERROR_IO_ERROR == ret || RPC_PORT_ERROR_OUT_OF_MEMORY == ret) { + return VC_ERROR_OPERATION_FAILED; + } + + return ret; +} + static void __request_tidl_connect() { if (g_proxy_tidl_info->connection_requesting) { @@ -449,7 +458,12 @@ int vc_widget_tidl_request_initialize(int pid, int* service_state, int* daemon_p int temp_service_state = 0; int temp_daemon_pid = 0; int ret = rpc_port_proxy_vc_widget_proxy_vc_widget_invoke_initialize(g_proxy_tidl_info->rpc_h, pid, &temp_service_state, &temp_daemon_pid); - if (RPC_PORT_ERROR_NONE != ret) { + int exception = get_last_result(); + if (RPC_PORT_ERROR_NONE != exception) { + ret = __convert_unhandled_error(exception); + } + + if (VC_ERROR_NONE != ret) { SLOG(LOG_ERROR, TAG_VCW, "[TIDL ERROR] Request vc widget initialize : Fail to invoke message, error(%d)", ret); pthread_mutex_unlock(&g_w_init_mutex); return ret; @@ -482,7 +496,12 @@ int vc_widget_tidl_request_finalize(int pid) } int ret = rpc_port_proxy_vc_widget_proxy_vc_widget_invoke_finalize(g_proxy_tidl_info->rpc_h, pid); - if (RPC_PORT_ERROR_NONE != ret) { + int exception = get_last_result(); + if (RPC_PORT_ERROR_NONE != exception) { + ret = __convert_unhandled_error(exception); + } + + if (VC_ERROR_NONE != ret) { SLOG(LOG_ERROR, TAG_VCW, "[TIDL ERROR] Request vc widget finalize : Fail to invoke message, error(%d)", ret); pthread_mutex_unlock(&g_w_init_mutex); return ret; @@ -507,7 +526,12 @@ int vc_widget_tidl_request_start_recording(int pid, bool command) } int ret = rpc_port_proxy_vc_widget_proxy_vc_widget_invoke_start_recording(g_proxy_tidl_info->rpc_h, pid, (int)command); - if (RPC_PORT_ERROR_NONE != ret) { + int exception = get_last_result(); + if (RPC_PORT_ERROR_NONE != exception) { + ret = __convert_unhandled_error(exception); + } + + if (VC_ERROR_NONE != ret) { SLOG(LOG_ERROR, TAG_VCW, "[TIDL ERROR] Request vc widget start recording : Fail to invoke message, error(%d)", ret); return ret; } @@ -550,7 +574,12 @@ int vc_widget_tidl_request_enable_asr_result(int pid, bool enable) } int ret = rpc_port_proxy_vc_widget_proxy_vc_widget_invoke_enable_asr_result(g_proxy_tidl_info->rpc_h, pid, (int)enable); - if (RPC_PORT_ERROR_NONE != ret) { + int exception = get_last_result(); + if (RPC_PORT_ERROR_NONE != exception) { + ret = __convert_unhandled_error(exception); + } + + if (VC_ERROR_NONE != ret) { SLOG(LOG_ERROR, TAG_VCW, "[TIDL ERROR] Request vc widget enable asr result : Fail to invoke message, error(%d)", ret); return ret; } @@ -573,7 +602,12 @@ int vc_widget_tidl_request_start(int pid, int silence) } int ret = rpc_port_proxy_vc_widget_proxy_vc_widget_invoke_start(g_proxy_tidl_info->rpc_h, pid, silence); - if (RPC_PORT_ERROR_NONE != ret) { + int exception = get_last_result(); + if (RPC_PORT_ERROR_NONE != exception) { + ret = __convert_unhandled_error(exception); + } + + if (VC_ERROR_NONE != ret) { SLOG(LOG_ERROR, TAG_VCW, "[TIDL ERROR] Request vc widget start : Fail to invoke message, error(%d)", ret); return ret; } @@ -596,7 +630,12 @@ int vc_widget_tidl_request_stop(int pid) } int ret = rpc_port_proxy_vc_widget_proxy_vc_widget_invoke_stop(g_proxy_tidl_info->rpc_h, pid); - if (RPC_PORT_ERROR_NONE != ret) { + int exception = get_last_result(); + if (RPC_PORT_ERROR_NONE != exception) { + ret = __convert_unhandled_error(exception); + } + + if (VC_ERROR_NONE != ret) { SLOG(LOG_ERROR, TAG_VCW, "[TIDL ERROR] Request vc widget stop : Fail to invoke message, error(%d)", ret); return ret; } @@ -619,7 +658,12 @@ int vc_widget_tidl_request_cancel(int pid) } int ret = rpc_port_proxy_vc_widget_proxy_vc_widget_invoke_cancel(g_proxy_tidl_info->rpc_h, pid); - if (RPC_PORT_ERROR_NONE != ret) { + int exception = get_last_result(); + if (RPC_PORT_ERROR_NONE != exception) { + ret = __convert_unhandled_error(exception); + } + + if (VC_ERROR_NONE != ret) { SLOG(LOG_ERROR, TAG_VCW, "[TIDL ERROR] Request vc widget cancel : Fail to invoke message, error(%d)", ret); return ret; }