From 20e25d644ca890f5f3ab5559e17523b57f376494 Mon Sep 17 00:00:00 2001 From: Sejun Park Date: Thu, 26 Sep 2024 11:54:16 +0900 Subject: [PATCH] fixed svase issues Change-Id: I96653533277986a4fd964b76e7825b32039d953d --- client/vc_widget_tidl.c | 6 +- common/vc_command.c | 6 -- packaging/voice-control.spec | 2 +- server/vcd_client_data.c | 10 +-- server/vcd_recorder.c | 7 +- server/vcd_server.c | 133 ++++++++--------------------------- server/vcd_tidl.c | 5 +- server/vce.c | 21 ++---- 8 files changed, 44 insertions(+), 146 deletions(-) diff --git a/client/vc_widget_tidl.c b/client/vc_widget_tidl.c index 55b2e09..1e3acd8 100644 --- a/client/vc_widget_tidl.c +++ b/client/vc_widget_tidl.c @@ -350,11 +350,7 @@ int vc_widget_tidl_close_connection() free(g_proxy_tidl_info); g_proxy_tidl_info = NULL; - if (0 != rpc_port_stub_vc_widget_stub_vcd_widget_unregister()) { - SLOG(LOG_ERROR, TAG_VCW, "[TIDL ERROR] Fail to unregister stub"); - pthread_mutex_unlock(&g_w_tidl_mutex); - return VC_ERROR_OPERATION_FAILED; - } + rpc_port_stub_vc_widget_stub_vcd_widget_unregister(); free(g_stub_tidl_info); g_stub_tidl_info = NULL; diff --git a/common/vc_command.c b/common/vc_command.c index 2958d9d..1a13a6a 100644 --- a/common/vc_command.c +++ b/common/vc_command.c @@ -2224,9 +2224,6 @@ static int __vc_cmd_time_check(const char *str, struct tm *td) SLOG(LOG_DEBUG, TAG_VCCMD, "@@@ Time value is exist"); return ret; - } else if (VC_ERROR_NONE != ret) { - SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Error is occurred > (%d)", ret); - return ret; } ret = __vc_cmd_trelative_check(str, td, &exist); @@ -2268,9 +2265,6 @@ static int __vc_cmd_date_check(const char *str, struct tm *td) SLOG(LOG_DEBUG, TAG_VCCMD, "@@@ Date value is exist"); return ret; - } else if (VC_ERROR_NONE != ret) { - SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Error is occurred > (%d)", ret); - return ret; } ret = __vc_cmd_dabsolute_check(str, td, &exist); diff --git a/packaging/voice-control.spec b/packaging/voice-control.spec index ba68566..bc50dd8 100644 --- a/packaging/voice-control.spec +++ b/packaging/voice-control.spec @@ -1,6 +1,6 @@ Name: voice-control Summary: Voice control client library and daemon -Version: 1.90.3 +Version: 1.90.4 Release: 1 Group: Graphics & UI Framework/Voice Framework License: Apache-2.0 diff --git a/server/vcd_client_data.c b/server/vcd_client_data.c index ab42c56..292e347 100644 --- a/server/vcd_client_data.c +++ b/server/vcd_client_data.c @@ -453,10 +453,7 @@ int vcd_client_command_collect_command() /* 1. Get foreground pid */ int fg_pid = 0; int ret = -1; - if (0 != vcd_config_get_foreground(&fg_pid)) { - SLOG(LOG_WARN, TAG_VCD, "[Server WARNING] Fail to get foreground pid"); - /* There is no foreground app for voice control */ - } + vcd_config_get_foreground(&fg_pid); SLOG(LOG_INFO, TAG_VCD, "[Client Data] Foreground pid(%d)", fg_pid); @@ -1809,10 +1806,7 @@ int vcd_client_widget_get_foreground_pid() { /* 1. Get foreground pid */ int fg_pid = 0; - if (0 != vcd_config_get_foreground(&fg_pid)) { - SLOG(LOG_WARN, TAG_VCD, "[Server WARNING] Fail to get foreground pid"); - /* There is no foreground app for voice control */ - } + vcd_config_get_foreground(&fg_pid); widget_info_s* widget = NULL; diff --git a/server/vcd_recorder.c b/server/vcd_recorder.c index 0dd1394..0da5a63 100644 --- a/server/vcd_recorder.c +++ b/server/vcd_recorder.c @@ -229,9 +229,7 @@ static int __feed_audio_data_cb(const void* data, const unsigned int length) if (0 == g_buffer_count % 15) { float vol_db = get_volume_decibel((char*)data, length); - if (0 != vcdc_send_set_volume(vcd_client_manager_get_pid(), vol_db)) { - SLOG(LOG_ERROR, TAG_VCD, "[Recorder] Fail to send recording volume(%f)", vol_db); - } + vcdc_send_set_volume(vcd_client_manager_get_pid(), vol_db); } if (0 == g_buffer_count % 50) { @@ -407,8 +405,7 @@ Eina_Bool __read_test_func(void *data) __feed_audio_data_cb(buffer, buffer_size); float vol_db = get_volume_decibel(buffer, buffer_size); - if (0 != vcdc_send_set_volume(vcd_client_manager_get_pid(), vol_db)) - SLOG(LOG_ERROR, TAG_VCD, "[Recorder test] Fail to send recording volume(%f)", vol_db); + vcdc_send_set_volume(vcd_client_manager_get_pid(), vol_db); if (feof(g_pcm_fp) != 0) { fclose(g_pcm_fp); diff --git a/server/vcd_server.c b/server/vcd_server.c index 9945e0c..679dbec 100644 --- a/server/vcd_server.c +++ b/server/vcd_server.c @@ -154,9 +154,7 @@ static int __server_recorder_callback(const void* data, const unsigned int lengt if (VCE_SPEECH_DETECT_BEGIN == speech_detected) { if (-1 != vcd_client_manager_get_pid()) { /* Manager client is available */ - if (0 != vcdc_send_speech_detected(vcd_client_manager_get_pid())) { - SLOG(LOG_WARN, TAG_VCD, "[Server WARNING] Fail to send speech detected"); - } + vcdc_send_speech_detected(vcd_client_manager_get_pid()); } } else if (VCE_SPEECH_DETECT_END == speech_detected) { if (VCD_RECOGNITION_MODE_STOP_BY_SILENCE == vcd_client_get_recognition_mode()) { @@ -454,10 +452,7 @@ int vcd_send_asr_result(vce_asr_result_event_e event, const char* asr_result, vo if (NULL != asr_result) { SECURE_SLOG(LOG_INFO, TAG_VCD, "[Server] ASR result - Event(%d), Text(%s)", event, asr_result); - ret = vcdc_send_pre_result_to_manager(vcd_client_manager_get_pid(), event, asr_result); - if (0 != ret) { - SECURE_SLOG(LOG_ERROR, TAG_VCD, "[Server ERROR] Fail to send ASR result : mgr_pid(%d), asr_result(%s)", vcd_client_manager_get_pid(), asr_result); - } + vcdc_send_pre_result_to_manager(vcd_client_manager_get_pid(), event, asr_result); } return ret; @@ -482,10 +477,9 @@ int vcd_send_nlg_result(const char* nlg_result, void *user_data) } SLOG(LOG_ERROR, TAG_VCD, "[Server] send dialog : mgr_pid(%d), nlg_result(%s)", vcd_client_manager_get_pid(), nlg_result); - ret = vcdc_send_dialog(vcd_client_manager_get_pid(), -1, nlg_result, NULL, 0); //0: VC_DIALOG_END - if (0 != ret) - SECURE_SLOG(LOG_ERROR, TAG_VCD, "[Server ERROR] Fail to send dialog : mgr_pid(%d), nlg_result(%s)", vcd_client_manager_get_pid(), nlg_result); - return ret; + vcdc_send_dialog(vcd_client_manager_get_pid(), -1, nlg_result, NULL, 0); //0: VC_DIALOG_END + + return VCD_ERROR_NONE; } static void* __recorder_stop(void *data) @@ -876,9 +870,7 @@ int vcd_send_result(vce_result_event_e event, int* result_id, int count, const c if (-1 != vcd_client_manager_get_pid()) { /* Manager client is available */ - if (0 != vcdc_send_result_to_manager(vcd_client_manager_get_pid(), VC_RESULT_TYPE_NORMAL)) { - SLOG(LOG_WARN, TAG_VCD, "[Server WARNING] Fail to send result"); - } + vcdc_send_result_to_manager(vcd_client_manager_get_pid(), VC_RESULT_TYPE_NORMAL); } else { SLOG(LOG_INFO, TAG_VCD, "[Server] Manager is NOT available. Send result to client directly"); ecore_timer_add(0, __vcd_send_selected_result, NULL); @@ -891,9 +883,7 @@ int vcd_send_result(vce_result_event_e event, int* result_id, int count, const c if (-1 != vcd_client_manager_get_pid()) { /* Manager client is available */ - if (0 != vcdc_send_result_to_manager(vcd_client_manager_get_pid(), VC_RESULT_TYPE_NORMAL)) { - SLOG(LOG_WARN, TAG_VCD, "[Server WARNING] Fail to send result"); - } + vcdc_send_result_to_manager(vcd_client_manager_get_pid(), VC_RESULT_TYPE_NORMAL); } else { SLOG(LOG_WARN, TAG_VCD, "[Server WARNING] Manager is NOT available"); } @@ -909,9 +899,6 @@ int vcd_send_result(vce_result_event_e event, int* result_id, int count, const c bool temp = vcd_client_manager_get_exclusive(); vc_info_parser_set_result(all_result, event, msg, NULL, temp); ret = vcdc_send_result_to_manager(vcd_client_manager_get_pid(), VC_RESULT_TYPE_NOTIFICATION); - if (0 != ret) { - SLOG(LOG_WARN, TAG_VCD, "[Server WARNING] Fail to send result"); - } g_restart_timer = ecore_timer_add(0, __restart_engine, NULL); return ret; @@ -927,9 +914,6 @@ int vcd_send_result(vce_result_event_e event, int* result_id, int count, const c bool temp = vcd_client_manager_get_exclusive(); vc_info_parser_set_result(all_result, event, msg, NULL, temp); ret = vcdc_send_result_to_manager(vcd_client_manager_get_pid(), VC_RESULT_TYPE_NOTIFICATION); - if (0 != ret) { - SLOG(LOG_WARN, TAG_VCD, "[Server WARNING] Fail to send result"); - } return ret; } } @@ -1139,18 +1123,14 @@ int vcd_send_feedback_audio_format(int rate, vce_audio_channel_e channel, vce_au SLOG(LOG_INFO, TAG_VCD, "[Server DEBUG] Engine - Send TTS feedback audio format, g_current_tts_uid(%u)", g_current_tts_uid); /* send TTS feedback audio format to VC manager */ - int ret = VCD_ERROR_NONE; int pid = __get_tts_played_pid(); if (VC_INVALID_TTS_UID == pid || vcd_client_manager_get_pid() == pid) { - ret = vcdc_send_feedback_audio_format_to_manager(vcd_client_manager_get_pid(), rate, channel, audio_type); - if (VCD_ERROR_NONE != ret) { - SLOG(LOG_ERROR, TAG_VCD, "[Server ERROR] Fail to send TTS feedback audio format to VC manager"); - } + vcdc_send_feedback_audio_format_to_manager(vcd_client_manager_get_pid(), rate, channel, audio_type); } else { SLOG(LOG_INFO, TAG_VCD, "[Server INFO] Do not send TTS feedback audio format to VC manager"); } - return ret; + return VCD_ERROR_NONE; } int vcd_send_feedback_streaming(vce_feedback_event_e event, char* buffer, int len) @@ -1161,7 +1141,6 @@ int vcd_send_feedback_streaming(vce_feedback_event_e event, char* buffer, int le SLOG(LOG_INFO, TAG_VCD, "[Server info] set current uid and utt_id as manager pid(%d)", vcd_client_manager_get_pid()); } - int ret = VCD_ERROR_NONE; int pid = __get_tts_played_pid(); int utt_id = g_current_tts_uid % 1000; @@ -1169,16 +1148,10 @@ int vcd_send_feedback_streaming(vce_feedback_event_e event, char* buffer, int le if (VC_INVALID_TTS_UID == pid || pid == vcd_client_manager_get_pid() || -1 == vcd_client_manager_get_pid()) { /* send TTS feedback streaming to manager client */ - ret = vcdc_send_feedback_streaming_to_manager(vcd_client_manager_get_pid(), pid, utt_id, event, buffer, len); - if (VCD_ERROR_NONE != ret) { - SLOG(LOG_ERROR, TAG_VCD, "[Server ERROR] Fail to send TTS feedback streaming to manager client"); - } + vcdc_send_feedback_streaming_to_manager(vcd_client_manager_get_pid(), pid, utt_id, event, buffer, len); } else { /* send TTS feedback streaming to client */ - ret = vcdc_send_feedback_streaming(pid, utt_id, event, buffer, len); - if (VCD_ERROR_NONE != ret) { - SLOG(LOG_ERROR, TAG_VCD, "[Server ERROR] Fail to send TTS feedback streaming to client"); - } + vcdc_send_feedback_streaming(pid, utt_id, event, buffer, len); } if (VCE_FEEDBACK_EVENT_FINISH == event) { @@ -1192,7 +1165,7 @@ int vcd_send_feedback_streaming(vce_feedback_event_e event, char* buffer, int le } SLOG(LOG_INFO, TAG_VCD, "[Server info] feedback streaming finish event, reset current uid & service state(%d)", vcd_config_get_service_state()); } - return ret; + return VCD_ERROR_NONE; } @@ -1405,12 +1378,9 @@ bool vcd_finalize() vcd_client_manager_unset_appid(); - int ret = vcd_config_finalize(); - if (0 != ret) { - SLOG(LOG_ERROR, TAG_VCD, "[Server WARNING] Fail to finalize config."); - } + vcd_config_finalize(); - ret = vc_db_finalize(); + int ret = vc_db_finalize(); if (0 != ret) { SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to finalize DB : %d", ret); } @@ -1700,8 +1670,7 @@ int vcd_server_mgr_initialize(int pid, vcd_audio_streaming_mode_e mode) return VCD_ERROR_OPERATION_FAILED; } - if (0 != vcdc_send_manager_pid(pid)) - SLOG(LOG_WARN, TAG_VCD, "[Server WARNING] Fail to send manager pid"); + vcdc_send_manager_pid(pid); vcd_recorder_set_audio_streaming_mode(mode); @@ -1721,13 +1690,10 @@ int vcd_server_mgr_finalize(int pid) /* Cancel recognition */ vcd_server_mgr_cancel(); - if (0 != vcdc_send_manager_pid(-1)) - SLOG(LOG_WARN, TAG_VCD, "[Server WARNING] Fail to send manager pid"); + vcdc_send_manager_pid(-1); /* Remove manager information */ - if (0 != vcd_client_manager_unset()) { - SLOG(LOG_WARN, TAG_VCD, "[Server WARNING] Fail to delete client"); - } + vcd_client_manager_unset(); if (0 == vcd_client_get_ref_count()) { SLOG(LOG_INFO, TAG_VCD, "[Server] Connected client list is empty"); @@ -1772,10 +1738,7 @@ int vcd_server_mgr_set_demandable_client(int pid) } /* Save client list */ - if (0 != vcd_client_manager_set_demandable_client(pid, client_list)) { - SLOG(LOG_ERROR, TAG_VCD, "[Server ERROR] Fail to set demandable client list"); - return VCD_ERROR_OPERATION_FAILED; - } + vcd_client_manager_set_demandable_client(pid, client_list); return VCD_ERROR_NONE; } @@ -2014,9 +1977,7 @@ int vcd_server_mgr_start(vcd_recognition_mode_e recognition_mode, bool exclusive int fg_pid = -1; if (true == start_by_client) { /* Get foreground pid */ - if (0 != vcd_config_get_foreground(&fg_pid)) { - SLOG(LOG_ERROR, TAG_VCD, "[Server ERROR] Fail to get foreground"); - } + vcd_config_get_foreground(&fg_pid); /* Set client exclusive option */ if (0 != vcd_client_set_exclusive_command(fg_pid)) { @@ -2280,8 +2241,6 @@ int vcd_server_mgr_do_action(int pid, int type, const char* action) int vcd_server_mgr_set_disabled_command_type(int pid, int disabled_cmd_type) { - int ret = -1; - /* check if pid is valid */ if (false == vcd_client_manager_is_valid(pid)) { SLOG(LOG_ERROR, TAG_VCD, "[Server ERROR] The manager pid(%d) is NOT valid", pid); @@ -2294,14 +2253,9 @@ int vcd_server_mgr_set_disabled_command_type(int pid, int disabled_cmd_type) return VCD_ERROR_INVALID_STATE; } - ret = vcd_config_set_disabled_command_type(disabled_cmd_type); - if (0 != ret) { - SLOG(LOG_ERROR, TAG_VCD, "[Server ERROR] Fail to set command type"); - } else { - SLOG(LOG_ERROR, TAG_VCD, "[Server] Set command type(%d)", disabled_cmd_type); - } + vcd_config_set_disabled_command_type(disabled_cmd_type); - return ret; + return VCD_ERROR_NONE; } @@ -2358,11 +2312,7 @@ int vcd_server_mgr_send_audio_streaming(int pid, int event, const char* buffer, } if (VCD_AUDIO_STREAMING_EVENT_FINISH == event) { - ret = vcd_recorder_stop_streaming(); - if (0 != ret) { - SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to stop streaming, ret(%d)", ret); - return ret; - } + vcd_recorder_stop_streaming(); } return VCD_ERROR_NONE; @@ -2481,10 +2431,7 @@ int vcd_server_set_foreground(int pid, bool value) return VCD_ERROR_INVALID_PARAMETER; } - if (0 != vcd_config_set_foreground(pid, value)) { - SLOG(LOG_ERROR, TAG_VCD, "[Server ERROR] Fail to set foreground : pid(%d), value(%d)", pid, value); - return VCD_ERROR_OPERATION_FAILED; - } + vcd_config_set_foreground(pid, value); return VCD_ERROR_NONE; } @@ -2592,11 +2539,7 @@ int vcd_server_dialog(int pid, const char* disp_text, const char* utt_text, int return ret; } - ret = vcdc_send_dialog(vcd_client_manager_get_pid(), pid, disp_text, utt_text, continuous); - if (0 != ret) { - SLOG(LOG_ERROR, TAG_VCD, "[Server ERROR] Fail to send dialog : mgr_pid(%d), pid(%d), disp_text(%s), utt_text(%s), continue(%d)", vcd_client_manager_get_pid(), pid, disp_text, utt_text, continuous); - return ret; - } + vcdc_send_dialog(vcd_client_manager_get_pid(), pid, disp_text, utt_text, continuous); } return VCD_ERROR_NONE; } @@ -3153,13 +3096,9 @@ int vcd_get_command_count(vce_cmd_h vce_command, int* count) { SLOG(LOG_INFO, TAG_VCD, "[Server] Get command count"); - int ret = 0; - ret = vcd_engine_agent_get_command_count(vce_command, count); - if (0 != ret) { - SLOG(LOG_ERROR, TAG_VCD, "[Server ERROR] Fail to get command count : ret(%d)", ret); - } + vcd_engine_agent_get_command_count(vce_command, count); - return ret; + return VCD_ERROR_NONE; } int vcd_get_audio_type(char** audio_type) @@ -3184,14 +3123,9 @@ int vcd_set_private_data(const char* key, const char* data) return VCD_ERROR_INVALID_STATE; } - int ret = vcd_engine_agent_set_private_data(key, data); - if (0 != ret) { - SLOG(LOG_ERROR, TAG_VCD, "[Server ERROR] Fail to set private data to the manager client : ret(%d)", ret); - } else { - SLOG(LOG_INFO, TAG_VCD, "[Server] Set private data to the manager client, key(%s), data(%s)", key, data); - } + vcd_engine_agent_set_private_data(key, data); - return ret; + return VCD_ERROR_NONE; } int vcd_get_private_data(const char* key, char** data) @@ -3203,14 +3137,9 @@ int vcd_get_private_data(const char* key, char** data) return VCD_ERROR_INVALID_STATE; } - int ret = vcd_engine_agent_get_private_data(key, data); - if (0 != ret) { - SLOG(LOG_ERROR, TAG_VCD, "[Server ERROR] Fail to get private data from the manager client : ret(%d)", ret); - } else { - SLOG(LOG_INFO, TAG_VCD, "[Server] Get private data from the manager client, key(%s), data(%s)", key, *data); - } + vcd_engine_agent_get_private_data(key, data); - return ret; + return VCD_ERROR_NONE; } int vcd_start_recording() @@ -3351,4 +3280,4 @@ int vcd_set_tts_audio_format_request_cb(vce_tts_audio_format_request_cb callback } return ret; -} \ No newline at end of file +} diff --git a/server/vcd_tidl.c b/server/vcd_tidl.c index fcdf952..db818aa 100644 --- a/server/vcd_tidl.c +++ b/server/vcd_tidl.c @@ -1883,10 +1883,11 @@ int __setting_tidl_open_connection() int __setting_tidl_close_connection() { + int ret = -1; SLOG(LOG_DEBUG, TAG_VCD, "[TIDL] Close connection"); - rpc_port_stub_vcd_setting_stub_vc_setting_unregister(); + ret = rpc_port_stub_vcd_setting_stub_vc_setting_unregister(); - return VCD_ERROR_NONE; + return ret; } diff --git a/server/vce.c b/server/vce.c index d97cb86..4ce0c9e 100644 --- a/server/vce.c +++ b/server/vce.c @@ -286,12 +286,7 @@ int vce_send_specific_engine_result(const char* engine_app_id, const char* event SLOG(LOG_ERROR, TAG_VCD, "[INFO] Input parameter is NULL. (no result)"); } - ret = vcd_send_specific_engine_result(engine_app_id, event, result, user_info); - if (0 != ret) { - SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to send specific engine result, ret(%d)", ret); - } else { - SLOG(LOG_INFO, TAG_VCD, "[INFO] Success to send specific engine result, event(%s), result(%s)", event, result); - } + vcd_send_specific_engine_result(engine_app_id, event, result, user_info); return ret; } @@ -361,18 +356,13 @@ int vce_get_command_count(vce_cmd_h vce_command, int* count) return VCE_ERROR_NOT_SUPPORTED; } - int ret = VCE_ERROR_NONE; - if (NULL == count) { SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Invalid parameter"); return VCE_ERROR_INVALID_PARAMETER; } - ret = vcd_get_command_count(vce_command, count); - if (0 != ret) { - SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to get command count"); - } + vcd_get_command_count(vce_command, count); - return ret; + return VCE_ERROR_NONE; } int vce_get_audio_type(char** audio_type) @@ -597,10 +587,7 @@ int vce_send_feedback_audio_format(int rate, vce_audio_channel_e channel, vce_au return VCE_ERROR_INVALID_PARAMETER; } - ret = vcd_send_feedback_audio_format(rate, channel, audio_type); - if (0 != ret) { - SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to send feedback audio format"); - } + vcd_send_feedback_audio_format(rate, channel, audio_type); return ret; } -- 2.34.1