From 3fea72b9eff6517ea2253a0b2bae03224b1d059d Mon Sep 17 00:00:00 2001 From: sooyeon Date: Tue, 28 Jun 2022 11:02:03 +0900 Subject: [PATCH] Fix minor issues (indentation, filemod, add a checker of return values, etc) Change-Id: I0f34be3b3fdfd659e7f47bca5d82f0c5333c1840 Signed-off-by: sooyeon --- client/vc_mgr.c | 0 client/vc_mgr_dbus.c | 0 client/vc_mgr_tidl.c | 0 client/vc_setting_tidl.c | 4 +- client/vc_setting_tidl.h | 0 client/vc_tidl.c | 44 +- client/vc_tidl.h | 0 server/vcd_client_data.c | 12 +- server/vcd_dbus.c | 0 server/vcd_dbus_server.c | 0 server/vcd_tidl.c | 1012 +++++++++++++++++++------------------- 11 files changed, 538 insertions(+), 534 deletions(-) mode change 100755 => 100644 client/vc_mgr.c mode change 100755 => 100644 client/vc_mgr_dbus.c mode change 100755 => 100644 client/vc_mgr_tidl.c mode change 100755 => 100644 client/vc_setting_tidl.c mode change 100755 => 100644 client/vc_setting_tidl.h mode change 100755 => 100644 client/vc_tidl.c mode change 100755 => 100644 client/vc_tidl.h mode change 100755 => 100644 server/vcd_dbus.c mode change 100755 => 100644 server/vcd_dbus_server.c diff --git a/client/vc_mgr.c b/client/vc_mgr.c old mode 100755 new mode 100644 diff --git a/client/vc_mgr_dbus.c b/client/vc_mgr_dbus.c old mode 100755 new mode 100644 diff --git a/client/vc_mgr_tidl.c b/client/vc_mgr_tidl.c old mode 100755 new mode 100644 diff --git a/client/vc_setting_tidl.c b/client/vc_setting_tidl.c old mode 100755 new mode 100644 index 240ef70..6f687c3 --- a/client/vc_setting_tidl.c +++ b/client/vc_setting_tidl.c @@ -146,13 +146,13 @@ static void __request_tidl_connect(vc_setting_tidl_info_s* info) { if (info->connection_requesting) { SLOG(LOG_INFO, TAG_VCC, "[TIDL] Already connection is requested. Skip to call rpc_port_proxy_vc_setting_proxy_vc_setting_connect()."); - return ; + return; } int ret = rpc_port_proxy_vc_setting_proxy_vc_setting_connect(info->rpc_h); if (0 != ret) { SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to request connection to stub. ret(%d)", ret); - return ; + return; } SLOG(LOG_INFO, TAG_VCC, "[INFO] Request connection to stub. ret(%d)", ret); diff --git a/client/vc_setting_tidl.h b/client/vc_setting_tidl.h old mode 100755 new mode 100644 diff --git a/client/vc_tidl.c b/client/vc_tidl.c old mode 100755 new mode 100644 index 110440a..6a6caef --- a/client/vc_tidl.c +++ b/client/vc_tidl.c @@ -152,13 +152,13 @@ static void __request_tidl_connect(vc_tidl_info_s* info) { if (info->connection_requesting) { SLOG(LOG_INFO, TAG_VCC, "[TIDL] Already connection is requested. Skip to call rpc_port_proxy_vc_proxy_vc_connect()."); - return ; + return; } int ret = rpc_port_proxy_vc_proxy_vc_connect(info->rpc_h); if (0 != ret) { SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to request connection to stub. ret(%d)", ret); - return ; + return; } SLOG(LOG_INFO, TAG_VCC, "[INFO] Request connection to stub. ret(%d)", ret); @@ -267,7 +267,9 @@ static int __create_notify_callback_handle(vc_tidl_info_s* info) info->notify_cb_h = NULL; } - if (RPC_PORT_ERROR_NONE != rpc_port_proxy_vc_proxy_vc_notify_cb_create(&info->notify_cb_h)) { + int ret = rpc_port_proxy_vc_proxy_vc_notify_cb_create(&info->notify_cb_h); + if (RPC_PORT_ERROR_NONE != ret) { + SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to invoke rpc_port_proxy_vc_proxy_vc_notify_cb_create(). err(%d)", ret); return VC_ERROR_OUT_OF_MEMORY; } @@ -284,7 +286,9 @@ static int __create_feedback_callback_handle(vc_tidl_info_s* info) info->feedback_cb_h = NULL; } - if (RPC_PORT_ERROR_NONE != rpc_port_proxy_vc_proxy_vc_feedback_cb_create(&info->feedback_cb_h)) { + int ret = rpc_port_proxy_vc_proxy_vc_feedback_cb_create(&info->feedback_cb_h); + if (RPC_PORT_ERROR_NONE != ret) { + SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to invoke rpc_port_proxy_vc_proxy_vc_feedback_cb_create(). err(%d)", ret); return VC_ERROR_OUT_OF_MEMORY; } @@ -424,7 +428,7 @@ int vc_tidl_request_initialize(int pid, int* mgr_pid, int* service_state, int* d 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) { - SLOG(LOG_ERROR, TAG_VCC, ">>>> Request vc initialize : Fail to invoke message"); + SLOG(LOG_ERROR, TAG_VCC, ">>>> Request vc initialize : Fail to invoke message. err(%d)", ret); return __covert_unhandled_error(ret); } @@ -443,7 +447,7 @@ int vc_tidl_request_finalize(int pid) int ret = rpc_port_proxy_vc_proxy_vc_invoke_finalize(info->rpc_h, pid); if (RPC_PORT_ERROR_NONE != ret) { - SLOG(LOG_ERROR, TAG_VCC, ">>>> Request vc finalize : Fail to invoke message"); + SLOG(LOG_ERROR, TAG_VCC, ">>>> Request vc finalize : Fail to invoke message. err(%d)", ret); return __covert_unhandled_error(ret); } @@ -462,7 +466,7 @@ int vc_tidl_request_set_command(int pid, vc_cmd_type_e cmd_type) int ret = rpc_port_proxy_vc_proxy_vc_invoke_set_command(info->rpc_h, pid, cmd_type); if (RPC_PORT_ERROR_NONE != ret) { - SLOG(LOG_ERROR, TAG_VCC, ">>>> Request vc set command : Fail to invoke message"); + SLOG(LOG_ERROR, TAG_VCC, ">>>> Request vc set command : Fail to invoke message. err(%d)", ret); return __covert_unhandled_error(ret); } @@ -481,7 +485,7 @@ int vc_tidl_request_unset_command(int pid, vc_cmd_type_e cmd_type) int ret = rpc_port_proxy_vc_proxy_vc_invoke_unset_command(info->rpc_h, pid, cmd_type); if (RPC_PORT_ERROR_NONE != ret) { - SLOG(LOG_ERROR, TAG_VCC, ">>>> Request vc unset command : Fail to invoke message"); + SLOG(LOG_ERROR, TAG_VCC, ">>>> Request vc unset command : Fail to invoke message. err(%d)", ret); return __covert_unhandled_error(ret); } @@ -501,7 +505,7 @@ int vc_tidl_request_set_foreground(int pid, bool value) int ret = rpc_port_proxy_vc_proxy_vc_invoke_set_foreground(info->rpc_h, pid, value); if (RPC_PORT_ERROR_NONE != ret) { - SLOG(LOG_ERROR, TAG_VCC, ">>>> Request vc set foreground : Fail to invoke message"); + SLOG(LOG_ERROR, TAG_VCC, ">>>> Request vc set foreground : Fail to invoke message. err(%d)", ret); return __covert_unhandled_error(ret); } @@ -520,7 +524,7 @@ int vc_tidl_request_set_server_dialog(int pid, const char* app_id, const char* c 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) { - SLOG(LOG_ERROR, TAG_VCC, ">>>> Request vc set server dialog : Fail to invoke message"); + SLOG(LOG_ERROR, TAG_VCC, ">>>> Request vc set server dialog : Fail to invoke message. err(%d)", ret); return __covert_unhandled_error(ret); } @@ -540,7 +544,7 @@ int vc_tidl_request_request_dialog(int pid, const char* disp_text, const char* u 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) { - SLOG(LOG_ERROR, TAG_VCC, ">>>> Request vc request dialog : Fail to invoke message"); + SLOG(LOG_ERROR, TAG_VCC, ">>>> Request vc request dialog : Fail to invoke message. err(%d)", ret); return __covert_unhandled_error(ret); } @@ -559,7 +563,7 @@ int vc_tidl_request_is_system_command_valid(int pid, bool* is_sys_cmd_valid) 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) { - SLOG(LOG_ERROR, TAG_VCC, ">>>> Request vc is system command valid : Fail to invoke message"); + SLOG(LOG_ERROR, TAG_VCC, ">>>> Request vc is system command valid : Fail to invoke message. err(%d)", ret); return __covert_unhandled_error(ret); } @@ -579,7 +583,7 @@ int vc_tidl_request_auth_enable(int pid, int mgr_pid) int ret = rpc_port_proxy_vc_proxy_vc_invoke_auth_enable(info->rpc_h, pid, mgr_pid); if (RPC_PORT_ERROR_NONE != ret) { - SLOG(LOG_ERROR, TAG_VCC, ">>>> Request vc auth enable : Fail to invoke message"); + SLOG(LOG_ERROR, TAG_VCC, ">>>> Request vc auth enable : Fail to invoke message. err(%d)", ret); return __covert_unhandled_error(ret); } @@ -598,7 +602,7 @@ int vc_tidl_request_auth_disable(int pid, int mgr_pid) int ret = rpc_port_proxy_vc_proxy_vc_invoke_auth_disable(info->rpc_h, pid, mgr_pid); if (RPC_PORT_ERROR_NONE != ret) { - SLOG(LOG_ERROR, TAG_VCC, ">>>> Request vc auth disable : Fail to invoke message"); + SLOG(LOG_ERROR, TAG_VCC, ">>>> Request vc auth disable : Fail to invoke message. err(%d)", ret); return __covert_unhandled_error(ret); } @@ -617,7 +621,7 @@ int vc_tidl_request_auth_start(int pid, int mgr_pid) int ret = rpc_port_proxy_vc_proxy_vc_invoke_auth_start(info->rpc_h, pid, mgr_pid); if (RPC_PORT_ERROR_NONE != ret) { - SLOG(LOG_ERROR, TAG_VCC, ">>>> Request vc auth start : Fail to invoke message"); + SLOG(LOG_ERROR, TAG_VCC, ">>>> Request vc auth start : Fail to invoke message. err(%d)", ret); return __covert_unhandled_error(ret); } @@ -636,7 +640,7 @@ int vc_tidl_request_auth_stop(int pid, int mgr_pid) int ret = rpc_port_proxy_vc_proxy_vc_invoke_auth_stop(info->rpc_h, pid, mgr_pid); if (RPC_PORT_ERROR_NONE != ret) { - SLOG(LOG_ERROR, TAG_VCC, ">>>> Request vc auth stop : Fail to invoke message"); + SLOG(LOG_ERROR, TAG_VCC, ">>>> Request vc auth stop : Fail to invoke message. err(%d)", ret); return __covert_unhandled_error(ret); } @@ -655,7 +659,7 @@ int vc_tidl_request_auth_cancel(int pid, int mgr_pid) int ret = rpc_port_proxy_vc_proxy_vc_invoke_auth_cancel(info->rpc_h, pid, mgr_pid); if (RPC_PORT_ERROR_NONE != ret) { - SLOG(LOG_ERROR, TAG_VCC, ">>>> Request vc auth cancel : Fail to invoke message"); + SLOG(LOG_ERROR, TAG_VCC, ">>>> Request vc auth cancel : Fail to invoke message. err(%d)", ret); return __covert_unhandled_error(ret); } @@ -680,7 +684,7 @@ 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) { - SLOG(LOG_ERROR, TAG_VCC, ">>>> Request vc request tts : Fail to invoke message"); + SLOG(LOG_ERROR, TAG_VCC, ">>>> Request vc request tts : Fail to invoke message. err(%d)", ret); return __covert_unhandled_error(ret); } @@ -699,7 +703,7 @@ int vc_tidl_request_cancel_tts(int pid, int utt_id) int ret = rpc_port_proxy_vc_proxy_vc_invoke_cancel_tts(info->rpc_h, pid, utt_id); if (RPC_PORT_ERROR_NONE != ret) { - SLOG(LOG_ERROR, TAG_VCC, ">>>> Request vc cancel tts : Fail to invoke message"); + SLOG(LOG_ERROR, TAG_VCC, ">>>> Request vc cancel tts : Fail to invoke message. err(%d)", ret); return __covert_unhandled_error(ret); } @@ -718,7 +722,7 @@ int vc_tidl_request_get_tts_audio_format(int pid, int* rate, vc_audio_channel_e* 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) { - SLOG(LOG_ERROR, TAG_VCC, ">>>> Request vc get tts audio format: Fail to invoke message"); + SLOG(LOG_ERROR, TAG_VCC, ">>>> Request vc get tts audio format: Fail to invoke message. err(%d)", ret); return __covert_unhandled_error(ret); } diff --git a/client/vc_tidl.h b/client/vc_tidl.h old mode 100755 new mode 100644 diff --git a/server/vcd_client_data.c b/server/vcd_client_data.c index 31332db..267c7c6 100644 --- a/server/vcd_client_data.c +++ b/server/vcd_client_data.c @@ -1438,8 +1438,8 @@ int vcd_client_delete_tidl_info(int pid) free(client_tidl_info); } - /*Remove handle from list*/ - g_client_tidl_info_list = g_slist_remove_link(g_client_tidl_info_list, tmp); + /*Delete handle from list*/ + g_client_tidl_info_list = g_slist_delete_link(g_client_tidl_info_list, tmp); return 0; } @@ -2091,8 +2091,8 @@ int vcd_client_widget_delete_tidl_info(int pid) free(widget_tidl_info); } - /*Remove handle from list*/ - g_widget_tidl_info_list = g_slist_remove_link(g_widget_tidl_info_list, tmp); + /*Delete handle from list*/ + g_widget_tidl_info_list = g_slist_delete_link(g_widget_tidl_info_list, tmp); return 0; } @@ -2344,8 +2344,8 @@ int vcd_client_setting_delete_tidl_info(int pid) free(setting_tidl_info); } - /*Remove handle from list*/ - g_setting_tidl_info_list = g_slist_remove_link(g_setting_tidl_info_list, tmp); + /*Delete handle from list*/ + g_setting_tidl_info_list = g_slist_delete_link(g_setting_tidl_info_list, tmp); return 0; } diff --git a/server/vcd_dbus.c b/server/vcd_dbus.c old mode 100755 new mode 100644 diff --git a/server/vcd_dbus_server.c b/server/vcd_dbus_server.c old mode 100755 new mode 100644 diff --git a/server/vcd_tidl.c b/server/vcd_tidl.c index f9b43c9..2b78f91 100644 --- a/server/vcd_tidl.c +++ b/server/vcd_tidl.c @@ -158,30 +158,30 @@ void __send_msg(bundle* msg, vcd_client_type_e type, int pid) return; } pthread_mutex_unlock(&g_mgr_tidl_info_mutex); - } else if (VCD_CLIENT_TYPE_NORMAL == type) { - pthread_mutex_lock(&g_client_tidl_info_mutex); - - SLOG(LOG_INFO, TAG_VCD, "[TIDL] message to client"); - client_tidl_info_s* client_tidl_info = vcd_client_get_tidl_info(pid); - if (NULL == client_tidl_info) { - SLOG(LOG_ERROR, TAG_VCD, "[TIDL] tidl proxy info not allocated"); - pthread_mutex_unlock(&g_client_tidl_info_mutex); - return; - } - - rpc_port_stub_vcd_stub_vc_notify_cb_h handle = client_tidl_info->notify_cb; - if (NULL == handle) { - SLOG(LOG_ERROR, TAG_VCD, "[TIDL] notify callback handle is null"); - pthread_mutex_unlock(&g_client_tidl_info_mutex); - return; - } - - if (0 != rpc_port_stub_vcd_stub_vc_notify_cb_invoke(handle, pid, msg)) { - SLOG(LOG_ERROR, TAG_VCD, "[Server ERROR] Fail to send msg"); - pthread_mutex_unlock(&g_client_tidl_info_mutex); - return; - } - pthread_mutex_unlock(&g_client_tidl_info_mutex); + } else if (VCD_CLIENT_TYPE_NORMAL == type) { + pthread_mutex_lock(&g_client_tidl_info_mutex); + + SLOG(LOG_INFO, TAG_VCD, "[TIDL] message to client"); + client_tidl_info_s* client_tidl_info = vcd_client_get_tidl_info(pid); + if (NULL == client_tidl_info) { + SLOG(LOG_ERROR, TAG_VCD, "[TIDL] tidl proxy info not allocated"); + pthread_mutex_unlock(&g_client_tidl_info_mutex); + return; + } + + rpc_port_stub_vcd_stub_vc_notify_cb_h handle = client_tidl_info->notify_cb; + if (NULL == handle) { + SLOG(LOG_ERROR, TAG_VCD, "[TIDL] notify callback handle is null"); + pthread_mutex_unlock(&g_client_tidl_info_mutex); + return; + } + + if (0 != rpc_port_stub_vcd_stub_vc_notify_cb_invoke(handle, pid, msg)) { + SLOG(LOG_ERROR, TAG_VCD, "[Server ERROR] Fail to send msg"); + pthread_mutex_unlock(&g_client_tidl_info_mutex); + return; + } + pthread_mutex_unlock(&g_client_tidl_info_mutex); } else if (VCD_CLIENT_TYPE_WIDGET == type) { pthread_mutex_lock(&g_widget_tidl_info_mutex); @@ -241,31 +241,31 @@ void __send_signal(bundle* msg) pthread_mutex_unlock(&g_mgr_tidl_info_mutex); pthread_mutex_lock(&g_client_tidl_info_mutex); - // get all pids - int* client_list = NULL; + // get all pids + int* client_list = NULL; int client_count = 0; - int ret = -1; - ret = vcd_client_get_tidl_list(&client_list, &client_count); + int ret = -1; + ret = vcd_client_get_tidl_list(&client_list, &client_count); - client_tidl_info_s* client_tidl_info; - int pid = -1; + client_tidl_info_s* client_tidl_info = NULL; + int pid = -1; if (0 == ret && 0 < client_count) { - for (int i = 0 ; i < client_count ; i++) { - pid = client_list[i]; + for (int i = 0 ; i < client_count ; i++) { + pid = client_list[i]; - client_tidl_info = vcd_client_get_tidl_info(pid); - if (NULL == client_tidl_info) { - SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to get tidl info. pid(%d)", pid); - continue; - } + client_tidl_info = vcd_client_get_tidl_info(pid); + if (NULL == client_tidl_info) { + SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to get tidl info. pid(%d)", pid); + continue; + } - if (0 != rpc_port_stub_vcd_stub_vc_notify_cb_invoke(client_tidl_info->notify_cb, pid, msg)) { + if (0 != rpc_port_stub_vcd_stub_vc_notify_cb_invoke(client_tidl_info->notify_cb, pid, msg)) { SLOG(LOG_ERROR, TAG_VCD, "[Server ERROR] Fail to send msg"); continue; - } - } - } + } + } + } pthread_mutex_unlock(&g_client_tidl_info_mutex); pthread_mutex_lock(&g_widget_tidl_info_mutex); @@ -316,23 +316,23 @@ void __send_signal(bundle* msg) */ static void __vc_create_cb(rpc_port_stub_vcd_stub_vc_context_h context, void *user_data) { - SLOG(LOG_INFO, TAG_VCD, "[TIDL] __vc_create_cb"); + SLOG(LOG_INFO, TAG_VCD, "[TIDL] __vc_create_cb"); char *sender = NULL; rpc_port_stub_vcd_stub_vc_context_get_sender(context, &sender); if (!sender) { - SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Sender is NULL"); - return ; - } + SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Sender is NULL"); + return; + } SLOG(LOG_INFO, TAG_VCD, "[TIDL] sender(%s)", sender); // sender (app_id) - free(sender); + free(sender); } static void __vc_terminate_cb(rpc_port_stub_vcd_stub_vc_context_h context, void *user_data) { - SLOG(LOG_INFO, TAG_VCD, "[TIDL] __vc_terminate_cb"); + SLOG(LOG_INFO, TAG_VCD, "[TIDL] __vc_terminate_cb"); void* tag = NULL; rpc_port_stub_vcd_stub_vc_context_get_tag(context, &tag); @@ -371,529 +371,529 @@ static void __vc_terminate_cb(rpc_port_stub_vcd_stub_vc_context_h context, void static void __vc_register_notify_cb_cb(rpc_port_stub_vcd_stub_vc_context_h context, int pid, rpc_port_stub_vcd_stub_vc_notify_cb_h callback, void *user_data) { - SLOG(LOG_INFO, TAG_VCD, "[TIDL] __vc_register_notify_cb_cb. pid(%d)", pid); + SLOG(LOG_INFO, TAG_VCD, "[TIDL] __vc_register_notify_cb_cb. pid(%d)", pid); - if (NULL == callback) { - SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] callback is null."); - return ; - } + if (NULL == callback) { + SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] callback is null."); + return; + } - int ret = -1; - ret = vcd_client_add_tidl_info(pid); - if (0 != ret) { - SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to add tidl info."); - return ; - } + int ret = -1; + ret = vcd_client_add_tidl_info(pid); + if (0 != ret) { + SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to add tidl info."); + return; + } - ret = vcd_client_set_tidl_notify_cb(pid, callback, user_data); - if (0 != ret) { - SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to set notify callback."); - } else { - SLOG(LOG_INFO, TAG_VCD, "[TIDL] Succeed to set notify callback."); - } + ret = vcd_client_set_tidl_notify_cb(pid, callback, user_data); + if (0 != ret) { + SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to set notify callback."); + } else { + SLOG(LOG_INFO, TAG_VCD, "[TIDL] Succeed to set notify callback."); + } } static int __vc_register_notify_cb_sync_cb(rpc_port_stub_vcd_stub_vc_context_h context, int pid, rpc_port_stub_vcd_stub_vc_notify_cb_h callback, void *user_data) { - SLOG(LOG_INFO, TAG_VCD, "[TIDL] __vc_register_notify_cb_sync_cb. pid(%d)", pid); + SLOG(LOG_INFO, TAG_VCD, "[TIDL] __vc_register_notify_cb_sync_cb. pid(%d)", pid); - if (NULL == callback) { - SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] callback is null."); - return VCD_ERROR_INVALID_PARAMETER; - } + if (NULL == callback) { + SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] callback is null."); + return VCD_ERROR_INVALID_PARAMETER; + } - int ret = -1; - ret = vcd_client_add_tidl_info(pid); - if (0 != ret) { - SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to add tidl info."); - return ret; - } - - ret = vcd_client_set_tidl_notify_cb(pid, callback, user_data); - if (0 != ret) { - SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to set notify callback."); - } else { - SLOG(LOG_INFO, TAG_VCD, "[TIDL] Succeed to set notify callback."); - } + int ret = -1; + ret = vcd_client_add_tidl_info(pid); + if (0 != ret) { + SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to add tidl info."); + return ret; + } + + ret = vcd_client_set_tidl_notify_cb(pid, callback, user_data); + if (0 != ret) { + SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to set notify callback."); + } else { + SLOG(LOG_INFO, TAG_VCD, "[TIDL] Succeed to set notify callback."); + } - return ret; + return ret; } static void __vc_register_feedback_cb_cb(rpc_port_stub_vcd_stub_vc_context_h context, int pid, rpc_port_stub_vcd_stub_vc_feedback_cb_h callback, void *user_data) { - SLOG(LOG_INFO, TAG_VCD, "[TIDL] __vc_register_feedback_cb_cb. pid(%d)", pid); + SLOG(LOG_INFO, TAG_VCD, "[TIDL] __vc_register_feedback_cb_cb. pid(%d)", pid); - if (NULL == callback) { - SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] callback is null."); - return ; - } + if (NULL == callback) { + SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] callback is null."); + return; + } - int ret = -1; - ret = vcd_client_add_tidl_info(pid); - if (0 != ret) { - SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to add tidl info."); - return ; - } + int ret = -1; + ret = vcd_client_add_tidl_info(pid); + if (0 != ret) { + SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to add tidl info."); + return; + } - ret = vcd_client_set_tidl_feedback_cb(pid, callback, user_data); - if (0 != ret) { - SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to set feedback callback."); - } else { - SLOG(LOG_INFO, TAG_VCD, "[TIDL] Succeed to set feedback callback."); - } + ret = vcd_client_set_tidl_feedback_cb(pid, callback, user_data); + if (0 != ret) { + SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to set feedback callback."); + } else { + SLOG(LOG_INFO, TAG_VCD, "[TIDL] Succeed to set feedback callback."); + } } static int __vc_register_feedback_cb_sync_cb(rpc_port_stub_vcd_stub_vc_context_h context, int pid, rpc_port_stub_vcd_stub_vc_feedback_cb_h callback, void *user_data) { - SLOG(LOG_INFO, TAG_VCD, "[TIDL] __vc_register_feedback_cb_sync_cb. pid(%d)", pid); + SLOG(LOG_INFO, TAG_VCD, "[TIDL] __vc_register_feedback_cb_sync_cb. pid(%d)", pid); - if (NULL == callback) { - SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] callback is null."); - return VCD_ERROR_INVALID_PARAMETER; - } + if (NULL == callback) { + SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] callback is null."); + return VCD_ERROR_INVALID_PARAMETER; + } - int ret = -1; - ret = vcd_client_add_tidl_info(pid); - if (0 != ret) { - SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to add tidl info."); - return ret; - } - - ret = vcd_client_set_tidl_feedback_cb(pid, callback, user_data); - if (0 != ret) { - SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to set feedback callback."); - } else { - SLOG(LOG_INFO, TAG_VCD, "[TIDL] Succeed to set feedback callback."); - } + int ret = -1; + ret = vcd_client_add_tidl_info(pid); + if (0 != ret) { + SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to add tidl info."); + return ret; + } + + ret = vcd_client_set_tidl_feedback_cb(pid, callback, user_data); + if (0 != ret) { + SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to set feedback callback."); + } else { + SLOG(LOG_INFO, TAG_VCD, "[TIDL] Succeed to set feedback callback."); + } - return ret; + return ret; } static int __vc_initialize_cb(rpc_port_stub_vcd_stub_vc_context_h context, int pid, int *mgr_pid, int *service_state, int *daemon_pid, void *user_data) { - SLOG(LOG_INFO, TAG_VCD, "[TIDL] __vc_initialize_cb. pid(%d)", pid); + SLOG(LOG_INFO, TAG_VCD, "[TIDL] __vc_initialize_cb. pid(%d)", pid); - int ret = VCD_ERROR_OPERATION_FAILED; + int ret = VCD_ERROR_OPERATION_FAILED; uintptr_t ptr_pid = pid; rpc_port_stub_vcd_stub_vc_context_set_tag(context, (void*)ptr_pid); - ret = vcd_server_initialize(pid); - *service_state = vcd_server_get_service_state(); - *daemon_pid = getpid(); - *mgr_pid = vcd_client_manager_get_pid(); + ret = vcd_server_initialize(pid); + *service_state = vcd_server_get_service_state(); + *daemon_pid = getpid(); + *mgr_pid = vcd_client_manager_get_pid(); - if (VCD_ERROR_NONE == ret) { - SLOG(LOG_INFO, TAG_VCD, "[IN] vcd initialize : pid(%d) daemon_pid(%d)", pid, *daemon_pid); - } else { - SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to vcd initialize : pid(%d) daemon_pid(%d) ret(%d)", pid, *daemon_pid, ret); - } + if (VCD_ERROR_NONE == ret) { + SLOG(LOG_INFO, TAG_VCD, "[IN] vcd initialize : pid(%d) daemon_pid(%d)", pid, *daemon_pid); + } else { + SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to vcd initialize : pid(%d) daemon_pid(%d) ret(%d)", pid, *daemon_pid, ret); + } - return ret; + return ret; } static int __vc_finalize_cb(rpc_port_stub_vcd_stub_vc_context_h context, int pid, void *user_data) { - SLOG(LOG_INFO, TAG_VCD, "[TIDL] __vc_finalize_cb"); + SLOG(LOG_INFO, TAG_VCD, "[TIDL] __vc_finalize_cb"); - int ret = VCD_ERROR_OPERATION_FAILED; + int ret = VCD_ERROR_OPERATION_FAILED; - ret = vcd_server_finalize(pid); - if (VCD_ERROR_NONE == ret) { - SLOG(LOG_INFO, TAG_VCD, "[IN] vcd finalize : pid(%d)", pid); - } else { - SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to vcd finalize : pid(%d) ret(%d)", pid, ret); - } + ret = vcd_server_finalize(pid); + if (VCD_ERROR_NONE == ret) { + SLOG(LOG_INFO, TAG_VCD, "[IN] vcd finalize : pid(%d)", pid); + } else { + SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to vcd finalize : pid(%d) ret(%d)", pid, ret); + } - return ret; + return ret; } static int __vc_set_command_cb(rpc_port_stub_vcd_stub_vc_context_h context, int pid, int cmd_type, void *user_data) { - SLOG(LOG_INFO, TAG_VCD, "[TIDL] __vc_set_command_cb"); + SLOG(LOG_INFO, TAG_VCD, "[TIDL] __vc_set_command_cb"); - int ret = VCD_ERROR_OPERATION_FAILED; + int ret = VCD_ERROR_OPERATION_FAILED; - ret = vcd_server_set_command(pid, (vc_cmd_type_e)cmd_type); - if (VCD_ERROR_NONE == ret) { - SLOG(LOG_INFO, TAG_VCD, "[IN] vcd set command : pid(%d), cmd_type(%d)", pid, cmd_type); - } else { - SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to vcd set command : pid(%d), cmd_type(%d) ret(%d)", pid, cmd_type, ret); - } + ret = vcd_server_set_command(pid, (vc_cmd_type_e)cmd_type); + if (VCD_ERROR_NONE == ret) { + SLOG(LOG_INFO, TAG_VCD, "[IN] vcd set command : pid(%d), cmd_type(%d)", pid, cmd_type); + } else { + SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to vcd set command : pid(%d), cmd_type(%d) ret(%d)", pid, cmd_type, ret); + } - return ret; + return ret; } static int __vc_unset_command_cb(rpc_port_stub_vcd_stub_vc_context_h context, int pid, int cmd_type, void *user_data) { - SLOG(LOG_INFO, TAG_VCD, "[TIDL] __vc_unset_command_cb"); + SLOG(LOG_INFO, TAG_VCD, "[TIDL] __vc_unset_command_cb"); - int ret = VCD_ERROR_OPERATION_FAILED; + int ret = VCD_ERROR_OPERATION_FAILED; - ret = vcd_server_unset_command(pid, (vc_cmd_type_e)cmd_type); - if (VCD_ERROR_NONE == ret) { - SLOG(LOG_INFO, TAG_VCD, "[IN] vcd unset command : pid(%d), cmd_type(%d)", pid, cmd_type); - } else { - SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to vcd unset command : pid(%d), cmd_type(%d) ret(%d)", pid, cmd_type, ret); - } - - return ret; + ret = vcd_server_unset_command(pid, (vc_cmd_type_e)cmd_type); + if (VCD_ERROR_NONE == ret) { + SLOG(LOG_INFO, TAG_VCD, "[IN] vcd unset command : pid(%d), cmd_type(%d)", pid, cmd_type); + } else { + SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to vcd unset command : pid(%d), cmd_type(%d) ret(%d)", pid, cmd_type, ret); + } + + return ret; } static int __vc_set_foreground_cb(rpc_port_stub_vcd_stub_vc_context_h context, int pid, bool value, void *user_data) { - // check more... - SLOG(LOG_INFO, TAG_VCD, "[TIDL] __vc_set_foreground_cb"); + // check more... + SLOG(LOG_INFO, TAG_VCD, "[TIDL] __vc_set_foreground_cb"); - int ret = VCD_ERROR_OPERATION_FAILED; + int ret = VCD_ERROR_OPERATION_FAILED; - ret = vcd_server_set_foreground(pid, value); - if (VCD_ERROR_NONE != ret) { - SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to vcd set foreground : pid(%d) ret(%d)", pid, ret); - return ret; - } - - SLOG(LOG_INFO, TAG_VCD, "[IN] vcd set foreground : pid(%d)", pid); - vcdc_send_request_set_foreground(pid, value); + ret = vcd_server_set_foreground(pid, value); + if (VCD_ERROR_NONE != ret) { + SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to vcd set foreground : pid(%d) ret(%d)", pid, ret); + return ret; + } + + SLOG(LOG_INFO, TAG_VCD, "[IN] vcd set foreground : pid(%d)", pid); + vcdc_send_request_set_foreground(pid, value); - return ret; + return ret; } static int __vc_set_server_dialog_cb(rpc_port_stub_vcd_stub_vc_context_h context, int pid, const char *app_id, const char *credential, void *user_data) { - SLOG(LOG_INFO, TAG_VCD, "[TIDL] __vc_set_server_dialog_cb"); + SLOG(LOG_INFO, TAG_VCD, "[TIDL] __vc_set_server_dialog_cb"); - int ret = VCD_ERROR_OPERATION_FAILED; + int ret = VCD_ERROR_OPERATION_FAILED; - ret = vcd_server_set_server_dialog(pid, app_id, credential); - if (VCD_ERROR_NONE == ret) { - SLOG(LOG_INFO, TAG_VCD, "[IN] vcd set server dialog : pid(%d), app_id(%s)", pid, app_id); - } else { - SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to vcd set server dialog : pid(%d), app_id(%s) ret(%d)", pid, app_id, ret); - } - - return ret; + ret = vcd_server_set_server_dialog(pid, app_id, credential); + if (VCD_ERROR_NONE == ret) { + SLOG(LOG_INFO, TAG_VCD, "[IN] vcd set server dialog : pid(%d), app_id(%s)", pid, app_id); + } else { + SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to vcd set server dialog : pid(%d), app_id(%s) ret(%d)", pid, app_id, ret); + } + + return ret; } static int __vc_request_dialog_cb(rpc_port_stub_vcd_stub_vc_context_h context, int pid, const char *disp_text, const char *utt_text, bool continuous, void *user_data) { - SLOG(LOG_INFO, TAG_VCD, "[TIDL] __vc_request_dialog_cb"); + SLOG(LOG_INFO, TAG_VCD, "[TIDL] __vc_request_dialog_cb"); - int ret = VCD_ERROR_OPERATION_FAILED; + int ret = VCD_ERROR_OPERATION_FAILED; - ret = vcd_server_dialog(pid, disp_text, utt_text, continuous); - if (VCD_ERROR_NONE == ret) { - SLOG(LOG_INFO, TAG_VCD, "[IN] vcd request dialog : pid(%d), disp_text(%s), utt_text(%s), continuous(%d)", pid, disp_text, utt_text, continuous); - } else { - SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to vcd request dialog : pid(%d), disp_text(%s), utt_text(%s), continuous(%d), ret(%d)", pid, disp_text, utt_text, continuous, ret); - } - - return ret; + ret = vcd_server_dialog(pid, disp_text, utt_text, continuous); + if (VCD_ERROR_NONE == ret) { + SLOG(LOG_INFO, TAG_VCD, "[IN] vcd request dialog : pid(%d), disp_text(%s), utt_text(%s), continuous(%d)", pid, disp_text, utt_text, continuous); + } else { + SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to vcd request dialog : pid(%d), disp_text(%s), utt_text(%s), continuous(%d), ret(%d)", pid, disp_text, utt_text, continuous, ret); + } + + return ret; } static int __vc_is_system_command_valid_cb(rpc_port_stub_vcd_stub_vc_context_h context, int pid, bool *is_sys_cmd_valid, void *user_data) { - SLOG(LOG_INFO, TAG_VCD, "[TIDL] __vc_is_system_command_valid_cb"); + SLOG(LOG_INFO, TAG_VCD, "[TIDL] __vc_is_system_command_valid_cb"); - int ret = VCD_ERROR_OPERATION_FAILED; + int ret = VCD_ERROR_OPERATION_FAILED; - ret = vcd_server_is_system_command_valid(pid, (int*)is_sys_cmd_valid); - if (VCD_ERROR_NONE == ret) { - SLOG(LOG_INFO, TAG_VCD, "[IN] vcd check system command is valid : pid(%d), is_sys_cmd_valid(%d)", pid, *is_sys_cmd_valid); - } else { - SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to vcd check system command is valid : pid(%d), ret(%d)", pid, ret); - } - - return ret; + ret = vcd_server_is_system_command_valid(pid, (int*)is_sys_cmd_valid); + if (VCD_ERROR_NONE == ret) { + SLOG(LOG_INFO, TAG_VCD, "[IN] vcd check system command is valid : pid(%d), is_sys_cmd_valid(%d)", pid, *is_sys_cmd_valid); + } else { + SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to vcd check system command is valid : pid(%d), ret(%d)", pid, ret); + } + + return ret; } static int __vc_auth_enable_cb(rpc_port_stub_vcd_stub_vc_context_h context, int pid, int mgr_pid, void *user_data) { - SLOG(LOG_INFO, TAG_VCD, "[TIDL] __vc_auth_enable_cb. Send a request to vc_mgr"); + SLOG(LOG_INFO, TAG_VCD, "[TIDL] __vc_auth_enable_cb. Send a request to vc_mgr"); - int ret = VCD_ERROR_OPERATION_FAILED; - ret = vcdc_send_request_auth_enable(pid); - if (VCD_ERROR_NONE == ret) { - SLOG(LOG_INFO, TAG_VCD, "[SUCCESS] Send request auth enable. pid(%d), mgr_pid(%d)", pid, mgr_pid); - } else { - SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to send request auth enable. ret(%d), pid(%d), mgr_pid(%d)", ret, pid, mgr_pid); - } + int ret = VCD_ERROR_OPERATION_FAILED; + ret = vcdc_send_request_auth_enable(pid); + if (VCD_ERROR_NONE == ret) { + SLOG(LOG_INFO, TAG_VCD, "[SUCCESS] Send request auth enable. pid(%d), mgr_pid(%d)", pid, mgr_pid); + } else { + SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to send request auth enable. ret(%d), pid(%d), mgr_pid(%d)", ret, pid, mgr_pid); + } - return ret; + return ret; } static int __vc_auth_disable_cb(rpc_port_stub_vcd_stub_vc_context_h context, int pid, int mgr_pid, void *user_data) { - SLOG(LOG_INFO, TAG_VCD, "[TIDL] __vc_auth_disable_cb. Send a request to vc_mgr"); + SLOG(LOG_INFO, TAG_VCD, "[TIDL] __vc_auth_disable_cb. Send a request to vc_mgr"); - int ret = VCD_ERROR_OPERATION_FAILED; - ret = vcdc_send_request_auth_disable(pid); - if (VCD_ERROR_NONE == ret) { - SLOG(LOG_INFO, TAG_VCD, "[SUCCESS] Send request auth disable. pid(%d), mgr_pid(%d)", pid, mgr_pid); - } else { - SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to send request auth disable. ret(%d), pid(%d), mgr_pid(%d)", ret, pid, mgr_pid); - } + int ret = VCD_ERROR_OPERATION_FAILED; + ret = vcdc_send_request_auth_disable(pid); + if (VCD_ERROR_NONE == ret) { + SLOG(LOG_INFO, TAG_VCD, "[SUCCESS] Send request auth disable. pid(%d), mgr_pid(%d)", pid, mgr_pid); + } else { + SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to send request auth disable. ret(%d), pid(%d), mgr_pid(%d)", ret, pid, mgr_pid); + } - return ret; + return ret; } static int __vc_auth_start_cb(rpc_port_stub_vcd_stub_vc_context_h context, int pid, int mgr_pid, void *user_data) { - SLOG(LOG_INFO, TAG_VCD, "[TIDL] __vc_auth_start_cb. Send a request to vc_mgr"); + SLOG(LOG_INFO, TAG_VCD, "[TIDL] __vc_auth_start_cb. Send a request to vc_mgr"); - int ret = VCD_ERROR_OPERATION_FAILED; - ret = vcdc_send_request_auth_start(pid); - if (VCD_ERROR_NONE == ret) { - SLOG(LOG_INFO, TAG_VCD, "[SUCCESS] Send request auth start. pid(%d), mgr_pid(%d)", pid, mgr_pid); - } else { - SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to send request auth start. ret(%d), pid(%d), mgr_pid(%d)", ret, pid, mgr_pid); - } + int ret = VCD_ERROR_OPERATION_FAILED; + ret = vcdc_send_request_auth_start(pid); + if (VCD_ERROR_NONE == ret) { + SLOG(LOG_INFO, TAG_VCD, "[SUCCESS] Send request auth start. pid(%d), mgr_pid(%d)", pid, mgr_pid); + } else { + SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to send request auth start. ret(%d), pid(%d), mgr_pid(%d)", ret, pid, mgr_pid); + } - return ret; + return ret; } static int __vc_auth_stop_cb(rpc_port_stub_vcd_stub_vc_context_h context, int pid, int mgr_pid, void *user_data) { - SLOG(LOG_INFO, TAG_VCD, "[TIDL] __vc_auth_stop_cb. Send a request to vc_mgr"); + SLOG(LOG_INFO, TAG_VCD, "[TIDL] __vc_auth_stop_cb. Send a request to vc_mgr"); - int ret = VCD_ERROR_OPERATION_FAILED; - ret = vcdc_send_request_auth_stop(pid); - if (VCD_ERROR_NONE == ret) { - SLOG(LOG_INFO, TAG_VCD, "[SUCCESS] Send request auth stop. pid(%d), mgr_pid(%d)", pid, mgr_pid); - } else { - SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to send request auth stop. ret(%d), pid(%d), mgr_pid(%d)", ret, pid, mgr_pid); - } + int ret = VCD_ERROR_OPERATION_FAILED; + ret = vcdc_send_request_auth_stop(pid); + if (VCD_ERROR_NONE == ret) { + SLOG(LOG_INFO, TAG_VCD, "[SUCCESS] Send request auth stop. pid(%d), mgr_pid(%d)", pid, mgr_pid); + } else { + SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to send request auth stop. ret(%d), pid(%d), mgr_pid(%d)", ret, pid, mgr_pid); + } - return ret; + return ret; } static int __vc_auth_cancel_cb(rpc_port_stub_vcd_stub_vc_context_h context, int pid, int mgr_pid, void *user_data) { - SLOG(LOG_INFO, TAG_VCD, "[TIDL] __vc_auth_cancel_cb. Send a request to vc_mgr"); + SLOG(LOG_INFO, TAG_VCD, "[TIDL] __vc_auth_cancel_cb. Send a request to vc_mgr"); - int ret = VCD_ERROR_OPERATION_FAILED; - ret = vcdc_send_request_auth_cancel(pid); - if (VCD_ERROR_NONE == ret) { - SLOG(LOG_INFO, TAG_VCD, "[SUCCESS] Send request auth cancel. pid(%d), mgr_pid(%d)", pid, mgr_pid); - } else { - SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to send request auth cancel. ret(%d), pid(%d), mgr_pid(%d)", ret, pid, mgr_pid); - } + int ret = VCD_ERROR_OPERATION_FAILED; + ret = vcdc_send_request_auth_cancel(pid); + if (VCD_ERROR_NONE == ret) { + SLOG(LOG_INFO, TAG_VCD, "[SUCCESS] Send request auth cancel. pid(%d), mgr_pid(%d)", pid, mgr_pid); + } else { + SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to send request auth cancel. ret(%d), pid(%d), mgr_pid(%d)", ret, pid, mgr_pid); + } - return ret; + return ret; } static int __vc_request_tts_cb(rpc_port_stub_vcd_stub_vc_context_h context, int pid, const char *text, const char *lang, bool to_vcm, int *utt_id, void *user_data) { - SLOG(LOG_INFO, TAG_VCD, "[TIDL] __vc_request_tts_cb"); + SLOG(LOG_INFO, TAG_VCD, "[TIDL] __vc_request_tts_cb"); - int ret = VCD_ERROR_OPERATION_FAILED; + int ret = VCD_ERROR_OPERATION_FAILED; - ret = vcd_server_request_tts(pid, text, lang, to_vcm, utt_id); - if (VCD_ERROR_NONE == ret) { - SLOG(LOG_INFO, TAG_VCD, "[IN] vcd request tts : pid(%d), text(%s), language(%s), to_vcm(%d)", pid, text, lang, to_vcm); - } else { - SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to vcd request tts : pid(%d), text(%s), language(%s), to_vcm(%d), ret(%d)", pid, text, lang, to_vcm, ret); - } - - return ret; + ret = vcd_server_request_tts(pid, text, lang, to_vcm, utt_id); + if (VCD_ERROR_NONE == ret) { + SLOG(LOG_INFO, TAG_VCD, "[IN] vcd request tts : pid(%d), text(%s), language(%s), to_vcm(%d)", pid, text, lang, to_vcm); + } else { + SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to vcd request tts : pid(%d), text(%s), language(%s), to_vcm(%d), ret(%d)", pid, text, lang, to_vcm, ret); + } + + return ret; } static int __vc_cancel_tts_cb(rpc_port_stub_vcd_stub_vc_context_h context, int pid, int utt_id, void *user_data) { - SLOG(LOG_INFO, TAG_VCD, "[TIDL] __vc_cancel_tts_cb"); + SLOG(LOG_INFO, TAG_VCD, "[TIDL] __vc_cancel_tts_cb"); - int ret = VCD_ERROR_OPERATION_FAILED; + int ret = VCD_ERROR_OPERATION_FAILED; - ret = vcd_server_cancel_tts(pid, utt_id); - if (VCD_ERROR_NONE == ret) { - SLOG(LOG_INFO, TAG_VCD, "[IN] vcd cancel tts : pid(%d), utt_id(%d)", pid, utt_id); - } else { - SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to vcd cancel tts : pid(%d), utt_id(%d), ret(%d)", pid, utt_id, ret); - } - - return ret; + ret = vcd_server_cancel_tts(pid, utt_id); + if (VCD_ERROR_NONE == ret) { + SLOG(LOG_INFO, TAG_VCD, "[IN] vcd cancel tts : pid(%d), utt_id(%d)", pid, utt_id); + } else { + SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to vcd cancel tts : pid(%d), utt_id(%d), ret(%d)", pid, utt_id, ret); + } + + return ret; } static int __vc_get_tts_audio_format_cb(rpc_port_stub_vcd_stub_vc_context_h context, int pid, int *rate, int *channel, int *audio_type, void *user_data) { - SLOG(LOG_INFO, TAG_VCD, "[TIDL] __vc_get_tts_audio_format_cb"); + SLOG(LOG_INFO, TAG_VCD, "[TIDL] __vc_get_tts_audio_format_cb"); - int ret = VCD_ERROR_OPERATION_FAILED; + int ret = VCD_ERROR_OPERATION_FAILED; - ret = vcd_server_get_tts_audio_format(pid, rate, channel, audio_type); - if (VCD_ERROR_NONE == ret) { - SLOG(LOG_INFO, TAG_VCD, "[IN] vcd get tts audio format : pid(%d), rate(%d), channel(%d), audio_type(%d)", pid, *rate, *channel, *audio_type); - } else { - SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to vcd get tts audio format : pid(%d) ret(%d)", pid, ret); - } - - return ret; + ret = vcd_server_get_tts_audio_format(pid, rate, channel, audio_type); + if (VCD_ERROR_NONE == ret) { + SLOG(LOG_INFO, TAG_VCD, "[IN] vcd get tts audio format : pid(%d), rate(%d), channel(%d), audio_type(%d)", pid, *rate, *channel, *audio_type); + } else { + SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to vcd get tts audio format : pid(%d) ret(%d)", pid, ret); + } + + return ret; } int vcd_client_tidl_open_connection() { - SLOG(LOG_INFO, TAG_VCD, "[TIDL] vcd_client_tidl_open_connection"); - - g_client_callback.create = __vc_create_cb; - g_client_callback.terminate = __vc_terminate_cb; - g_client_callback.register_notify_cb = __vc_register_notify_cb_cb; - g_client_callback.register_notify_cb_sync = __vc_register_notify_cb_sync_cb; - g_client_callback.register_feedback_cb = __vc_register_feedback_cb_cb; - g_client_callback.register_feedback_cb_sync = __vc_register_feedback_cb_sync_cb; - g_client_callback.initialize = __vc_initialize_cb; - g_client_callback.finalize = __vc_finalize_cb; - g_client_callback.set_command = __vc_set_command_cb; - g_client_callback.unset_command = __vc_unset_command_cb; - g_client_callback.set_foreground = __vc_set_foreground_cb; - g_client_callback.set_server_dialog = __vc_set_server_dialog_cb; - g_client_callback.request_dialog = __vc_request_dialog_cb; - g_client_callback.is_system_command_valid = __vc_is_system_command_valid_cb; - g_client_callback.auth_enable = __vc_auth_enable_cb; - g_client_callback.auth_disable = __vc_auth_disable_cb; - g_client_callback.auth_start = __vc_auth_start_cb; - g_client_callback.auth_stop = __vc_auth_stop_cb; - g_client_callback.auth_cancel = __vc_auth_cancel_cb; - g_client_callback.request_tts = __vc_request_tts_cb; - g_client_callback.cancel_tts = __vc_cancel_tts_cb; - g_client_callback.get_tts_audio_format = __vc_get_tts_audio_format_cb; - - int ret = -1; - ret = rpc_port_stub_vcd_stub_vc_register(&g_client_callback, NULL); - if (VCD_ERROR_NONE != ret) { - SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to register TIDL callbacks. ret(%d)", ret); - return VCD_ERROR_OPERATION_FAILED; - } - - return VCD_ERROR_NONE; + SLOG(LOG_INFO, TAG_VCD, "[TIDL] vcd_client_tidl_open_connection"); + + g_client_callback.create = __vc_create_cb; + g_client_callback.terminate = __vc_terminate_cb; + g_client_callback.register_notify_cb = __vc_register_notify_cb_cb; + g_client_callback.register_notify_cb_sync = __vc_register_notify_cb_sync_cb; + g_client_callback.register_feedback_cb = __vc_register_feedback_cb_cb; + g_client_callback.register_feedback_cb_sync = __vc_register_feedback_cb_sync_cb; + g_client_callback.initialize = __vc_initialize_cb; + g_client_callback.finalize = __vc_finalize_cb; + g_client_callback.set_command = __vc_set_command_cb; + g_client_callback.unset_command = __vc_unset_command_cb; + g_client_callback.set_foreground = __vc_set_foreground_cb; + g_client_callback.set_server_dialog = __vc_set_server_dialog_cb; + g_client_callback.request_dialog = __vc_request_dialog_cb; + g_client_callback.is_system_command_valid = __vc_is_system_command_valid_cb; + g_client_callback.auth_enable = __vc_auth_enable_cb; + g_client_callback.auth_disable = __vc_auth_disable_cb; + g_client_callback.auth_start = __vc_auth_start_cb; + g_client_callback.auth_stop = __vc_auth_stop_cb; + g_client_callback.auth_cancel = __vc_auth_cancel_cb; + g_client_callback.request_tts = __vc_request_tts_cb; + g_client_callback.cancel_tts = __vc_cancel_tts_cb; + g_client_callback.get_tts_audio_format = __vc_get_tts_audio_format_cb; + + int ret = -1; + ret = rpc_port_stub_vcd_stub_vc_register(&g_client_callback, NULL); + if (VCD_ERROR_NONE != ret) { + SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to register TIDL callbacks. ret(%d)", ret); + return VCD_ERROR_OPERATION_FAILED; + } + + return VCD_ERROR_NONE; } int vcd_client_tidl_close_connection() { - SLOG(LOG_INFO, TAG_VCD, "[TIDL] vcd_tidl_close_connection"); - rpc_port_stub_vcd_stub_vc_unregister(); + SLOG(LOG_INFO, TAG_VCD, "[TIDL] vcd_tidl_close_connection"); + rpc_port_stub_vcd_stub_vc_unregister(); - return VCD_ERROR_NONE; + return VCD_ERROR_NONE; } int vcdc_send_error_signal_to_app(int pid, int reason, char *err_msg) { - if (NULL == err_msg) { + if (NULL == err_msg) { SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Input parameter is NULL"); return VCD_ERROR_INVALID_PARAMETER; - } + } - client_tidl_info_s* info = vcd_client_get_tidl_info(pid); - if (NULL == info) { - SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to get tidl info. pid(%d)", pid); - return VCD_ERROR_INVALID_PARAMETER; - } + client_tidl_info_s* info = vcd_client_get_tidl_info(pid); + if (NULL == info) { + SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to get tidl info. pid(%d)", pid); + return VCD_ERROR_INVALID_PARAMETER; + } - bundle* msg = bundle_create(); - if (NULL == msg) { - SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to create bundle data"); - return VCD_ERROR_OUT_OF_MEMORY; - } + bundle* msg = bundle_create(); + if (NULL == msg) { + SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to create bundle data"); + return VCD_ERROR_OUT_OF_MEMORY; + } SLOG(LOG_INFO, TAG_VCD, "[TIDL] Send error signal to app(%d)", pid); - char pid_char[10] = {0}; - char reason_char[10] = {0}; - snprintf(pid_char, 10, "%d", pid); - snprintf(reason_char, 10, "%d", reason); + char pid_char[10] = {0}; + char reason_char[10] = {0}; + snprintf(pid_char, 10, "%d", pid); + snprintf(reason_char, 10, "%d", reason); - bundle_add_str(msg, VC_BUNDLE_METHOD, VCD_METHOD_ERROR_TO_APP); - bundle_add_str(msg, VC_BUNDLE_PID, pid_char); - bundle_add_str(msg, VC_BUNDLE_REASON, reason_char); - bundle_add_str(msg, VC_BUNDLE_ERR_MSG, err_msg); + bundle_add_str(msg, VC_BUNDLE_METHOD, VCD_METHOD_ERROR_TO_APP); + bundle_add_str(msg, VC_BUNDLE_PID, pid_char); + bundle_add_str(msg, VC_BUNDLE_REASON, reason_char); + bundle_add_str(msg, VC_BUNDLE_ERR_MSG, err_msg); - rpc_port_stub_vcd_stub_vc_notify_cb_invoke(info->notify_cb, pid, msg); + rpc_port_stub_vcd_stub_vc_notify_cb_invoke(info->notify_cb, pid, msg); - return VCD_ERROR_NONE; + return VCD_ERROR_NONE; } int vcdc_send_manager_pid(int manager_pid) { - // send signal to all pid + // send signal to all pid - // get all pids - int* client_list = NULL; + // get all pids + int* client_list = NULL; int client_count = 0; - int ret = -1; - ret = vcd_client_get_tidl_list(&client_list, &client_count); - if (0 != ret || 0 == client_count) { - SLOG(LOG_WARN, TAG_VCD, "[WARNING] There is no client"); - return VCD_ERROR_NONE; - } - - client_tidl_info_s* info; - int pid = -1; - bundle* msg; - char pid_char[10] = {0}; - char mgrpid_char[10] = {0}; - for (int i = 0 ; i < client_count ; i++) { - pid = client_list[i]; - - info = vcd_client_get_tidl_info(pid); - if (NULL == info) { - SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to get tidl info. pid(%d)", pid); - continue; - } + int ret = -1; + ret = vcd_client_get_tidl_list(&client_list, &client_count); + if (0 != ret || 0 == client_count) { + SLOG(LOG_WARN, TAG_VCD, "[WARNING] There is no client"); + return VCD_ERROR_NONE; + } + + client_tidl_info_s* info; + int pid = -1; + bundle* msg; + char pid_char[10] = {0}; + char mgrpid_char[10] = {0}; + for (int i = 0 ; i < client_count ; i++) { + pid = client_list[i]; + + info = vcd_client_get_tidl_info(pid); + if (NULL == info) { + SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to get tidl info. pid(%d)", pid); + continue; + } - msg = bundle_create(); - if (NULL == msg) { - SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to create bundle data"); - continue; - } + msg = bundle_create(); + if (NULL == msg) { + SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to create bundle data"); + continue; + } - SLOG(LOG_INFO, TAG_VCD, "[TIDL] Send manager pid(%d) to app(%d)", manager_pid, pid); + SLOG(LOG_INFO, TAG_VCD, "[TIDL] Send manager pid(%d) to app(%d)", manager_pid, pid); - snprintf(pid_char, 10, "%d", pid); - snprintf(mgrpid_char, 10, "%d", manager_pid); + snprintf(pid_char, 10, "%d", pid); + snprintf(mgrpid_char, 10, "%d", manager_pid); - bundle_add_str(msg, VC_BUNDLE_METHOD, VCD_METHOD_SEND_MANAGER_PID); - bundle_add_str(msg, VC_BUNDLE_PID, pid_char); - bundle_add_str(msg, VC_BUNDLE_MANAGER_PID, mgrpid_char); + bundle_add_str(msg, VC_BUNDLE_METHOD, VCD_METHOD_SEND_MANAGER_PID); + bundle_add_str(msg, VC_BUNDLE_PID, pid_char); + bundle_add_str(msg, VC_BUNDLE_MANAGER_PID, mgrpid_char); - rpc_port_stub_vcd_stub_vc_notify_cb_invoke(info->notify_cb, pid, msg); + rpc_port_stub_vcd_stub_vc_notify_cb_invoke(info->notify_cb, pid, msg); - bundle_free(msg); - } + bundle_free(msg); + } - return VCD_ERROR_NONE; + return VCD_ERROR_NONE; } int vcdc_send_feedback_streaming(int pid, int utt_id, vc_feedback_event_e event, char* buffer, int len) { - if (NULL == buffer || 0 >= len) { - SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Invalid parameter"); - return VCD_ERROR_INVALID_PARAMETER; - } + if (NULL == buffer || 0 >= len) { + SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Invalid parameter"); + return VCD_ERROR_INVALID_PARAMETER; + } - client_tidl_info_s* info = vcd_client_get_tidl_info(pid); - if (NULL == info) { - SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to get tidl info. pid(%d)", pid); - return VCD_ERROR_INVALID_PARAMETER; - } + client_tidl_info_s* info = vcd_client_get_tidl_info(pid); + if (NULL == info) { + SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to get tidl info. pid(%d)", pid); + return VCD_ERROR_INVALID_PARAMETER; + } - bundle* msg = bundle_create(); - if (NULL == msg) { - SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to create bundle data"); - return VCD_ERROR_OUT_OF_MEMORY; - } + bundle* msg = bundle_create(); + if (NULL == msg) { + SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to create bundle data"); + return VCD_ERROR_OUT_OF_MEMORY; + } SLOG(LOG_INFO, TAG_VCD, "[TIDL] Send feedback streaming to app(%d), utt_id(%d), event(%d), length(%d)", pid, utt_id, event, len); - rpc_port_stub_vcd_stub_array_char_h arr_char = NULL; - rpc_port_stub_vcd_stub_array_char_create(&arr_char); - rpc_port_stub_vcd_stub_array_char_set(arr_char, buffer, len); + rpc_port_stub_vcd_stub_array_char_h arr_char = NULL; + rpc_port_stub_vcd_stub_array_char_create(&arr_char); + rpc_port_stub_vcd_stub_array_char_set(arr_char, buffer, len); - rpc_port_stub_vcd_stub_vc_feedback_cb_invoke(info->feedback_cb, utt_id, event, arr_char, len); + rpc_port_stub_vcd_stub_vc_feedback_cb_invoke(info->feedback_cb, utt_id, event, arr_char, len); - rpc_port_stub_vcd_stub_array_char_destroy(arr_char); + rpc_port_stub_vcd_stub_array_char_destroy(arr_char); - bundle_free(msg); + bundle_free(msg); - return VCD_ERROR_NONE; + return VCD_ERROR_NONE; } int vcdc_send_hello(int pid, vcd_client_type_e type) @@ -922,7 +922,7 @@ int vcdc_send_hello(int pid, vcd_client_type_e type) SLOG(LOG_DEBUG, TAG_VCD, "[TIDL] VCD SEND MESSAGE"); - // TODO: VCD_CLIENT_TYPE_MANAGER?? type?? + // TODO: VCD_CLIENT_TYPE_MANAGER?? type?? __send_msg(msg, VCD_CLIENT_TYPE_MANAGER, pid); bundle_free(msg); @@ -1037,12 +1037,12 @@ int vcdc_send_result(int pid, int manager_pid, int cmd_type) { SLOG(LOG_DEBUG, TAG_VCD, "[TIDL] Send result"); - vcd_client_type_e type; + vcd_client_type_e type; bundle* msg = bundle_create(); - if (NULL == msg) { - SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to create bundle data"); - return VCD_ERROR_OUT_OF_MEMORY; - } + if (NULL == msg) { + SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to create bundle data"); + return VCD_ERROR_OUT_OF_MEMORY; + } SLOG(LOG_INFO, TAG_VCD, "[TIDL] Result command type(%d)", cmd_type); @@ -1050,25 +1050,25 @@ int vcdc_send_result(int pid, int manager_pid, int cmd_type) case VC_COMMAND_TYPE_FOREGROUND: case VC_COMMAND_TYPE_BACKGROUND: if (pid == manager_pid) { - type = VCD_CLIENT_TYPE_MANAGER; - bundle_add_str(msg, VC_BUNDLE_METHOD, VCD_MANAGER_METHOD_RESULT); + type = VCD_CLIENT_TYPE_MANAGER; + bundle_add_str(msg, VC_BUNDLE_METHOD, VCD_MANAGER_METHOD_RESULT); } else { - type = VCD_CLIENT_TYPE_NORMAL; - char pid_char[10] = {0}; - snprintf(pid_char, 10, "%d", pid); - bundle_add_str(msg, VC_BUNDLE_PID, pid_char); - bundle_add_str(msg, VC_BUNDLE_METHOD, VCD_METHOD_RESULT); + type = VCD_CLIENT_TYPE_NORMAL; + char pid_char[10] = {0}; + snprintf(pid_char, 10, "%d", pid); + bundle_add_str(msg, VC_BUNDLE_PID, pid_char); + bundle_add_str(msg, VC_BUNDLE_METHOD, VCD_METHOD_RESULT); } break; case VC_COMMAND_TYPE_WIDGET: - type = VCD_CLIENT_TYPE_WIDGET; - bundle_add_str(msg, VC_BUNDLE_METHOD, VCD_WIDGET_METHOD_RESULT); + type = VCD_CLIENT_TYPE_WIDGET; + bundle_add_str(msg, VC_BUNDLE_METHOD, VCD_WIDGET_METHOD_RESULT); break; case VC_COMMAND_TYPE_SYSTEM: case VC_COMMAND_TYPE_SYSTEM_BACKGROUND: case VC_COMMAND_TYPE_EXCLUSIVE: - type = VCD_CLIENT_TYPE_MANAGER; - bundle_add_str(msg, VC_BUNDLE_METHOD, VCD_MANAGER_METHOD_RESULT); + type = VCD_CLIENT_TYPE_MANAGER; + bundle_add_str(msg, VC_BUNDLE_METHOD, VCD_MANAGER_METHOD_RESULT); break; default: @@ -1766,7 +1766,7 @@ static void __vc_mgr_register_cb_cb(rpc_port_stub_vcd_mgr_stub_vc_mgr_context_h if (0 != ret) { SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to create manager tidl info."); pthread_mutex_unlock(&g_mgr_tidl_info_mutex); - return; + return; } manager_tidl_info_s* mgr_tidl_info = vcd_client_manager_get_tidl_info(); @@ -1774,7 +1774,7 @@ static void __vc_mgr_register_cb_cb(rpc_port_stub_vcd_mgr_stub_vc_mgr_context_h if (NULL == mgr_tidl_info) { SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to get manager tidl info. pid(%d)", pid); pthread_mutex_unlock(&g_mgr_tidl_info_mutex); - return; + return; } char *sender = NULL; @@ -2145,51 +2145,51 @@ static void __vc_mgr_send_utterance_status_cb(rpc_port_stub_vcd_mgr_stub_vc_mgr SLOG(LOG_DEBUG, TAG_VCD, "@@@ VCD Manager send utterance status"); SLOG(LOG_INFO, TAG_VCD, "[IN] vcd mgr send utterance status : pid(%d), utt_id(%d), utt_status(%d)", pid, utt_id, utt_status); - pthread_mutex_lock(&g_client_tidl_info_mutex); - - SLOG(LOG_INFO, TAG_VCD, "[TIDL] message to client"); - client_tidl_info_s* client_tidl_info = vcd_client_get_tidl_info(pid); - if (NULL == client_tidl_info) { - SLOG(LOG_ERROR, TAG_VCD, "[TIDL] tidl proxy info not allocated"); - pthread_mutex_unlock(&g_client_tidl_info_mutex); - return; - } - - rpc_port_stub_vcd_stub_vc_notify_cb_h handle = client_tidl_info->notify_cb; - if (NULL == handle) { - SLOG(LOG_ERROR, TAG_VCD, "[TIDL] notify callback handle is null"); - pthread_mutex_unlock(&g_client_tidl_info_mutex); - return; - } - - bundle* msg = bundle_create(); - if (NULL == msg) { - SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to create bundle data"); - pthread_mutex_unlock(&g_client_tidl_info_mutex); - return; - } - - char pid_char[10] = {0}; - char uttid_char[10] = {0}; - char uttstatus_char[10] = {0}; - snprintf(pid_char, 10, "%d", pid); - snprintf(uttid_char, 10, "%d", utt_id); - snprintf(uttstatus_char, 10, "%d", utt_status); - - bundle_add_str(msg, VC_BUNDLE_METHOD, VC_MANAGER_METHOD_UTTERANCE_STATUS); - bundle_add_str(msg, VC_BUNDLE_PID, pid_char); - bundle_add_str(msg, VC_BUNDLE_REASON, uttid_char); - bundle_add_str(msg, VC_BUNDLE_ERR_MSG, uttstatus_char); - - if (0 != rpc_port_stub_vcd_stub_vc_notify_cb_invoke(handle, pid, msg)) { - SLOG(LOG_ERROR, TAG_VCD, "[Server ERROR] Fail to send msg"); - bundle_free(msg); - pthread_mutex_unlock(&g_client_tidl_info_mutex); - return; - } - - bundle_free(msg); - pthread_mutex_unlock(&g_client_tidl_info_mutex); + pthread_mutex_lock(&g_client_tidl_info_mutex); + + SLOG(LOG_INFO, TAG_VCD, "[TIDL] message to client"); + client_tidl_info_s* client_tidl_info = vcd_client_get_tidl_info(pid); + if (NULL == client_tidl_info) { + SLOG(LOG_ERROR, TAG_VCD, "[TIDL] tidl proxy info not allocated"); + pthread_mutex_unlock(&g_client_tidl_info_mutex); + return; + } + + rpc_port_stub_vcd_stub_vc_notify_cb_h handle = client_tidl_info->notify_cb; + if (NULL == handle) { + SLOG(LOG_ERROR, TAG_VCD, "[TIDL] notify callback handle is null"); + pthread_mutex_unlock(&g_client_tidl_info_mutex); + return; + } + + bundle* msg = bundle_create(); + if (NULL == msg) { + SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to create bundle data"); + pthread_mutex_unlock(&g_client_tidl_info_mutex); + return; + } + + char pid_char[10] = {0}; + char uttid_char[10] = {0}; + char uttstatus_char[10] = {0}; + snprintf(pid_char, 10, "%d", pid); + snprintf(uttid_char, 10, "%d", utt_id); + snprintf(uttstatus_char, 10, "%d", utt_status); + + bundle_add_str(msg, VC_BUNDLE_METHOD, VC_MANAGER_METHOD_UTTERANCE_STATUS); + bundle_add_str(msg, VC_BUNDLE_PID, pid_char); + bundle_add_str(msg, VC_BUNDLE_REASON, uttid_char); + bundle_add_str(msg, VC_BUNDLE_ERR_MSG, uttstatus_char); + + if (0 != rpc_port_stub_vcd_stub_vc_notify_cb_invoke(handle, pid, msg)) { + SLOG(LOG_ERROR, TAG_VCD, "[Server ERROR] Fail to send msg"); + bundle_free(msg); + pthread_mutex_unlock(&g_client_tidl_info_mutex); + return; + } + + bundle_free(msg); + pthread_mutex_unlock(&g_client_tidl_info_mutex); SLOG(LOG_DEBUG, TAG_VCD, "@@@"); } @@ -2382,14 +2382,14 @@ static void __vc_widget_register_cb_cb(rpc_port_stub_vcd_widget_stub_vc_widget_ if (0 != ret) { SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to add widget tidl info."); pthread_mutex_unlock(&g_widget_tidl_info_mutex); - return; + return; } widget_tidl_info_s* widget_tidl_info = vcd_client_widget_get_tidl_info(pid); if (NULL == widget_tidl_info) { SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to get widget tidl info. pid(%d)", pid); pthread_mutex_unlock(&g_widget_tidl_info_mutex); - return; + return; } char *sender = NULL; @@ -2620,23 +2620,23 @@ int vcd_widget_tidl_close_connection() */ static void __vc_setting_create_cb(rpc_port_stub_vcd_setting_stub_vc_setting_context_h context, void *user_data) { - SLOG(LOG_INFO, TAG_VCD, "[TIDL] __vc_setting_create_cb"); + SLOG(LOG_INFO, TAG_VCD, "[TIDL] __vc_setting_create_cb"); char *sender = NULL; rpc_port_stub_vcd_setting_stub_vc_setting_context_get_sender(context, &sender); if (!sender) { - SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Sender is NULL"); - return ; - } + SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Sender is NULL"); + return; + } SLOG(LOG_INFO, TAG_VCD, "[TIDL] sender(%s)", sender); // sender (app_id) - free(sender); + free(sender); } static void __vc_setting_terminate_cb(rpc_port_stub_vcd_setting_stub_vc_setting_context_h context, void *user_data) { - SLOG(LOG_INFO, TAG_VCD, "[TIDL] __vc_setting_terminate_cb"); + SLOG(LOG_INFO, TAG_VCD, "[TIDL] __vc_setting_terminate_cb"); void* tag = NULL; rpc_port_stub_vcd_setting_stub_vc_setting_context_get_tag(context, &tag); @@ -2670,52 +2670,52 @@ static void __vc_setting_terminate_cb(rpc_port_stub_vcd_setting_stub_vc_setting_ static void __vc_setting_register_notify_cb_cb(rpc_port_stub_vcd_setting_stub_vc_setting_context_h context, int pid, rpc_port_stub_vcd_setting_stub_vc_setting_notify_cb_h callback, void *user_data) { - SLOG(LOG_INFO, TAG_VCD, "[TIDL] __vc_setting_register_notify_cb_cb. pid(%d)", pid); + SLOG(LOG_INFO, TAG_VCD, "[TIDL] __vc_setting_register_notify_cb_cb. pid(%d)", pid); - if (NULL == callback) { - SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] callback is null."); - return ; - } + if (NULL == callback) { + SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] callback is null."); + return; + } - int ret = -1; - ret = vcd_client_setting_add_tidl_info(pid); - if (0 != ret) { - SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to add tidl info."); - return ; - } + int ret = -1; + ret = vcd_client_setting_add_tidl_info(pid); + if (0 != ret) { + SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to add tidl info."); + return; + } - ret = vcd_client_setting_set_tidl_notify_cb(pid, callback, user_data); - if (0 != ret) { - SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to set notify callback."); - } else { - SLOG(LOG_INFO, TAG_VCD, "[TIDL] Succeed to set notify callback."); - } + ret = vcd_client_setting_set_tidl_notify_cb(pid, callback, user_data); + if (0 != ret) { + SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to set notify callback."); + } else { + SLOG(LOG_INFO, TAG_VCD, "[TIDL] Succeed to set notify callback."); + } } static int __vc_setting_register_notify_cb_sync_cb(rpc_port_stub_vcd_setting_stub_vc_setting_context_h context, int pid, rpc_port_stub_vcd_setting_stub_vc_setting_notify_cb_h callback, void *user_data) { - SLOG(LOG_INFO, TAG_VCD, "[TIDL] __vc_setting_register_notify_cb_sync_cb. pid(%d)", pid); + SLOG(LOG_INFO, TAG_VCD, "[TIDL] __vc_setting_register_notify_cb_sync_cb. pid(%d)", pid); - if (NULL == callback) { - SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] callback is null."); - return VCD_ERROR_INVALID_PARAMETER; - } + if (NULL == callback) { + SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] callback is null."); + return VCD_ERROR_INVALID_PARAMETER; + } - int ret = -1; - ret = vcd_client_setting_add_tidl_info(pid); - if (0 != ret) { - SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to add tidl info."); - return ret; - } - - ret = vcd_client_setting_set_tidl_notify_cb(pid, callback, user_data); - if (0 != ret) { - SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to set notify callback."); - } else { - SLOG(LOG_INFO, TAG_VCD, "[TIDL] Succeed to set notify callback."); - } + int ret = -1; + ret = vcd_client_setting_add_tidl_info(pid); + if (0 != ret) { + SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to add tidl info."); + return ret; + } + + ret = vcd_client_setting_set_tidl_notify_cb(pid, callback, user_data); + if (0 != ret) { + SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to set notify callback."); + } else { + SLOG(LOG_INFO, TAG_VCD, "[TIDL] Succeed to set notify callback."); + } - return ret; + return ret; } int __vc_setting_set_language_cb(rpc_port_stub_vcd_setting_stub_vc_setting_context_h context, int pid, const char *language, void *user_data) @@ -2725,13 +2725,13 @@ int __vc_setting_set_language_cb(rpc_port_stub_vcd_setting_stub_vc_setting_cont return VCD_ERROR_INVALID_PARAMETER; } - SLOG(LOG_INFO, TAG_VCD, "[IN] vcd server set language : language(%s)", language); + SLOG(LOG_INFO, TAG_VCD, "[IN] vcd server set language : language(%s)", language); - int ret = vcd_server_set_language(language); + int ret = vcd_server_set_language(language); if (0 != ret) { - SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to set language(%d).", ret); - } else { - SLOG(LOG_INFO, TAG_VCD, "[TIDL] Succeed to set language."); + SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to set language(%d).", ret); + } else { + SLOG(LOG_INFO, TAG_VCD, "[TIDL] Succeed to set language."); } return ret; -- 2.34.1