From 5d84fa5d582936a2938f3357e6b23879ef4c4cec Mon Sep 17 00:00:00 2001 From: Wonnam Jang Date: Tue, 29 May 2018 21:17:06 +0900 Subject: [PATCH 01/16] Change partial match level to word Change-Id: Ia3110f87da01bac30720c91f7ef4ada86ae98972 Signed-off-by: Wonnam Jang --- server/vcd_server.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/server/vcd_server.c b/server/vcd_server.c index 0a9b9e9..89a58d1 100644 --- a/server/vcd_server.c +++ b/server/vcd_server.c @@ -683,7 +683,7 @@ int vcd_send_result(vce_result_event_e event, int* result_id, int count, const c vc_cmd_list_get_count(widget_cmd_list, &cnt); if (0 < cnt) { /* Matched with widget command partially */ - vc_cmd_get_partially_matched_cmd_list(all_result, widget_cmd_list, vc_cmd_list, VC_SEARCH_CHAR_LEVEL); + vc_cmd_get_partially_matched_cmd_list(all_result, widget_cmd_list, vc_cmd_list, VC_SEARCH_WORD_LEVEL); vc_cmd_list_get_count(vc_cmd_list, &cnt); if (0 < cnt) { top_priority = VC_COMMAND_PRIORITY_WIDGET; @@ -702,7 +702,7 @@ int vcd_send_result(vce_result_event_e event, int* result_id, int count, const c vc_cmd_list_get_count(foreground_cmd_list, &cnt); if (0 < cnt) { /* Matched with foreground command partially */ - vc_cmd_get_partially_matched_cmd_list(all_result, foreground_cmd_list, vc_cmd_list, VC_SEARCH_CHAR_LEVEL); + vc_cmd_get_partially_matched_cmd_list(all_result, foreground_cmd_list, vc_cmd_list, VC_SEARCH_WORD_LEVEL); vc_cmd_list_get_count(vc_cmd_list, &cnt); if (0 < cnt) { top_priority = VC_COMMAND_PRIORITY_FOREGROUND; @@ -777,7 +777,7 @@ int vcd_send_result(vce_result_event_e event, int* result_id, int count, const c vc_cmd_list_get_count(widget_cmd_list, &cnt); if (0 < cnt) { /* Matched with widget command partially */ - vc_cmd_get_partially_matched_cmd_list(all_result, widget_cmd_list, temp_list, VC_SEARCH_CHAR_LEVEL); + vc_cmd_get_partially_matched_cmd_list(all_result, widget_cmd_list, temp_list, VC_SEARCH_WORD_LEVEL); vc_cmd_list_get_count(temp_list, &cnt); if (0 < cnt) { if (0 != vc_cmd_list_destroy(vc_cmd_list, true)) { @@ -801,7 +801,7 @@ int vcd_send_result(vce_result_event_e event, int* result_id, int count, const c vc_cmd_list_get_count(foreground_cmd_list, &cnt); if (0 < cnt) { /* Matched with foreground command partially */ - vc_cmd_get_partially_matched_cmd_list(all_result, foreground_cmd_list, temp_list, VC_SEARCH_CHAR_LEVEL); + vc_cmd_get_partially_matched_cmd_list(all_result, foreground_cmd_list, temp_list, VC_SEARCH_WORD_LEVEL); vc_cmd_list_get_count(temp_list, &cnt); if (0 < cnt) { if (0 != vc_cmd_list_destroy(vc_cmd_list, true)) { -- 2.7.4 From 96889b116efb6c717376ee51c451ff530dfcaad3 Mon Sep 17 00:00:00 2001 From: Wonnam Jang Date: Thu, 31 May 2018 16:22:47 +0900 Subject: [PATCH 02/16] Not use partial match Change-Id: Ica25f29ae0be807863d4b4831e0a9c2523be1dcd Signed-off-by: Wonnam Jang --- include/voice_control_command_expand.h | 1 + server/vcd_server.c | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/include/voice_control_command_expand.h b/include/voice_control_command_expand.h index 7947fa5..c188e77 100755 --- a/include/voice_control_command_expand.h +++ b/include/voice_control_command_expand.h @@ -42,6 +42,7 @@ typedef enum { VC_CMD_FORMAT_PARTIAL /**< Partial matched command */ } vc_cmd_format_e; +#define VC_SEARCH_NONE_LEVEL 0 #define VC_SEARCH_TEXT_LEVEL 1 #define VC_SEARCH_WORD_LEVEL 2 #define VC_SEARCH_CHAR_LEVEL 3 diff --git a/server/vcd_server.c b/server/vcd_server.c index 89a58d1..ef9dc76 100644 --- a/server/vcd_server.c +++ b/server/vcd_server.c @@ -683,7 +683,7 @@ int vcd_send_result(vce_result_event_e event, int* result_id, int count, const c vc_cmd_list_get_count(widget_cmd_list, &cnt); if (0 < cnt) { /* Matched with widget command partially */ - vc_cmd_get_partially_matched_cmd_list(all_result, widget_cmd_list, vc_cmd_list, VC_SEARCH_WORD_LEVEL); + vc_cmd_get_partially_matched_cmd_list(all_result, widget_cmd_list, vc_cmd_list, VC_SEARCH_NONE_LEVEL); vc_cmd_list_get_count(vc_cmd_list, &cnt); if (0 < cnt) { top_priority = VC_COMMAND_PRIORITY_WIDGET; @@ -702,7 +702,7 @@ int vcd_send_result(vce_result_event_e event, int* result_id, int count, const c vc_cmd_list_get_count(foreground_cmd_list, &cnt); if (0 < cnt) { /* Matched with foreground command partially */ - vc_cmd_get_partially_matched_cmd_list(all_result, foreground_cmd_list, vc_cmd_list, VC_SEARCH_WORD_LEVEL); + vc_cmd_get_partially_matched_cmd_list(all_result, foreground_cmd_list, vc_cmd_list, VC_SEARCH_NONE_LEVEL); vc_cmd_list_get_count(vc_cmd_list, &cnt); if (0 < cnt) { top_priority = VC_COMMAND_PRIORITY_FOREGROUND; @@ -777,7 +777,7 @@ int vcd_send_result(vce_result_event_e event, int* result_id, int count, const c vc_cmd_list_get_count(widget_cmd_list, &cnt); if (0 < cnt) { /* Matched with widget command partially */ - vc_cmd_get_partially_matched_cmd_list(all_result, widget_cmd_list, temp_list, VC_SEARCH_WORD_LEVEL); + vc_cmd_get_partially_matched_cmd_list(all_result, widget_cmd_list, temp_list, VC_SEARCH_NONE_LEVEL); vc_cmd_list_get_count(temp_list, &cnt); if (0 < cnt) { if (0 != vc_cmd_list_destroy(vc_cmd_list, true)) { @@ -801,7 +801,7 @@ int vcd_send_result(vce_result_event_e event, int* result_id, int count, const c vc_cmd_list_get_count(foreground_cmd_list, &cnt); if (0 < cnt) { /* Matched with foreground command partially */ - vc_cmd_get_partially_matched_cmd_list(all_result, foreground_cmd_list, temp_list, VC_SEARCH_WORD_LEVEL); + vc_cmd_get_partially_matched_cmd_list(all_result, foreground_cmd_list, temp_list, VC_SEARCH_NONE_LEVEL); vc_cmd_list_get_count(temp_list, &cnt); if (0 < cnt) { if (0 != vc_cmd_list_destroy(vc_cmd_list, true)) { -- 2.7.4 From 3c6c8fcee27573f0e2f0e2e495e4b8a7543329a7 Mon Sep 17 00:00:00 2001 From: "sooyeon.kim" Date: Mon, 4 Jun 2018 23:21:49 +0900 Subject: [PATCH 03/16] Add feedback and server dialog APIs Change-Id: I7a4bfe718206b21f723fe693940185a5e18916c2 Signed-off-by: sooyeon.kim --- client/CMakeLists.txt | 3 + client/vc.c | 183 +++++++++++++- client/vc_dbus.c | 69 ++++++ client/vc_dbus.h | 2 + client/vc_mgr.c | 519 +++++++++++++++++++++++++++++++++++----- client/vc_mgr_client.c | 101 +++++++- client/vc_mgr_client.h | 13 + client/vc_mgr_data.cpp | 126 ++++++++++ client/vc_mgr_data.h | 63 +++++ client/vc_mgr_dbus.c | 92 +++++++ client/vc_mgr_dbus.h | 6 + client/vc_mgr_player.c | 413 ++++++++++++++++++++++++++++++++ client/vc_mgr_player.h | 25 ++ common/vc_defs.h | 9 + common/vc_info_parser.h | 1 + doc/uix_vc_doc.h | 5 + doc/uix_vc_engine_main_doc.h | 4 + include/vce.h | 136 +++++++++++ include/voice_control.h | 43 ++++ include/voice_control_common.h | 29 +++ include/voice_control_manager.h | 202 ++++++++++++++++ server/vcd_client_data.c | 33 +++ server/vcd_client_data.h | 5 + server/vcd_dbus.c | 132 ++++++++++ server/vcd_dbus.h | 8 + server/vcd_dbus_server.c | 201 +++++++++++++++- server/vcd_dbus_server.h | 10 + server/vcd_engine_agent.c | 66 ++++- server/vcd_engine_agent.h | 5 + server/vcd_main.h | 39 +-- server/vcd_server.c | 169 ++++++++++++- server/vcd_server.h | 18 ++ server/vce.c | 73 ++++++ 33 files changed, 2692 insertions(+), 111 deletions(-) create mode 100644 client/vc_mgr_data.cpp create mode 100644 client/vc_mgr_data.h create mode 100644 client/vc_mgr_player.c create mode 100644 client/vc_mgr_player.h mode change 100755 => 100644 common/vc_defs.h mode change 100755 => 100644 server/vcd_dbus.c mode change 100755 => 100644 server/vcd_dbus_server.c diff --git a/client/CMakeLists.txt b/client/CMakeLists.txt index fcc4c43..0380cc0 100644 --- a/client/CMakeLists.txt +++ b/client/CMakeLists.txt @@ -34,6 +34,8 @@ SET(WIDGET_SRCS SET(MANAGER_SRCS vc_mgr.c vc_mgr_client.c + vc_mgr_data.cpp + vc_mgr_player.c vc_mgr_dbus.c ../common/vc_cmd_db.c ../common/vc_command.c @@ -52,6 +54,7 @@ FOREACH(flag ${pkgs_CFLAGS}) SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") ENDFOREACH(flag) SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}") +SET(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}") ## voice control library ## ADD_LIBRARY(${PROJECT_NAME} SHARED ${SRCS}) diff --git a/client/vc.c b/client/vc.c index 9a893f3..14bdf8b 100644 --- a/client/vc.c +++ b/client/vc.c @@ -2146,6 +2146,187 @@ int vc_set_invocation_name(const char* name) return ret; } +int vc_set_server_dialog(const char* app_id, const char* credential) +{ + vc_state_e state; + int ret = -1; + + SLOG(LOG_DEBUG, TAG_VCC, "@@@ Set server dialog, pid(%d), app_id(%s)", getpid(), app_id); + if (0 != __vc_get_feature_enabled()) { + return VC_ERROR_NOT_SUPPORTED; + } + if (0 != __vc_check_privilege()) { + return VC_ERROR_PERMISSION_DENIED; + } + + if (NULL == credential) { + SLOG(LOG_DEBUG, TAG_VCC, "[ERROR] Credential is NULL"); + return VC_ERROR_INVALID_PARAMETER; + } + + if (0 != vc_client_get_client_state(g_vc, &state)) { + SLOG(LOG_ERROR, TAG_VCC, "[ERROR] A handle is not valid"); + SLOG(LOG_DEBUG, TAG_VCC, "@@@"); + return VC_ERROR_INVALID_STATE; + } + + /* check state */ + if (state != VC_STATE_READY) { + SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Invalid State: Current state(%d) is not 'READY'", state); + SLOG(LOG_DEBUG, TAG_VCC, "@@@"); + return VC_ERROR_INVALID_STATE; + } + + /* Check service state */ + vc_service_state_e service_state = -1; + vc_client_get_service_state(g_vc, &service_state); + if (service_state != VC_SERVICE_STATE_READY) { + SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Invalid State: service state(%d) is not 'READY'", service_state); + SLOG(LOG_DEBUG, TAG_VCC, "@@@"); + return VC_ERROR_INVALID_STATE; + } + + char* tmp_appid = NULL; + if (NULL == app_id) { + ret = app_manager_get_app_id(getpid(), &tmp_appid); + if (0 != ret || NULL == tmp_appid) { + SLOG(LOG_ERROR, TAG_VCC, "[ERROR] app_id is NULL"); + if (NULL != tmp_appid) + free(tmp_appid); + return VC_ERROR_INVALID_PARAMETER; + } + } else { + tmp_appid = strdup(app_id); + } + int pid = getpid(); + + SLOG(LOG_DEBUG, TAG_VCC, "Set server dialog : pid(%d), app_id(%s)", pid, tmp_appid); + + int count = 0; + bool is_prepared = false; + do { + ret = vc_dbus_set_server_dialog(pid, tmp_appid, credential); + if (0 != ret) { + if (VC_ERROR_INVALID_PARAMETER == ret && false == is_prepared) { + vc_client_set_client_state(g_vc, VC_STATE_INITIALIZED); + if (0 == vc_prepare_sync()) { + is_prepared = true; + SLOG(LOG_INFO, TAG_VCC, "[INFO] Success vc_prepare_sync"); + } + } else if (VC_ERROR_TIMED_OUT != ret) { + SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to request set server dialog to vc service : %s", __vc_get_error_code(ret)); + break; + } else { + SLOG(LOG_WARN, TAG_VCC, "[WARNING] retry request set server dialog : %s", __vc_get_error_code(ret)); + usleep(10000); + count++; + if (VC_RETRY_COUNT == count) { + SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to request"); + break; + } + } + } + } while (0 != ret); + + + if (NULL != tmp_appid) + free(tmp_appid); + + SLOG(LOG_DEBUG, TAG_VCC, "@@@"); + + return ret; +} + +int vc_unset_server_dialog(const char* app_id) +{ + vc_state_e state; + int ret = -1; + + SLOG(LOG_DEBUG, TAG_VCC, "@@@ Unset server dialog, pid(%d), app_id(%s)", getpid(), app_id); + if (0 != __vc_get_feature_enabled()) { + return VC_ERROR_NOT_SUPPORTED; + } + if (0 != __vc_check_privilege()) { + return VC_ERROR_PERMISSION_DENIED; + } + + if (0 != vc_client_get_client_state(g_vc, &state)) { + SLOG(LOG_ERROR, TAG_VCC, "[ERROR] A handle is not valid"); + SLOG(LOG_DEBUG, TAG_VCC, "@@@"); + return VC_ERROR_INVALID_STATE; + } + + /* check state */ + if (state != VC_STATE_READY) { + SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Invalid State: Current state(%d) is not 'READY'", state); + SLOG(LOG_DEBUG, TAG_VCC, "@@@"); + return VC_ERROR_INVALID_STATE; + } + + /* Check service state */ + vc_service_state_e service_state = -1; + vc_client_get_service_state(g_vc, &service_state); + if (service_state != VC_SERVICE_STATE_READY) { + SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Invalid State: service state(%d) is not 'READY'", service_state); + SLOG(LOG_DEBUG, TAG_VCC, "@@@"); + return VC_ERROR_INVALID_STATE; + } + + char* tmp_appid = NULL; + if (NULL == app_id) { + ret = app_manager_get_app_id(getpid(), &tmp_appid); + if (0 != ret || NULL == tmp_appid) { + SLOG(LOG_ERROR, TAG_VCC, "[ERROR] app_id is NULL"); + if (NULL != tmp_appid) + free(tmp_appid); + return VC_ERROR_INVALID_PARAMETER; + } + } else { + tmp_appid = strdup(app_id); + } + int pid = getpid(); + + SLOG(LOG_DEBUG, TAG_VCC, "Unset server dialog : pid(%d), app_id(%s)", pid, tmp_appid); + + int count = 0; + bool is_prepared = false; + char* credential = strdup("#NULL"); + do { + ret = vc_dbus_set_server_dialog(pid, tmp_appid, credential); + if (0 != ret) { + if (VC_ERROR_INVALID_PARAMETER == ret && false == is_prepared) { + vc_client_set_client_state(g_vc, VC_STATE_INITIALIZED); + if (0 == vc_prepare_sync()) { + is_prepared = true; + SLOG(LOG_INFO, TAG_VCC, "[INFO] Success vc_prepare_sync"); + } + } else if (VC_ERROR_TIMED_OUT != ret) { + SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to request unset server dialog to vc service : %s", __vc_get_error_code(ret)); + break; + } else { + SLOG(LOG_WARN, TAG_VCC, "[WARNING] retry request unset server dialog : %s", __vc_get_error_code(ret)); + usleep(10000); + count++; + if (VC_RETRY_COUNT == count) { + SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to request"); + break; + } + } + } + } while (0 != ret); + + + if (NULL != tmp_appid) + free(tmp_appid); + if (NULL != credential) + free(credential); + + SLOG(LOG_DEBUG, TAG_VCC, "@@@"); + + return ret; +} + + int vc_request_dialog(const char* disp_text, const char* utt_text, bool auto_start) { vc_state_e state; @@ -2183,7 +2364,7 @@ int vc_request_dialog(const char* disp_text, const char* utt_text, bool auto_sta SLOG(LOG_DEBUG, TAG_VCC, "Request dialog : pid(%d) disp_text(%s), utt_text(%s), auto_start(%d)", getpid(), disp_text, utt_text, auto_start); int ret = vc_dbus_request_dialog(getpid(), disp_text, utt_text, auto_start); if (0 != ret) { - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to set foreground (true) : %d", ret); + SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to request dialog, ret(%d)", ret); return VC_ERROR_OPERATION_FAILED; } diff --git a/client/vc_dbus.c b/client/vc_dbus.c index 186d259..dfe0228 100644 --- a/client/vc_dbus.c +++ b/client/vc_dbus.c @@ -851,6 +851,75 @@ int vc_dbus_set_foreground(int pid, bool value) return 0; } +int vc_dbus_set_server_dialog(int pid, const char* app_id, const char* credential) +{ + if (NULL == g_conn_sender) { + SLOG(LOG_ERROR, TAG_VCC, "[ERROR] NULL connection"); + if (0 != vc_dbus_reconnect()) { + SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to reconnect"); + } + } + + DBusMessage* msg; + msg = dbus_message_new_method_call( + VC_SERVER_SERVICE_NAME, + VC_SERVER_SERVICE_OBJECT_PATH, + VC_SERVER_SERVICE_INTERFACE, + VC_METHOD_SET_SERVER_DIALOG); + + if (NULL == msg) { + SLOG(LOG_ERROR, TAG_VCC, "@@ vc set server dialog : Fail to make message"); + return VC_ERROR_OPERATION_FAILED; + } else { + SLOG(LOG_DEBUG, TAG_VCC, "@@ vc set server dialog : pid(%d), app_id(%s)", pid, app_id); + } + + dbus_message_append_args(msg, + DBUS_TYPE_INT32, &pid, + DBUS_TYPE_STRING, &app_id, + DBUS_TYPE_STRING, &credential, + DBUS_TYPE_INVALID); + + DBusError err; + dbus_error_init(&err); + + DBusMessage* result_msg; + int result = VC_ERROR_OPERATION_FAILED; + + result_msg = dbus_connection_send_with_reply_and_block(g_conn_sender, msg, g_waiting_time, &err); + dbus_message_unref(msg); + + if (dbus_error_is_set(&err)) { + SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Dbus Error (%s)", err.message); + dbus_error_free(&err); + } + + if (NULL != result_msg) { + dbus_message_get_args(result_msg, &err, + DBUS_TYPE_INT32, &result, + DBUS_TYPE_INVALID); + + if (dbus_error_is_set(&err)) { + SLOG(LOG_ERROR, TAG_VCC, "@@ Get arguments error (%s)", err.message); + dbus_error_free(&err); + result = VC_ERROR_OPERATION_FAILED; + } + dbus_message_unref(result_msg); + + if (0 == result) { + SLOG(LOG_DEBUG, TAG_VCC, "@@ vc set server dialog : result = %d", result); + } else { + SLOG(LOG_ERROR, TAG_VCC, "@@ vc set server dialog : result = %d", result); + } + } else { + SLOG(LOG_ERROR, TAG_VCC, "@@ Result message is NULL"); + vc_dbus_reconnect(); + result = VC_ERROR_TIMED_OUT; + } + + return result; +} + int vc_dbus_request_dialog(int pid, const char* disp_text, const char* utt_text, bool continuous) { if (NULL == g_conn_sender) { diff --git a/client/vc_dbus.h b/client/vc_dbus.h index b5db90b..e7f7512 100644 --- a/client/vc_dbus.h +++ b/client/vc_dbus.h @@ -42,6 +42,8 @@ int vc_dbus_request_unset_command(int pid, vc_cmd_type_e cmd_type); int vc_dbus_set_foreground(int pid, bool value); +int vc_dbus_set_server_dialog(int pid, const char* app_id, const char* credential); + int vc_dbus_request_dialog(int pid, const char* disp_text, const char* utt_text, bool continuous); int vc_dbus_request_is_system_command_valid(int pid, bool* is_sys_cmd_valid); diff --git a/client/vc_mgr.c b/client/vc_mgr.c index e56205e..ab8d584 100644 --- a/client/vc_mgr.c +++ b/client/vc_mgr.c @@ -28,6 +28,8 @@ #include "vc_main.h" #include "vc_mgr_client.h" #include "vc_mgr_dbus.h" +#include "vc_mgr_data.h" +#include "vc_mgr_player.h" #include "voice_control.h" #include "voice_control_command.h" #include "voice_control_command_expand.h" @@ -61,6 +63,12 @@ static cynara *p_cynara = NULL; static bool g_err_callback_status = false; +/* for TTS feedback */ +static int g_feedback_rate = 16000; +static vc_audio_channel_e g_feedback_audio_channel = 0; +static vc_audio_type_e g_feedback_audio_type = 0; + + static Eina_Bool __vc_mgr_notify_state_changed(void *data); static void __vc_mgr_notify_error(void *data); static Eina_Bool __vc_mgr_notify_result(void *data); @@ -262,6 +270,12 @@ int vc_mgr_initialize(void) return ret; } + /* for TTS feedback */ +/* ret = vc_mgr_player_init(); + if (0 != ret) { + SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Fail to initialize VC mgr player : %d", ret); + } +*/ SLOG(LOG_ERROR, TAG_VCM, "[Success] pid(%d)", g_vc_m->handle); SLOG(LOG_DEBUG, TAG_VCM, "@@@"); @@ -339,6 +353,12 @@ int vc_mgr_deinitialize(void) SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Fail to finalize DB, ret(%d)", ret); } + /* for TTS feedback */ +/* ret = vc_mgr_player_release(); + if (0 != ret) { + SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Fail to release VC mgr player(%d)", ret); + } +*/ if (0 != vc_mgr_dbus_close_connection()) { SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Fail to close connection"); } @@ -1700,26 +1720,14 @@ int vc_mgr_set_private_data(const char* key, const char* data) } int ret = -1; - int count = 0; - while (0 != ret) { - ret = vc_mgr_dbus_request_set_private_data(g_vc_m->handle, key, data); - if (0 != ret) { - if (VC_ERROR_TIMED_OUT != ret) { - SLOG(LOG_DEBUG, TAG_VCM, "[ERROR] Fail to set private data request : %s", __vc_mgr_get_error_code(ret)); - break; - } else { - SLOG(LOG_WARN, TAG_VCM, "[WARNING] retry set private data request : %s", __vc_mgr_get_error_code(ret)); - usleep(10000); - count++; - if (VC_RETRY_COUNT == count) { - SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Fail to request"); - break; - } - } - } else { - SLOG(LOG_DEBUG, TAG_VCM, "[SUCCESS] Set domain"); - } + ret = vc_mgr_dbus_request_set_private_data(g_vc_m->handle, key, data); + if (0 != ret) { + SLOG(LOG_DEBUG, TAG_VCM, "[ERROR] Fail to set private data : %s", __vc_mgr_get_error_code(ret)); + return ret; + } else { + SLOG(LOG_DEBUG, TAG_VCM, "[SUCCESS] Set private data"); } + SLOG(LOG_DEBUG, TAG_VCM, "@@@"); return 0; @@ -1910,25 +1918,61 @@ int vc_mgr_do_action(vc_send_event_type_e type, char* send_event) } int ret = -1; - int count = 0; - while (0 != ret) { - ret = vc_mgr_dbus_request_do_action(g_vc_m->handle, type, send_event); - if (0 != ret) { - if (VC_ERROR_TIMED_OUT != ret) { - SLOG(LOG_DEBUG, TAG_VCM, "[ERROR] Fail to do action request : %s", __vc_mgr_get_error_code(ret)); - break; - } else { - SLOG(LOG_WARN, TAG_VCM, "[WARNING] retry do action request : %s", __vc_mgr_get_error_code(ret)); - usleep(10000); - count++; - if (VC_RETRY_COUNT == count) { - SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Fail to request"); - break; - } - } - } else { - SLOG(LOG_DEBUG, TAG_VCM, "[SUCCESS] do action"); - } + ret = vc_mgr_dbus_request_do_action(g_vc_m->handle, type, send_event); + if (0 != ret) { + SLOG(LOG_DEBUG, TAG_VCM, "[ERROR] Fail to do action request : %s", __vc_mgr_get_error_code(ret)); + return ret; + } else { + SLOG(LOG_DEBUG, TAG_VCM, "[SUCCESS] do action"); + } + SLOG(LOG_DEBUG, TAG_VCM, "@@@"); + + return 0; +} + +int vc_mgr_send_specific_engine_request(const char* engine_app_id, const char* event, const char* request) +{ + SLOG(LOG_DEBUG, TAG_VCM, "@@@ [Manager] specific engine request. engine app id(%s), event(%s), request(%s)", engine_app_id, event, request); + + if (NULL == engine_app_id || NULL == event) { + SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Invalid parameter"); + return VC_ERROR_INVALID_PARAMETER; + } + + if (NULL == request) { + SLOG(LOG_ERROR, TAG_VCM, "[INFO] Input parameter is NULL. (no request)"); + } + + vc_state_e state; + if (0 != vc_mgr_client_get_client_state(g_vc_m, &state)) { + SLOG(LOG_ERROR, TAG_VCM, "[ERROR] A handle is not available"); + SLOG(LOG_DEBUG, TAG_VCM, "@@@"); + return VC_ERROR_INVALID_STATE; + } + + /* check state */ + if (state != VC_STATE_READY) { + SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Invalid State: Current state(%d) is not 'READY'", state); + SLOG(LOG_DEBUG, TAG_VCM, "@@@"); + return VC_ERROR_INVALID_STATE; + } + + /* Check service state */ + vc_service_state_e service_state = -1; + vc_mgr_client_get_service_state(g_vc_m, &service_state); + if (service_state != VC_SERVICE_STATE_READY) { + SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Invalid State: service state(%d) is not 'READY'", service_state); + SLOG(LOG_DEBUG, TAG_VCM, "@@@"); + return VC_ERROR_INVALID_STATE; + } + + int ret = -1; + ret = vc_mgr_dbus_send_specific_engine_request(g_vc_m->handle, engine_app_id, event, request); + if (0 != ret) { + SLOG(LOG_DEBUG, TAG_VCM, "[ERROR] Fail to specific engine request : %s", __vc_mgr_get_error_code(ret)); + return ret; + } else { + SLOG(LOG_DEBUG, TAG_VCM, "[SUCCESS] specific engine request"); } SLOG(LOG_DEBUG, TAG_VCM, "@@@"); @@ -2332,30 +2376,14 @@ int vc_mgr_set_selected_results(vc_cmd_list_h vc_cmd_list) } } - int ret; - int count = 0; - /* Request */ - ret = -1; - count = 0; - while (0 != ret) { - ret = vc_mgr_dbus_send_result_selection(g_vc_m->handle); - if (0 != ret) { - if (VC_ERROR_TIMED_OUT != ret) { - SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Fail to send result selection : %s", __vc_mgr_get_error_code(ret)); - break; - } else { - SLOG(LOG_WARN, TAG_VCM, "[WARNING] retry send result selection : %s", __vc_mgr_get_error_code(ret)); - usleep(10000); - count++; - if (VC_RETRY_COUNT == count) { - SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Fail to request"); - break; - } - } - } else { - SLOG(LOG_DEBUG, TAG_VCM, "[SUCCESS] result selection"); - } + int ret = -1; + ret = vc_mgr_dbus_send_result_selection(g_vc_m->handle); + if (0 != ret) { + SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Fail to send result selection : %s", __vc_mgr_get_error_code(ret)); + return ret; + } else { + SLOG(LOG_DEBUG, TAG_VCM, "[SUCCESS] result selection"); } vc_mgr_client_unset_all_result(g_vc_m); @@ -3272,6 +3300,81 @@ int __vc_mgr_cb_private_data_requested(const char* key, char** data) return ret; } +/* for TTS feedback */ +int __vc_mgr_cb_feedback_audio_format(int rate, vc_audio_channel_e channel, vc_audio_type_e audio_type) +{ + vc_mgr_feedback_audio_format_cb callback = NULL; + void* user_data = NULL; + + /* set global audio formats */ + g_feedback_rate = rate; + g_feedback_audio_channel = channel; + g_feedback_audio_type = audio_type; + + vc_mgr_client_get_feedback_audio_format_cb(g_vc_m, &callback, &user_data); + + if (NULL != callback) { + vc_mgr_client_use_callback(g_vc_m); + callback(rate, channel, audio_type, user_data); + vc_mgr_client_not_use_callback(g_vc_m); + SLOG(LOG_DEBUG, TAG_VCM, "TTS feedback audio format callback is called"); + } else { + SLOG(LOG_WARN, TAG_VCM, "[WARNING] TTS feedback audio format callback is null"); + } + + return VC_ERROR_NONE; +} + +int __vc_mgr_cb_feedback_streaming(vc_feedback_event_e event, char* buffer, int len) +{ + /* add feedback data */ + vc_feedback_data_s* temp_feedback_data = NULL; + temp_feedback_data = (vc_feedback_data_s*)calloc(1, sizeof(vc_feedback_data_s)); + if (NULL == temp_feedback_data) { + SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Out of memory"); + return VC_ERROR_OUT_OF_MEMORY; + } + + temp_feedback_data->data = NULL; + temp_feedback_data->rate = g_feedback_rate; + temp_feedback_data->data_size = 0; + + if (0 < len) { + temp_feedback_data->data = (char*)calloc(len + 5, sizeof(char)); + if (NULL != temp_feedback_data->data) { + memcpy(temp_feedback_data->data, buffer, len); + temp_feedback_data->data_size = len; + SLOG(LOG_DEBUG, TAG_VCM, "[DEBUG][memcpy] data(%p) size(%d)", + temp_feedback_data->data, temp_feedback_data->data_size); + } else { + SLOG(LOG_ERROR, TAG_VCM, "[ERROR] fail to allocate memory"); + } + } else { + SLOG(LOG_ERROR, TAG_VCM, "[ERROR] feedback data is NULL"); + } + + temp_feedback_data->event = event; + temp_feedback_data->audio_type = g_feedback_audio_type; + temp_feedback_data->channel = g_feedback_audio_channel; + + int ret = vc_mgr_data_add_feedback_data(temp_feedback_data); + if (0 != ret) { + SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Fail to add feedback data"); + if (NULL != temp_feedback_data->data) { + free(temp_feedback_data->data); + temp_feedback_data->data = NULL; + } + if (NULL != temp_feedback_data) { + free(temp_feedback_data); + temp_feedback_data = NULL; + } + + return ret; + } + + return VC_ERROR_NONE; +} + int vc_mgr_set_dialog_request_cb(vc_mgr_dialog_request_cb callback, void* user_data) { if (0 != __vc_mgr_get_feature_enabled()) { @@ -3631,3 +3734,297 @@ int __vc_mgr_request_auth_cancel(int pid) return 0; } + +int vc_mgr_set_specific_engine_result_cb(vc_mgr_specific_engine_result_cb callback, void* user_data) +{ + if (0 != __vc_mgr_get_feature_enabled()) { + return VC_ERROR_NOT_SUPPORTED; + } + + if (NULL == callback) + return VC_ERROR_INVALID_PARAMETER; + + vc_state_e state; + if (0 != vc_mgr_client_get_client_state(g_vc_m, &state)) { + SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Set specific engine result callback : A handle is not available"); + return VC_ERROR_INVALID_STATE; + } + + /* check state */ + if (state != VC_STATE_INITIALIZED) { + SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Set specific engine result callback : Current state(%d) is not 'Initialized'", state); + return VC_ERROR_INVALID_STATE; + } + + vc_mgr_client_set_specific_engine_result_cb(g_vc_m, callback, user_data); + + return 0; +} +int vc_mgr_unset_specific_engine_result_cb(void) +{ + if (0 != __vc_mgr_get_feature_enabled()) { + return VC_ERROR_NOT_SUPPORTED; + } + + vc_state_e state; + if (0 != vc_mgr_client_get_client_state(g_vc_m, &state)) { + SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Unset specific engine result callback : A handle is not available"); + return VC_ERROR_INVALID_STATE; + } + + /* check state */ + if (state != VC_STATE_INITIALIZED) { + SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Unset specific engine result callback : Current state(%d) is not 'Initialize'", state); + return VC_ERROR_INVALID_STATE; + } + + vc_mgr_client_set_specific_engine_result_cb(g_vc_m, NULL, NULL); + + return 0; +} + +void __vc_mgr_cb_specific_engine_result(const char* engine_app_id, const char* event, const char* result) +{ + vc_mgr_specific_engine_result_cb callback = NULL; + void* user_data = NULL; + + vc_mgr_client_get_specific_engine_result_cb(g_vc_m, &callback, &user_data); + if (NULL == callback) { + SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Client specific engine result callback is NULL"); + return; + } + + vc_mgr_client_use_callback(g_vc_m); + callback(engine_app_id, event, result, user_data); + vc_mgr_client_not_use_callback(g_vc_m); + SLOG(LOG_DEBUG, TAG_VCM, "Specific engine result callback is called, engine app id(%s), event(%s), result(%s)", engine_app_id, event, result); + + return; +} + +/* for TTS feedback */ +int vc_mgr_set_feedback_audio_format_cb(vc_mgr_feedback_audio_format_cb callback, void* user_data) +{ + if (NULL == callback) + return VC_ERROR_INVALID_PARAMETER; + + vc_state_e state; + if (0 != vc_mgr_client_get_client_state(g_vc_m, &state)) { + SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Set feedback audio format callback : A handle is not available"); + return VC_ERROR_INVALID_STATE; + } + + /* check state */ + if (VC_STATE_INITIALIZED != state) { + SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Set feedback audio format callback : Current state is not 'Initialized' (%d)", state); + return VC_ERROR_INVALID_STATE; + } + + vc_mgr_client_set_feedback_audio_format_cb(g_vc_m, callback, user_data); + + SLOG(LOG_DEBUG, TAG_VCM, "[SUCCESS] Set feedback audio format callback"); + + return 0; +} + +int vc_mgr_unset_feedback_audio_format_cb() +{ + vc_state_e state; + if (0 != vc_mgr_client_get_client_state(g_vc_m, &state)) { + SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Unset feedback audio format callback : A handle is not available"); + return VC_ERROR_INVALID_STATE; + } + + /* check state */ + if (VC_STATE_INITIALIZED != state) { + SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Unset feedback audio format callback : Current state is not 'Initialized' (%d)", state); + return VC_ERROR_INVALID_STATE; + } + + vc_mgr_client_set_feedback_audio_format_cb(g_vc_m, NULL, NULL); + + SLOG(LOG_DEBUG, TAG_VCM, "[SUCCESS] Unset feedback audio format callback"); + + return 0; +} + +int vc_mgr_set_feedback_streaming_cb(vc_mgr_feedback_streaming_cb callback, void* user_data) +{ + if (NULL == callback) + return VC_ERROR_INVALID_PARAMETER; + + vc_state_e state; + if (0 != vc_mgr_client_get_client_state(g_vc_m, &state)) { + SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Set feedback streaming callback : A handle is not available"); + return VC_ERROR_INVALID_STATE; + } + + /* check state */ + if (VC_STATE_INITIALIZED != state) { + SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Set feedback streaming callback : Current state is not 'Initialized' (%d)", state); + return VC_ERROR_INVALID_STATE; + } + + vc_mgr_client_set_feedback_streaming_cb(g_vc_m, callback, user_data); + + SLOG(LOG_DEBUG, TAG_VCM, "[SUCCESS] Set feedback streaming callback"); + + return 0; +} + +int vc_mgr_unset_feedback_streaming_cb() +{ + vc_state_e state; + if (0 != vc_mgr_client_get_client_state(g_vc_m, &state)) { + SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Unset feedback streaming callback : A handle is not available"); + return VC_ERROR_INVALID_STATE; + } + + /* check state */ + if (VC_STATE_INITIALIZED != state) { + SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Unset feedback streaming callback : Current state is not 'Initialized' (%d)", state); + return VC_ERROR_INVALID_STATE; + } + + vc_mgr_client_set_feedback_streaming_cb(g_vc_m, NULL, NULL); + + SLOG(LOG_DEBUG, TAG_VCM, "[SUCCESS] Unset feedback streaming callback"); + + return 0; +} + +static void __tts_feedback_thread(void* data, Ecore_Thread* thread) +{ + SLOG(LOG_DEBUG, TAG_VCM, "[SUCCESS] Start thread"); + + vc_feedback_data_s* feedback_data = NULL; + vc_mgr_feedback_streaming_cb callback = NULL; + void* user_data = NULL; + + vc_mgr_client_get_feedback_streaming_cb(g_vc_m, &callback, &user_data); + if (NULL == callback) { + SLOG(LOG_WARN, TAG_VCM, "[WARNING] TTS feedback streaming callback is null"); + return; + } + + while (1) { + int ret = -1; + int cnt = 0; + + /* get feedback data */ + ret = vc_mgr_data_get_feedback_data(&feedback_data); + if (0 != ret || NULL == feedback_data) { + /* empty queue */ + SLOG(LOG_DEBUG, TAG_VCM, "[DEBUG] No feedback data. Waiting mode"); + + /* waiting */ + while (1) { + usleep(10000); + if (0 < vc_mgr_data_get_feedback_data_size()) { + SLOG(LOG_INFO, TAG_VCM, "[INFO] Resume thread"); + break; + } + if (200 < cnt) { + SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Wrong request, there's no pcm data"); + return; + } + cnt++; + } + SLOG(LOG_INFO, TAG_VCM, "[INFO] Finish to wait for new feedback data come"); + + /* resume feedback thread */ + continue; + } + + SLOG(LOG_DEBUG, TAG_VCM, "TTS feedback streaming callback is called"); + vc_mgr_client_use_callback(g_vc_m); + callback(feedback_data->event, feedback_data->data, feedback_data->data_size, user_data); + vc_mgr_client_not_use_callback(g_vc_m); + + /* If no feedback data and EVENT_FINISH */ + if (0 >= vc_mgr_data_get_feedback_data_size() && VC_FEEDBACK_EVENT_FINISH == feedback_data->event) { + SLOG(LOG_INFO, TAG_VCM, "[INFO] Finish feedback"); + break; + } + } +} + +static void __end_tts_feedback_thread(void* data, Ecore_Thread* thread) +{ + SLOG(LOG_DEBUG, TAG_VCM, "[SUCCESS] End thread"); +} + +int vc_mgr_start_feedback(void) +{ + SLOG(LOG_DEBUG, TAG_VCM, "@@@ [Manager] Request start TTS feedback"); + + vc_state_e state; + if (0 != vc_mgr_client_get_client_state(g_vc_m, &state)) { + SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Start feedback : A handle is not available"); + return VC_ERROR_INVALID_STATE; + } + + /* check state */ + if (VC_STATE_READY != state) { + SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Start feedback : Current state is not 'Ready' (%d)", state); + return VC_ERROR_INVALID_STATE; + } + +#if 1 + ecore_thread_run(__tts_feedback_thread, __end_tts_feedback_thread, NULL, NULL); +#else + /* start playing TTS feedback */ + int ret = -1; + ret = vc_mgr_player_play(); + if (0 != ret) { + SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Fail to player play, ret(%d)", ret); + } +#endif + return 0; +} + +int vc_mgr_stop_feedback(void) +{ + SLOG(LOG_DEBUG, TAG_VCM, "@@@ [Manager] Request stop TTS feedback"); + + vc_state_e state; + if (0 != vc_mgr_client_get_client_state(g_vc_m, &state)) { + SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Stop feedback : A handle is not available"); + return VC_ERROR_INVALID_STATE; + } + + /* check state */ + if (VC_STATE_READY != state) { + SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Stop feedback : Current state is not 'Ready' (%d)", state); + return VC_ERROR_INVALID_STATE; + } + +#if 1 + int ret = -1; + + while (1) { + vc_feedback_data_s* feedback_data = NULL; + + /* get feedback data */ + ret = vc_mgr_data_get_feedback_data(&feedback_data); + if (0 != ret || NULL == feedback_data) { + /* empty queue */ + SLOG(LOG_INFO, TAG_VCM, "[INFO] No feedback data to stop any more"); + return 0; + } + ret = vc_mgr_data_clear_feedback_data(&feedback_data); + if (0 != ret) { + SLOG(LOG_INFO, TAG_VCM, "[ERROR] Fail to clear data, ret(%d)", ret); + break; + } + } +#else + /* request to stop playing TTS feedback */ + int ret = -1; + ret = vc_mgr_player_stop(); + if (0 != ret) { + SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Fail to player stop, ret(%d)", ret); + } +#endif + return ret; +} diff --git a/client/vc_mgr_client.c b/client/vc_mgr_client.c index 985f460..18120ed 100644 --- a/client/vc_mgr_client.c +++ b/client/vc_mgr_client.c @@ -46,7 +46,15 @@ typedef struct { vc_mgr_private_data_set_cb private_data_set_cb; void* private_data_set_user_data; vc_mgr_private_data_requested_cb private_data_requested_cb; - void* private_data_requested_user_data; + void* private_data_requested_user_data; + vc_mgr_specific_engine_result_cb specific_engine_result_cb; + void* specific_engine_result_user_data; + + /* for TTS feedback */ + vc_mgr_feedback_audio_format_cb feedback_audio_format_cb; + void* feedback_audio_format_user_data; + vc_mgr_feedback_streaming_cb feedback_streaming_cb; + void* feedback_streaming_user_data; /* All result */ vc_result_event_e all_result_event; @@ -174,6 +182,13 @@ int vc_mgr_client_create(vc_h* vc) client->private_data_set_user_data = NULL; client->private_data_requested_cb = NULL; client->private_data_requested_user_data = NULL; + client->specific_engine_result_cb = NULL; + client->specific_engine_result_user_data = NULL; + + client->feedback_audio_format_cb = NULL; + client->feedback_audio_format_user_data = NULL; + client->feedback_streaming_cb = NULL; + client->feedback_streaming_user_data = NULL; client->exclusive_cmd_option = false; @@ -645,6 +660,62 @@ int vc_mgr_client_get_private_data_requested_cb(vc_h vc, vc_mgr_private_data_req return 0; } +int vc_mgr_client_set_feedback_audio_format_cb(vc_h vc, vc_mgr_feedback_audio_format_cb callback, void* user_data) +{ + vc_mgr_client_s* client = __mgr_client_get(vc); + + /* check handle */ + if (NULL == client) + return VC_ERROR_INVALID_PARAMETER; + + client->feedback_audio_format_cb = callback; + client->feedback_audio_format_user_data = user_data; + + return 0; +} + +int vc_mgr_client_get_feedback_audio_format_cb(vc_h vc, vc_mgr_feedback_audio_format_cb* callback, void** user_data) +{ + vc_mgr_client_s* client = __mgr_client_get(vc); + + /* check handle */ + if (NULL == client) + return VC_ERROR_INVALID_PARAMETER; + + *callback = client->feedback_audio_format_cb; + *user_data = client->feedback_audio_format_user_data; + + return 0; +} + +int vc_mgr_client_set_feedback_streaming_cb(vc_h vc, vc_mgr_feedback_streaming_cb callback, void* user_data) +{ + vc_mgr_client_s* client = __mgr_client_get(vc); + + /* check handle */ + if (NULL == client) + return VC_ERROR_INVALID_PARAMETER; + + client->feedback_streaming_cb = callback; + client->feedback_streaming_user_data = user_data; + + return 0; +} + +int vc_mgr_client_get_feedback_streaming_cb(vc_h vc, vc_mgr_feedback_streaming_cb* callback, void** user_data) +{ + vc_mgr_client_s* client = __mgr_client_get(vc); + + /* check handle */ + if (NULL == client) + return VC_ERROR_INVALID_PARAMETER; + + *callback = client->feedback_streaming_cb; + *user_data = client->feedback_streaming_user_data; + + return 0; +} + /* set/get option */ int vc_mgr_client_set_service_state(vc_h vc, vc_service_state_e state) { @@ -1191,3 +1262,31 @@ int vc_mgr_client_get_start_by_client(vc_h vc, bool* option) return 0; } + +int vc_mgr_client_set_specific_engine_result_cb(vc_h vc, vc_mgr_specific_engine_result_cb callback, void* user_data) +{ + vc_mgr_client_s* client = __mgr_client_get(vc); + + /* check handle */ + if (NULL == client) + return VC_ERROR_INVALID_PARAMETER; + + client->specific_engine_result_cb = callback; + client->specific_engine_result_user_data = user_data; + + return 0; +} + +int vc_mgr_client_get_specific_engine_result_cb(vc_h vc, vc_mgr_specific_engine_result_cb* callback, void** user_data) +{ + vc_mgr_client_s* client = __mgr_client_get(vc); + + /* check handle */ + if (NULL == client) + return VC_ERROR_INVALID_PARAMETER; + + *callback = client->specific_engine_result_cb; + *user_data = client->specific_engine_result_user_data; + + return 0; +} diff --git a/client/vc_mgr_client.h b/client/vc_mgr_client.h index 4c91392..e8104c0 100644 --- a/client/vc_mgr_client.h +++ b/client/vc_mgr_client.h @@ -95,6 +95,19 @@ int vc_mgr_client_set_private_data_requested_cb(vc_h vc, vc_mgr_private_data_req int vc_mgr_client_get_private_data_requested_cb(vc_h vc, vc_mgr_private_data_requested_cb* callback, void** user_data); +int vc_mgr_client_set_specific_engine_result_cb(vc_h vc, vc_mgr_specific_engine_result_cb callback, void* user_data); + +int vc_mgr_client_get_specific_engine_result_cb(vc_h vc, vc_mgr_specific_engine_result_cb* callback, void** user_data); + +int vc_mgr_client_set_feedback_audio_format_cb(vc_h vc, vc_mgr_feedback_audio_format_cb callback, void* user_data); + +int vc_mgr_client_get_feedback_audio_format_cb(vc_h vc, vc_mgr_feedback_audio_format_cb* callback, void** user_data); + +int vc_mgr_client_set_feedback_streaming_cb(vc_h vc, vc_mgr_feedback_streaming_cb callback, void* user_data); + +int vc_mgr_client_get_feedback_streaming_cb(vc_h vc, vc_mgr_feedback_streaming_cb* callback, void** user_data); + + /* * set/get option */ diff --git a/client/vc_mgr_data.cpp b/client/vc_mgr_data.cpp new file mode 100644 index 0000000..fa455cd --- /dev/null +++ b/client/vc_mgr_data.cpp @@ -0,0 +1,126 @@ +/* +* Copyright (c) 2018 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +#include +#include +#include +#include +#include +#include + +#include "vc_mgr_data.h" + +using namespace std; + +std::list g_feedback_data; + +static pthread_mutex_t g_feedback_data_mutex = PTHREAD_MUTEX_INITIALIZER; + +int vc_mgr_data_add_feedback_data(vc_feedback_data_s* data) +{ + if (NULL == data) { + SLOG(LOG_ERROR, TAG_VCM, "[DATA ERROR] feedback data is NULL"); + return VC_ERROR_INVALID_PARAMETER; + } + + pthread_mutex_lock(&g_feedback_data_mutex); + + std::list::iterator iter; + + try { + iter = g_feedback_data.insert(g_feedback_data.end(), data); + } catch (const std::bad_alloc&) { + SLOG(LOG_ERROR, TAG_VCM, "[DATA ERROR] Fail to insert feedback data (bad alloc)"); + pthread_mutex_unlock(&g_feedback_data_mutex); + + return VC_ERROR_OUT_OF_MEMORY; + } + + pthread_mutex_unlock(&g_feedback_data_mutex); + + return VC_ERROR_NONE; +} + +int vc_mgr_data_get_feedback_data(vc_feedback_data_s** data) +{ + SLOG(LOG_DEBUG, TAG_VCM, "[DATA] feedback_data : %p", *data); + + pthread_mutex_lock(&g_feedback_data_mutex); + + if (0 == g_feedback_data.size()) { + SLOG(LOG_DEBUG, TAG_VCM, "[DATA] There is no feedback data"); + *data = NULL; + pthread_mutex_unlock(&g_feedback_data_mutex); + + return -1; + } + + std::list::iterator iter; + + if (!g_feedback_data.empty()) { + iter = g_feedback_data.begin(); + *data = *iter; + g_feedback_data.pop_front(); + } + + pthread_mutex_unlock(&g_feedback_data_mutex); + + return VC_ERROR_NONE; +} + +int vc_mgr_data_get_feedback_data_size() +{ + SLOG(LOG_DEBUG, TAG_VCM, "[DATA] get feedback data size"); + + int data_size = 0; + + pthread_mutex_lock(&g_feedback_data_mutex); + data_size = g_feedback_data.size(); + + pthread_mutex_unlock(&g_feedback_data_mutex); + + return data_size; +} + +int vc_mgr_data_clear_feedback_data(vc_feedback_data_s** data) +{ + SLOG(LOG_DEBUG, TAG_VCM, "[DATA] clear feedback data"); + + pthread_mutex_lock(&g_feedback_data_mutex); + + if (!g_feedback_data.empty()) { + SLOG(LOG_DEBUG, TAG_VCM, "[DEBUG] data(%p) size(%d) rate(%d)", (*data)->data, (*data)->data_size, (*data)->rate); + + if (NULL != (*data)->data) { + free((*data)->data); + (*data)->data = NULL; + } + + free(*data); + *data = NULL; + } + + pthread_mutex_unlock(&g_feedback_data_mutex); + + return VC_ERROR_NONE; +} + +int vc_mgr_data_get_pid() +{ +// SLOG(LOG_DEBUG, TAG_VCM, "[DATA] get VC mgr pid"); + + return getpid(); +} diff --git a/client/vc_mgr_data.h b/client/vc_mgr_data.h new file mode 100644 index 0000000..3e2960f --- /dev/null +++ b/client/vc_mgr_data.h @@ -0,0 +1,63 @@ +/* +* Copyright (c) 2018 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + + +#ifndef __VC_MGR_DATA_H__ +#define __VC_MGR_DATA_H__ + +#include +#include + + +#ifdef __cplusplus +extern "C" { +#endif + +#define TAG_VCM "vcm" /* Manager client log tag */ + +typedef enum { + VC_FEEDBACK_STATE_CREATED = 0, + VC_FEEDBACK_STATE_READY, + VC_FEEDBACK_STATE_PLAYING +} vc_feedback_state_e; + +typedef struct { + int utt_id; + void* data; + unsigned int data_size; + + vc_feedback_event_e event; + vc_audio_type_e audio_type; + vc_audio_channel_e channel; + int rate; +} vc_feedback_data_s; + + +int vc_mgr_data_add_feedback_data(vc_feedback_data_s* data); + +int vc_mgr_data_get_feedback_data(vc_feedback_data_s** data); + +int vc_mgr_data_get_feedback_data_size(); + +int vc_mgr_data_clear_feedback_data(vc_feedback_data_s** data); + +int vc_mgr_data_get_pid(); + +#ifdef __cplusplus +} +#endif + +#endif /* __VC_MGR_DATA_H__ */ diff --git a/client/vc_mgr_dbus.c b/client/vc_mgr_dbus.c index 0935452..040ebcb 100644 --- a/client/vc_mgr_dbus.c +++ b/client/vc_mgr_dbus.c @@ -51,6 +51,11 @@ extern int __vc_mgr_cb_private_data_set(const char* key, const char* data); extern int __vc_mgr_cb_private_data_requested(const char* key, char** data); +/* for TTS feedback */ +extern int __vc_mgr_cb_feedback_audio_format(int rate, vc_audio_channel_e channel, vc_audio_type_e audio_type); + +extern int __vc_mgr_cb_feedback_streaming(vc_feedback_event_e event, char* buffer, int len); + /* Authority */ extern int __vc_mgr_request_auth_enable(int pid); @@ -64,6 +69,8 @@ extern int __vc_mgr_request_auth_cancel(int pid); extern int __vc_mgr_cb_dialog(int pid, const char* disp_text, const char* utt_text, bool continuous); +extern void __vc_mgr_cb_specific_engine_result(const char* engine_app_id, const char* event, const char* result); + static Eina_Bool vc_mgr_listener_event_callback(void* data, Ecore_Fd_Handler *fd_handler) { if (NULL == g_m_conn_listener) return ECORE_CALLBACK_RENEW; @@ -195,7 +202,20 @@ static Eina_Bool vc_mgr_listener_event_callback(void* data, Ecore_Fd_Handler *fd SLOG(LOG_DEBUG, TAG_VCM, "@@@"); } /* VCD_MANAGER_METHOD_PRE_RESULT */ + else if (dbus_message_is_method_call(msg, if_name, VCD_MANAGER_METHOD_SPECIFIC_ENGINE_RESULT)) { + SLOG(LOG_DEBUG, TAG_VCM, "@@@ Get specific engine result"); + char* engine_app_id = NULL; + char* event = NULL; + char* result = NULL; + + dbus_message_get_args(msg, &err, DBUS_TYPE_STRING, &engine_app_id, DBUS_TYPE_STRING, &event, DBUS_TYPE_STRING, &result, DBUS_TYPE_INVALID); + if (NULL != result) { + __vc_mgr_cb_specific_engine_result(engine_app_id, event, result); + } + + SLOG(LOG_DEBUG, TAG_VCM, "@@@"); + } /* VCD_MANAGER_METHOD_SPECIFIC_ENGINE_RESULT */ else if (dbus_message_is_method_call(msg, if_name, VCD_MANAGER_METHOD_RESULT)) { SLOG(LOG_DEBUG, TAG_VCM, "@@@ Get System Result"); @@ -372,6 +392,40 @@ static Eina_Bool vc_mgr_listener_event_callback(void* data, Ecore_Fd_Handler *fd SLOG(LOG_DEBUG, TAG_VCM, "@@@"); } /* VCD_MANAGER_METHOD_GET_PRIVATE_DATA */ + else if (dbus_message_is_method_call(msg, if_name, VCD_MANAGER_METHOD_FEEDBACK_AUDIO_FORMAT)) { + SLOG(LOG_INFO, TAG_VCM, "@@@ Get TTS feedback audio format"); + int rate; + vc_audio_channel_e channel; + vc_audio_type_e audio_type; + + dbus_message_get_args(msg, &err, + DBUS_TYPE_INT32, &rate, + DBUS_TYPE_INT32, &channel, + DBUS_TYPE_INT32, &audio_type, + DBUS_TYPE_INVALID); + + __vc_mgr_cb_feedback_audio_format(rate, channel, audio_type); + + SLOG(LOG_INFO, TAG_VCM, "@@@"); + } /* VCD_MANAGER_METHOD_FEEDBACK_AUDIO_FORMAT */ + + else if (dbus_message_is_method_call(msg, if_name, VCD_MANAGER_METHOD_FEEDBACK_STREAMING)) { + SLOG(LOG_INFO, TAG_VCM, "@@@ Get TTS feedback streaming"); + vc_feedback_event_e event; + char* buffer = NULL; + int len; + + dbus_message_get_args(msg, &err, + DBUS_TYPE_INT32, &event, + DBUS_TYPE_ARRAY, DBUS_TYPE_BYTE, + &buffer, &len, + DBUS_TYPE_INVALID); + + __vc_mgr_cb_feedback_streaming(event, buffer, len); + + SLOG(LOG_INFO, TAG_VCM, "@@@"); + } /* VCD_MANAGER_METHOD_FEEDBACK_STREAMING */ + /* Authority */ else if (dbus_message_is_method_call(msg, if_name, VC_METHOD_AUTH_ENABLE)) { SLOG(LOG_DEBUG, TAG_VCM, "@@@ Get request auth enable"); @@ -2200,3 +2254,41 @@ int vc_mgr_dbus_send_result_selection(int pid) return 0; } + +int vc_mgr_dbus_send_specific_engine_request(int pid, const char* engine_app_id, const char* event, const char* request) +{ + DBusMessage* msg; + + /* create a signal & check for errors */ + msg = dbus_message_new_method_call( + VC_SERVER_SERVICE_NAME, + VC_SERVER_SERVICE_OBJECT_PATH, /* object name of the signal */ + VC_SERVER_SERVICE_INTERFACE, /* interface name of the signal */ + VC_MANAGER_METHOD_SPECIFIC_ENGINE_REQUEST); /* name of the signal */ + + if (NULL == msg) { + SLOG(LOG_ERROR, TAG_VCM, "@@ vc send specific engine : Fail to make message"); + return VC_ERROR_OPERATION_FAILED; + } else { + SLOG(LOG_DEBUG, TAG_VCM, "@@ vc send specific engine : pid(%d), engine_app_id(%s), event(%s), request(%s)", pid, engine_app_id, event, request); + } + + dbus_message_append_args(msg, + DBUS_TYPE_INT32, &pid, + DBUS_TYPE_STRING, &engine_app_id, + DBUS_TYPE_STRING, &event, + DBUS_TYPE_STRING, &request, + DBUS_TYPE_INVALID); + + dbus_message_set_no_reply(msg, TRUE); + + if (1 != dbus_connection_send(g_m_conn_sender, msg, NULL)) { + SLOG(LOG_ERROR, TAG_VCM, "[Dbus ERROR] Fail to Send"); + return -1; + } else { + SLOG(LOG_DEBUG, TAG_VCM, "[Dbus] SUCCESS Send"); + dbus_connection_flush(g_m_conn_sender); + } + + return 0; +} diff --git a/client/vc_mgr_dbus.h b/client/vc_mgr_dbus.h index 267aa05..26789e8 100644 --- a/client/vc_mgr_dbus.h +++ b/client/vc_mgr_dbus.h @@ -64,10 +64,16 @@ int vc_mgr_dbus_send_result(int pid, int cmd_type, int result_id); int vc_mgr_dbus_send_result_selection(int pid); +int vc_mgr_dbus_send_specific_engine_request(int pid, const char* engine_app_id, const char* event, const char* request); + int vc_mgr_dbus_request_enable_command_type(int pid, int cmd_type); int vc_mgr_dbus_request_disable_command_type(int pid, int cmd_type); +int vc_mgr_dbus_request_start_feedback(int pid); + +int vc_mgr_dbus_request_stop_feedback(int pid); + #ifdef __cplusplus } #endif diff --git a/client/vc_mgr_player.c b/client/vc_mgr_player.c new file mode 100644 index 0000000..06915f9 --- /dev/null +++ b/client/vc_mgr_player.c @@ -0,0 +1,413 @@ +/* +* Copyright (c) 2018 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +#include +#include +#include +#include +#include +#include + +#include "vc_main.h" +#include "vc_mgr_player.h" +#include "vc_mgr_data.h" + +typedef enum { + AUDIO_STATE_NONE = 0, + AUDIO_STATE_READY, + AUDIO_STATE_PLAY +} audio_state_e; + +typedef struct { + vc_feedback_state_e state; + + vc_feedback_event_e event; + int idx; +} player_s; + +#define SOUND_BUFFER_LENGTH 2048 + +static bool g_player_init = false; + +static player_s* g_playing_info; + +static audio_state_e g_audio_state; + +static vc_audio_type_e g_audio_type; + +static vc_audio_channel_e g_audio_channel; + +static int g_sampling_rate; + +static audio_out_h g_audio_h; + + +static int __create_audio_out(int rate, vc_audio_channel_e channel, vc_audio_type_e audio_type) +{ + int ret = -1; + audio_channel_e sample_channel = 0; + audio_sample_type_e sample_type = 0; + + if (VC_AUDIO_CHANNEL_MONO == channel) { + sample_channel = AUDIO_CHANNEL_MONO; + } else if (VC_AUDIO_CHANNEL_STEREO == channel) { + sample_channel = AUDIO_CHANNEL_STEREO; + } + + if (VC_AUDIO_TYPE_PCM_S16_LE == audio_type) { + sample_type = AUDIO_SAMPLE_TYPE_S16_LE; + } else { + sample_type = AUDIO_SAMPLE_TYPE_U8; + } + + /* create audio_out new */ + ret = audio_out_create_new(rate, sample_channel, sample_type, &g_audio_h); + if (AUDIO_IO_ERROR_NONE != ret) { + g_audio_state = AUDIO_STATE_NONE; + g_audio_h = NULL; + SLOG(LOG_ERROR, TAG_VCM, "[Player ERROR] Fail to create audio"); + return -1; + } else { + SLOG(LOG_DEBUG, TAG_VCM, "[Player DEBUG] Create audio"); + } + + g_audio_channel = channel; + g_audio_type = audio_type; + g_sampling_rate = rate; + + g_audio_state = AUDIO_STATE_READY; + + return 0; +} + +static int __destroy_audio_out() +{ + if (NULL == g_audio_h) { + SLOG(LOG_ERROR, TAG_VCM, "[Player ERROR] Current handle is not valid"); + return -1; + } + + int ret = -1; + ret = audio_out_destroy(g_audio_h); + if (AUDIO_IO_ERROR_NONE != ret) { + SLOG(LOG_ERROR, TAG_VCM, "[Player ERROR] Fail to destroy audio"); + return -1; + } else { + SLOG(LOG_DEBUG, TAG_VCM, "[Player DEBUG] Destroy audio"); + } + + g_audio_channel = 0; + g_audio_type = 0; + g_sampling_rate = 0; + + g_audio_state = AUDIO_STATE_NONE; + g_audio_h = NULL; + + return 0; +} + +int vc_mgr_player_init(int rate, vc_audio_channel_e channel, vc_audio_type_e audio_type) +{ + g_audio_state = AUDIO_STATE_NONE; + g_audio_h = NULL; + + ecore_thread_max_set(1); + + int ret = -1; + + + ret = __create_audio_out(rate, channel, audio_type); + if (0 != ret) { + return -1; + } + + g_player_init = true; + + return 0; +} + +int vc_mgr_player_release() +{ + if (false == g_player_init) { + SLOG(LOG_ERROR, TAG_VCM, "[Player ERROR] Not initialized"); + return VC_ERROR_OPERATION_FAILED; + } + + int ret = -1; + + int thread_count = ecore_thread_active_get(); + SLOG(LOG_DEBUG, TAG_VCM, "[Player DEBUG] Active thread count : %d", thread_count); + int count = 0; + while (0 < thread_count) { + usleep(10000); + + count++; + if (20 == count) { + SLOG(LOG_WARN, TAG_VCM, "[Player WARN] Thread is blocked. Player release continue"); + break; + } + + thread_count = ecore_thread_active_get(); + } + + SLOG(LOG_DEBUG, TAG_VCM, "[Player DEBUG] Thread is release"); + + ret = __destroy_audio_out(); + if (0 != ret) { + return -1; + } + + g_player_init = false; + + return 0; +} + +static void __play_feedback_thread(void* data, Ecore_Thread* thread) +{ + SLOG(LOG_DEBUG, TAG_VCM, "[Player DEBUG] Start thread"); + + if (NULL == g_playing_info) { + SLOG(LOG_ERROR, TAG_VCM, "[Player ERROR] No current player"); + return; + } + + player_s* player = g_playing_info; + vc_feedback_data_s* feedback_data = NULL; + + int ret = -1; + int len = SOUND_BUFFER_LENGTH; + int idx = 0; + + while (1) { + /* get feedback data */ + ret = vc_mgr_data_get_feedback_data(&feedback_data); + if (0 != ret || NULL == feedback_data) { + /* empty queue */ + SLOG(LOG_DEBUG, TAG_VCM, "[Player DEBUG] No feedback data. Waiting mode"); + + /* waiting */ + while (1) { + usleep(10000); + if (0 < vc_mgr_data_get_feedback_data_size()) { + SLOG(LOG_INFO, TAG_VCM, "[Player INFO] Resume thread"); + break; + } + + if (AUDIO_STATE_PLAY == g_audio_state) { + /* release audio & recover session */ + ret = audio_out_unprepare(g_audio_h); + if (AUDIO_IO_ERROR_NONE != ret) { + SLOG(LOG_ERROR, TAG_VCM, "[Player ERROR] Fail to unprepare audio"); + } else { + SLOG(LOG_DEBUG, TAG_VCM, "[Player DEBUG] Unprepare audio"); + } + g_audio_state = AUDIO_STATE_READY; + } + } + + SLOG(LOG_INFO, TAG_VCM, "[Player INFO] Finish to wait for new feedback data come"); + + /* resume play thread */ + player->state = VC_FEEDBACK_STATE_PLAYING; + continue; + } + + if (VC_FEEDBACK_EVENT_START == feedback_data->event || + (VC_FEEDBACK_EVENT_FINISH == player->event && VC_FEEDBACK_EVENT_FINISH == feedback_data->event)) { + int pid = vc_mgr_data_get_pid(); + SLOG(LOG_INFO, TAG_VCM, "[Player DEBUG] Start utterance (%d)", pid); + } + + player->event = feedback_data->event; + idx = 0; + /* If no feedback data and EVENT_FINISH */ + if (NULL == feedback_data->data || 0 >= feedback_data->data_size) { + if (VC_FEEDBACK_EVENT_FINISH == feedback_data->event) { + int pid = vc_mgr_data_get_pid(); + if (pid <= 0) { + return; + } + SLOG(LOG_DEBUG, TAG_VCM, "[Player DEBUG] No sound data"); + } + SLOG(LOG_INFO, TAG_VCM, "[Player INFO] Finish utterance"); + vc_mgr_data_clear_feedback_data(&feedback_data); + continue; + } + + if (g_sampling_rate != feedback_data->rate || g_audio_type != feedback_data->audio_type || g_audio_channel != feedback_data->channel) { + SLOG(LOG_DEBUG, TAG_VCM, "[Player DEBUG] change audio handle"); + if (NULL != g_audio_h) { + __destroy_audio_out(); + } + + if (0 > __create_audio_out(feedback_data->rate, feedback_data->channel, feedback_data->audio_type)) { + SLOG(LOG_ERROR, TAG_VCM, "[Player ERROR] Fail to create audio out"); + vc_mgr_data_clear_feedback_data(&feedback_data); + + return; + } + } + + while (VC_FEEDBACK_STATE_PLAYING == player->state) { + if ((unsigned int)idx >= feedback_data->data_size) + break; + + if ((unsigned int)idx + SOUND_BUFFER_LENGTH > feedback_data->data_size) { + len = feedback_data->data_size - idx; + } else { + len = SOUND_BUFFER_LENGTH; + } + + if (AUDIO_STATE_READY == g_audio_state) { + /* request prepare */ + ret = audio_out_prepare(g_audio_h); + if (AUDIO_IO_ERROR_NONE != ret) { + SLOG(LOG_ERROR, TAG_VCM, "[Player ERROR] Fail to prepare audio"); + vc_mgr_data_clear_feedback_data(&feedback_data); + return; + } + SLOG(LOG_DEBUG, TAG_VCM, "[Player DEBUG] Prepare audio"); + g_audio_state = AUDIO_STATE_PLAY; + } + + char* temp_data = feedback_data->data; + SLOG(LOG_DEBUG, TAG_VCM, "[Player DEBUG] data(%p), idx(%d), len(%d)", temp_data, idx, len); + + ret = audio_out_write(g_audio_h, &temp_data[idx], len); + if (0 > ret) { + SLOG(LOG_WARN, TAG_VCM, "[Player WARN] Fail to audio write - %d", ret); + } else { + idx += len; + } + + if (NULL == g_playing_info) { + SLOG(LOG_ERROR, TAG_VCM, "[Player ERROR] Current player is NULL"); + g_audio_state = AUDIO_STATE_READY; + ret = audio_out_unprepare(g_audio_h); + if (AUDIO_IO_ERROR_NONE != ret) { + SLOG(LOG_ERROR, TAG_VCM, "[Player ERROR] Fail to unprepare audio"); + } + + vc_mgr_data_clear_feedback_data(&feedback_data); + + return; + } + } + + if (NULL == g_playing_info && VC_FEEDBACK_STATE_READY == player->state) { + /* player stop */ + g_audio_state = AUDIO_STATE_READY; + SLOG(LOG_DEBUG, TAG_VCM, "[Player DEBUG] Stop play thread"); + + /* request to unprepare audio */ + ret = audio_out_unprepare(g_audio_h); + if (AUDIO_IO_ERROR_NONE != ret) { + SLOG(LOG_ERROR, TAG_VCM, "[Player ERROR] Fail to unprepare audio"); + } else { + SLOG(LOG_DEBUG, TAG_VCM, "[Player DEBUG] Unprepare audio"); + } + + vc_mgr_data_clear_feedback_data(&feedback_data); + return; + } + + if ((VC_FEEDBACK_STATE_PLAYING == player->state) && (VC_FEEDBACK_EVENT_FINISH == feedback_data->event)) { + int pid = vc_mgr_data_get_pid(); + if (pid <= 0) { + return; + } + SLOG(LOG_DEBUG, TAG_VCM, "[Player DEBUG] Finish utterance"); + } + + vc_mgr_data_clear_feedback_data(&feedback_data); + + if (NULL == g_playing_info) { + SLOG(LOG_ERROR, TAG_VCM, "[Player ERROR] Current player is NULL"); + g_audio_state = AUDIO_STATE_READY; + ret = audio_out_unprepare(g_audio_h); + if (AUDIO_IO_ERROR_NONE != ret) { + SLOG(LOG_ERROR, TAG_VCM, "[Player ERROR] Fail to unprepare audio"); + } + + return; + } + + } + +} + +static void __end_play_feedback_thread(void* data, Ecore_Thread* thread) +{ + SLOG(LOG_DEBUG, TAG_VCM, "[Player DEBUG] End thread"); +} + +int vc_mgr_player_play() +{ + if (false == g_player_init) { + SLOG(LOG_ERROR, TAG_VCM, "[Player ERROR] Not initialized"); + return VC_ERROR_OPERATION_FAILED; + } + + if (NULL != g_playing_info) { + SLOG(LOG_WARN, TAG_VCM, "[Player WARN] Stop old player"); + vc_mgr_player_stop(); + } + + SLOG(LOG_DEBUG, TAG_VCM, "[Player DEBUG] start play"); + + /* check sound queue size */ + int data_size = vc_mgr_data_get_feedback_data_size(); + if (0 == data_size) { + SLOG(LOG_WARN, TAG_VCM, "[Player WARN] A sound queue of current player is empty"); + } else if (0 < data_size) { + SLOG(LOG_INFO, TAG_VCM, "[Player INFO] Run thread"); + ecore_thread_run(__play_feedback_thread, __end_play_feedback_thread, NULL, NULL); + } + + return 0; +} + +int vc_mgr_player_stop() +{ + if (false == g_player_init) { + SLOG(LOG_ERROR, TAG_VCM, "[Player ERROR] Not initialized"); + return VC_ERROR_OPERATION_FAILED; + } + + if (NULL != g_playing_info) { + g_playing_info = NULL; + SLOG(LOG_DEBUG, TAG_VCM, "[Player DEBUG] No more current playing"); + } + + SLOG(LOG_DEBUG, TAG_VCM, "[Player DEBUG] stop play"); + + int thread_count = ecore_thread_active_get(); + int count = 0; + + while (0 < thread_count) { + usleep(10000); + + count++; + if (30 == count) { + SLOG(LOG_WARN, TAG_VCM, "[Player WARN] Thread is blocked. Player release continue"); + break; + } + + thread_count = ecore_thread_active_get(); + } + + return 0; +} diff --git a/client/vc_mgr_player.h b/client/vc_mgr_player.h new file mode 100644 index 0000000..6cf550c --- /dev/null +++ b/client/vc_mgr_player.h @@ -0,0 +1,25 @@ + +#ifndef __VC_MGR_PLAYER_H__ +#define __VC_MGR_PLAYER_H__ + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +int vc_mgr_player_init(int rate, vc_audio_channel_e channel, vc_audio_type_e audio_type); + +int vc_mgr_player_release(); + +int vc_mgr_player_play(); + +int vc_mgr_player_stop(); + + +#ifdef __cplusplus +} +#endif + +#endif /* __VC_MGR_PLAYER_H__ */ diff --git a/common/vc_defs.h b/common/vc_defs.h old mode 100755 new mode 100644 index 0299485..096aa4f --- a/common/vc_defs.h +++ b/common/vc_defs.h @@ -66,6 +66,7 @@ extern "C" { #define VC_METHOD_SET_COMMAND "vc_method_set_command" #define VC_METHOD_UNSET_COMMAND "vc_method_unset_command" #define VC_METHOD_SET_FOREGROUND "vc_method_set_foreground" +#define VC_METHOD_SET_SERVER_DIALOG "vc_method_set_server_dialog" #define VC_METHOD_DIALOG "vc_method_dialog" #define VC_METHOD_IS_SYS_COMMAND_VALID "vc_method_is_system_command_valid" @@ -139,6 +140,10 @@ extern "C" { #define VC_MANAGER_METHOD_RESULT_SELECTION "vc_manager_method_result_selection" #define VC_MANAGER_METHOD_SET_DOMAIN "vc_manager_method_set_domain" #define VC_MANAGER_METHOD_DO_ACTION "vc_manager_method_do_action" +#define VC_MANAGER_METHOD_SPECIFIC_ENGINE_REQUEST "vcd_manager_method_specific_engine_request" + +#define VC_MANAGER_METHOD_START_FEEDBACK "vc_manager_method_request_start_feedback" +#define VC_MANAGER_METHOD_STOP_FEEDBACK "vc_manager_method_request_stop_feedback" #define VCD_MANAGER_METHOD_HELLO "vcd_manager_method_hello" #define VCD_MANAGER_METHOD_SPEECH_DETECTED "vcd_manager_method_speech_detected" @@ -150,9 +155,13 @@ extern "C" { #define VCD_MANAGER_METHOD_DIALOG "vcd_manager_method_dialog" #define VCD_MANAGER_METHOD_SET_PRIVATE_DATA "vcd_manager_set_private_data" #define VCD_MANAGER_METHOD_GET_PRIVATE_DATA "vcd_manager_get_private_data" +#define VCD_MANAGER_METHOD_SPECIFIC_ENGINE_RESULT "vcd_manager_method_specific_engine_result" #define VCD_MANAGER_METHOD_ERROR "vcd_manager_method_error" +#define VCD_MANAGER_METHOD_FEEDBACK_AUDIO_FORMAT "vcd_manager_method_feedback_audio_format" +#define VCD_MANAGER_METHOD_FEEDBACK_STREAMING "vcd_manager_method_feedback_streaming" + #define VCC_MANAGER_METHOD_SET_FOREGROUND "vcd_manager_method_set_foreground" diff --git a/common/vc_info_parser.h b/common/vc_info_parser.h index d1532a6..45b7a1e 100644 --- a/common/vc_info_parser.h +++ b/common/vc_info_parser.h @@ -37,6 +37,7 @@ typedef struct _client_s { bool fg_cmd; bool bg_cmd; bool exclusive_cmd; + bool server_dialog; } vc_client_info_s; diff --git a/doc/uix_vc_doc.h b/doc/uix_vc_doc.h index 771f326..d9c6fc9 100644 --- a/doc/uix_vc_doc.h +++ b/doc/uix_vc_doc.h @@ -169,6 +169,11 @@ * * * + * vc_set_server_dialog() + * Ready + * + * + * * vc_request_dialog() * Ready * diff --git a/doc/uix_vc_engine_main_doc.h b/doc/uix_vc_engine_main_doc.h index 6c01165..e81a1fd 100644 --- a/doc/uix_vc_engine_main_doc.h +++ b/doc/uix_vc_engine_main_doc.h @@ -93,6 +93,10 @@ * Called when the engine service user sets audio recording type. * * + * vce_set_server_dialog_cb() + * Called when the engine service user sets app id which is want to ask server dialog. + * + * * vce_set_domain_cb() * Called when the engine service user sets domain (agent or device type). * diff --git a/include/vce.h b/include/vce.h index d37ffbe..c735acd 100644 --- a/include/vce.h +++ b/include/vce.h @@ -18,6 +18,7 @@ #ifndef __VCE_H__ #define __VCE_H__ +#include /** * @addtogroup CAPI_UIX_VOICE_CONTROL_ENGINE_MODULE @@ -101,6 +102,27 @@ typedef enum { } vce_asr_result_event_e; /** + * @brief Enumerations of audio channels + * @since_tizen 5.0 + */ +typedef enum { + VCE_AUDIO_CHANNEL_MONO = 0, /**< 1 channel, mono */ + VCE_AUDIO_CHANNEL_STEREO = 1 /**< 2 channels, stereo */ +} vce_audio_channel_e; + +/** + * @brief Enumeration for TTS feedback events + * @since_tizen 5.0 + */ +typedef enum { + VCE_FEEDBACK_EVENT_FAIL = -1, /**< Failed */ + VCE_FEEDBACK_EVENT_START = 1, /**< Start event */ + VCE_FEEDBACK_EVENT_CONTINUE = 2, /**< Continue event */ + VCE_FEEDBACK_EVENT_FINISH = 3 /**< Finish event */ +} vce_feedback_event_e; + + +/** * @brief A structure of handle for VC command. * @since_tizen 5.0 */ @@ -373,6 +395,19 @@ typedef int (*vce_cancel_cb)(void); typedef int (*vce_set_audio_type_cb)(const char* audio_type); /** +* @brief Called when the engine service user sets app id which is want to ask server dialog. +* @since_tizen 5.0 +* @remarks The @a app_id and @a credential can be used only in the callback. To use outside, make a copy. +* @param[in] app_id App id which is to want to ask server dialog. +* @param[in] credential Credential key. +* @return 0 on success, otherwise a negative error value. +* @retval #VCE_ERROR_NONE Successful. +* @retval #VCE_ERROR_NOT_SUPPORTED_FEATURE Not supported feature. +* @retval #VCE_ERROR_PERMISSION_DENIED Permission denied. +*/ +typedef int (*vce_set_server_dialog_cb)(const char* app_id, const char* credential); + +/** * @brief Called when the engine service user sets domain (agent or device type). * @since_tizen 5.0 * @remarks The @a domain can be used only in the callback. To use outside, make a copy. @@ -396,6 +431,26 @@ typedef int (*vce_set_domain_cb)(const char* domain); typedef int (*vce_nlu_base_info_requested_cb)(const char* key, char** value); /** +* @brief Called when client gets the specific engine's request from the engine service user. +* @since_tizen 5.0 +* +* @param[in] engine_app_id The specific engine's app id +* @param[in] event The specific engine event type +* @param[in] request The specific engine request +* +* @return 0 on success, otherwise a negative error value. +* @retval #VCE_ERROR_NONE Successful +* @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter +* @retval #VCE_ERROR_OPERATION_FAILED Operation failure +* +* @pre An application registers callback function using vce_set_specific_engine_request_cb(). +* +* @see vce_set_specific_engine_request_cb() +* @see vce_unset_specific_engine_request_cb() +*/ +typedef int (*vce_specific_engine_request_cb)(const char* engine_app_id, const char* event, const char* request); + +/** * @brief Called when the engine service user sets private data between app and engine. * @since_tizen 5.0 * @remarks The @a key, @a data can be used only in the callback. To use outside, make a copy. @@ -519,11 +574,18 @@ typedef struct { vce_cancel_cb cancel; /**< Cancel recording and processing */ vce_set_audio_type_cb set_audio_type; /**< Set audio type */ + vce_set_server_dialog_cb set_server_dialog; /**< Set server dialog */ vce_set_domain_cb set_domain; /**< Set domain */ vce_process_text_cb process_text; /**< Request to process text */ vce_process_list_event_cb process_list_event; /**< Request to process list event */ vce_process_haptic_event_cb process_haptic_event; /**< Request to process haptic event */ + + /* Optional callbacks */ + vce_private_data_set_cb private_data_set; + vce_private_data_requested_cb private_data_request; + vce_nlu_base_info_requested_cb nlu_base_info_request; + vce_specific_engine_request_cb specific_engine_request; } vce_request_callback_s; /** @@ -693,6 +755,24 @@ int vce_send_asr_result(vce_asr_result_event_e event, const char* asr_result, vo int vce_send_nlg_result(const char* nlg_result, void* user_data); /** +* @brief Sends the specific engine result to the engine service user. +* @since_tizen 5.0 +* +* @param[in] engine_app_id A specific engine's app id +* @param[in] event A specific engine result event +* @param[in] result A specific engine result text +* @param[in] user_data The user data passed from the start +* +* @return 0 on success, otherwise a negative error value +* @retval #VCE_ERROR_NONE Successful +* @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter +* @retval #VCE_ERROR_OUT_OF_MEMORY Out of Memory +* @retval #VCE_ERROR_OPERATION_FAILED Operation failure +* @pre The vce_main() function should be invoked before this function is called. +*/ +int vce_send_specific_engine_result(const char* engine_app_id, const char* event, const char* result, void *user_info); + +/** * @brief Sends the error to the engine service user. * @details The following error codes can be delivered. \n * #VCE_ERROR_NONE, \n @@ -771,6 +851,36 @@ int vce_set_private_data_requested_cb(vce_private_data_requested_cb callback_fun int vce_set_nlu_base_info_requested_cb(vce_nlu_base_info_requested_cb callback_func); /** +* @brief Registers a callback function for getting the engine service request. +* @since_tizen 5.0 +* +* @param[in] callback Callback function to register +* @param[in] user_data The user data to be passed to the callback function +* +* @return 0 on success, otherwise a negative error value +* @retval #VCE_ERROR_NONE Successful +* @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter +* @retval #VCE_ERROR_PERMISSION_DENIED Permission denied +* @retval #VCE_ERROR_NOT_SUPPORTED Not supported +* +* @see vce_unset_specific_engine_request_cb() +*/ +int vce_set_specific_engine_request_cb(vce_specific_engine_request_cb callback_func); + +/** +* @brief Unregisters the engine service request callback function. +* @since_tizen 5.0 +* +* @return 0 on success, otherwise a negative error value +* @retval #VC_ERROR_NONE Successful +* @retval #VC_ERROR_PERMISSION_DENIED Permission denied +* @retval #VC_ERROR_NOT_SUPPORTED Not supported +* +* @see vce_set_specific_engine_request_cb() +*/ +int vce_unset_specific_engine_request_cb(void); + +/** * @brief Retrieves all commands using callback function. * @since_tizen 5.0 * @param[in] vce_command The handle to be passed to the vce_set_commands() function @@ -879,6 +989,32 @@ int vce_start_recording(void); */ int vce_stop_recording(void); +/* for TTS feeadback */ +/** +* @brief Sends audio formats necessary for playing TTS feedback. +* @since_tizen 5.0 +* @return 0 on success, otherwise a negative error value. +* @retval #VCE_ERROR_NONE Successful +* @retval #VCE_ERROR_PERMISSION_DENIED Permission denied +* @retval #VCE_ERROR_NOT_SUPPORTED Not supported +* @retval #VCE_ERROR_OPERATION_FAILED Operation failure +* @retval #VCE_ERROR_OUT_OF_MEMORY Out of Memory +*/ +int vce_send_feedback_audio_format(int rate, vce_audio_channel_e channel, vce_audio_type_e audio_type); + +/** +* @brief Sends audio streaming necessary for playing TTS feedback. +* @since_tizen 5.0 +* @return 0 on success, otherwise a negative error value. +* @retval #VCE_ERROR_NONE Successful +* @retval #VCE_ERROR_PERMISSION_DENIED Permission denied +* @retval #VCE_ERROR_NOT_SUPPORTED Not supported +* @retval #VCE_ERROR_OPERATION_FAILED Operation failure +* @retval #VCE_ERROR_OUT_OF_MEMORY Out of Memory +*/ +int vce_send_feedback_streaming(vce_feedback_event_e event, char* buffer, int len); + + #ifdef __cplusplus } #endif diff --git a/include/voice_control.h b/include/voice_control.h index 9dfe6e0..f46b5c0 100644 --- a/include/voice_control.h +++ b/include/voice_control.h @@ -289,6 +289,49 @@ int vc_set_invocation_name(const char* name); /** + * @brief Requests to set app id which is to want to ask the server dialogue. + * @details Using this function, the developer can request registering the application on vc framework. + * If developer requests to register @a app_id with @a credential which is valid, the application will be set on vc framework. + * and then, when the developer requests the dialogue using vc_request_dialog(), dialog from specific engine server will be played by vc framework. + * @since_tizen 5.0 + * @privlevel public + * @privilege %http://tizen.org/privilege/recorder + * @param[in] app_id App id which is to want to ask server dialog. + * @param[in] credential Credential key. + * @return @c 0 on success, + * otherwise a negative error value + * @retval #VC_ERROR_NONE Successful + * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #VC_ERROR_INVALID_STATE Invalid state + * @retval #VC_ERROR_PERMISSION_DENIED Permission denied + * @retval #VC_ERROR_NOT_SUPPORTED Not supported + * @pre The service state should be #VC_SERVICE_STATE_READY. + * @see vc_unset_server_dialog() + */ +int vc_set_server_dialog(const char* app_id, const char* credential); + + +/** + * @brief Requests to unset app id which is to not want to ask the server dialogue. + * @details Using this function, the developer can disable function to ask dialog based on server. + * @since_tizen 5.0 + * @privlevel public + * @privilege %http://tizen.org/privilege/recorder + * @param[in] app_id App id which is to not want to ask server dialog. + * @return @c 0 on success, + * otherwise a negative error value + * @retval #VC_ERROR_NONE Successful + * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #VC_ERROR_INVALID_STATE Invalid state + * @retval #VC_ERROR_PERMISSION_DENIED Permission denied + * @retval #VC_ERROR_NOT_SUPPORTED Not supported + * @pre The service state should be #VC_SERVICE_STATE_READY. + * @see vc_set_server_dialog() + */ +int vc_unset_server_dialog(const char* app_id); + + +/** * @brief Requests to start the dialogue. * @details Using this function, the developer can request starting the dialogue to the framework. * When the developer requests the dialogue, two types of texts, @a disp_text and @a utt_text, can be sent by this function. diff --git a/include/voice_control_common.h b/include/voice_control_common.h index b979562..5ae1ffa 100644 --- a/include/voice_control_common.h +++ b/include/voice_control_common.h @@ -93,6 +93,35 @@ typedef enum { VC_STATE_READY = 2 /**< 'Ready' state */ } vc_state_e; +/** +* @brief Enumerations of audio types. +* @since_tizen 5.0 +*/ +typedef enum { + VC_AUDIO_TYPE_PCM_S16_LE = 0, /**< Signed 16bit audio type, Little endian */ + VC_AUDIO_TYPE_PCM_U8 /**< Unsigned 8bit audio type */ +} vc_audio_type_e; + +/** + * @brief Enumerations for audio channels + * @since_tizen 5.0 + */ +typedef enum { + VC_AUDIO_CHANNEL_MONO = 0, /**< 1 channel, mono */ + VC_AUDIO_CHANNEL_STEREO = 1 /**< 2 channels, stereo */ +} vc_audio_channel_e; + +/** + * @brief Enumeration for TTS feedback events + * @since_tizen 5.0 + */ +typedef enum { + VC_FEEDBACK_EVENT_FAIL = -1, /**< Failed */ + VC_FEEDBACK_EVENT_START = 1, /**< Start event */ + VC_FEEDBACK_EVENT_CONTINUE = 2, /**< Continue event */ + VC_FEEDBACK_EVENT_FINISH = 3 /**< Finish event */ +} vc_feedback_event_e; + /** * @brief Called when client gets the recognition result. diff --git a/include/voice_control_manager.h b/include/voice_control_manager.h index cdd8af3..a1aab2b 100644 --- a/include/voice_control_manager.h +++ b/include/voice_control_manager.h @@ -164,6 +164,22 @@ typedef bool (*vc_mgr_all_result_cb)(vc_result_event_e event, vc_cmd_list_h vc_c typedef void (*vc_mgr_pre_result_cb)(vc_pre_result_event_e event, const char *result, void *user_data); /** +* @brief Called when client gets the specific engine's result from vc-service. +* @since_tizen 5.0 +* +* @param[in] engine_app_id The specific engine's app id +* @param[in] event The specific engine event type +* @param[in] result The specific engine result +* @param[in] user_data The user data passed from the callback registration function +* +* @pre An application registers callback function using vc_mgr_set_specific_engine_result_cb(). +* +* @see vc_mgr_set_specific_engine_result_cb() +* @see vc_mgr_unset_specific_engine_result_cb() +*/ +typedef void (*vc_mgr_specific_engine_result_cb)(const char* engine_app_id, const char* event, const char* result, void *user_data); + +/** * @brief Called when user speaking is detected. * @since_tizen 5.0 * @@ -230,6 +246,38 @@ typedef int (*vc_mgr_private_data_set_cb)(const char *key, const char *data, voi */ typedef int (*vc_mgr_private_data_requested_cb)(const char *key, char **data, void *user_data); +/* for TTS feedback */ +/** +* @brief Called when engine sends audio formats necessary for playing TTS feedback +* +* @param[in] rate Audio sampling rate +* @param[in] channel Audio channel (e.g. #VC_AUDIO_CHANNEL_MONO, #VC_AUDIO_CHANNEL_STEREO) +* @param[in] audio_type Audio type (e.g. #VC_AUDIO_TYPE_PCM_S16_LE, #VC_AUDIO_TYPE_PCM_U8) +* @param[in] user_data The user data passed from the callback registration function +* +* @pre An application registers callback function using vc_mgr_set_feedback_audio_format_cb(). +* +* @see vc_mgr_set_feedback_audio_format_cb() +* @see vc_mgr_unset_feedback_audio_format_cb() +*/ +typedef void (*vc_mgr_feedback_audio_format_cb)(int rate, vc_audio_channel_e channel, vc_audio_type_e audio_type, void *user_data); + +/** +* @brief Called when engine sends audio streaming for TTS feedback +* +* @param[in] event TTS feedback event (e.g. #VC_FEEDBACK_EVENT_START, #VC_FEEDBACK_EVENT_CONTINUE) +* @param[in] buffer Audio streaming data +* @param[in] len Length of the audio streaming data +* @param[in] user_data The user data passed from the callback registration function +* +* @pre An application registers callback function using vc_mgr_set_feedback_streaming_cb(). +* +* @see vc_mgr_set_feedback_streaming_cb() +* @see vc_mgr_unset_feedback_streaming_cb() +*/ +typedef void (*vc_mgr_feedback_streaming_cb)(vc_feedback_event_e event, char* buffer, int len, void *user_data); + + /** * @platform * @brief Initializes the voice control manager. @@ -745,6 +793,23 @@ int vc_mgr_get_private_data(const char *key, char **data); int vc_mgr_do_action(vc_send_event_type_e type, char *send_event); /** +* @brief Sends the specific engine request to the vc-service. +* @since_tizen 5.0 +* +* @param[in] engine_app_id A specific engine's app id +* @param[in] event A engine service user request event +* @param[in] request A engine service user request text +* +* @return 0 on success, otherwise a negative error value +* @retval #VC_ERROR_NONE Successful +* @retval #VC_ERROR_OUT_OF_MEMORY Not enough memory +* @retval #VC_ERROR_INVALID_STATE Invalid state +* @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter +* @retval #VC_ERROR_OPERATION_FAILED Operation failure +*/ +int vc_mgr_send_specific_engine_request(const char* engine_app_id, const char* event, const char* request); + +/** * @platform * @brief Starts recognition. * @since_tizen 5.0 @@ -975,6 +1040,42 @@ int vc_mgr_set_pre_result_cb(vc_mgr_pre_result_cb callback, void *user_data); int vc_mgr_unset_pre_result_cb(void); /** +* @brief Registers a callback function for getting specific engine result. +* @since_tizen 5.0 +* +* @param[in] callback Callback function to register +* @param[in] user_data The user data to be passed to the callback function +* +* @return 0 on success, otherwise a negative error value +* @retval #VC_ERROR_NONE Successful +* @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter +* @retval #VC_ERROR_INVALID_STATE Invalid state +* @retval #VC_ERROR_PERMISSION_DENIED Permission denied +* @retval #VC_ERROR_NOT_SUPPORTED Not supported +* +* @pre The state should be #VC_STATE_INITIALIZED. +* +* @see vc_mgr_unset_specific_engine_result_cb() +*/ +int vc_mgr_set_specific_engine_result_cb(vc_mgr_specific_engine_result_cb callback, void* user_data); + +/** +* @brief Unregisters the specific engine result callback function. +* @since_tizen 5.0 +* +* @return 0 on success, otherwise a negative error value +* @retval #VC_ERROR_NONE Successful +* @retval #VC_ERROR_INVALID_STATE Invalid state +* @retval #VC_ERROR_PERMISSION_DENIED Permission denied +* @retval #VC_ERROR_NOT_SUPPORTED Not supported +* +* @pre The state should be #VC_STATE_INITIALIZED. +* +* @see vc_mgr_set_specific_engine_result_cb() +*/ +int vc_mgr_unset_specific_engine_result_cb(void); + +/** * @platform * @brief Sets a callback function for getting all types of recognition results. * @since_tizen 5.0 @@ -1451,6 +1552,107 @@ int vc_mgr_set_private_data_requested_cb(vc_mgr_private_data_requested_cb callba */ int vc_mgr_unset_private_data_requested_cb(void); +/* for TTS feedback */ +/** +* @brief Sets a callback function to be called when engine sends audio formats necessary for playing TTS feedback. +* +* @param[in] callback Callback function to set +* @param[in] user_data The user data to be passed to the callback function +* +* @return 0 on success, otherwise a negative error value +* @retval #VC_ERROR_NONE Successful +* @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter +* @retval #VC_ERROR_INVALID_STATE Invalid state +* +* @pre The state should be #VC_STATE_INITIALIZED. +* +* @see vc_mgr_feedback_audio_format_cb() +* @see vc_mgr_unset_feedback_audio_format_cb() +*/ +int vc_mgr_set_feedback_audio_format_cb(vc_mgr_feedback_audio_format_cb callback, void* user_data); + +/** +* @brief Unsets a callback function to be called when engine sends audio formats necessary for playing TTS feedback. +* +* @return 0 on success, otherwise a negative error value +* @retval #VC_ERROR_NONE Successful +* @retval #VC_ERROR_INVALID_STATE Invalid state +* +* @pre The state should be #VC_STATE_INITIALIZED. +* +* @see vc_mgr_feedback_audio_format_cb() +* @see vc_mgr_set_feedback_audio_format_cb() +*/ +int vc_mgr_unset_feedback_audio_format_cb(void); + +/** +* @brief Sets a callback function to be called when engine sends audio streaming for TTS feedback. +* +* @param[in] callback Callback function to set +* @param[in] user_data The user data to be passed to the callback function +* +* @return 0 on success, otherwise a negative error value +* @retval #VC_ERROR_NONE Successful +* @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter +* @retval #VC_ERROR_INVALID_STATE Invalid state +* +* @pre The state should be #VC_STATE_INITIALIZED. +* +* @see vc_mgr_feedback_streaming_cb() +* @see vc_mgr_unset_feedback_streaming_cb() +*/ +int vc_mgr_set_feedback_streaming_cb(vc_mgr_feedback_streaming_cb callback, void* user_data); + +/** +* @brief Unsets a callback function to be called when engine sends audio streaming for TTS feedback. +* +* @return 0 on success, otherwise a negative error value +* @retval #VC_ERROR_NONE Successful +* @retval #VC_ERROR_INVALID_STATE Invalid state +* +* @pre The state should be #VC_STATE_INITIALIZED. +* +* @see vc_mgr_feedback_streaming_cb() +* @see vc_mgr_set_feedback_streaming_cb() +*/ +int vc_mgr_unset_feedback_streaming_cb(void); + +/** +* @brief Starts getting TTS feedback streaming data from the buffer. +* +* @remarks In order to get TTS feedback streaming data, the application should set 'vc_mgr_feedback_streaming_cb()' using vc_mgr_set_feedback_streaming_cb(). +* +* @return 0 on success, otherwise a negative error value +* @retval #VC_ERROR_NONE Successful +* @retval #VC_ERROR_INVALID_STATE Invalid state +* +* @pre The state should be #VC_STATE_READY. \n +* 'vc_mgr_feedback_streaming_cb()' should be registered. +* +* @see vc_mgr_feedback_streaming_cb() +* @see vc_mgr_set_feedback_streaming_cb() +* @see vc_mgr_unset_feedback_streaming_cb() +* @see vc_mgr_stop_feedback() +*/ +int vc_mgr_start_feedback(void); + +/** +* @brief Stops getting and removes TTS feedback streaming data from the buffer. +* +* @return 0 on success, otherwise a negative error value +* @retval #VC_ERROR_NONE Successful +* @retval #VC_ERROR_INVALID_STATE Invalid state +* +* @pre The state should be #VC_STATE_READY. +* +* @see vc_mgr_feedback_streaming_cb() +* @see vc_mgr_set_feedback_streaming_cb() +* @see vc_mgr_unset_feedback_streaming_cb() +* @see vc_mgr_start_feedback() +*/ +int vc_mgr_stop_feedback(void); + + #ifdef __cplusplus } #endif diff --git a/server/vcd_client_data.c b/server/vcd_client_data.c index 4ae7bb3..6953e17 100644 --- a/server/vcd_client_data.c +++ b/server/vcd_client_data.c @@ -769,6 +769,38 @@ vcd_recognition_mode_e vcd_client_get_recognition_mode() return g_recognition_mode; } +int vcd_client_set_server_dialog(int pid, bool is_server_dialog) +{ + vc_client_info_s* client_info = NULL; + + client_info = __client_get_element(pid); + if (NULL == client_info) { + SLOG(LOG_ERROR, TAG_VCD, "[Client Data ERROR] vcd_client_get_pid : pid(%d) is not found", pid); + return VCD_ERROR_INVALID_PARAMETER; + } + + client_info->server_dialog = is_server_dialog; + + SLOG(LOG_DEBUG, TAG_VCD, "[Client Data] Set server dialog, client pid(%d), server_dialog(%d)", pid, client_info->server_dialog); + return 0; +} + +int vcd_client_get_server_dialog(int pid, bool* is_server_dialog) +{ + vc_client_info_s* client_info = NULL; + + client_info = __client_get_element(pid); + if (NULL == client_info) { + SLOG(LOG_ERROR, TAG_VCD, "[Client Data ERROR] vcd_client_get_pid : pid(%d) is not found", pid); + return VCD_ERROR_INVALID_PARAMETER; + } + + *is_server_dialog = client_info->server_dialog; + + SLOG(LOG_DEBUG, TAG_VCD, "[Client Data] Get server dialog, client pid(%d), server_dialog(%d)", pid, *is_server_dialog); + return 0; +} + int vcd_client_append_cmd_from_type(int type, vc_cmd_list_h list) { GSList *item = NULL; @@ -998,6 +1030,7 @@ int vcd_client_add(int pid) info->fg_cmd = false; info->bg_cmd = false; info->exclusive_cmd = false; + info->server_dialog = false; /* Add item to global list */ g_client_list = g_slist_append(g_client_list, info); diff --git a/server/vcd_client_data.h b/server/vcd_client_data.h index 3ee5f0d..6060c81 100644 --- a/server/vcd_client_data.h +++ b/server/vcd_client_data.h @@ -155,6 +155,11 @@ int vcd_client_unset_exclusive_command(int pid); int vcd_client_save_client_info(); void vcd_client_update_foreground_pid(); + +int vcd_client_set_server_dialog(int pid, bool is_server_dialog); + +int vcd_client_get_server_dialog(int pid, bool* is_server_dialog); + /* * widget API */ diff --git a/server/vcd_dbus.c b/server/vcd_dbus.c old mode 100755 new mode 100644 index 250e5a0..5b3d4ee --- a/server/vcd_dbus.c +++ b/server/vcd_dbus.c @@ -405,6 +405,42 @@ int vcdc_send_pre_result_to_manager(int manager_pid, int event, const char* pre_ return 0; } +int vcdc_send_specific_engine_result_to_manager(int manager_pid, const char* engine_app_id, const char* event, const char* result) +{ + SLOG(LOG_DEBUG, TAG_VCD, "[VCDC] send specific engine result to manager, mgr pid(%d), engine app id(%s), event(%s), result(%s),", + manager_pid, engine_app_id, event, result); + + if (0 != __dbus_check()) { + return VCD_ERROR_OPERATION_FAILED; + } + + DBusError err; + dbus_error_init(&err); + + DBusMessage* msg = NULL; + + msg = __get_message(manager_pid, VCD_MANAGER_METHOD_SPECIFIC_ENGINE_RESULT, VCD_CLIENT_TYPE_MANAGER); + + if (NULL == msg) { + SLOG(LOG_ERROR, TAG_VCD, "[Dbus ERROR] Message is NULL"); + return VCD_ERROR_OUT_OF_MEMORY; + } + + dbus_message_append_args(msg, DBUS_TYPE_STRING, &engine_app_id, DBUS_TYPE_STRING, &event, DBUS_TYPE_STRING, &result, DBUS_TYPE_INVALID); + + dbus_message_set_no_reply(msg, TRUE); + + if (1 != dbus_connection_send(g_conn_sender, msg, NULL)) { + SLOG(LOG_ERROR, TAG_VCD, "[Dbus ERROR] Fail to Send"); + return VCD_ERROR_OPERATION_FAILED; + } else { + SLOG(LOG_DEBUG, TAG_VCD, "[Dbus] SUCCESS Send"); + dbus_connection_flush(g_conn_sender); + } + + return 0; +} + int vcdc_send_result_to_manager(int manger_pid, int result_type) { if (0 != __dbus_check()) { @@ -902,6 +938,90 @@ int vcdc_send_request_get_private_data(int pid, const char* key, char** data) return result; } +int vcdc_send_feedback_audio_format_to_manager(int manager_pid, int rate, vc_audio_channel_e channel, vce_audio_type_e audio_type) +{ + SLOG(LOG_INFO, TAG_VCD, "[Dbus] Send TTS feedback audio format : manager_pid(%d), rate(%d), audio channel(%d), audio type(%d)", manager_pid, rate, channel, audio_type); + + if (0 != __dbus_check()) { + return VCD_ERROR_OPERATION_FAILED; + } + + DBusError err; + dbus_error_init(&err); + + /* make dbus message */ + DBusMessage* msg = NULL; + msg = __get_message(manager_pid, VCD_MANAGER_METHOD_FEEDBACK_AUDIO_FORMAT, VCD_CLIENT_TYPE_MANAGER); + if (NULL == msg) { + SLOG(LOG_ERROR, TAG_VCD, "[Dbus ERROR] Message is NULL"); + return VCD_ERROR_OUT_OF_MEMORY; + } + + dbus_message_append_args(msg, + DBUS_TYPE_INT32, &rate, + DBUS_TYPE_INT32, &channel, + DBUS_TYPE_INT32, &audio_type, + DBUS_TYPE_INVALID); + + dbus_message_set_no_reply(msg, TRUE); + + int ret = VCD_ERROR_NONE; + + if (1 != dbus_connection_send(g_conn_sender, msg, NULL)) { + SLOG(LOG_ERROR, TAG_VCD, "[Dbus ERROR] Fail to Send"); + ret = VCD_ERROR_OPERATION_FAILED; + } else { + SLOG(LOG_INFO, TAG_VCD, "[Dbus] SUCCESS Send"); + dbus_connection_flush(g_conn_sender); + } + + dbus_message_unref(msg); + + return ret; +} + +int vcdc_send_feedback_streaming_to_manager(int manager_pid, vc_feedback_event_e event, char* buffer, int len) +{ + SLOG(LOG_INFO, TAG_VCD, "[Dbus] Send TTS feedback streaming : manager_pid(%d), feedback event(%d), buffer(%p), length(%d)", manager_pid, event, buffer, len); + + if (0 != __dbus_check()) { + return VCD_ERROR_OPERATION_FAILED; + } + + DBusError err; + dbus_error_init(&err); + + /* make dbus message */ + DBusMessage* msg = NULL; + msg = __get_message(manager_pid, VCD_MANAGER_METHOD_FEEDBACK_STREAMING, VCD_CLIENT_TYPE_MANAGER); + if (NULL == msg) { + SLOG(LOG_ERROR, TAG_VCD, "[Dbus ERROR] Message is NULL"); + return VCD_ERROR_OUT_OF_MEMORY; + } + + dbus_message_append_args(msg, + DBUS_TYPE_INT32, &event, + DBUS_TYPE_ARRAY, DBUS_TYPE_BYTE, + &buffer, len, + DBUS_TYPE_INVALID); + + dbus_message_set_no_reply(msg, TRUE); + + int ret = VCD_ERROR_NONE; + + if (1 != dbus_connection_send(g_conn_sender, msg, NULL)) { + SLOG(LOG_ERROR, TAG_VCD, "[Dbus ERROR] Fail to Send"); + ret = VCD_ERROR_OPERATION_FAILED; + } else { + SLOG(LOG_INFO, TAG_VCD, "[Dbus] SUCCESS Send"); + dbus_connection_flush(g_conn_sender); + } + + dbus_message_unref(msg); + + return ret; +} + static Eina_Bool listener_event_callback(void* data, Ecore_Fd_Handler *fd_handler) { if (NULL == g_conn_listener) return ECORE_CALLBACK_RENEW; @@ -970,12 +1090,21 @@ static Eina_Bool listener_event_callback(void* data, Ecore_Fd_Handler *fd_handle else if (dbus_message_is_method_call(msg, VC_SERVER_SERVICE_INTERFACE, VC_MANAGER_METHOD_DO_ACTION)) vcd_dbus_server_mgr_do_action(g_conn_listener, msg); + else if (dbus_message_is_method_call(msg, VC_SERVER_SERVICE_INTERFACE, VC_MANAGER_METHOD_SPECIFIC_ENGINE_REQUEST)) + vcd_dbus_server_mgr_send_specific_engine_request(g_conn_listener, msg); + else if (dbus_message_is_method_call(msg, VC_SERVER_SERVICE_INTERFACE, VC_MANAGER_METHOD_ENABLE_COMMAND_TYPE)) vcd_dbus_server_mgr_enable_command_type(g_conn_listener, msg); else if (dbus_message_is_method_call(msg, VC_SERVER_SERVICE_INTERFACE, VC_MANAGER_METHOD_DISABLE_COMMAND_TYPE)) vcd_dbus_server_mgr_disable_command_type(g_conn_listener, msg); + else if (dbus_message_is_method_call(msg, VC_SERVER_SERVICE_INTERFACE, VC_MANAGER_METHOD_START_FEEDBACK)) + vcd_dbus_server_mgr_start_feedback(g_conn_listener, msg); + + else if (dbus_message_is_method_call(msg, VC_SERVER_SERVICE_INTERFACE, VC_MANAGER_METHOD_STOP_FEEDBACK)) + vcd_dbus_server_mgr_stop_feedback(g_conn_listener, msg); + /* client event */ else if (dbus_message_is_method_call(msg, VC_SERVER_SERVICE_INTERFACE, VC_METHOD_INITIALIZE)) vcd_dbus_server_initialize(g_conn_listener, msg); @@ -995,6 +1124,9 @@ static Eina_Bool listener_event_callback(void* data, Ecore_Fd_Handler *fd_handle else if (dbus_message_is_method_call(msg, VC_SERVER_SERVICE_INTERFACE, VC_METHOD_SET_FOREGROUND)) vcd_dbus_server_set_foreground(g_conn_listener, msg); + else if (dbus_message_is_method_call(msg, VC_SERVER_SERVICE_INTERFACE, VC_METHOD_SET_SERVER_DIALOG)) + vcd_dbus_server_set_server_dialog(g_conn_listener, msg); + else if (dbus_message_is_method_call(msg, VC_SERVER_SERVICE_INTERFACE, VC_METHOD_DIALOG)) vcd_dbus_server_dialog(g_conn_listener, msg); diff --git a/server/vcd_dbus.h b/server/vcd_dbus.h index d4674ec..0dbe188 100644 --- a/server/vcd_dbus.h +++ b/server/vcd_dbus.h @@ -48,6 +48,8 @@ int vcdc_send_asr_result(int pid, int event, const char* asr_result, int cmd_typ int vcdc_send_pre_result_to_manager(int manager_pid, int event, const char* pre_result); +int vcdc_send_specific_engine_result_to_manager(int manager_pid, const char* engine_app_id, const char* event, const char* result); + int vcdc_send_result_to_manager(int manger_pid, int result_type); int vcdc_send_speech_detected(int manger_pid); @@ -66,6 +68,12 @@ int vcdc_send_request_set_private_data(int pid, const char* key, const char* dat int vcdc_send_request_get_private_data(int pid, const char* key, char** data); +/* for TTS feedback */ +int vcdc_send_feedback_audio_format_to_manager(int manager_pid, int rate, vc_audio_channel_e channel, vce_audio_type_e audio_type); + +int vcdc_send_feedback_streaming_to_manager(int manager_pid, vc_feedback_event_e event, char* buffer, int len); + + #ifdef __cplusplus } #endif diff --git a/server/vcd_dbus_server.c b/server/vcd_dbus_server.c old mode 100755 new mode 100644 index 6a6a15d..297ef13 --- a/server/vcd_dbus_server.c +++ b/server/vcd_dbus_server.c @@ -620,6 +620,39 @@ int vcd_dbus_server_mgr_get_private_data(DBusConnection* conn, DBusMessage* msg) return 0; } +int vcd_dbus_server_mgr_send_specific_engine_request(DBusConnection* conn, DBusMessage* msg) +{ + DBusError err; + dbus_error_init(&err); + + int pid = 0; + char* engine_app_id = NULL; + char* event = NULL; + char* request = NULL; + + int ret = VCD_ERROR_OPERATION_FAILED; + + SLOG(LOG_DEBUG, TAG_VCD, "@@@ VCD Manager specific engine request"); + + dbus_message_get_args(msg, &err, + DBUS_TYPE_INT32, &pid, + DBUS_TYPE_STRING, &engine_app_id, + DBUS_TYPE_STRING, &event, + DBUS_TYPE_STRING, &request, + DBUS_TYPE_INVALID); + + if (dbus_error_is_set(&err)) { + SLOG(LOG_ERROR, TAG_VCD, "[IN ERROR] vcd mgr specific engine request : get arguments error (%s)", err.message); + dbus_error_free(&err); + ret = VCD_ERROR_OPERATION_FAILED; + } else { + ret = vcd_server_mgr_send_specific_engine_request(pid, engine_app_id, event, request); + SLOG(LOG_DEBUG, TAG_VCD, "[IN] vcd mgr specific engine request : pid(%d), engine_app_id(%s), event(%s), request(%s), ret(%d)", pid, engine_app_id, event, request, ret); + } + + return 0; +} + int vcd_dbus_server_mgr_set_domain(DBusConnection* conn, DBusMessage* msg) { DBusError err; @@ -630,7 +663,7 @@ int vcd_dbus_server_mgr_set_domain(DBusConnection* conn, DBusMessage* msg) int ret = VCD_ERROR_OPERATION_FAILED; - SLOG(LOG_DEBUG, TAG_VCD, "@@@ VCD Manager set audio type"); + SLOG(LOG_DEBUG, TAG_VCD, "@@@ VCD Manager set domain type"); dbus_message_get_args(msg, &err, DBUS_TYPE_INT32, &pid, @@ -1033,6 +1066,114 @@ int vcd_dbus_server_mgr_result_selection(DBusConnection* conn, DBusMessage* msg) */ } +/* for TTS feedback */ +int vcd_dbus_server_mgr_start_feedback(DBusConnection* conn, DBusMessage* msg) +{ + DBusError err; + dbus_error_init(&err); + + int pid = 0; + + int ret = VCD_ERROR_OPERATION_FAILED; + + SLOG(LOG_DEBUG, TAG_VCD, "@@@ VCD Manager start TTS feedback"); + + dbus_message_get_args(msg, &err, + DBUS_TYPE_INT32, &pid, + DBUS_TYPE_INVALID); + + if (dbus_error_is_set(&err)) { + SLOG(LOG_ERROR, TAG_VCD, "[ERROR] vcd mgr start TTS feedback : get arguments error (%s)", err.message); + dbus_error_free(&err); + ret = VCD_ERROR_OPERATION_FAILED; + } else { + SLOG(LOG_DEBUG, TAG_VCD, "[DEBUG] vcd mgr start TTS feedback : pid(%d)", pid); + ret = vcd_server_mgr_start_feedback(); + } + + DBusMessage* reply; + reply = dbus_message_new_method_return(msg); + + if (NULL != reply) { + dbus_message_append_args(reply, + DBUS_TYPE_INT32, &ret, + DBUS_TYPE_INVALID); + + if (0 == ret) { + SLOG(LOG_DEBUG, TAG_VCD, "[SUCCESS] Result(%d)", ret); + } else { + SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Result(%d)", ret); + } + + if (!dbus_connection_send(conn, reply, NULL)) { + SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Out of Memory"); + } + + dbus_connection_flush(conn); + dbus_message_unref(reply); + } else { + SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to create reply message"); + } + + SLOG(LOG_DEBUG, TAG_VCD, "@@@"); + + return 0; +} + +int vcd_dbus_server_mgr_stop_feedback(DBusConnection* conn, DBusMessage* msg) +{ + DBusError err; + dbus_error_init(&err); + + int pid = 0; + + int ret = VCD_ERROR_OPERATION_FAILED; + + SLOG(LOG_DEBUG, TAG_VCD, "@@@ VCD Manager stop TTS feedback"); + + dbus_message_get_args(msg, &err, + DBUS_TYPE_INT32, &pid, + DBUS_TYPE_INVALID); + + if (dbus_error_is_set(&err)) { + SLOG(LOG_ERROR, TAG_VCD, "[ERROR] vcd mgr stop TTS feedback : get arguments error (%s)", err.message); + dbus_error_free(&err); + ret = VCD_ERROR_OPERATION_FAILED; + } else { + SLOG(LOG_DEBUG, TAG_VCD, "[DEBUG] vcd mgr stop TTS feedback : pid(%d)", pid); + ret = vcd_server_mgr_stop_feedback(); + } + + DBusMessage* reply; + reply = dbus_message_new_method_return(msg); + + if (NULL != reply) { + dbus_message_append_args(reply, + DBUS_TYPE_INT32, &ret, + DBUS_TYPE_INVALID); + + if (0 == ret) { + SLOG(LOG_DEBUG, TAG_VCD, "[SUCCESS] Result(%d)", ret); + } else { + SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Result(%d)", ret); + } + + if (!dbus_connection_send(conn, reply, NULL)) { + SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Out of Memory"); + } + + dbus_connection_flush(conn); + dbus_message_unref(reply); + } else { + SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to create reply message"); + } + + SLOG(LOG_DEBUG, TAG_VCD, "@@@"); + + return 0; +} + + /* * Dbus Server functions for client */ @@ -1330,6 +1471,64 @@ int vcd_dbus_server_set_foreground(DBusConnection* conn, DBusMessage* msg) return 0; } +int vcd_dbus_server_set_server_dialog(DBusConnection* conn, DBusMessage* msg) +{ + DBusError err; + dbus_error_init(&err); + + int pid = -1; + char* app_id = NULL; + char* credential = NULL; + int ret = VCD_ERROR_OPERATION_FAILED; + + dbus_message_get_args(msg, &err, + DBUS_TYPE_INT32, &pid, + DBUS_TYPE_STRING, &app_id, + DBUS_TYPE_STRING, &credential, + DBUS_TYPE_INVALID); + + SLOG(LOG_DEBUG, TAG_VCD, "@@@ VCD set server dialog"); + + if (dbus_error_is_set(&err)) { + SLOG(LOG_ERROR, TAG_VCD, "[IN ERROR] vcd set server dialog : get arguments error (%s)", err.message); + dbus_error_free(&err); + ret = VCD_ERROR_OPERATION_FAILED; + } else { + SLOG(LOG_DEBUG, TAG_VCD, "[IN] vcd set server dialog : pid(%d), app_id(%s)", pid, app_id); + ret = vcd_server_set_server_dialog(pid, app_id, credential); + } + + DBusMessage* reply; + reply = dbus_message_new_method_return(msg); + + if (NULL != reply) { + if (0 == ret) { + /* Append result and language */ + dbus_message_append_args(reply, DBUS_TYPE_INT32, &ret, DBUS_TYPE_INVALID); + + SLOG(LOG_DEBUG, TAG_VCD, "[OUT SUCCESS] Result(%d)", ret); + } else { + dbus_message_append_args(reply, DBUS_TYPE_INT32, &ret, DBUS_TYPE_INVALID); + + SLOG(LOG_ERROR, TAG_VCD, "[OUT ERROR] Result(%d)", ret); + } + + if (!dbus_connection_send(conn, reply, NULL)) { + SLOG(LOG_ERROR, TAG_VCD, "[OUT ERROR] Out Of Memory!"); + } + + dbus_connection_flush(conn); + dbus_message_unref(reply); + } else { + SLOG(LOG_ERROR, TAG_VCD, "[OUT ERROR] Fail to create reply message!!"); + } + + SLOG(LOG_DEBUG, TAG_VCD, "@@@"); + + return 0; + +} + int vcd_dbus_server_dialog(DBusConnection* conn, DBusMessage* msg) { DBusError err; diff --git a/server/vcd_dbus_server.h b/server/vcd_dbus_server.h index caa87df..1456536 100644 --- a/server/vcd_dbus_server.h +++ b/server/vcd_dbus_server.h @@ -67,6 +67,14 @@ int vcd_dbus_server_mgr_enable_command_type(DBusConnection* conn, DBusMessage* m int vcd_dbus_server_mgr_disable_command_type(DBusConnection* conn, DBusMessage* msg); +int vcd_dbus_server_mgr_send_specific_engine_request(DBusConnection* conn, DBusMessage* msg); + +/* for TTS feedback */ +int vcd_dbus_server_mgr_start_feedback(DBusConnection* conn, DBusMessage* msg); + +int vcd_dbus_server_mgr_stop_feedback(DBusConnection* conn, DBusMessage* msg); + + /* * Dbus Server functions for client */ @@ -85,6 +93,8 @@ int vcd_dbus_server_unset_command(DBusConnection* conn, DBusMessage* msg); int vcd_dbus_server_set_foreground(DBusConnection* conn, DBusMessage* msg); +int vcd_dbus_server_set_server_dialog(DBusConnection* conn, DBusMessage* msg); + int vcd_dbus_server_dialog(DBusConnection* conn, DBusMessage* msg); int vcd_dbus_server_is_system_command_valid(DBusConnection* conn, DBusMessage* msg); diff --git a/server/vcd_engine_agent.c b/server/vcd_engine_agent.c index bd3ecea..da79346 100644 --- a/server/vcd_engine_agent.c +++ b/server/vcd_engine_agent.c @@ -42,7 +42,7 @@ typedef struct { bool use_network; void *handle; - vc_engine_callback_s* callbacks; + vce_request_callback_s* callbacks; } vcengine_s; typedef struct _vcengine_info { @@ -94,7 +94,7 @@ int vcd_engine_agent_init() g_dynamic_engine.handle = NULL; g_dynamic_engine.is_command_ready = false; - g_dynamic_engine.callbacks = (vc_engine_callback_s*)calloc(1, sizeof(vc_engine_callback_s)); + g_dynamic_engine.callbacks = (vce_request_callback_s*)calloc(1, sizeof(vce_request_callback_s)); if (NULL == g_dynamic_engine.callbacks) { SLOG(LOG_ERROR, TAG_VCD, "[Engine Agent] Fail to allocate memory"); return VCD_ERROR_OUT_OF_MEMORY; @@ -186,7 +186,7 @@ int __internal_get_engine_info(vce_request_callback_s* callback) free(g_dynamic_engine.callbacks); g_dynamic_engine.callbacks = NULL; } - g_dynamic_engine.callbacks = (vc_engine_callback_s*)calloc(1, sizeof(vc_engine_callback_s)); + g_dynamic_engine.callbacks = (vce_request_callback_s*)calloc(1, sizeof(vce_request_callback_s)); if (NULL == g_dynamic_engine.callbacks) { SLOG(LOG_ERROR, TAG_VCD, "[Engine Agent ERROR] Fail to allocate memory"); return VCD_ERROR_OUT_OF_MEMORY; @@ -208,6 +208,7 @@ int __internal_get_engine_info(vce_request_callback_s* callback) g_dynamic_engine.callbacks->cancel = callback->cancel; g_dynamic_engine.callbacks->set_domain = callback->set_domain; g_dynamic_engine.callbacks->set_audio_type = callback->set_audio_type; + g_dynamic_engine.callbacks->set_server_dialog = callback->set_server_dialog; g_dynamic_engine.callbacks->process_text = callback->process_text; g_dynamic_engine.callbacks->process_list_event = callback->process_list_event; g_dynamic_engine.callbacks->process_haptic_event = callback->process_haptic_event; @@ -215,6 +216,7 @@ int __internal_get_engine_info(vce_request_callback_s* callback) g_dynamic_engine.callbacks->private_data_set = NULL; g_dynamic_engine.callbacks->private_data_request = NULL; g_dynamic_engine.callbacks->nlu_base_info_request = NULL; + g_dynamic_engine.callbacks->specific_engine_request = NULL; SLOG(LOG_DEBUG, TAG_VCD, "@@@ Valid Engine"); SLOG(LOG_DEBUG, TAG_VCD, "Engine uuid : %s", g_dynamic_engine.engine_uuid); @@ -266,6 +268,7 @@ int vcd_engine_agent_load_current_engine(vce_request_callback_s* callback) NULL == g_dynamic_engine.callbacks->stop || NULL == g_dynamic_engine.callbacks->cancel || NULL == g_dynamic_engine.callbacks->set_audio_type || + NULL == g_dynamic_engine.callbacks->set_server_dialog || NULL == g_dynamic_engine.callbacks->set_domain || NULL == g_dynamic_engine.callbacks->process_text || NULL == g_dynamic_engine.callbacks->process_list_event || @@ -472,6 +475,25 @@ int vcd_engine_set_audio_type(const char* audio) return 0; } +int vcd_engine_set_server_dialog(const char* app_id, const char* credential) +{ + if (false == g_agent_init) { + SLOG(LOG_ERROR, TAG_VCD, "[Engine Agent ERROR] Not Initialized"); + return VCD_ERROR_OPERATION_FAILED; + } + + int ret = -1; + if (true == g_dynamic_engine.is_loaded) { + ret = g_dynamic_engine.callbacks->set_server_dialog(app_id, credential); + if (0 != ret) { + SLOG(LOG_ERROR, TAG_VCD, "[Engine Agent ERROR] Fail to set server dialog (%d)", ret); + return ret; + } + } + + return 0; +} + int vcd_engine_set_domain(int pid, const char* domain) { if (false == g_agent_init) { @@ -567,6 +589,28 @@ int vcd_engine_get_private_data(int pid, const char* key, char** data) return 0; } +int vcd_engine_send_specific_engine_request(const char* engine_app_id, const char* event, const char* request) +{ + if (false == g_agent_init) { + SLOG(LOG_ERROR, TAG_VCD, "[Engine Agent ERROR] Not Initialized"); + return VCD_ERROR_OPERATION_FAILED; + } + + int ret = -1; + if (true == g_dynamic_engine.is_loaded && NULL != g_dynamic_engine.callbacks->specific_engine_request) { + ret = g_dynamic_engine.callbacks->specific_engine_request(engine_app_id, event, request); + if (0 != ret) { + SLOG(LOG_ERROR, TAG_VCD, "[Engine Agent ERROR] Fail to set specific engine request (%d)", ret); + return VCD_ERROR_OPERATION_FAILED; + } + } else { + SLOG(LOG_ERROR, TAG_VCD, "[Engine Agent ERROR] Engine is not loaded or There is no specific_engine_request callback"); + return VCD_ERROR_OPERATION_FAILED; + } + + return 0; +} + int vcd_engine_process_text(int pid, const char* text) { if (false == g_agent_init) { @@ -844,3 +888,19 @@ int vcd_engine_agent_set_nlu_base_info_requested_cb(vce_nlu_base_info_requested_ return VCD_ERROR_NONE; } +int vcd_engine_agent_set_specific_engine_request_cb(vce_specific_engine_request_cb callback_func) +{ + if (false == g_agent_init) { + SLOG(LOG_ERROR, TAG_VCD, "[Engine Agent ERROR] Not Initialized"); + return VCD_ERROR_OPERATION_FAILED; + } + + if (false == g_dynamic_engine.is_loaded) { + SLOG(LOG_ERROR, TAG_VCD, "[Engine Agent ERROR] Not loaded engine"); + return VCD_ERROR_OPERATION_FAILED; + } + + g_dynamic_engine.callbacks->specific_engine_request = callback_func; + + return VCD_ERROR_NONE; +} diff --git a/server/vcd_engine_agent.h b/server/vcd_engine_agent.h index a327584..4dc5e25 100644 --- a/server/vcd_engine_agent.h +++ b/server/vcd_engine_agent.h @@ -66,6 +66,8 @@ int vcd_engine_recognize_cancel(); int vcd_engine_set_audio_type(const char* audio); +int vcd_engine_set_server_dialog(const char* app_id, const char* credential); + int vcd_engine_set_domain(int pid, const char* domain); int vcd_engine_get_nlu_base_info(int pid, const char* key, char** value); @@ -74,6 +76,8 @@ int vcd_engine_set_private_data(int pid, const char* key, const char* data); int vcd_engine_get_private_data(int pid, const char* key, char** data); +int vcd_engine_send_specific_engine_request(const char* engine_app_id, const char* event, const char* request); + int vcd_engine_process_text(int pid, const char* text); int vcd_engine_process_list_event(int pid, const char* event); @@ -101,6 +105,7 @@ int vcd_engine_agent_set_private_data_requested_cb(vce_private_data_requested_cb int vcd_engine_agent_set_nlu_base_info_requested_cb(vce_nlu_base_info_requested_cb callback_func); +int vcd_engine_agent_set_specific_engine_request_cb(vce_specific_engine_request_cb callback_func); #ifdef __cplusplus } diff --git a/server/vcd_main.h b/server/vcd_main.h index 72e105c..a9f7943 100644 --- a/server/vcd_main.h +++ b/server/vcd_main.h @@ -32,6 +32,8 @@ #include "vc_defs.h" #include "vce.h" +#include "voice_control_common.h" + #ifdef __cplusplus extern "C" { @@ -76,43 +78,6 @@ typedef struct { int index; } vce_cmd_s; -typedef struct { - int version; /**< Version */ - - /* Mandatory callbacks */ - /* Get engine information */ - vce_get_info_cb get_info; /**< Called when the engine service user requests the basic information of VC engine */ - vce_get_recording_format_cb get_recording_format; /**< Get recording format */ - vce_foreach_supported_languages_cb foreach_langs; /**< Foreach language list */ - vce_is_language_supported_cb is_lang_supported; /**< Check language */ - - vce_initialize_cb initialize; /**< Initialize engine */ - vce_deinitialize_cb deinitialize; /**< Shutdown engine */ - - /* Set info */ - vce_set_language_cb set_language; /**< Set language */ - vce_set_commands_cb set_commands; /**< Request to set current commands */ - vce_unset_commands_cb unset_commands; /**< Request to unset current commands */ - - /* Control recognition */ - vce_start_cb start; /**< Start recognition */ - vce_set_recording_data_cb set_recording; /**< Set recording data */ - vce_stop_cb stop; /**< Stop recording for getting result */ - vce_cancel_cb cancel; /**< Cancel recording and processing */ - - vce_set_audio_type_cb set_audio_type; /**< Set audio type */ - - vce_set_domain_cb set_domain; /**< Set domain */ - vce_process_text_cb process_text; /**< Request to process text */ - vce_process_list_event_cb process_list_event; /**< Request to process list event */ - vce_process_haptic_event_cb process_haptic_event; /**< Request to process haptic event */ - - /* Optional callbacks */ - vce_private_data_set_cb private_data_set; - vce_private_data_requested_cb private_data_request; - vce_nlu_base_info_requested_cb nlu_base_info_request; -} vc_engine_callback_s; - #ifdef __cplusplus } diff --git a/server/vcd_server.c b/server/vcd_server.c index ef9dc76..d5bf69b 100644 --- a/server/vcd_server.c +++ b/server/vcd_server.c @@ -445,6 +445,21 @@ int vcd_send_asr_result(vce_asr_result_event_e event, const char* asr_result, vo return ret; } +int vcd_send_specific_engine_result(const char* engine_app_id, const char* event, const char* result, void *user_info) +{ + if (NULL != result) { + SLOG(LOG_DEBUG, TAG_VCD, "[Server] specific engine result - Event(%s), Text(%s)", event, result); + vcdc_send_specific_engine_result_to_manager(vcd_client_manager_get_pid(), engine_app_id, event, result); + } + + if (VCD_RECOGNITION_MODE_RESTART_CONTINUOUSLY != vcd_client_get_recognition_mode()) { + vcd_config_set_service_state(VCD_STATE_READY); + vcdc_send_service_state(VCD_STATE_READY); + } + + return VCD_ERROR_NONE; +} + int vcd_send_nlg_result(const char* nlg_result, void *user_data) { int ret = __vcd_server_launch_manager_app(); @@ -1078,6 +1093,36 @@ int vcd_send_error(vce_error_e error, const char* msg, void *user_data) return ret; } +/* for TTS feedback */ +int vcd_send_feedback_audio_format(int rate, vce_audio_channel_e channel, vce_audio_type_e audio_type) +{ + SLOG(LOG_INFO, TAG_VCD, "[Server DEBUG] Engine - Send TTS feedback audio format"); + + /* send TTS feedback audio format to VC manager */ + int ret = VCD_ERROR_NONE; + 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"); + } + + return ret; +} + +int vcd_send_feedback_streaming(vce_feedback_event_e event, char* buffer, int len) +{ + SLOG(LOG_INFO, TAG_VCD, "[Server DEBUG] Engine - Send TTS feedback streaming"); + + /* send TTS feedback streaming to VC manager */ + int ret = VCD_ERROR_NONE; + ret = vcdc_send_feedback_streaming_to_manager(vcd_client_manager_get_pid(), event, buffer, len); + if (VCD_ERROR_NONE != ret) { + SLOG(LOG_ERROR, TAG_VCD, "[Server ERROR] Fail to send TTS feedback streaming to VC manager"); + } + + return ret; +} + + /* * vcd server Interfaces */ @@ -1991,6 +2036,30 @@ int vcd_server_mgr_get_private_data(int pid, const char* key, char** data) return ret; } +int vcd_server_mgr_send_specific_engine_request(int pid, const char* engine_app_id, const char* event, const char* request) +{ + /* 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); + return VCD_ERROR_INVALID_PARAMETER; + } + vcd_state_e state = vcd_config_get_service_state(); + if (VCD_STATE_READY != state) { + SLOG(LOG_ERROR, TAG_VCD, "[Server ERROR] Current state is not ready"); + return VCD_ERROR_INVALID_STATE; + } + + /* Get private data to engine */ + int ret = vcd_engine_send_specific_engine_request(engine_app_id, event, request); + if (0 != ret) { + SLOG(LOG_ERROR, TAG_VCD, "[Server ERROR] Fail to set specific engine request : %d", ret); + } else { + SLOG(LOG_DEBUG, TAG_VCD, "[Server SUCCESS] Set specific engine request "); + } + + return ret; +} + int vcd_server_mgr_do_action(int pid, int type, const char* action) { int ret = -1; @@ -2078,6 +2147,40 @@ int vcd_server_mgr_disable_command_type(int pid, int cmd_type) return ret; } +/* for TTS feedback */ +int vcd_server_mgr_start_feedback(void) +{ + /* check current state */ + /* not Recording??? */ + + if (-1 == vcd_client_manager_get_pid()) { + SLOG(LOG_ERROR, TAG_VCD, "[Server] Manager is NOT available"); + return VCD_ERROR_OPERATION_FAILED; + } + + SLOG(LOG_DEBUG, TAG_VCD, "[Server] start TTS feedback"); + + /* check there is TTS buffer to be spoken */ + + return VCD_ERROR_NONE; +} + +int vcd_server_mgr_stop_feedback(void) +{ + /* check current state */ + /* not Recording??? */ + + if (-1 == vcd_client_manager_get_pid()) { + SLOG(LOG_ERROR, TAG_VCD, "[Server] Manager is NOT available"); + return VCD_ERROR_OPERATION_FAILED; + } + + SLOG(LOG_DEBUG, TAG_VCD, "[Server] stop TTS feedback"); + + return VCD_ERROR_NONE; +} + + /* * VC Server Functions for Client */ @@ -2225,26 +2328,66 @@ static int __vcd_server_launch_manager_app() return VCD_ERROR_NONE; } -int vcd_server_dialog(int pid, const char* disp_text, const char* utt_text, int continuous) +int vcd_server_set_server_dialog(int pid, const char* app_id, const char* credential) { /* check if pid is valid */ - if (false == vcd_client_is_available(pid) && false == vcd_client_widget_is_available(pid)) { + if (false == vcd_client_is_available(pid)) { SLOG(LOG_ERROR, TAG_VCD, "[Server ERROR] pid is NOT valid "); return VCD_ERROR_INVALID_PARAMETER; } - int ret = __vcd_server_launch_manager_app(); + int ret = vcd_engine_set_server_dialog(app_id, credential); 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); + SLOG(LOG_ERROR, TAG_VCD, "[Server ERROR] Fail to set server dialog, pid(%d), app_id(%s), ret(%d)", pid, app_id, ret); + vcd_client_set_server_dialog(pid, false); return ret; } + SLOG(LOG_ERROR, TAG_VCD, "[Success] Set server dialog, pid(%d), app_id(%s)", pid, app_id); + + if (0 != strncmp(credential, "#NULL", strlen(credential))) { + ret = vcd_client_set_server_dialog(pid, true); + if (0 != ret) + SLOG(LOG_DEBUG, TAG_VCD, "[Server] Set to true for server dialog, app_id(%s)", app_id); + } else { + ret = vcd_client_set_server_dialog(pid, false); + if (0 != ret) + SLOG(LOG_DEBUG, TAG_VCD, "[Server] Set to false for server dialog, app_id(%s)", app_id); + } + + return 0; +} + +int vcd_server_dialog(int pid, const char* disp_text, const char* utt_text, int continuous) +{ + /* check if pid is valid */ + if (false == vcd_client_is_available(pid) && false == vcd_client_widget_is_available(pid)) { + SLOG(LOG_ERROR, TAG_VCD, "[Server ERROR] pid is NOT valid "); + return VCD_ERROR_INVALID_PARAMETER; + } - ret = vcdc_send_dialog(vcd_client_manager_get_pid(), pid, disp_text, utt_text, continuous); + bool is_server_dialog = false; + int ret = vcd_client_get_server_dialog(pid, &is_server_dialog); 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; + SLOG(LOG_ERROR, TAG_VCD, "[Server ERROR] Fail to get server dialog, pid(%d), ret(%d)", pid, ret); } + if (true == is_server_dialog) { + /* ++ Request tts event to engine */ + + /* -- Request tts event to engine */ + } else { + ret = __vcd_server_launch_manager_app(); + 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; + } + + 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; + } + } return 0; } @@ -2742,3 +2885,15 @@ int vcd_set_nlu_base_info_requested_cb(vce_nlu_base_info_requested_cb callback_f return ret; } + +int vcd_set_specific_engine_request_cb(vce_specific_engine_request_cb callback_func) +{ + SLOG(LOG_DEBUG, TAG_VCD, "[Server] Set specific engine request cb"); + int ret = 0; + ret = vcd_engine_agent_set_specific_engine_request_cb(callback_func); + if (0 != ret) { + SLOG(LOG_ERROR, TAG_VCD, "[Server ERROR] Fail to set specific engine request cb : ret(%d)", ret); + } + + return ret; +} diff --git a/server/vcd_server.h b/server/vcd_server.h index 70bc3d9..e11108f 100644 --- a/server/vcd_server.h +++ b/server/vcd_server.h @@ -80,6 +80,12 @@ int vcd_server_mgr_enable_command_type(int pid, int cmd_type); int vcd_server_mgr_disable_command_type(int pid, int cmd_type); +/* for TTS feedback */ +int vcd_server_mgr_start_feedback(void); + +int vcd_server_mgr_stop_feedback(void); + + /* * For client */ @@ -93,6 +99,8 @@ int vcd_server_unset_command(int pid, vc_cmd_type_e cmd_type); int vcd_server_set_foreground(int pid, bool value); +int vcd_server_set_server_dialog(int pid, const char* app_id, const char* credential); + int vcd_server_dialog(int pid, const char* disp_text, const char* utt_text, int continuous); int vcd_server_is_system_command_valid(int pid, int* is_sys_cmd_valid); @@ -126,6 +134,8 @@ int vcd_server_widget_enable_asr_result(int pid, bool enable); int vcd_server_set_language(const char* language); +int vcd_server_mgr_send_specific_engine_request(int pid, const char* engine_app_id, const char* event, const char* request); + /* * For engine service */ @@ -133,6 +143,8 @@ int vcd_send_result(vce_result_event_e event, int* result_id, int count, const c int vcd_send_asr_result(vce_asr_result_event_e event, const char* asr_result, void *user_data); +int vcd_send_specific_engine_result(const char* engine_app_id, const char* event, const char* result, void *user_info); + int vcd_send_nlg_result(const char* nlg_result, void *user_data); int vcd_send_error(vce_error_e error, const char* msg, void *user_data); @@ -157,6 +169,12 @@ int vcd_set_private_data_requested_cb(vce_private_data_requested_cb callback_fun int vcd_set_nlu_base_info_requested_cb(vce_nlu_base_info_requested_cb callback_func); +int vcd_set_specific_engine_request_cb(vce_specific_engine_request_cb callback_func); + +int vcd_send_feedback_audio_format(int rate, vce_audio_channel_e channel, vce_audio_type_e audio_type); + +int vcd_send_feedback_streaming(vce_feedback_event_e event, char* buffer, int len); + #ifdef __cplusplus } diff --git a/server/vce.c b/server/vce.c index cbb21fa..087cee8 100644 --- a/server/vce.c +++ b/server/vce.c @@ -221,6 +221,29 @@ int vce_send_asr_result(vce_asr_result_event_e event, const char* asr_result, vo return ret; } +int vce_send_specific_engine_result(const char* engine_app_id, const char* event, const char* result, void *user_info) +{ + int ret = VCE_ERROR_NONE; + + if (NULL == engine_app_id || NULL == event) { + SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Invalid parameter"); + return VCE_ERROR_INVALID_PARAMETER; + } + + if (NULL == result) { + 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); + } + + return ret; +} + int vce_send_nlg_result(const char* nlg_result, void *user_data) { int ret = VCE_ERROR_NONE; @@ -449,3 +472,53 @@ int vce_set_nlu_base_info_requested_cb(vce_nlu_base_info_requested_cb callback_f return ret; } + +int vce_set_specific_engine_request_cb(vce_specific_engine_request_cb callback_func) +{ + if (NULL == callback_func) { + SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Invalid parameter"); + return VCE_ERROR_INVALID_PARAMETER; + } + + int ret = vcd_set_specific_engine_request_cb(callback_func); + if (0 != ret) { + SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to set specific engine request cb"); + } + + return ret; +} + +int vce_unset_specific_engine_request_cb(void) +{ + int ret = vcd_set_specific_engine_request_cb(NULL); + if (0 != ret) { + SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to set specific engine request cb"); + } + + return ret; +} + +/* for TTS feedback */ +int vce_send_feedback_audio_format(int rate, vce_audio_channel_e channel, vce_audio_type_e audio_type) +{ + int ret = VCE_ERROR_NONE; + + 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"); + } + + return ret; +} + +int vce_send_feedback_streaming(vce_feedback_event_e event, char* buffer, int len) +{ + int ret = VCE_ERROR_NONE; + + ret = vcd_send_feedback_streaming(event, buffer, len); + if (0 != ret) { + SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to send feedback streaming"); + } + + return ret; +} -- 2.7.4 From 0473475ab0c0c7095326bdbb792117450574a456 Mon Sep 17 00:00:00 2001 From: "sooyeon.kim" Date: Thu, 7 Jun 2018 11:30:06 +0900 Subject: [PATCH 04/16] [ACR-1232][voice-control][Add] Add APIs for VCE Change-Id: Ic39e01b23aa231f88d1e1a70aedf5f8d35220323 Signed-off-by: sooyeon.kim --- include/vce.h | 189 +++++++++++++++++++++++++++++++++------------------------- server/vce.c | 15 +++++ 2 files changed, 122 insertions(+), 82 deletions(-) diff --git a/include/vce.h b/include/vce.h index c735acd..e5d917f 100644 --- a/include/vce.h +++ b/include/vce.h @@ -31,7 +31,7 @@ extern "C" { /** * @brief Enumerations of error codes. -* @since_tizen 5.0 +* @since_tizen 4.0 */ typedef enum { VCE_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */ @@ -50,7 +50,7 @@ typedef enum { /** * @brief Enumerations of audio type. -* @since_tizen 5.0 +* @since_tizen 4.0 */ typedef enum { VCE_AUDIO_TYPE_PCM_S16_LE = 0, /**< Signed 16bit audio type, Little endian */ @@ -59,7 +59,7 @@ typedef enum { /** * @brief Enumerations of callback event. -* @since_tizen 5.0 +* @since_tizen 4.0 */ typedef enum { VCE_RESULT_EVENT_SUCCESS = 0, /**< Event when the recognition full result is ready */ @@ -69,7 +69,7 @@ typedef enum { /** * @brief Enumerations of command type. -* @since_tizen 5.0 +* @since_tizen 4.0 */ typedef enum { VCE_COMMAND_FORMAT_FIXED = 0, /**< Fixed command */ @@ -83,7 +83,7 @@ typedef enum { /** * @brief Enumerations of speech detect. -* @since_tizen 5.0 +* @since_tizen 4.0 */ typedef enum { VCE_SPEECH_DETECT_NONE = 0, /**< No event */ @@ -93,7 +93,7 @@ typedef enum { /** * @brief Enumerations of ASR result events. -* @since_tizen 5.0 +* @since_tizen 4.0 */ typedef enum { VCE_ASR_RESULT_EVENT_FINAL_RESULT = 0, /**< Event when the ASR result is last data or ASR result is only one result */ @@ -102,8 +102,8 @@ typedef enum { } vce_asr_result_event_e; /** - * @brief Enumerations of audio channels - * @since_tizen 5.0 + * @brief Enumerations of audio channels. + * @since_tizen 4.0 */ typedef enum { VCE_AUDIO_CHANNEL_MONO = 0, /**< 1 channel, mono */ @@ -111,8 +111,8 @@ typedef enum { } vce_audio_channel_e; /** - * @brief Enumeration for TTS feedback events - * @since_tizen 5.0 + * @brief Enumeration for TTS feedback events. + * @since_tizen 4.0 */ typedef enum { VCE_FEEDBACK_EVENT_FAIL = -1, /**< Failed */ @@ -124,74 +124,74 @@ typedef enum { /** * @brief A structure of handle for VC command. -* @since_tizen 5.0 +* @since_tizen 4.0 */ typedef struct vce_cmd_s* vce_cmd_h; /** * @brief Definition for foreground command type. -* @since_tizen 5.0 +* @since_tizen 4.0 */ #define VCE_COMMAND_TYPE_FOREGROUND 1 /** * @brief Definition for background command type. -* @since_tizen 5.0 +* @since_tizen 4.0 */ #define VCE_COMMAND_TYPE_BACKGROUND 2 /** * @brief Definition for widget command type. -* @since_tizen 5.0 +* @since_tizen 4.0 */ #define VCE_COMMAND_TYPE_WIDGET 3 /** * @brief Definition for system command type. -* @since_tizen 5.0 +* @since_tizen 4.0 */ #define VCE_COMMAND_TYPE_SYSTEM 4 /** * @brief Definition for system background command type. -* @since_tizen 5.0 +* @since_tizen 4.0 */ #define VCE_COMMAND_TYPE_SYSTEM_BACKGROUND 5 /** * @brief Definitions for exclusive command type. -* @since_tizen 5.0 +* @since_tizen 4.0 */ #define VCE_COMMAND_TYPE_EXCLUSIVE 6 /** * @brief Definition of bluetooth audio id. -* @since_tizen 5.0 +* @since_tizen 4.0 */ #define VCE_AUDIO_ID_BLUETOOTH "VC_AUDIO_ID_BLUETOOTH" /**< Bluetooth audio id */ /** * @brief Definition of Wi-Fi audio id. -* @since_tizen 5.0 +* @since_tizen 4.0 */ #define VCE_AUDIO_ID_WIFI "VC_AUDIO_ID_WIFI" /**< Wi-Fi audio id */ /** * @brief Definition for none message. -* @since_tizen 5.0 +* @since_tizen 4.0 */ #define VC_RESULT_MESSAGE_NONE "vc.result.message.none" /** * @brief Definition for failed recognition because the speech is too loud to listen. -* @since_tizen 5.0 +* @since_tizen 4.0 */ #define VC_RESULT_MESSAGE_ERROR_TOO_LOUD "vc.result.message.error.too.loud" /** * @brief Called when VC engine informs the engine service user about whole supported languages. * @details This callback function is implemented by the engine service user. Therefore, the engine developer does NOT have to implement this callback function. -* @since_tizen 5.0 +* @since_tizen 4.0 * @remarks This callback function is called by vce_foreach_supported_languages_cb() to retrieve the whole supported language list. * The @a user_data must be transferred from vce_foreach_supported_languages_cb(). * The @a language can be used only in the callback. To use outside, make a copy. @@ -206,7 +206,7 @@ typedef bool (*vce_supported_language_cb)(const char* language, void* user_data) /** * @brief Called when the engine service user initializes Voice Control (VC) engine. -* @since_tizen 5.0 +* @since_tizen 4.0 * @remarks This callback function is mandatory and must be registered using vce_main(). * @return 0 on success, otherwise a negative error value * @retval #VCE_ERROR_NONE Successful @@ -219,7 +219,7 @@ typedef int (*vce_initialize_cb)(void); /** * @brief Called when the engine service user deinitializes VC engine. -* @since_tizen 5.0 +* @since_tizen 4.0 * @remarks This callback function is mandatory and must be registered using vce_main(). * @return 0 on success, otherwise a negative error value * @retval #VCE_ERROR_NONE Successful @@ -230,9 +230,12 @@ typedef int (*vce_deinitialize_cb)(void); /** * @brief Called when the engine service user requests the recording format of VC engine. -* @since_tizen 5.0 +* @since_tizen 4.0 * @remarks This callback function is mandatory and must be registered using vce_main(). * The @a audio_id can be used only in the callback. To use outside, make a copy. +* The @a types is managed by the platform and will be released when this callback function is completed. +* The @a rate is managed by the platform and will be released when this callback function is completed. +* The @a channels is managed by the platform and will be released when this callback function is completed. * @param[in] audio_id The audio device id. (e.g. #VCE_AUDIO_ID_BLUETOOTH or #VCE_AUDIO_ID_WIFI) * @param[out] types The format used by the recorder. * @param[out] rate The sample rate used by the recorder. @@ -245,7 +248,7 @@ typedef int (*vce_get_recording_format_cb)(const char* audio_id, vce_audio_type_ /** * @brief Called when the engine service user retrieves all supported languages of VC engine. -* @since_tizen 5.0 +* @since_tizen 4.0 * @remarks This callback function is mandatory and must be registered using vce_main(). * @param[in] callback a callback function * @param[in] user_data The user data to be passed to the callback function @@ -261,7 +264,7 @@ typedef int (*vce_foreach_supported_languages_cb)(vce_supported_language_cb call /** * @brief Called when the engine service user checks whether a language is supported or not. -* @since_tizen 5.0 +* @since_tizen 4.0 * @remarks This callback function is mandatory and must be registered using vce_main(). * The @a language can be used only in the callback. To use outside, make a copy. * @param[in] language A language @@ -271,7 +274,7 @@ typedef bool (*vce_is_language_supported_cb)(const char* language); /** * @brief Called when the engine service user sets language. -* @since_tizen 5.0 +* @since_tizen 4.0 * @remarks The @a language can be used only in the callback. To use outside, make a copy. * @param[in] language A language. * @return 0 on success, otherwise a negative error value @@ -284,8 +287,10 @@ typedef int (*vce_set_language_cb)(const char* language); /** * @brief Called when the engine service user sets command list before recognition. -* @since_tizen 5.0 +* @since_tizen 4.0 * @remarks This function should set commands via vcd_foreach_command(). +* The @a vc_command should not be released. +* The @a vc_command can be used only in the callback. To use outside, make a copy. * @param[in] vc_command command handle. The @a vc_command can be used only in the callback. To use outside, make a copy. * @return 0 on success, otherwise a negative error value * @retval #VCE_ERROR_NONE Successful @@ -303,7 +308,7 @@ typedef int (*vce_set_commands_cb)(vce_cmd_h vc_command); /** * @brief Called when the engine service user unsets command list for reset. -* @since_tizen 5.0 +* @since_tizen 4.0 * @return 0 on success, otherwise a negative error value * @retval #VCE_ERROR_NONE Successful * @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter @@ -316,7 +321,7 @@ typedef int (*vce_unset_commands_cb)(void); /** * @brief Called when the engine service user starts recognition. -* @since_tizen 5.0 +* @since_tizen 4.0 * @remarks This callback function is mandatory and must be registered using vce_main(). * @param[in] stop_by_silence Silence detection option. * @c true to detect the silence, @@ -337,9 +342,10 @@ typedef int (*vce_start_cb)(bool stop_by_silence); /** * @brief Called when the engine service user sets recording data for speech recognition from recorder. -* @since_tizen 5.0 +* @since_tizen 4.0 * @remarks This function should be returned immediately after recording data copy. * The @a data can be used only in the callback. To use outside, make a copy. +* The @a speech_detected should not be released. This is managed by the platform. * @param[in] data A recording data * @param[in] length A length of recording data * @param[out] speech_detected The status of speech (e.g. #VCE_SPEECH_DETECT_BEGIN or #VCE_SPEECH_DETECT_END). The @a speech_detected can be used only in the callback. To use outside, make a copy. @@ -357,7 +363,7 @@ typedef int(*vce_set_recording_data_cb)(const void* data, unsigned int length, v /** * @brief Called when the engine service user stops to get the result of recognition. -* @since_tizen 5.0 +* @since_tizen 4.0 * @return 0 on success, otherwise a negative error value * @retval #VCE_ERROR_NONE Successful * @retval #VCE_ERROR_INVALID_STATE Invalid state @@ -373,7 +379,7 @@ typedef int (*vce_stop_cb)(void); /** * @brief Called when the engine service user cancels the recognition process. -* @since_tizen 5.0 +* @since_tizen 4.0 * @return 0 on success, otherwise a negative error value. * @retval #VCE_ERROR_NONE Successful. * @retval #VCE_ERROR_INVALID_STATE Invalid state. @@ -385,8 +391,8 @@ typedef int (*vce_cancel_cb)(void); /** * @brief Called when the engine service user sets audio recording type. -* @since_tizen 5.0 -* @remarks The @a audio can be used only in the callback. To use outside, make a copy. +* @since_tizen 4.0 +* @remarks The @a audio_type can be used only in the callback. To use outside, make a copy. * @param[in] audio_type Current audio type (e.g. #VCE_AUDIO_ID_BLUETOOTH or #VCE_AUDIO_ID_WIFI) * @return 0 on success, otherwise a negative error value. * @retval #VCE_ERROR_NONE Successful. @@ -396,7 +402,7 @@ typedef int (*vce_set_audio_type_cb)(const char* audio_type); /** * @brief Called when the engine service user sets app id which is want to ask server dialog. -* @since_tizen 5.0 +* @since_tizen 4.0 * @remarks The @a app_id and @a credential can be used only in the callback. To use outside, make a copy. * @param[in] app_id App id which is to want to ask server dialog. * @param[in] credential Credential key. @@ -409,7 +415,7 @@ typedef int (*vce_set_server_dialog_cb)(const char* app_id, const char* credenti /** * @brief Called when the engine service user sets domain (agent or device type). -* @since_tizen 5.0 +* @since_tizen 4.0 * @remarks The @a domain can be used only in the callback. To use outside, make a copy. * @param[in] domain Agent (e.g. "music", "news", etc) or device type (e.g. "tv", "mobile", etc) corresponding to the command * @return 0 on success, otherwise a negative error value. @@ -420,8 +426,9 @@ typedef int (*vce_set_domain_cb)(const char* domain); /** * @brief Called when the engine service user requests essential value from NLU result. -* @since_tizen 5.0 +* @since_tizen 4.0 * @remarks The @a key can be used only in the callback. To use outside, make a copy. +* The @a value is managed by the platform and will be released when this callback function is completed. * @param[in] key NLU base info key. * @param[out] value NLU base info value. * @return 0 on success, otherwise a negative error value. @@ -432,7 +439,10 @@ typedef int (*vce_nlu_base_info_requested_cb)(const char* key, char** value); /** * @brief Called when client gets the specific engine's request from the engine service user. -* @since_tizen 5.0 +* @since_tizen 4.0 +* @remarks The @a engine_app_id is managed by the platform and will be released when this callback function is completed. +* The @a event is managed by the platform and will be released when this callback function is completed. +* The @a request is managed by the platform and will be released when this callback function is completed. * * @param[in] engine_app_id The specific engine's app id * @param[in] event The specific engine event type @@ -452,7 +462,7 @@ typedef int (*vce_specific_engine_request_cb)(const char* engine_app_id, const c /** * @brief Called when the engine service user sets private data between app and engine. -* @since_tizen 5.0 +* @since_tizen 4.0 * @remarks The @a key, @a data can be used only in the callback. To use outside, make a copy. * @param[in] key Private key. * @param[in] data Private data. @@ -464,8 +474,9 @@ typedef int (*vce_private_data_set_cb)(const char* key, const char* data); /** * @brief Called when the engine service user requests private data between app and engine. -* @since_tizen 5.0 +* @since_tizen 4.0 * @remarks The @a key can be used only in the callback. To use outside, make a copy. +* The @a data is managed by the platform and will be released when this callback function is completed. * @param[in] key Private key. * @param[out] data Private data. * @return 0 on success, otherwise a negative error value. @@ -476,7 +487,7 @@ typedef int (*vce_private_data_requested_cb)(const char* key, char** data); /** * @brief Called when the engine service user requests process text. -* @since_tizen 5.0 +* @since_tizen 4.0 * @remarks The @a text can be used only in the callback. To use outside, make a copy. * @param[in] text Requested text * @return 0 on success, otherwise a negative error value. @@ -487,7 +498,7 @@ typedef int (*vce_process_text_cb)(const char* text); /** * @brief Called when the engine service user requests list event. -* @since_tizen 5.0 +* @since_tizen 4.0 * @remarks The @a event can be used only in the callback. To use outside, make a copy. * @param[in] event Requested list event * @return 0 on success, otherwise a negative error value. @@ -498,7 +509,7 @@ typedef int (*vce_process_list_event_cb)(const char* event); /** * @brief Called when the engine service user requests haptic event. -* @since_tizen 5.0 +* @since_tizen 4.0 * @remarks The @a event can be used only in the callback. To use outside, make a copy. * @param[in] event Requested haptic event * @return 0 on success, otherwise a negative error value. @@ -509,9 +520,12 @@ typedef int (*vce_process_haptic_event_cb)(const char* event); /** * @brief Called when the engine service user requests the base information of VC engine. -* @since_tizen 5.0 +* @since_tizen 4.0 * @remarks This callback function is mandatory and must be registered using vce_main(). -* The allocated @a engine_uuid, @a engine_name, and @a engine_settings_app_id will be released internally. +* The @a engine_uuid is managed by the platform and will be released when this callback function is completed. +* The @a engine_name is managed by the platform and will be released when this callback function is completed. +* The @a engine_settings_app_id is managed by the platform and will be released when this callback function is completed. +* The @a use_network is managed by the platform and will be released when this callback function is completed. * In order to upload the engine to Tizen Appstore, both the service app and the UI app (engine settings) are necessary. * Therefore, @a engine_settings_app_id should be set to the application ID of the UI application. * If there is no UI application, then @a engine_settings_app_id should be set to NULL. @@ -528,7 +542,7 @@ typedef int (*vce_get_info_cb)(char** engine_uuid, char** engine_name, char** en /** * @brief Called to retrieve the commands. -* @since_tizen 5.0 +* @since_tizen 4.0 * @remarks The @a command, @a param can be used only in the callback. To use outside, make a copy. * @param[in] id command id * @param[in] type command type @@ -547,7 +561,7 @@ typedef bool (*vce_command_cb)(int id, int type, int format, const char* command /** * @brief A structure for the VC engine functions. * @details This structure contains essential callback functions for operating VC engine. -* @since_tizen 5.0 +* @since_tizen 4.0 * @remarks These functions ar mandatory for operating VC engine. Therefore, all functions MUST be implemented. */ typedef struct { @@ -582,16 +596,16 @@ typedef struct { vce_process_haptic_event_cb process_haptic_event; /**< Request to process haptic event */ /* Optional callbacks */ - vce_private_data_set_cb private_data_set; + vce_private_data_set_cb private_data_set; vce_private_data_requested_cb private_data_request; vce_nlu_base_info_requested_cb nlu_base_info_request; vce_specific_engine_request_cb specific_engine_request; } vce_request_callback_s; /** -* @brief Main function for Voice Control (VC) engine. +* @brief Starts the main function for Voice Control (VC) engine. * @details This function is the main function for operating VC engine. -* @since_tizen 5.0 +* @since_tizen 4.0 * @privlevel public * @privilege %http://tizen.org/privilege/recorder * @remarks The service_app_main() should be used for working the engine after this function. @@ -701,7 +715,7 @@ int vce_main(int argc, char** argv, vce_request_callback_s* callback); /** * @brief Sends the results to the engine service user. -* @since_tizen 5.0 +* @since_tizen 4.0 * @param[in] event A result event * @param[in] result_id Result ids * @param[in] count Result count @@ -718,14 +732,14 @@ int vce_main(int argc, char** argv, vce_request_callback_s* callback); * @retval #VCE_ERROR_INVALID_STATE Invalid state * @retval #VCE_ERROR_OPERATION_FAILED Operation failure * @pre The vce_main() function should be invoked before this function is called. -* vce_stop_cb() will invoke this callback. +* vce_stop_cb() will invoke this callback. * @see vce_stop_cb() */ int vce_send_result(vce_result_event_e event, int* result_id, int count, const char* all_result, const char* non_fixed_result, const char* nlu_result, const char* msg, int* user_info, void* user_data); /** * @brief Sends the ASR result to the engine service user. -* @since_tizen 5.0 +* @since_tizen 4.0 * @param[in] event A asr result event * @param[in] asr_result A asr result text * @param[in] user_data The user data passed from the start @@ -741,7 +755,7 @@ int vce_send_asr_result(vce_asr_result_event_e event, const char* asr_result, vo /** * @brief Sends the NLG (Natural Language Generation) result to the engine service user. -* @since_tizen 5.0 +* @since_tizen 4.0 * @param[in] nlg_result A nlg result * @param[in] user_data The user data passed from the start * @return @c 0 on success, otherwise a negative error value @@ -756,12 +770,12 @@ int vce_send_nlg_result(const char* nlg_result, void* user_data); /** * @brief Sends the specific engine result to the engine service user. -* @since_tizen 5.0 +* @since_tizen 4.0 * * @param[in] engine_app_id A specific engine's app id * @param[in] event A specific engine result event * @param[in] result A specific engine result text -* @param[in] user_data The user data passed from the start +* @param[in] user_info The user info passed from the start * * @return 0 on success, otherwise a negative error value * @retval #VCE_ERROR_NONE Successful @@ -787,7 +801,7 @@ int vce_send_specific_engine_result(const char* engine_app_id, const char* event * #VCE_ERROR_OPERATION_FAILED, \n * #VCE_ERROR_PERMISSION_DENIED, \n * #VCE_ERROR_NOT_SUPPORTED_FEATURE. -* @since_tizen 5.0 +* @since_tizen 4.0 * @param[in] error Error type * @param[in] msg Error message * @param[in] user_data The user data passed from set callback function @@ -802,7 +816,7 @@ int vce_send_error(vce_error_e error, const char* msg, void* user_data); /** * @brief Sets a callback function for setting the private data to the engine service. -* @since_tizen 5.0 +* @since_tizen 4.0 * @privlevel public * @privilege %http://tizen.org/privilege/recorder * @remarks The vce_private_data_set_cb() function is called when the engine service user sets the private data to the engine service. @@ -821,7 +835,7 @@ int vce_set_private_data_set_cb(vce_private_data_set_cb callback_func); /** * @brief Sets a callback function for requesting the private data to the engine service. -* @since_tizen 5.0 +* @since_tizen 4.0 * @privlevel public * @privilege %http://tizen.org/privilege/recorder * @remarks The vce_private_data_requested_cb() function is called when the engine service user requests the private data to the engine service. @@ -838,7 +852,7 @@ int vce_set_private_data_requested_cb(vce_private_data_requested_cb callback_fun /** * @brief Sets a callback function for requesting the NLU base information to the engine service. -* @since_tizen 5.0 +* @since_tizen 4.0 * @remarks The vce_nlu_base_info_requested_cb() function is called when the engine service user requests the NLU base information to the engine service. * @param[in] callback_func vce_nlu_base_info_requested event callback function * @return @c 0 on success, otherwise a negative error value @@ -851,16 +865,14 @@ int vce_set_private_data_requested_cb(vce_private_data_requested_cb callback_fun int vce_set_nlu_base_info_requested_cb(vce_nlu_base_info_requested_cb callback_func); /** -* @brief Registers a callback function for getting the engine service request. -* @since_tizen 5.0 +* @brief Sets a callback function for getting the engine service request. +* @since_tizen 4.0 * -* @param[in] callback Callback function to register -* @param[in] user_data The user data to be passed to the callback function +* @param[in] callback_func Callback function to register * * @return 0 on success, otherwise a negative error value * @retval #VCE_ERROR_NONE Successful * @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter -* @retval #VCE_ERROR_PERMISSION_DENIED Permission denied * @retval #VCE_ERROR_NOT_SUPPORTED Not supported * * @see vce_unset_specific_engine_request_cb() @@ -868,12 +880,11 @@ int vce_set_nlu_base_info_requested_cb(vce_nlu_base_info_requested_cb callback_f int vce_set_specific_engine_request_cb(vce_specific_engine_request_cb callback_func); /** -* @brief Unregisters the engine service request callback function. -* @since_tizen 5.0 +* @brief Unsets the engine service request callback function. +* @since_tizen 4.0 * * @return 0 on success, otherwise a negative error value * @retval #VC_ERROR_NONE Successful -* @retval #VC_ERROR_PERMISSION_DENIED Permission denied * @retval #VC_ERROR_NOT_SUPPORTED Not supported * * @see vce_set_specific_engine_request_cb() @@ -882,16 +893,18 @@ int vce_unset_specific_engine_request_cb(void); /** * @brief Retrieves all commands using callback function. -* @since_tizen 5.0 +* @since_tizen 4.0 +* * @param[in] vce_command The handle to be passed to the vce_set_commands() function * @param[in] callback The callback function to invoke * @param[in] user_data The user data to be passed to the callback function +* * @return 0 on success, otherwise a negative error value * @retval #VCE_ERROR_NONE Successful * @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter * @retval #VCE_ERROR_OPERATION_FAILED Operation failure * @retval #VCE_ERROR_INVALID_STATE Invalid state -* @post This function invokes vce_command_cb() repeatedly for getting commands. +* @post This function invokes vce_command_cb() repeatedly for getting commands. * @see vce_foreach_command_cb() * @see vce_set_commands() */ @@ -899,9 +912,11 @@ int vce_get_foreach_command(vce_cmd_h vce_command, vce_command_cb callback, void /** * @brief Gets command length. -* @since_tizen 5.0 +* @since_tizen 4.0 +* * @param[in] vce_command The handle to be passed to the vce_set_commands() function * @param[out] count The command count value +* * @return 0 on success, otherwise a negative error value. * @retval #VCE_ERROR_NONE Successful * @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter @@ -912,7 +927,7 @@ int vce_get_command_count(vce_cmd_h vce_command, int* count); /** * @brief Gets current audio type. -* @since_tizen 5.0 +* @since_tizen 4.0 * @privlevel public * @privilege %http://tizen.org/privilege/recorder * @remarks The @a audio_type must be released using free() when it is no longer required. @@ -927,7 +942,7 @@ int vce_get_audio_type(char** audio_type); /** * @brief Sets private data to a voice manager client. -* @since_tizen 5.0 +* @since_tizen 4.0 * @privlevel public * @privilege %http://tizen.org/privilege/recorder * @param[in] key Private key @@ -945,7 +960,7 @@ int vce_set_private_data(const char* key, const char* data); /** * @brief Gets private data from a voice manager client. -* @since_tizen 5.0 +* @since_tizen 4.0 * @privlevel public * @privilege %http://tizen.org/privilege/recorder * @remarks The @a data must be released using free() when it is no longer required. @@ -964,7 +979,7 @@ int vce_get_private_data(const char* key, char** data); /** * @brief Starts recording voice. -* @since_tizen 5.0 +* @since_tizen 4.0 * @privlevel public * @privilege %http://tizen.org/privilege/recorder * @return 0 on success, otherwise a negative error value. @@ -978,7 +993,7 @@ int vce_start_recording(void); /** * @brief Stops recording voice. -* @since_tizen 5.0 +* @since_tizen 4.0 * @privlevel public * @privilege %http://tizen.org/privilege/recorder * @return 0 on success, otherwise a negative error value. @@ -992,11 +1007,16 @@ int vce_stop_recording(void); /* for TTS feeadback */ /** * @brief Sends audio formats necessary for playing TTS feedback. -* @since_tizen 5.0 +* @since_tizen 4.0 +* +* @param[in] rate A sampling rate +* @param[in] channel The audio channel +* @param[in] audio_type The audio type +* * @return 0 on success, otherwise a negative error value. * @retval #VCE_ERROR_NONE Successful -* @retval #VCE_ERROR_PERMISSION_DENIED Permission denied * @retval #VCE_ERROR_NOT_SUPPORTED Not supported +* @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter * @retval #VCE_ERROR_OPERATION_FAILED Operation failure * @retval #VCE_ERROR_OUT_OF_MEMORY Out of Memory */ @@ -1004,11 +1024,16 @@ int vce_send_feedback_audio_format(int rate, vce_audio_channel_e channel, vce_au /** * @brief Sends audio streaming necessary for playing TTS feedback. -* @since_tizen 5.0 +* @since_tizen 4.0 +* +* @param[in] event A feedback event +* @param[in] buffer The feedback data +* @param[in] len The length of the feedback data +* * @return 0 on success, otherwise a negative error value. * @retval #VCE_ERROR_NONE Successful -* @retval #VCE_ERROR_PERMISSION_DENIED Permission denied * @retval #VCE_ERROR_NOT_SUPPORTED Not supported +* @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter * @retval #VCE_ERROR_OPERATION_FAILED Operation failure * @retval #VCE_ERROR_OUT_OF_MEMORY Out of Memory */ diff --git a/server/vce.c b/server/vce.c index 087cee8..36e842d 100644 --- a/server/vce.c +++ b/server/vce.c @@ -503,6 +503,16 @@ int vce_send_feedback_audio_format(int rate, vce_audio_channel_e channel, vce_au { int ret = VCE_ERROR_NONE; + if (channel < VCE_AUDIO_CHANNEL_MONO || channel > VCE_AUDIO_CHANNEL_STEREO) { + SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Invalid parameter"); + return VCE_ERROR_INVALID_PARAMETER; + } + + if (audio_type < VCE_AUDIO_TYPE_PCM_S16_LE || audio_type > VCE_AUDIO_TYPE_PCM_U8) { + SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Invalid parameter"); + 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"); @@ -515,6 +525,11 @@ int vce_send_feedback_streaming(vce_feedback_event_e event, char* buffer, int le { int ret = VCE_ERROR_NONE; + if (NULL == buffer) { + SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Input parameter is NULL"); + return VCE_ERROR_INVALID_PARAMETER; + } + ret = vcd_send_feedback_streaming(event, buffer, len); if (0 != ret) { SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to send feedback streaming"); -- 2.7.4 From 73095f23a811518ad8cb5be8cfe3fe6572cb8acb Mon Sep 17 00:00:00 2001 From: "sooyeon.kim" Date: Tue, 26 Jun 2018 22:08:16 +0900 Subject: [PATCH 05/16] Add engine-parser Change-Id: Ib3789585acd459938a507fc2a102089e8130e460 Signed-off-by: sooyeon.kim --- CMakeLists.txt | 7 +- common/vc_config_mgr.c | 430 +++++++++++++---- common/vc_config_parser.c | 60 ++- common/vc_config_parser.h | 2 + common/vc_defs.h | 6 +- engine-parser/CMakeLists.txt | 37 ++ engine-parser/src/vc-engine-parser.c | 883 +++++++++++++++++++++++++++++++++++ packaging/voice-control.spec | 4 + 8 files changed, 1335 insertions(+), 94 deletions(-) create mode 100644 engine-parser/CMakeLists.txt create mode 100644 engine-parser/src/vc-engine-parser.c diff --git a/CMakeLists.txt b/CMakeLists.txt index 51c98b0..8819be3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -43,12 +43,12 @@ INCLUDE(FindPkgConfig) IF("${_TV_PRODUCT}" STREQUAL "TRUE") pkg_check_modules(pkgs REQUIRED aul capi-appfw-app-control capi-appfw-app-manager capi-base-common capi-media-audio-io capi-media-sound-manager ecore-wayland - capi-network-bluetooth capi-network-bluetooth-tv capi-system-info cynara-client cynara-session dbus-1 db-util dlog ecore glib-2.0 json-glib-1.0 libtzplatform-config libxml-2.0 sqlite3 vconf msfapi + capi-network-bluetooth capi-network-bluetooth-tv capi-system-info cynara-client cynara-session dbus-1 db-util dlog ecore glib-2.0 json-glib-1.0 libgum libtzplatform-config libxml-2.0 sqlite3 vconf msfapi ) ELSE() pkg_check_modules(pkgs REQUIRED aul capi-appfw-app-control capi-appfw-app-manager capi-base-common capi-media-audio-io capi-media-sound-manager ecore-wayland - capi-system-info cynara-client cynara-session dbus-1 db-util dlog ecore glib-2.0 json-glib-1.0 libtzplatform-config libxml-2.0 sqlite3 vconf + capi-system-info cynara-client cynara-session dbus-1 db-util dlog ecore glib-2.0 json-glib-1.0 libgum libtzplatform-config libxml-2.0 sqlite3 vconf ) ENDIF() @@ -62,6 +62,9 @@ ADD_SUBDIRECTORY(client) ## Server daemon ## ADD_SUBDIRECTORY(server) +## Engine Parser ## +ADD_SUBDIRECTORY(engine-parser) + ## config ## INSTALL(FILES ${CMAKE_SOURCE_DIR}/vc-config.xml DESTINATION ${TZ_SYS_RO_SHARE}/voice/vc/1.0) diff --git a/common/vc_config_mgr.c b/common/vc_config_mgr.c index 296e88a..5c33189 100755 --- a/common/vc_config_mgr.c +++ b/common/vc_config_mgr.c @@ -41,6 +41,12 @@ typedef struct { vc_config_enabled_cb enabled_cb; } vc_config_client_s; +/* for engine directory monitoring */ +typedef struct { + Ecore_Fd_Handler* dir_fd_handler; + int dir_fd; + int dir_wd; +} vc_engine_inotify_s; const char* vc_config_tag() { @@ -58,10 +64,14 @@ static Ecore_Fd_Handler* g_fd_handler_lang = NULL; static int g_fd_lang; static int g_wd_lang; +static GList* g_ino_list = NULL; + static pthread_mutex_t vc_config_mgr_mutex = PTHREAD_MUTEX_INITIALIZER; -int __vc_config_mgr_print_engine_info(); +static int __vc_config_mgr_register_engine_config_updated_event(const char* path); +static int __vc_config_mgr_unregister_engine_config_updated_event(); +int __vc_config_mgr_print_engine_info(); int __vc_config_mgr_print_client_info(); int vc_config_convert_error_code(vc_config_error_e code) @@ -260,6 +270,295 @@ int __vc_config_mgr_select_lang(const char* engine_id, char** language) return VC_ERROR_OPERATION_FAILED; } +int __vc_config_release_client(int uid) +{ + GSList *iter = NULL; + vc_config_client_s* temp_client = NULL; + + if (0 < g_slist_length(g_config_client_list)) { + /* Check uid */ + iter = g_slist_nth(g_config_client_list, 0); + + while (NULL != iter) { + temp_client = iter->data; + + if (NULL != temp_client) { + if (uid == temp_client->uid) { + g_config_client_list = g_slist_remove(g_config_client_list, temp_client); + free(temp_client); + break; + } + } + + iter = g_slist_next(iter); + } + } + + SLOG(LOG_DEBUG, vc_config_tag(), "Client count (%d)", g_slist_length(g_config_client_list)); + + return g_slist_length(g_config_client_list); +} + +void __vc_config_release_engine() +{ + GSList *iter = NULL; + vc_engine_info_s *engine_info = NULL; + + if (0 < g_slist_length(g_engine_list)) { + + /* Get a first item */ + iter = g_slist_nth(g_engine_list, 0); + + while (NULL != iter) { + engine_info = iter->data; + + if (NULL != engine_info) { + g_engine_list = g_slist_remove(g_engine_list, engine_info); + + vc_parser_free_engine_info(engine_info); + } + + iter = g_slist_nth(g_engine_list, 0); + } + } + + return; +} + +int __vc_config_mgr_get_engine_info() +{ + DIR *dp = NULL; + struct dirent *dirp = NULL; + + char filepath[512] = {'\0',}; + int filesize; + vc_engine_info_s* info = NULL; + + __vc_config_release_engine(); + g_engine_list = NULL; + __vc_config_mgr_unregister_engine_config_updated_event(); + + /* Copy default info directory to download directory */ + dp = opendir(VC_DEFAULT_ENGINE_INFO); + if (NULL == dp) { + SLOG(LOG_DEBUG, vc_config_tag(), "[CONFIG] No default directory : %s", VC_DEFAULT_ENGINE_INFO); + } else { + do { + dirp = readdir(dp); + + if (NULL != dirp) { + if (!strcmp(".", dirp->d_name) || !strcmp("..", dirp->d_name)) + continue; + + filesize = strlen(VC_DEFAULT_ENGINE_INFO) + strlen(dirp->d_name) + 2; + if (filesize >= 512) { + SECURE_SLOG(LOG_ERROR, vc_config_tag(), "[CONFIG ERROR] File path is too long : %s", dirp->d_name); + closedir(dp); + return -1; + } + + memset(filepath, '\0', 512); + snprintf(filepath, 512, "%s/%s", VC_DEFAULT_ENGINE_INFO, dirp->d_name); + + SECURE_SLOG(LOG_DEBUG, vc_config_tag(), "[CONFIG] Filepath(%s)", filepath); + + char dest[512] = {'\0',}; + snprintf(dest, 512, "%s/%s", VC_DOWNLOAD_ENGINE_INFO, dirp->d_name); + + if (0 != access(dest, F_OK)) { + if (0 != vc_parser_copy_xml(filepath, dest)) { + SLOG(LOG_ERROR, vc_config_tag(), "[CONFIG ERROR] Fail to copy engine info"); + } + } + } + } while (NULL != dirp); + + closedir(dp); + } + + /* Get engine info from default engine directory */ + dp = opendir(VC_DOWNLOAD_ENGINE_INFO); + if (NULL == dp) { + SLOG(LOG_DEBUG, vc_config_tag(), "[CONFIG] No downloadable directory : %s", VC_DOWNLOAD_ENGINE_INFO); + } else { + do { + dirp = readdir(dp); + + if (NULL != dirp) { + if (!strcmp(".", dirp->d_name) || !strcmp("..", dirp->d_name)) + continue; + + filesize = strlen(VC_DOWNLOAD_ENGINE_INFO) + strlen(dirp->d_name) + 2; + if (filesize >= 512) { + SECURE_SLOG(LOG_ERROR, vc_config_tag(), "[CONFIG ERROR] File path is too long : %s", dirp->d_name); + closedir(dp); + return -1; + } + + memset(filepath, '\0', 512); + snprintf(filepath, 512, "%s/%s", VC_DOWNLOAD_ENGINE_INFO, dirp->d_name); + + SECURE_SLOG(LOG_DEBUG, vc_config_tag(), "[CONFIG] Filepath(%s)", filepath); + + if (0 == vc_parser_get_engine_info(filepath, &info)) { + g_engine_list = g_slist_append(g_engine_list, info); + if (0 != __vc_config_mgr_register_engine_config_updated_event(filepath)) { + SLOG(LOG_ERROR, vc_config_tag(), "[ERROR] Fail to register engine config updated event"); + } + } + } + } while (NULL != dirp); + + closedir(dp); + } + + if (0 >= g_slist_length(g_engine_list)) { + SLOG(LOG_ERROR, vc_config_tag(), "[ERROR] No engine"); + return -1; + } + + return 0; +} + +static Eina_Bool __vc_config_mgr_engine_config_inotify_event_callback(void* data, Ecore_Fd_Handler *fd_handler) +{ + SLOG(LOG_DEBUG, vc_config_tag(), "@@@ Engine config updated callback event"); + + vc_engine_inotify_s *ino = (vc_engine_inotify_s *)data; + int dir_fd = ino->dir_fd; + + int length; + struct inotify_event event; + memset(&event, '\0', sizeof(struct inotify_event)); + + length = read(dir_fd, &event, sizeof(struct inotify_event)); + if (0 > length) { + SLOG(LOG_ERROR, vc_config_tag(), "[ERROR] Empty Inotify event"); + SLOG(LOG_DEBUG, vc_config_tag(), "@@@"); + return ECORE_CALLBACK_DONE; + } + + if (IN_CLOSE_WRITE == event.mask) { + int ret = __vc_config_mgr_get_engine_info(); + if (0 != ret) { + SLOG(LOG_ERROR, vc_config_tag(), "[ERROR] Fail to get engine info when config updated"); + } + __vc_config_mgr_print_engine_info(); + bool support = vc_config_check_default_language_is_valid(g_config_info->language); + if (false == support) { + SLOG(LOG_DEBUG, vc_config_tag(), "[ERROR] Default language is valid"); + char* temp_lang = NULL; + ret = __vc_config_mgr_select_lang(g_config_info->engine_id, &temp_lang); + if (0 != ret) { + SLOG(LOG_ERROR, vc_config_tag(), "[ERROR] Fail to get language"); + } + + ret = vc_config_mgr_set_default_language(temp_lang); + if (0 != ret) { + SLOG(LOG_ERROR, vc_config_tag(), "[ERROR] Fail to set language"); + } else { + SLOG(LOG_DEBUG, vc_config_tag(), "[DEBUG] Saved default language : lang(%s)", g_config_info->language); + } + if (NULL != temp_lang) { + free(temp_lang); + temp_lang = NULL; + } + } + } else { + SLOG(LOG_ERROR, vc_config_tag(), "[ERROR] Undefined event"); + } + + SLOG(LOG_DEBUG, vc_config_tag(), "@@@"); + + return ECORE_CALLBACK_PASS_ON; +} + +static int __vc_config_mgr_register_engine_config_updated_event(const char* path) +{ + if (NULL == path) { + SLOG(LOG_ERROR, vc_config_tag(), "[ERROR] Path is NULL"); + return -1; + } + + /* For engine directory monitoring */ + vc_engine_inotify_s *ino = (vc_engine_inotify_s *)calloc(1, sizeof(vc_engine_inotify_s)); + if (NULL == ino) { + SLOG(LOG_ERROR, vc_config_tag(), "[ERROR] Fail to allocate memory"); + return -1; + } + + ino->dir_fd = inotify_init(); + if (ino->dir_fd < 0) { + SLOG(LOG_ERROR, vc_config_tag(), "[ERROR] Fail to init inotify"); + free(ino); + ino = NULL; + + return -1; + } + + ino->dir_wd = inotify_add_watch(ino->dir_fd, path, IN_CLOSE_WRITE); + SLOG(LOG_DEBUG, vc_config_tag(), "Add inotify watch(%s)", path); + if (ino->dir_wd < 0) { + SLOG(LOG_ERROR, vc_config_tag(), "[ERROR] Fail to add watch"); + free(ino); + ino = NULL; + return -1; + } + + ino->dir_fd_handler = ecore_main_fd_handler_add(ino->dir_fd, ECORE_FD_READ, (Ecore_Fd_Cb)__vc_config_mgr_engine_config_inotify_event_callback, (void *)ino, NULL, NULL); + if (NULL == ino->dir_fd_handler) { + SLOG(LOG_ERROR, vc_config_tag(), "[ERROR] Fail to add fd handler"); + free(ino); + ino = NULL; + return -1; + } + + /* Set non-blocking mode of file */ + int value; + value = fcntl(ino->dir_fd, F_GETFL, 0); + value |= O_NONBLOCK; + + if (0 > fcntl(ino->dir_fd, F_SETFL, value)) { + SLOG(LOG_WARN, vc_config_tag(), "[WARNING] Fail to set non-block mode"); + } + + g_ino_list = g_list_append(g_ino_list, ino); + + return 0; +} + +static int __vc_config_mgr_unregister_engine_config_updated_event() +{ + /* delete all inotify variable */ + if (0 < g_list_length(g_ino_list)) { + GList *iter = NULL; + iter = g_list_first(g_ino_list); + + while (NULL != iter) { + vc_engine_inotify_s *tmp = iter->data; + + if (NULL != tmp) { + ecore_main_fd_handler_del(tmp->dir_fd_handler); + inotify_rm_watch(tmp->dir_fd, tmp->dir_wd); + close(tmp->dir_fd); + + free(tmp); + tmp = NULL; + } + + g_ino_list = g_list_remove_link(g_ino_list, iter); + + iter = g_list_first(g_ino_list); + } + } + + return 0; +} + + + + + Eina_Bool vc_config_mgr_inotify_event_cb(void* data, Ecore_Fd_Handler *fd_handler) { SLOG(LOG_DEBUG, vc_config_tag(), "@@@ Config changed callback event"); @@ -529,14 +828,12 @@ int vc_config_mgr_initialize(int uid) } /* Get file name from default engine directory */ - DIR *dp = NULL; - struct dirent *dirp; - g_engine_list = NULL; if (0 != access(VC_CONFIG_BASE, F_OK)) { if (0 != mkdir(VC_CONFIG_BASE, S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)) { SLOG(LOG_ERROR, vc_config_tag(), "[ERROR] Fail to make directory : %s", VC_CONFIG_BASE); + __vc_config_release_client(uid); pthread_mutex_unlock(&vc_config_mgr_mutex); return -1; } else { @@ -546,6 +843,7 @@ int vc_config_mgr_initialize(int uid) if (0 != access(VC_RUNTIME_INFO_ROOT, F_OK)) { if (0 != mkdir(VC_RUNTIME_INFO_ROOT, S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)) { SLOG(LOG_ERROR, vc_config_tag(), "[ERROR] Fail to make directory : %s", VC_RUNTIME_INFO_ROOT); + __vc_config_release_client(uid); pthread_mutex_unlock(&vc_config_mgr_mutex); return -1; } else { @@ -553,55 +851,49 @@ int vc_config_mgr_initialize(int uid) } } - dp = opendir(VC_DEFAULT_ENGINE_INFO); - if (NULL != dp) { - do { - dirp = readdir(dp); - - if (NULL != dirp) { - if (!strcmp(".", dirp->d_name) || !strcmp("..", dirp->d_name)) - continue; - - vc_engine_info_s* info = NULL; - char* filepath = NULL; - int filesize = 0; - - filesize = strlen(VC_DEFAULT_ENGINE_INFO) + strlen(dirp->d_name) + 5; - filepath = (char*)calloc(filesize, sizeof(char)); - - if (NULL != filepath) { - snprintf(filepath, filesize, "%s/%s", VC_DEFAULT_ENGINE_INFO, dirp->d_name); - } else { - SLOG(LOG_ERROR, vc_config_tag(), "[Engine Agent ERROR] Memory not enough!!"); - continue; - } - - if (0 == vc_parser_get_engine_info(filepath, &info)) { - g_engine_list = g_slist_append(g_engine_list, info); - } - - if (NULL != filepath) { - free(filepath); - filepath = NULL; - } - } - } while (NULL != dirp); + if (0 != access(VC_DOWNLOAD_BASE, F_OK)) { + if (0 != mkdir(VC_DOWNLOAD_BASE, S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)) { + SLOG(LOG_ERROR, vc_config_tag(), "[ERROR] Fail to make directory : %s", VC_DOWNLOAD_BASE); + __vc_config_release_client(uid); + pthread_mutex_unlock(&vc_config_mgr_mutex); + return -1; + } else { + SLOG(LOG_DEBUG, vc_config_tag(), "Success to make directory : %s", VC_DOWNLOAD_BASE); + } + } + if (0 != access(VC_DOWNLOAD_ENGINE_INFO, F_OK)) { + if (0 != mkdir(VC_DOWNLOAD_ENGINE_INFO, S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)) { + SLOG(LOG_ERROR, vc_config_tag(), "[ERROR] Fail to make directory : %s", VC_DOWNLOAD_ENGINE_INFO); + __vc_config_release_client(uid); + pthread_mutex_unlock(&vc_config_mgr_mutex); + return -1; + } else { + SLOG(LOG_DEBUG, vc_config_tag(), "Success to make directory : %s", VC_DOWNLOAD_ENGINE_INFO); + } + } - closedir(dp); - } else { - SLOG(LOG_WARN, vc_config_tag(), "[Engine Agent WARNING] Fail to open default directory"); + if (0 != __vc_config_mgr_get_engine_info()) { + SLOG(LOG_ERROR, vc_config_tag(), "[ERROR] Fail to get engine info"); + __vc_config_release_client(uid); + __vc_config_release_engine(); + pthread_mutex_unlock(&vc_config_mgr_mutex); + return VC_CONFIG_ERROR_ENGINE_NOT_FOUND; } __vc_config_mgr_print_engine_info(); if (0 != vc_parser_load_config(&g_config_info)) { SLOG(LOG_ERROR, vc_config_tag(), "[ERROR] Fail to parse configure information"); + __vc_config_release_client(uid); + __vc_config_release_engine(); pthread_mutex_unlock(&vc_config_mgr_mutex); return -1; } if (0 != __vc_config_mgr_check_engine_is_valid(g_config_info->engine_id)) { SLOG(LOG_ERROR, vc_config_tag(), "[ERROR] Fail to get default engine"); + __vc_config_release_client(uid); + __vc_config_release_engine(); vc_parser_unload_config(g_config_info); pthread_mutex_unlock(&vc_config_mgr_mutex); return VC_CONFIG_ERROR_ENGINE_NOT_FOUND; @@ -616,6 +908,8 @@ int vc_config_mgr_initialize(int uid) char* tmp_language; if (0 != __vc_config_mgr_select_lang(g_config_info->engine_id, &tmp_language)) { SLOG(LOG_ERROR, vc_config_tag(), "[ERROR] Fail to select language"); + __vc_config_release_client(uid); + __vc_config_release_engine(); vc_parser_unload_config(g_config_info); pthread_mutex_unlock(&vc_config_mgr_mutex); return -1; @@ -630,6 +924,8 @@ int vc_config_mgr_initialize(int uid) if (0 != vc_parser_set_language(tmp_language)) { free(tmp_language); SLOG(LOG_ERROR, vc_config_tag(), "[ERROR] Fail to save config"); + __vc_config_release_client(uid); + __vc_config_release_engine(); vc_parser_unload_config(g_config_info); pthread_mutex_unlock(&vc_config_mgr_mutex); return -1; @@ -655,6 +951,8 @@ int vc_config_mgr_initialize(int uid) temp_client = (vc_config_client_s*)calloc(1, sizeof(vc_config_client_s)); if (NULL == temp_client) { SLOG(LOG_ERROR, vc_config_tag(), "[ERROR] Fail to allocate memory"); + __vc_config_release_client(uid); + __vc_config_release_engine(); vc_parser_unload_config(g_config_info); pthread_mutex_unlock(&vc_config_mgr_mutex); return VC_ERROR_OUT_OF_MEMORY; @@ -676,62 +974,22 @@ int vc_config_mgr_initialize(int uid) int vc_config_mgr_finalize(int uid) { - GSList *iter = NULL; - vc_config_client_s* temp_client = NULL; - SLOG(LOG_INFO, vc_config_tag(), "[WARNING] Enter critical section"); - pthread_mutex_lock(&vc_config_mgr_mutex); - if (0 < g_slist_length(g_config_client_list)) { - /* Check uid */ - iter = g_slist_nth(g_config_client_list, 0); - - while (NULL != iter) { - temp_client = iter->data; - - if (NULL != temp_client) { - if (uid == temp_client->uid) { - g_config_client_list = g_slist_remove(g_config_client_list, temp_client); - free(temp_client); - break; - } - } - - iter = g_slist_next(iter); - } - } + pthread_mutex_lock(&vc_config_mgr_mutex); - if (0 < g_slist_length(g_config_client_list)) { - SLOG(LOG_DEBUG, vc_config_tag(), "Client count (%d)", g_slist_length(g_config_client_list)); + if (0 < __vc_config_release_client(uid)) { pthread_mutex_unlock(&vc_config_mgr_mutex); - + SLOG(LOG_DEBUG, vc_config_tag(), "[WARNING] Leave critical section"); + if (0 != pthread_mutex_destroy(&vc_config_mgr_mutex)) { SLOG(LOG_ERROR, vc_config_tag(), "[ERROR] Fail to destroy vc_config_mgr_mutex."); } - return 0; } - vc_engine_info_s *engine_info = NULL; - - if (0 < g_slist_length(g_engine_list)) { - - /* Get a first item */ - iter = g_slist_nth(g_engine_list, 0); - - while (NULL != iter) { - engine_info = iter->data; - - if (NULL != engine_info) { - g_engine_list = g_slist_remove(g_engine_list, engine_info); - - vc_parser_free_engine_info(engine_info); - } - - iter = g_slist_nth(g_engine_list, 0); - } - } - + __vc_config_release_engine(); + vconf_ignore_key_changed(VCONFKEY_LANGSET, __vc_config_language_changed_cb); vc_parser_unload_config(g_config_info); diff --git a/common/vc_config_parser.c b/common/vc_config_parser.c index ac89c5a..a862549 100644 --- a/common/vc_config_parser.c +++ b/common/vc_config_parser.c @@ -302,12 +302,12 @@ int vc_parser_load_config(vc_config_s** config_info) bool is_default_open = false; if (0 != access(VC_CONFIG, F_OK)) { - doc = xmlParseFile(VC_CONFIG_DEFAULT); + doc = xmlParseFile(VC_DEFAULT_CONFIG); if (doc == NULL) { - SLOG(LOG_ERROR, vc_config_tag(), "[ERROR] Fail to parse file error : %s", VC_CONFIG_DEFAULT); + SLOG(LOG_ERROR, vc_config_tag(), "[ERROR] Fail to parse file error : %s", VC_DEFAULT_CONFIG); return -1; } - SLOG(LOG_DEBUG, vc_config_tag(), "Use default config : %s", VC_CONFIG_DEFAULT); + SLOG(LOG_DEBUG, vc_config_tag(), "Use default config : %s", VC_DEFAULT_CONFIG); is_default_open = true; } else { int retry_count = 0; @@ -322,9 +322,9 @@ int vc_parser_load_config(vc_config_s** config_info) if (VC_RETRY_COUNT == retry_count) { SLOG(LOG_ERROR, vc_config_tag(), "[ERROR] Fail to parse file error : %s", VC_CONFIG); - doc = xmlParseFile(VC_CONFIG_DEFAULT); + doc = xmlParseFile(VC_DEFAULT_CONFIG); if (NULL == doc) { - SLOG(LOG_ERROR, vc_config_tag(), "[ERROR] Fail to parse file error : %s", VC_CONFIG_DEFAULT); + SLOG(LOG_ERROR, vc_config_tag(), "[ERROR] Fail to parse file error : %s", VC_DEFAULT_CONFIG); xmlCleanupParser(); return -1; } @@ -760,6 +760,56 @@ int vc_parser_find_config_changed(int* auto_lang, char** language, int* enabled) return 0; } +int vc_parser_copy_xml(const char* original, const char* destination) +{ + if (NULL == original || NULL == destination) { + SLOG(LOG_ERROR, vc_config_tag(), "[ERROR] Input parameter is NULL"); + return -1; + } + + xmlDocPtr doc = NULL; + if (0 == access(original, F_OK)) { + SLOG(LOG_DEBUG, vc_config_tag(), "[DEBUG] Success to access to %s", original); + doc = xmlParseFile(original); + if (doc == NULL) { + SLOG(LOG_ERROR, vc_config_tag(), "[ERROR] Fail to parse file error : %s", original); + return -1; + } + } else { + SLOG(LOG_ERROR, vc_config_tag(), "[ERROR] Fail to access to %s", original); + return -1; + } + + int ret = xmlSaveFile(destination, doc); + if (0 > ret) { + SLOG(LOG_ERROR, vc_config_tag(), "[ERROR] Save result : %d", ret); + } else { + static FILE* pFile; + pFile = fopen(destination, "r"); + int fd = -1; + if (NULL == pFile) { + SLOG(LOG_ERROR, vc_config_tag(), "[ERROR] Fail to open file %s", destination); + } else { + fd = fileno(pFile); + fsync(fd); + fclose(pFile); + SLOG(LOG_INFO, vc_config_tag(), "[DEBUG] Success to fsync %s", destination); + } + SLOG(LOG_ERROR, vc_config_tag(), "[DEBUG] Success to save %s", destination); + } + + /* Set mode */ + if (0 > chmod(destination, 0600)) { + SLOG(LOG_ERROR, vc_config_tag(), "[ERROR] Fail to change file mode : %d", ret); + } + + xmlFreeDoc(doc); + doc = NULL; + SLOG(LOG_DEBUG, vc_config_tag(), "[SUCCESS] Copying xml"); + + return 0; +} + int vc_parser_set_foreground(int pid, bool value) { int cur_pid = 0; diff --git a/common/vc_config_parser.h b/common/vc_config_parser.h index 253aa11..15635f0 100644 --- a/common/vc_config_parser.h +++ b/common/vc_config_parser.h @@ -61,6 +61,8 @@ int vc_parser_set_enabled(bool value); int vc_parser_find_config_changed(int* auto_lang, char** language, int* enabled); +int vc_parser_copy_xml(const char* original, const char* destination); + /* Set / Get foreground info */ int vc_parser_set_foreground(int pid, bool value); diff --git a/common/vc_defs.h b/common/vc_defs.h index 096aa4f..d58ed69 100644 --- a/common/vc_defs.h +++ b/common/vc_defs.h @@ -179,7 +179,7 @@ extern "C" { #define VC_DAEMON_PATH tzplatform_mkpath(tzplatform_getid("TZ_SYS_BIN"), "vc-daemon") -#define VC_CONFIG_DEFAULT tzplatform_mkpath(tzplatform_getid("TZ_SYS_RO_SHARE"), "voice/vc/1.0/vc-config.xml") +#define VC_DEFAULT_CONFIG tzplatform_mkpath(tzplatform_getid("TZ_SYS_RO_SHARE"), "voice/vc/1.0/vc-config.xml") #define VC_DEFAULT_BASE tzplatform_mkpath(tzplatform_getid("TZ_SYS_RO_SHARE"), "voice/vc/1.0") @@ -207,6 +207,10 @@ extern "C" { #define VC_RUNTIME_INFO_CLIENT tzplatform_mkpath(tzplatform_getid("TZ_USER_HOME"), "share/.voice/vc/vc-client-info.xml") +#define VC_DOWNLOAD_BASE tzplatform_mkpath(tzplatform_getid("TZ_USER_HOME"), "/share/.voice/vc/1.0") + +#define VC_DOWNLOAD_ENGINE_INFO tzplatform_mkpath(tzplatform_getid("TZ_USER_HOME"), "/share/.voice/vc/1.0/engine-info") + #define VC_NO_FOREGROUND_PID -1 #define VC_BASE_LANGUAGE "en_US" #define VC_RETRY_COUNT 5 diff --git a/engine-parser/CMakeLists.txt b/engine-parser/CMakeLists.txt new file mode 100644 index 0000000..84dafbe --- /dev/null +++ b/engine-parser/CMakeLists.txt @@ -0,0 +1,37 @@ +pkg_check_modules(parser-pkgs REQUIRED + capi-base-common + dlog + glib-2.0 + libxml-2.0 + pkgmgr-info + pkgmgr-installer + capi-appfw-app-manager + libtzplatform-config +) + +FOREACH(flag ${parser-pkgs_CFLAGS}) + SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") +ENDFOREACH(flag) + +SET (SRCS + src/vc-engine-parser.c +) + +SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -Wall" ) +SET(extapi "-fvisibility=hidden") + +## SET C COMPILER FLAGS +SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} ${extapi}") + +## SET CPP COMPILER FLAGS +#SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden") +#SET(CMAKE_CXX_FLAGS "${OSP_DEBUG_FLAGS} ${OSP_OPT_FLAGS} ${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS} ${OSP_COMPILER_FLAGS}") + +## SET LINKER FLAGS +SET(CMAKE_SHARED_LINKER_FLAGS "-Wl,--as-needed") + +## Create Library +ADD_LIBRARY ("${PROJECT_NAME}-engine-parser" SHARED ${SRCS}) +TARGET_LINK_LIBRARIES("${PROJECT_NAME}-engine-parser" ${parser-pkgs_LDFLAGS} ) + +INSTALL(TARGETS "${PROJECT_NAME}-engine-parser" DESTINATION "/etc/package-manager/parserlib/metadata") diff --git a/engine-parser/src/vc-engine-parser.c b/engine-parser/src/vc-engine-parser.c new file mode 100644 index 0000000..0e4a92a --- /dev/null +++ b/engine-parser/src/vc-engine-parser.c @@ -0,0 +1,883 @@ +// +// Copyright (c) 2016 Samsung Electronics Co., Ltd. +// +// Licensed under the Apache License, Version 2.0 (the License); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +/* Define EXPORT_API */ +#ifndef EXPORT_API +#define EXPORT_API __attribute__((visibility("default"))) +#endif + +#ifdef LOG_TAG +#undef LOG_TAG +#endif +#define LOG_TAG "vc-engine-parser" + +#define VC_TAG_ENGINE_BASE "voice-control-engine" +#define VC_TAG_ENGINE_NAME "name" +#define VC_TAG_ENGINE_ID "id" +#define VC_TAG_ENGINE_SETTING "setting" +#define VC_TAG_ENGINE_LANGUAGE_SET "languages" +#define VC_TAG_ENGINE_LANGUAGE "lang" +#define VC_TAG_ENGINE_NON_FIXED_SUPPORT "non-fixed-support" +#define VC_TAG_ENGINE_CREDENTIAL "credential" + +#define VC_CONFIG_BASE tzplatform_mkpath(TZ_USER_HOME, "share/.voice") +#define VC_HOME tzplatform_mkpath(TZ_USER_HOME, "share/.voice/vc") +#define VC_ENGINE_BASE tzplatform_mkpath(TZ_USER_HOME, "share/.voice/vc/1.0") +#define VC_ENGINE_INFO tzplatform_mkpath(TZ_USER_SHARE, ".voice/vc/1.0/engine-info") + +#define VC_GLOBAL_CONFIG_BASE "/etc/skel/share/.voice" +#define VC_GLOBAL_HOME "/etc/skel/share/.voice/vc" +#define VC_GLOBAL_ENGINE_BASE "/etc/skel/share/.voice/vc/1.0" +#define VC_GLOBAL_ENGINE_INFO "/etc/skel/share/.voice/vc/1.0/engine-info" + +#define VC_METADATA_LANGUAGE "http://tizen.org/metadata/vc-engine/language" +#define VC_METADATA_NON_FIXED_SUPPORT "http://tizen.org/metadata/vc-engine/non-fixed-support" +#define VC_METADATA_CREDENTIAL_REQUIRED "http://tizen.org/metadata/vc-engine/credential-required" +#define VC_METADATA_ENGINE_SETTING "http://tizen.org/metadata/vc-engine/setting" +#define VC_METADATA_ENGINE_NAME "http://tizen.org/metadata/vc-engine/name" + +/* Define Macro */ +#define FREE(x) { if (NULL != x) { free(x); x = NULL; } } +#define G_FREE(x) { if (NULL != x) { g_free(x); x = NULL; } } + +typedef struct metadata { + const char *key; + const char *value; +} metadata; + +static xmlDocPtr g_doc; +GumUser *g_guser = NULL; +uid_t g_uid = 301; // app_fw +gid_t g_gid = 301; // app_fw +GumUserType g_ut = GUM_USERTYPE_NONE; +gchar *g_user_type = NULL; + +char *g_dir_config_base = NULL; +char *g_dir_home = NULL; +char *g_dir_engine_base = NULL; +char *g_dir_engine_info = NULL; + + +static int __create_engine_info_xml(const char *pkgid) +{ + LOGD("=== Create engine info doc"); + g_doc = xmlNewDoc((xmlChar*)"1.0"); + if (NULL == g_doc) { + LOGE("[ERROR] Fail to new doc"); + return -1; + } + LOGD("==="); + return 0; +} + +static int __save_engine_info_xml(const char *pkgid, gchar *ut, uid_t uid, gid_t gid) +{ + LOGD("=== Save engine info doc"); + char *dir_config_base = NULL; + char *dir_home = NULL; + char *dir_engine_base = NULL; + char *dir_engine_info = NULL; + + if (NULL == ut || (NULL != ut && 0 == strcmp(ut, "none"))) { + LOGE("[ERROR] Usertype is NONE"); + return -1; + } + + uid_t globalapp_uid = tzplatform_getuid(TZ_SYS_GLOBALAPP_USER); + uid_t tmp_uid = 0; + gid_t tmp_gid = 0; + LOGD("uid(%d)", uid); + + if (globalapp_uid == uid) { + /* Global app */ + dir_config_base = strdup(VC_GLOBAL_CONFIG_BASE); + dir_home = strdup(VC_GLOBAL_HOME); + dir_engine_base = strdup(VC_GLOBAL_ENGINE_BASE); + dir_engine_info = strdup(VC_GLOBAL_ENGINE_INFO); + tmp_uid = 301; // app_fw + tmp_gid = 301; // app_fw + } else { + /* User app, Guest app, Security app */ + if (NULL != g_dir_config_base) + dir_config_base = strdup(g_dir_config_base); + if (NULL != g_dir_home) + dir_home = strdup(g_dir_home); + if (NULL != g_dir_engine_base) + dir_engine_base = strdup(g_dir_engine_base); + if (NULL != g_dir_engine_info) + dir_engine_info = strdup(g_dir_engine_info); + tmp_uid = uid; + tmp_gid = gid; + } + + if (NULL == dir_config_base || NULL == dir_home || NULL == dir_engine_base || NULL == dir_engine_info) { + LOGE("[ERROR] Fail to allocate memory"); + FREE(dir_config_base) + FREE(dir_home) + FREE(dir_engine_base) + FREE(dir_engine_info) + return -1; + } + + LOGD("[DEBUG] dir_engine_info(%s)", dir_engine_info); + + /* Make directories */ + int fd = -1; +// if (0 != access(dir_config_base, F_OK)) { + fd = open(dir_config_base, O_DIRECTORY); + if (-1 == fd) { + LOGE("[INFO] No directory : %s, errno : %d", dir_config_base, errno); + if (0 != mkdir(dir_config_base, S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)) { + LOGE("[ERROR] Fail to make directory : %s, errno : %d", dir_config_base, errno); + FREE(dir_config_base) + FREE(dir_home) + FREE(dir_engine_base) + FREE(dir_engine_info) + return -1; + } else { + LOGD("Success to make directory : %s", dir_config_base); + if (0 != chown(dir_config_base, tmp_uid, tmp_gid)) { + LOGD("[ERROR] Fail to change user and group, errno : %d", errno); + } else { + LOGD("[DEBUG] Success to change user and group"); + } + } + } else { + close(fd); + } + +// if (0 != access(dir_home, F_OK)) { + fd = open(dir_home, O_DIRECTORY); + if (-1 == fd) { + LOGE("[INFO] No directory : %s, errno : %d", dir_home, errno); + if (0 != mkdir(dir_home, S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)) { + LOGE("[ERROR] Fail to make directory : %s, errno : %d", dir_home, errno); + FREE(dir_config_base) + FREE(dir_home) + FREE(dir_engine_base) + FREE(dir_engine_info) + return -1; + } else { + LOGD("Success to make directory : %s", dir_home); + if (0 != chown(dir_home, tmp_uid, tmp_gid)) { + LOGD("[ERROR] Fail to change user and group, errno : %d", errno); + } else { + LOGD("[DEBUG] Success to change user and group"); + } + } + } else { + close(fd); + } + +// if (0 != access(dir_engine_base, F_OK)) { + fd = open(dir_engine_base, O_DIRECTORY); + if (-1 == fd) { + LOGE("[INFO] No directory : %s, errno : %d", dir_engine_base, errno); + if (0 != mkdir(dir_engine_base, S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)) { + LOGE("[ERROR] Fail to make directory : %s, errno : %d", dir_engine_base, errno); + FREE(dir_config_base) + FREE(dir_home) + FREE(dir_engine_base) + FREE(dir_engine_info) + return -1; + } else { + LOGD("Success to make directory : %s", dir_engine_base); + if (0 != chown(dir_engine_base, tmp_uid, tmp_gid)) { + LOGD("[ERROR] Fail to change user and group, errno : %d", errno); + } else { + LOGD("[DEBUG] Success to change user and group"); + } + } + } else { + close(fd); + } + +// if (0 != access(dir_engine_info, F_OK)) { + fd = open(dir_engine_info, O_DIRECTORY); + if (-1 == fd) { + LOGE("[INFO] No directory : %s, errno : %d", dir_engine_info, errno); + if (0 != mkdir(dir_engine_info, S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)) { + LOGE("[ERROR] Fail to make directory : %s, errno : %d", dir_engine_info, errno); + FREE(dir_config_base) + FREE(dir_home) + FREE(dir_engine_base) + FREE(dir_engine_info) + return -1; + } else { + LOGD("Success to make directory : %s", dir_engine_info); + if (0 != chown(dir_engine_info, tmp_uid, tmp_gid)) { + LOGD("[ERROR] Fail to change user and group, errno : %d", errno); + } else { + LOGD("[DEBUG] Success to change user and group"); + } + } + } else { + close(fd); + } + + char path[256] = {'\0',}; + snprintf(path, 256, "%s/%s.xml", dir_engine_info, pkgid); + int ret = xmlSaveFormatFile(path, g_doc, 1); + LOGD("xmlSaveFile (%d)", ret); + if (0 == ret) { + if (0 != chown(path, tmp_uid, tmp_gid)) { + LOGD("[ERROR] Fail to change user and group"); + } else { + LOGD("[DEBUG] Success to change user and group"); + } + } + + FREE(dir_config_base) + FREE(dir_home) + FREE(dir_engine_base) + FREE(dir_engine_info) + + LOGD("==="); + + return 0; +} + +static int __remove_engine_info_xml(const char *pkgid, gchar *ut, uid_t uid) +{ + LOGD("=== Remove engine info doc"); + char *dir_engine_info = NULL; + + if (NULL == ut || (NULL != ut && 0 == strcmp(ut, "none"))) { + LOGE("[ERROR] Usertype is NONE"); + return -1; + } + + uid_t globalapp_uid = tzplatform_getuid(TZ_SYS_GLOBALAPP_USER); + + LOGD("uid(%d)", uid); + + if (globalapp_uid == uid) { + /* Global app */ + dir_engine_info = strdup(VC_GLOBAL_ENGINE_INFO); + } else { + /* User app, Guest app, Security app */ + if (NULL != g_dir_engine_info) + dir_engine_info = strdup(g_dir_engine_info); + } + + if (NULL == dir_engine_info) { + LOGE("[ERROR] Fail to allocate memory"); + return -1; + } + + LOGD("[DEBUG] dir_engine_info(%s)", dir_engine_info); + + char path[256] = {'\0',}; + snprintf(path, 256, "%s/%s.xml", dir_engine_info, pkgid); + if (0 == access(path, F_OK)) { + LOGD("Remove engine info xml(%s)", path); + if (0 != remove(path)) { + LOGE("[ERROR] Fail to emove engine info xml(%s)", path); + } + } + + FREE(dir_engine_info) + + LOGD("==="); + + return 0; +} + +static void __insert_language_from_metadata(xmlNodePtr root, const char *language) +{ + LOGD("==== Insert language"); + char* lang = NULL; + + if (NULL == root || NULL == language) { + LOGE("Invalid parameter, root(%p), language(%s)", root, language); + return; + } + + char *tmp_lang, *tmp_free; + tmp_free = tmp_lang = strdup(language); + xmlNodePtr languages_node = NULL; + xmlNodePtr lang_node = NULL; + + languages_node = xmlNewNode(NULL, (const xmlChar*)VC_TAG_ENGINE_LANGUAGE_SET); + + lang = strsep(&tmp_lang, ","); + while (NULL != lang) { + LOGD("lang (%s)", lang); + lang_node = xmlNewNode(NULL, (const xmlChar*)VC_TAG_ENGINE_LANGUAGE); + xmlNodeSetContent(lang_node, (const xmlChar*)lang); + xmlAddChild(languages_node, lang_node); + lang = strsep(&tmp_lang, ","); + } + xmlAddChild(root, languages_node); + + FREE(tmp_free) +} + +static int __write_metadata_inxml(const char *pkgid, const char *appid, GList *list) +{ + GList *iter = NULL; + metadata *md = NULL; + + __create_engine_info_xml(pkgid); + + xmlNodePtr root = NULL; + xmlNodePtr cur = NULL; + + root = xmlNewNode(NULL, (const xmlChar*)VC_TAG_ENGINE_BASE); + + if (NULL == root) { + LOGE("[ERROR] Fail to get new node"); +// xmlFreeDoc(g_doc); + return -1; + } + xmlDocSetRootElement(g_doc, root); + + iter = g_list_first(list); + while (NULL != iter) { + md = (metadata *)iter->data; + if (NULL != md && NULL != md->key && NULL != md->value) { + LOGD(" - key(%s) value(%s)", md->key, md->value); + if (!strcmp(md->key, VC_METADATA_LANGUAGE)) { + __insert_language_from_metadata(root, md->value); + } else if (!strcmp(md->key, VC_METADATA_NON_FIXED_SUPPORT)) { + cur = xmlNewNode(NULL, (const xmlChar*)VC_TAG_ENGINE_NON_FIXED_SUPPORT); + xmlNodeSetContent(cur, (const xmlChar*)md->value); + xmlAddChild(root, cur); + } else if (!strcmp(md->key, VC_METADATA_CREDENTIAL_REQUIRED)) { + cur = xmlNewNode(NULL, (const xmlChar*)VC_TAG_ENGINE_CREDENTIAL); + xmlNodeSetContent(cur, (const xmlChar*)md->value); + xmlAddChild(root, cur); + } else if (!strcmp(md->key, VC_METADATA_ENGINE_SETTING)) { + cur = xmlNewNode(NULL, (const xmlChar*)VC_TAG_ENGINE_SETTING); + xmlNodeSetContent(cur, (const xmlChar*)md->value); + xmlAddChild(root, cur); + } else if (!strcmp(md->key, VC_METADATA_ENGINE_NAME)) { + cur = xmlNewNode(NULL, (const xmlChar*)VC_TAG_ENGINE_NAME); + xmlNodeSetContent(cur, (const xmlChar*)md->value); + xmlAddChild(root, cur); + } else { + LOGW("[WARNING] Unknown metadata type"); + } + } + iter = g_list_next(iter); + } + + cur = xmlNewNode(NULL, (const xmlChar*)VC_TAG_ENGINE_ID); + xmlNodeSetContent(cur, (const xmlChar*)appid); + xmlAddChild(root, cur); + + LOGD(""); + return 0; +} + +EXPORT_API +int PKGMGR_MDPARSER_PLUGIN_INSTALL(const char *pkgid, const char *appid, GList *list) +{ + LOGD("METADATA INSTALL"); + LOGD("pkgid(%s) appid(%s) list(%d)", pkgid, appid, g_list_length(list)); + + int ret = -1; + ret = pkgmgr_installer_info_get_target_uid(&g_uid); + if (ret < 0) { + LOGE("[ERROR] Fail to get target uid"); + return 0; + } else { + LOGD("uid(%d)", g_uid); + printf("[Parser Debug][DEBUG] uid(%d)", g_uid); + } + + uid_t globalapp_uid = tzplatform_getuid(TZ_SYS_GLOBALAPP_USER); + if (globalapp_uid == g_uid) { + g_user_type = g_strdup("admin"); + } else { + g_guser = gum_user_get_sync(g_uid, FALSE); + if (NULL == g_guser) { + LOGE("[ERROR] g_guser is NULL"); + return -1; + } + + g_object_get(G_OBJECT(g_guser), "gid", &g_gid, NULL); + g_object_get(G_OBJECT(g_guser), "usertype", &g_ut, NULL); + g_user_type = g_strdup(gum_user_type_to_string(g_ut)); + } + + if (NULL == g_user_type) { + LOGE("[ERROR] Fail to allocate memory"); + if (NULL != g_guser) { + g_object_unref(g_guser); + g_guser = NULL; + } + return -1; + } + + if (0 == strcmp(g_user_type, "none")) { + /* GUM_USERTYPE_NONE */ + LOGE("[ERROR] Fail to get target uid"); + g_object_unref(g_guser); + g_guser = NULL; + G_FREE(g_user_type) + return -1; + } + + if (globalapp_uid == g_uid) { + /* global directory */ + LOGD("[DEBUG] usertype: %s", g_user_type); + if (0 >= g_list_length(list)) { + LOGE("[ERROR] No Engine Metadata"); + G_FREE(g_user_type) + return 0; + } + + if (0 != __write_metadata_inxml(pkgid, appid, list)) { + LOGE("[ERROR] Fail to write metadata in the xml"); + xmlFreeDoc(g_doc); + G_FREE(g_user_type) + return -1; + } + + /* Save in /etc/skel/share/ */ + g_dir_config_base = strdup(VC_GLOBAL_CONFIG_BASE); + g_dir_home = strdup(VC_GLOBAL_HOME); + g_dir_engine_base = strdup(VC_GLOBAL_ENGINE_BASE); + g_dir_engine_info = strdup(VC_GLOBAL_ENGINE_INFO); + + if (NULL == g_dir_config_base || NULL == g_dir_home || NULL == g_dir_engine_base || NULL == g_dir_engine_info) { + LOGE("[ERROR] Fail to allocate memory"); + FREE(g_dir_config_base) + FREE(g_dir_home) + FREE(g_dir_engine_base) + FREE(g_dir_engine_info) + xmlFreeDoc(g_doc); + G_FREE(g_user_type) + return -1; + } + + if (0 != __save_engine_info_xml(pkgid, g_user_type, g_uid, g_gid)) { + LOGE("[ERROR] Fail to make engine info file"); + xmlFreeDoc(g_doc); + G_FREE(g_user_type) + return -1; + } + + /* Get user data by using libgum */ + + GumUserService *gus = NULL; + GumUserList *users = NULL; + GumUserList *iter = NULL; + GumUser *user = NULL; + gchar **query; + GumUserType gumut = GUM_USERTYPE_NONE; + gchar *user_type = NULL; + + uid_t uid; + gid_t gid; + gchar *home_dir = NULL; + + gus = gum_user_service_create_sync(TRUE); + if (!gus) { + LOGE("Failed to create gum user service"); + G_FREE(g_user_type) + return -1; + } + + query = g_strsplit("admin,normal", ",", -1); + + users = gum_user_service_get_user_list_sync(gus, (const gchar *const *)query); + g_strfreev(query); + + if (!users) { + LOGD("NO users"); + g_object_unref(gus); + gus = NULL; + G_FREE(g_user_type) + return 0; + } + + /* Make new user list */ + + iter = users; + while (iter != NULL) { + user = (GumUser*) iter->data; + g_object_get(G_OBJECT(user), "uid", &uid, NULL); + G_FREE(home_dir) + + g_object_get(G_OBJECT(user), "gid", &gid, NULL); + g_object_get(G_OBJECT(user), "homedir", &home_dir, NULL); + g_object_get(G_OBJECT(user), "usertype", &gumut, NULL); + user_type = g_strdup(gum_user_type_to_string(gumut)); + if (NULL == user_type) { + gum_user_service_list_free(users); + G_FREE(home_dir) + g_object_unref(gus); + gus = NULL; + return -1; + } + + LOGD("[DEBUG] user info"); + if (NULL != home_dir) { + LOGD("[DEBUG] uid(%d), gid(%d), user_type(%s), home_dir(%s)", uid, gid, user_type, home_dir); + + g_dir_config_base = (char*)calloc(strlen(home_dir) + 14, sizeof(char)); + g_dir_home = (char*)calloc(strlen(home_dir) + 17, sizeof(char)); + g_dir_engine_base = (char*)calloc(strlen(home_dir) + 21, sizeof(char)); + g_dir_engine_info = (char*)calloc(strlen(home_dir) + 33, sizeof(char)); + + if (NULL == g_dir_config_base || NULL == g_dir_home || NULL == g_dir_engine_base || NULL == g_dir_engine_info) { + LOGE("[ERROR] Fail to allocate memory"); + FREE(g_dir_config_base) + FREE(g_dir_home) + FREE(g_dir_engine_base) + FREE(g_dir_engine_info) + gum_user_service_list_free(users); + g_object_unref(gus); + gus = NULL; + G_FREE(user_type) + G_FREE(home_dir) + return -1; + } + snprintf(g_dir_config_base, strlen(home_dir) + 14, "%s/share/.voice", home_dir); + snprintf(g_dir_home, strlen(home_dir) + 17, "%s/share/.voice/vc", home_dir); + snprintf(g_dir_engine_base, strlen(home_dir) + 21, "%s/share/.voice/vc/1.0", home_dir); + snprintf(g_dir_engine_info, strlen(home_dir) + 33, "%s/share/.voice/vc/1.0/engine-info", home_dir); + + LOGD("[DEBUG] g_dir_engine_info(%s)", g_dir_engine_info); + + if (0 != __save_engine_info_xml(pkgid, user_type, uid, gid)) { + LOGE("[ERROR] Fail to make engine info file"); + } + + FREE(g_dir_config_base) + FREE(g_dir_home) + FREE(g_dir_engine_base) + FREE(g_dir_engine_info) + + G_FREE(home_dir) + } + + G_FREE(user_type) + iter = g_list_next(iter); + } + + gum_user_service_list_free(users); + g_object_unref(gus); + gus = NULL; + } else { + /* user directory */ + LOGD("[DEBUG] usertype: %s", g_user_type); + + ret = tzplatform_set_user(g_uid); + if (ret < 0) { + LOGE("[ERROR] Invalid uid"); + g_object_unref(g_guser); + g_guser = NULL; + G_FREE(g_user_type) + return 0; + } else { + LOGD("TZ_USER_HOME: %s", tzplatform_mkstr(TZ_USER_HOME, "/")); + printf("[Parser Debug][DEBUG] TZ_USER_HOME: %s", tzplatform_mkstr(TZ_USER_HOME, "/")); + } + + if (0 >= g_list_length(list)) { + LOGE("[ERROR] No Engine Metadata"); + g_object_unref(g_guser); + g_guser = NULL; + G_FREE(g_user_type) + return 0; + } + + if (0 != __write_metadata_inxml(pkgid, appid, list)) { + LOGE("[ERROR] Fail to write metadata in the xml"); + xmlFreeDoc(g_doc); + g_object_unref(g_guser); + g_guser = NULL; + G_FREE(g_user_type) + return -1; + } + + g_dir_config_base = strdup(VC_CONFIG_BASE); + g_dir_home = strdup(VC_HOME); + g_dir_engine_base = strdup(VC_ENGINE_BASE); + g_dir_engine_info = strdup(VC_ENGINE_INFO); + + if (NULL == g_dir_config_base || NULL == g_dir_home || NULL == g_dir_engine_base || NULL == g_dir_engine_info) { + LOGE("[ERROR] Fail to allocate memory"); + FREE(g_dir_config_base) + FREE(g_dir_home) + FREE(g_dir_engine_base) + FREE(g_dir_engine_info) + xmlFreeDoc(g_doc); + g_object_unref(g_guser); + g_guser = NULL; + G_FREE(g_user_type) + return -1; + } + + if (0 != __save_engine_info_xml(pkgid, g_user_type, g_uid, g_gid)) { + LOGE("[ERROR] Fail to make engine info file"); + xmlFreeDoc(g_doc); + if (NULL != g_guser) { + g_object_unref(g_guser); + g_guser = NULL; + } + G_FREE(g_user_type) + return -1; + } + } + + xmlFreeDoc(g_doc); + if (NULL != g_guser) { + g_object_unref(g_guser); + g_guser = NULL; + } + G_FREE(g_user_type) + + FREE(g_dir_config_base) + FREE(g_dir_home) + FREE(g_dir_engine_base) + FREE(g_dir_engine_info) + + return 0; +} + +EXPORT_API +int PKGMGR_MDPARSER_PLUGIN_UNINSTALL(const char *pkgid, const char *appid, GList *list) +{ + LOGD("METADATA UNINSTALL"); + LOGD("pkgid(%s) appid(%s) list(%d)", pkgid, appid, g_list_length(list)); + + int ret = -1; + ret = pkgmgr_installer_info_get_target_uid(&g_uid); + if (ret < 0) { + LOGE("[ERROR] Fail to get target uid"); + return 0; + } else { + LOGD("uid(%d)", g_uid); + printf("[Parser Debug][DEBUG] uid(%d)", g_uid); + } + + uid_t globalapp_uid = tzplatform_getuid(TZ_SYS_GLOBALAPP_USER); + if (globalapp_uid == g_uid) { + g_user_type = g_strdup("admin"); + } else { + g_guser = gum_user_get_sync(g_uid, FALSE); + if (NULL == g_guser) { + LOGE("[ERROR] g_guser is NULL"); + return -1; + } + + g_object_get(G_OBJECT(g_guser), "usertype", &g_ut, NULL); + g_user_type = g_strdup(gum_user_type_to_string(g_ut)); + } + + if (NULL == g_user_type) { + LOGE("[ERROR] Fail to allocate memory"); + if (NULL != g_guser) { + g_object_unref(g_guser); + g_guser = NULL; + } + return -1; + } + + if (0 == strcmp(g_user_type, "none")) { + /* GUM_USERTYPE_NONE */ + LOGE("[ERROR] Fail to get target uid"); + g_object_unref(g_guser); + g_guser = NULL; + G_FREE(g_user_type) + return -1; + } + + if (globalapp_uid == g_uid) { + /* global directory */ + LOGD("[DEBUG] usertype: %s", g_user_type); + + /* Remove files in /etc/skel/share/ */ + g_dir_engine_info = strdup(VC_GLOBAL_ENGINE_INFO); + if (NULL == g_dir_engine_info) { + LOGE("[ERROR] Fail to allocate memory"); + G_FREE(g_user_type) + return -1; + } + + if (0 != __remove_engine_info_xml(pkgid, g_user_type, g_uid)) { + LOGE("[ERROR] Fail to remove engine info file"); + } + + /* Get user data by using libgum */ + + GumUserService *gus = NULL; + GumUserList *users = NULL; + GumUserList *iter = NULL; + GumUser *user = NULL; + gchar **query; + GumUserType gumut = GUM_USERTYPE_NONE; + gchar *user_type = NULL; + + uid_t uid; + gchar *home_dir = NULL; + + GList *md_iter = NULL; + metadata *md = NULL; + + gus = gum_user_service_create_sync(TRUE); + if (!gus) { + LOGE("Failed to create gum user service"); + G_FREE(g_user_type) + return -1; + } + + query = g_strsplit("admin,normal", ",", -1); + + users = gum_user_service_get_user_list_sync(gus, (const gchar *const *)query); + g_strfreev(query); + + if (!users) { + LOGD("NO users"); + g_object_unref(gus); + gus = NULL; + G_FREE(g_user_type) + return 0; + } + + /* Make new user list */ + + iter = users; + while (iter != NULL) { + user = (GumUser*) iter->data; + g_object_get(G_OBJECT(user), "uid", &uid, NULL); + G_FREE(home_dir) + g_object_get(G_OBJECT(user), "homedir", &home_dir, NULL); + g_object_get(G_OBJECT(user), "usertype", &gumut, NULL); + user_type = g_strdup(gum_user_type_to_string(gumut)); + if (NULL == user_type) { + gum_user_service_list_free(users); + G_FREE(home_dir) + g_object_unref(gus); + gus = NULL; + return -1; + } + + if (NULL != home_dir) { + g_dir_engine_info = (char*)calloc(strlen(home_dir) + 33, sizeof(char)); + if (NULL == g_dir_engine_info) { + gum_user_service_list_free(users); + G_FREE(home_dir) + g_object_unref(gus); + gus = NULL; + G_FREE(user_type) + return -1; + } + + snprintf(g_dir_engine_info, strlen(home_dir) + 33, "%s/share/.voice/vc/1.0/engine-info", home_dir); + + md_iter = g_list_first(list); + while (NULL != md_iter) { + md = (metadata *)md_iter->data; + LOGD(" - key(%s) value(%s)", md->key, md->value); + md_iter = g_list_next(md_iter); + } + + if (0 != __remove_engine_info_xml(pkgid, user_type, uid)) { + LOGE("[ERROR] Fail to remove engine info file"); + } + + G_FREE(home_dir) + G_FREE(g_dir_engine_info) + } + G_FREE(user_type) + + LOGD("Finish release memory"); + iter = g_list_next(iter); + LOGD("Finish next iter"); + } + + gum_user_service_list_free(users); + g_object_unref(gus); + gus = NULL; + } else { + /* user directory */ + LOGD("[DEBUG] usertype: %s", g_user_type); + + ret = tzplatform_set_user(g_uid); + if (ret < 0) { + LOGE("[ERROR] Invalid uid"); + g_object_unref(g_guser); + g_guser = NULL; + G_FREE(g_user_type) + return -1; + } else { + LOGD("TZ_USER_HOME: %s", tzplatform_mkstr(TZ_USER_HOME, "/")); + printf("[Parser Debug][DEBUG] TZ_USER_HOME: %s", tzplatform_mkstr(TZ_USER_HOME, "/")); + } + + g_dir_engine_info = strdup(VC_ENGINE_INFO); + if (NULL == g_dir_engine_info) { + LOGE("[ERROR] Fail to allocate memory"); + g_object_unref(g_guser); + g_guser = NULL; + G_FREE(g_user_type) + return -1; + } + + if (0 != __remove_engine_info_xml(pkgid, g_user_type, g_uid)) { + LOGE("[ERROR] Fail to remove engine info file"); + } + + } + + if (NULL != g_guser) { + g_object_unref(g_guser); + g_guser = NULL; + } + G_FREE(g_user_type) + + FREE(g_dir_engine_info) + + LOGD(""); + return 0; +} + +EXPORT_API +int PKGMGR_MDPARSER_PLUGIN_UPGRADE(const char *pkgid, const char *appid, GList *list) +{ + LOGD("METADATA UPGRADE"); + LOGD("pkgid(%s) appid(%s) list(%d)", pkgid, appid, g_list_length(list)); + + PKGMGR_MDPARSER_PLUGIN_UNINSTALL(pkgid, appid, list); + PKGMGR_MDPARSER_PLUGIN_INSTALL(pkgid, appid, list); + + LOGD(""); + return 0; +} diff --git a/packaging/voice-control.spec b/packaging/voice-control.spec index 278936c..6d0cc6d 100644 --- a/packaging/voice-control.spec +++ b/packaging/voice-control.spec @@ -26,9 +26,12 @@ BuildRequires: pkgconfig(ecore) BuildRequires: pkgconfig(ecore-wayland) BuildRequires: pkgconfig(glib-2.0) BuildRequires: pkgconfig(json-glib-1.0) +BuildRequires: pkgconfig(libgum) BuildRequires: pkgconfig(libtzplatform-config) BuildRequires: pkgconfig(libxml-2.0) BuildRequires: pkgconfig(sqlite3) +BuildRequires: pkgconfig(pkgmgr-info) +BuildRequires: pkgconfig(pkgmgr-installer) %if "%{tizen_profile_name}" == "tv" BuildRequires: pkgconfig(capi-network-bluetooth) BuildRequires: pkgconfig(capi-network-bluetooth-tv) @@ -128,6 +131,7 @@ mkdir -p %{_libdir}/voice/vc %{_libdir}/libvc_engine.so %{TZ_SYS_RO_SHARE}/voice/vc/1.0/vc-config.xml %{TZ_SYS_RO_SHARE}/dbus-1/services/org.tizen.voice* +%{TZ_SYS_RO_ETC}/package-manager/parserlib/metadata/libvc-engine-parser.so* /etc/dbus-1/session.d/vc-server.conf %files devel -- 2.7.4 From ff5e1589632ce92dae37aa62f0ec6d6060f6b48a Mon Sep 17 00:00:00 2001 From: Wonnam Jang Date: Wed, 4 Jul 2018 18:50:02 +0900 Subject: [PATCH 06/16] start recording when wait_timer for widget client is timed out Change-Id: I4b6ed1d3ec72d86ea100442b392d978945b98486 Signed-off-by: Wonnam Jang --- server/vcd_server.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/server/vcd_server.c b/server/vcd_server.c index d5bf69b..1ebdb5b 100644 --- a/server/vcd_server.c +++ b/server/vcd_server.c @@ -53,6 +53,7 @@ typedef enum { } vcd_send_event_type_e; static int __vcd_server_launch_manager_app(); +static int __start_internal_recognition(); /* * VC Server Internal Functions @@ -1688,6 +1689,7 @@ static int __reset_waiting_for_widget_recording(void) return 0; } +#if 0 static Eina_Bool __send_waiting_timeout_error_to_manager(void* data) { intptr_t ppid = (intptr_t)data; @@ -1698,6 +1700,21 @@ static Eina_Bool __send_waiting_timeout_error_to_manager(void* data) vcdc_send_error_signal_to_manager(vcd_client_manager_get_pid(), VCD_ERROR_OPERATION_FAILED, "voice_engine.error.proc_fail"); return EINA_FALSE; } +#else +static Eina_Bool __send_waiting_timeout_start_recording(void* data) +{ + intptr_t ppid = (intptr_t)data; + int pid = (int)ppid; + SLOG(LOG_ERROR, TAG_VCD, "Widget client didn't send to start recording, pid(%d)", pid); + + int ret = __start_internal_recognition(); + if (0 != ret) { + SLOG(LOG_ERROR, TAG_VCD, "[Server ERROR] Fail to start recongition : %d", ret); + return ret; + } + return EINA_FALSE; +} +#endif static int __set_waiting_for_widget_recording(int pid) { @@ -1706,7 +1723,7 @@ static int __set_waiting_for_widget_recording(int pid) // Check if the app included widget client is terminated or not. If it is terminated, vcd_server_widget_finalize() function will be called // In that function, it will start recording intptr_t ppid = (intptr_t)pid; - g_check_widget_client_timer = ecore_timer_add(2.0, __send_waiting_timeout_error_to_manager, (void*)ppid); + g_check_widget_client_timer = ecore_timer_add(2.0, __send_waiting_timeout_start_recording, (void*)ppid); // Set flag to wait for recording from widget client vcd_client_widget_set_waiting_for_recording(pid, true); -- 2.7.4 From 37715281667b7b9ffa44defae1e904715272724c Mon Sep 17 00:00:00 2001 From: Wonnam Jang Date: Thu, 5 Jul 2018 16:52:42 +0900 Subject: [PATCH 07/16] Call service_state_changed_cb on client side Change-Id: If72acefe89371e7880f2aa3353296489b5629571 Signed-off-by: Wonnam Jang --- client/vc.c | 17 +++++++++++++++++ client/vc_mgr.c | 19 +++++++++++++++++-- client/vc_mgr_client.c | 2 +- client/vc_widget.c | 20 +++++++++++++++++++- server/vcd_server.c | 2 +- 5 files changed, 55 insertions(+), 5 deletions(-) diff --git a/client/vc.c b/client/vc.c index 14bdf8b..1152606 100644 --- a/client/vc.c +++ b/client/vc.c @@ -511,8 +511,25 @@ static Eina_Bool __vc_connect_daemon(void *data) } /* Set service state */ + vc_service_state_e previous_service_state; + vc_client_get_service_state(g_vc, &previous_service_state); + vc_client_set_service_state(g_vc, (vc_service_state_e)service_state); + vc_service_state_changed_cb service_changed_callback = NULL; + void* user_data = NULL; + vc_client_get_service_state_changed_cb(g_vc, &service_changed_callback, &user_data); + + if (NULL != service_changed_callback) { + vc_client_use_callback(g_vc); + service_changed_callback(previous_service_state, service_state, user_data); + vc_client_not_use_callback(g_vc); + SLOG(LOG_DEBUG, TAG_VCC, "Service state changed callback is called"); + } else { + SLOG(LOG_WARN, TAG_VCC, "[WARNING] Service state changed callback is null"); + } + + /* Register focus handler */ g_focus_in_handler = ecore_event_handler_add(ECORE_WL_EVENT_FOCUS_IN, __focus_changed_cb, NULL); g_focus_out_handler = ecore_event_handler_add(ECORE_WL_EVENT_FOCUS_OUT, __focus_changed_cb, NULL); diff --git a/client/vc_mgr.c b/client/vc_mgr.c index ab8d584..ff628fc 100644 --- a/client/vc_mgr.c +++ b/client/vc_mgr.c @@ -396,18 +396,33 @@ static Eina_Bool __vc_mgr_connect_daemon(void *data) } /* Set service state */ + vc_service_state_e previous_service_state; + vc_mgr_client_get_service_state(g_vc_m, &previous_service_state); + vc_mgr_client_set_service_state(g_vc_m, (vc_service_state_e)service_state); + vc_service_state_changed_cb service_changed_callback = NULL; + void* user_data = NULL; + vc_mgr_client_get_service_state_changed_cb(g_vc_m, &service_changed_callback, &user_data); + + if (NULL != service_changed_callback) { + vc_mgr_client_use_callback(g_vc_m); + service_changed_callback(previous_service_state, service_state, user_data); + vc_mgr_client_not_use_callback(g_vc_m); + SLOG(LOG_DEBUG, TAG_VCM, "Service state changed callback is called"); + } else { + SLOG(LOG_WARN, TAG_VCM, "[WARNING] Service state changed callback is null"); + } + /* Set foreground */ vc_mgr_client_set_foreground(g_vc_m, foreground, true); SLOG(LOG_ERROR, TAG_VCM, "[SUCCESS] Connected daemon"); + /* Set client state */ vc_mgr_client_set_client_state(g_vc_m, VC_STATE_READY); vc_state_changed_cb changed_callback = NULL; - void* user_data = NULL; - vc_mgr_client_get_state_changed_cb(g_vc_m, &changed_callback, &user_data); vc_state_e current_state; diff --git a/client/vc_mgr_client.c b/client/vc_mgr_client.c index 18120ed..f6b9603 100644 --- a/client/vc_mgr_client.c +++ b/client/vc_mgr_client.c @@ -198,7 +198,7 @@ int vc_mgr_client_create(vc_h* vc) client->result_event = -1; client->result_text = NULL; - client->service_state = 0; + client->service_state = VC_SERVICE_STATE_NONE; client->internal_state = VC_INTERNAL_STATE_NONE; diff --git a/client/vc_widget.c b/client/vc_widget.c index 0dcca65..eb54aa7 100644 --- a/client/vc_widget.c +++ b/client/vc_widget.c @@ -395,10 +395,28 @@ static Eina_Bool __vc_widget_connect_daemon(void *data) return EINA_TRUE; } + /* Set service state */ + vc_service_state_e previous_service_state; + vc_widget_client_get_service_state(vc_w, &previous_service_state); + vc_widget_client_set_service_state(vc_w, (vc_service_state_e)service_state); + vc_service_state_changed_cb service_changed_callback = NULL; + void* user_data = NULL; + vc_widget_client_get_service_state_changed_cb(vc_w, &service_changed_callback, &user_data); + + if (NULL != service_changed_callback) { + vc_widget_client_use_callback(vc_w); + service_changed_callback(previous_service_state, service_state, user_data); + vc_widget_client_not_use_callback(vc_w); + SLOG(LOG_DEBUG, TAG_VCW, "Service state changed callback is called"); + } else { + SLOG(LOG_WARN, TAG_VCW, "[WARNING] Service state changed callback is null"); + } + SLOG(LOG_INFO, TAG_VCW, "@@@ [Widget] Connect daemon"); + /* Get app focus and set foreground */ char appid[1024] = {'\0',}; aul_app_get_appid_bypid(getpid(), appid, sizeof(appid) - 1); @@ -411,10 +429,10 @@ static Eina_Bool __vc_widget_connect_daemon(void *data) } } + /* Set client state */ vc_widget_client_set_state(vc_w, VC_STATE_READY); vc_state_changed_cb changed_callback = NULL; - void* user_data; vc_widget_client_get_state_changed_cb(vc_w, &changed_callback, &user_data); diff --git a/server/vcd_server.c b/server/vcd_server.c index d5bf69b..8bdf090 100644 --- a/server/vcd_server.c +++ b/server/vcd_server.c @@ -1217,7 +1217,7 @@ int vcd_initialize(vce_request_callback_s *callback) vcd_client_manager_unset(); vcd_config_set_service_state(VCD_STATE_READY); - vcdc_send_service_state(VCD_STATE_READY); +// vcdc_send_service_state(VCD_STATE_READY); /* Set timer cleanup client all */ g_check_client_timer = ecore_timer_add(CLIENT_CLEAN_UP_TIME, vcd_cleanup_client_all, NULL); -- 2.7.4 From 3f9c3d216e2f86c8a0a8e307fad5b481a0961bd4 Mon Sep 17 00:00:00 2001 From: "sooyeon.kim" Date: Wed, 18 Jul 2018 14:36:52 +0900 Subject: [PATCH 08/16] [ACR-1267][Change since_tizen subscription] Change-Id: I877ef026a344676a5fb0d7fc36be31b406b7d27e Signed-off-by: sooyeon.kim --- include/vce.h | 1327 ++++++++++++++++++++++++++++----------------------------- 1 file changed, 663 insertions(+), 664 deletions(-) diff --git a/include/vce.h b/include/vce.h index e5d917f..af5c5fd 100644 --- a/include/vce.h +++ b/include/vce.h @@ -1,18 +1,18 @@ /* -* Copyright (c) 2011-2017 Samsung Electronics Co., Ltd All Rights Reserved -* -* Licensed under the Apache License, Version 2.0 (the License); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an AS IS BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ + * Copyright (c) 2011-2017 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #ifndef __VCE_H__ @@ -21,18 +21,18 @@ #include /** -* @addtogroup CAPI_UIX_VOICE_CONTROL_ENGINE_MODULE -* @{ -*/ + * @addtogroup CAPI_UIX_VOICE_CONTROL_ENGINE_MODULE + * @{ + */ #ifdef __cplusplus extern "C" { #endif /** -* @brief Enumerations of error codes. -* @since_tizen 4.0 -*/ + * @brief Enumerations of error codes. + * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + */ typedef enum { VCE_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */ VCE_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of Memory */ @@ -49,18 +49,18 @@ typedef enum { } vce_error_e; /** -* @brief Enumerations of audio type. -* @since_tizen 4.0 -*/ + * @brief Enumerations of audio type. + * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + */ typedef enum { VCE_AUDIO_TYPE_PCM_S16_LE = 0, /**< Signed 16bit audio type, Little endian */ VCE_AUDIO_TYPE_PCM_U8 /**< Unsigned 8bit audio type */ } vce_audio_type_e; /** -* @brief Enumerations of callback event. -* @since_tizen 4.0 -*/ + * @brief Enumerations of callback event. + * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + */ typedef enum { VCE_RESULT_EVENT_SUCCESS = 0, /**< Event when the recognition full result is ready */ VCE_RESULT_EVENT_REJECTED, /**< Event when the recognition result is rejected */ @@ -68,9 +68,9 @@ typedef enum { } vce_result_event_e; /** -* @brief Enumerations of command type. -* @since_tizen 4.0 -*/ + * @brief Enumerations of command type. + * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + */ typedef enum { VCE_COMMAND_FORMAT_FIXED = 0, /**< Fixed command */ VCE_COMMAND_FORMAT_FIXED_AND_VFIXED, /**< Fixed command + variable-fixed command */ @@ -82,9 +82,9 @@ typedef enum { } vce_command_format_e; /** -* @brief Enumerations of speech detect. -* @since_tizen 4.0 -*/ + * @brief Enumerations of speech detect. + * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + */ typedef enum { VCE_SPEECH_DETECT_NONE = 0, /**< No event */ VCE_SPEECH_DETECT_BEGIN, /**< Begin of speech detected */ @@ -92,9 +92,9 @@ typedef enum { } vce_speech_detect_e; /** -* @brief Enumerations of ASR result events. -* @since_tizen 4.0 -*/ + * @brief Enumerations of ASR result events. + * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + */ typedef enum { VCE_ASR_RESULT_EVENT_FINAL_RESULT = 0, /**< Event when the ASR result is last data or ASR result is only one result */ VCE_ASR_RESULT_EVENT_PARTIAL_RESULT, /**< Event when the ASR result exist, not first and not last */ @@ -103,7 +103,7 @@ typedef enum { /** * @brief Enumerations of audio channels. - * @since_tizen 4.0 + * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif */ typedef enum { VCE_AUDIO_CHANNEL_MONO = 0, /**< 1 channel, mono */ @@ -112,7 +112,7 @@ typedef enum { /** * @brief Enumeration for TTS feedback events. - * @since_tizen 4.0 + * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif */ typedef enum { VCE_FEEDBACK_EVENT_FAIL = -1, /**< Failed */ @@ -123,447 +123,447 @@ typedef enum { /** -* @brief A structure of handle for VC command. -* @since_tizen 4.0 -*/ + * @brief A structure of handle for VC command. + * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + */ typedef struct vce_cmd_s* vce_cmd_h; /** -* @brief Definition for foreground command type. -* @since_tizen 4.0 -*/ + * @brief Definition for foreground command type. + * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + */ #define VCE_COMMAND_TYPE_FOREGROUND 1 /** -* @brief Definition for background command type. -* @since_tizen 4.0 -*/ + * @brief Definition for background command type. + * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + */ #define VCE_COMMAND_TYPE_BACKGROUND 2 /** -* @brief Definition for widget command type. -* @since_tizen 4.0 -*/ + * @brief Definition for widget command type. + * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + */ #define VCE_COMMAND_TYPE_WIDGET 3 /** -* @brief Definition for system command type. -* @since_tizen 4.0 -*/ + * @brief Definition for system command type. + * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + */ #define VCE_COMMAND_TYPE_SYSTEM 4 /** -* @brief Definition for system background command type. -* @since_tizen 4.0 -*/ + * @brief Definition for system background command type. + * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + */ #define VCE_COMMAND_TYPE_SYSTEM_BACKGROUND 5 /** -* @brief Definitions for exclusive command type. -* @since_tizen 4.0 -*/ + * @brief Definitions for exclusive command type. + * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + */ #define VCE_COMMAND_TYPE_EXCLUSIVE 6 /** -* @brief Definition of bluetooth audio id. -* @since_tizen 4.0 -*/ + * @brief Definition of bluetooth audio id. + * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + */ #define VCE_AUDIO_ID_BLUETOOTH "VC_AUDIO_ID_BLUETOOTH" /**< Bluetooth audio id */ /** -* @brief Definition of Wi-Fi audio id. -* @since_tizen 4.0 -*/ + * @brief Definition of Wi-Fi audio id. + * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + */ #define VCE_AUDIO_ID_WIFI "VC_AUDIO_ID_WIFI" /**< Wi-Fi audio id */ /** -* @brief Definition for none message. -* @since_tizen 4.0 -*/ + * @brief Definition for none message. + * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + */ #define VC_RESULT_MESSAGE_NONE "vc.result.message.none" /** -* @brief Definition for failed recognition because the speech is too loud to listen. -* @since_tizen 4.0 -*/ + * @brief Definition for failed recognition because the speech is too loud to listen. + * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + */ #define VC_RESULT_MESSAGE_ERROR_TOO_LOUD "vc.result.message.error.too.loud" /** -* @brief Called when VC engine informs the engine service user about whole supported languages. -* @details This callback function is implemented by the engine service user. Therefore, the engine developer does NOT have to implement this callback function. -* @since_tizen 4.0 -* @remarks This callback function is called by vce_foreach_supported_languages_cb() to retrieve the whole supported language list. -* The @a user_data must be transferred from vce_foreach_supported_languages_cb(). -* The @a language can be used only in the callback. To use outside, make a copy. -* @param[in] language A language is specified as an ISO 3166 alpha-2 two letter country-code followed by ISO 639-1 for the two-letter language code \n -* For example, "ko_KR" for Korean, "en_US" for American English. -* @param[in] user_data The user data passed from the foreach function -* @return @c true to continue with the next iteration of the loop \n @c false to break out of the loop -* @pre vce_foreach_supported_languages() will invoke this callback. -* @see vce_foreach_supported_languages() -*/ + * @brief Called when VC engine informs the engine service user about whole supported languages. + * @details This callback function is implemented by the engine service user. Therefore, the engine developer does NOT have to implement this callback function. + * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + * @remarks This callback function is called by vce_foreach_supported_languages_cb() to retrieve the whole supported language list. + * The @a user_data must be transferred from vce_foreach_supported_languages_cb(). + * The @a language can be used only in the callback. To use outside, make a copy. + * @param[in] language A language is specified as an ISO 3166 alpha-2 two letter country-code followed by ISO 639-1 for the two-letter language code \n + * For example, "ko_KR" for Korean, "en_US" for American English. + * @param[in] user_data The user data passed from the foreach function + * @return @c true to continue with the next iteration of the loop \n @c false to break out of the loop + * @pre vce_foreach_supported_languages() will invoke this callback. + * @see vce_foreach_supported_languages() + */ typedef bool (*vce_supported_language_cb)(const char* language, void* user_data); /** -* @brief Called when the engine service user initializes Voice Control (VC) engine. -* @since_tizen 4.0 -* @remarks This callback function is mandatory and must be registered using vce_main(). -* @return 0 on success, otherwise a negative error value -* @retval #VCE_ERROR_NONE Successful -* @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter -* @retval #VCE_ERROR_INVALID_STATE Already initialized -* @retval #VCE_ERROR_OPERATION_FAILED Operation failed -* @see vce_deinitialize_cb() -*/ + * @brief Called when the engine service user initializes Voice Control (VC) engine. + * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + * @remarks This callback function is mandatory and must be registered using vce_main(). + * @return 0 on success, otherwise a negative error value + * @retval #VCE_ERROR_NONE Successful + * @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #VCE_ERROR_INVALID_STATE Already initialized + * @retval #VCE_ERROR_OPERATION_FAILED Operation failed + * @see vce_deinitialize_cb() + */ typedef int (*vce_initialize_cb)(void); /** -* @brief Called when the engine service user deinitializes VC engine. -* @since_tizen 4.0 -* @remarks This callback function is mandatory and must be registered using vce_main(). -* @return 0 on success, otherwise a negative error value -* @retval #VCE_ERROR_NONE Successful -* @retval #VCE_ERROR_INVALID_STATE Not initialized -* @see vce_initialize_cb() -*/ + * @brief Called when the engine service user deinitializes VC engine. + * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + * @remarks This callback function is mandatory and must be registered using vce_main(). + * @return 0 on success, otherwise a negative error value + * @retval #VCE_ERROR_NONE Successful + * @retval #VCE_ERROR_INVALID_STATE Not initialized + * @see vce_initialize_cb() + */ typedef int (*vce_deinitialize_cb)(void); /** -* @brief Called when the engine service user requests the recording format of VC engine. -* @since_tizen 4.0 -* @remarks This callback function is mandatory and must be registered using vce_main(). -* The @a audio_id can be used only in the callback. To use outside, make a copy. -* The @a types is managed by the platform and will be released when this callback function is completed. -* The @a rate is managed by the platform and will be released when this callback function is completed. -* The @a channels is managed by the platform and will be released when this callback function is completed. -* @param[in] audio_id The audio device id. (e.g. #VCE_AUDIO_ID_BLUETOOTH or #VCE_AUDIO_ID_WIFI) -* @param[out] types The format used by the recorder. -* @param[out] rate The sample rate used by the recorder. -* @param[out] channels The number of channels used by the recorder. -* @return 0 on success, otherwise a negative error value -* @retval #VCE_ERROR_NONE Successful -* @retval #VCE_ERROR_INVALID_PARAMETER Not initialized -*/ + * @brief Called when the engine service user requests the recording format of VC engine. + * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + * @remarks This callback function is mandatory and must be registered using vce_main(). + * The @a audio_id can be used only in the callback. To use outside, make a copy. + * The @a types is managed by the platform and will be released when this callback function is completed. + * The @a rate is managed by the platform and will be released when this callback function is completed. + * The @a channels is managed by the platform and will be released when this callback function is completed. + * @param[in] audio_id The audio device id. (e.g. #VCE_AUDIO_ID_BLUETOOTH or #VCE_AUDIO_ID_WIFI) + * @param[out] types The format used by the recorder. + * @param[out] rate The sample rate used by the recorder. + * @param[out] channels The number of channels used by the recorder. + * @return 0 on success, otherwise a negative error value + * @retval #VCE_ERROR_NONE Successful + * @retval #VCE_ERROR_INVALID_PARAMETER Not initialized + */ typedef int (*vce_get_recording_format_cb)(const char* audio_id, vce_audio_type_e* types, int* rate, int* channels); /** -* @brief Called when the engine service user retrieves all supported languages of VC engine. -* @since_tizen 4.0 -* @remarks This callback function is mandatory and must be registered using vce_main(). -* @param[in] callback a callback function -* @param[in] user_data The user data to be passed to the callback function -* @return 0 on success, otherwise a negative error value -* @retval #VCE_ERROR_NONE Successful -* @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter -* @retval #VCE_ERROR_INVALID_STATE Not initialized -* @post This function invokes vce_supported_language_cb() repeatedly for getting supported languages. -* -* @see vce_supported_language_cb() -*/ + * @brief Called when the engine service user retrieves all supported languages of VC engine. + * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + * @remarks This callback function is mandatory and must be registered using vce_main(). + * @param[in] callback a callback function + * @param[in] user_data The user data to be passed to the callback function + * @return 0 on success, otherwise a negative error value + * @retval #VCE_ERROR_NONE Successful + * @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #VCE_ERROR_INVALID_STATE Not initialized + * @post This function invokes vce_supported_language_cb() repeatedly for getting supported languages. + * + * @see vce_supported_language_cb() + */ typedef int (*vce_foreach_supported_languages_cb)(vce_supported_language_cb callback, void* user_data); /** -* @brief Called when the engine service user checks whether a language is supported or not. -* @since_tizen 4.0 -* @remarks This callback function is mandatory and must be registered using vce_main(). -* The @a language can be used only in the callback. To use outside, make a copy. -* @param[in] language A language -* @return @c true = supported, \n @c false = not supported. -*/ + * @brief Called when the engine service user checks whether a language is supported or not. + * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + * @remarks This callback function is mandatory and must be registered using vce_main(). + * The @a language can be used only in the callback. To use outside, make a copy. + * @param[in] language A language + * @return @c true = supported, \n @c false = not supported. + */ typedef bool (*vce_is_language_supported_cb)(const char* language); /** -* @brief Called when the engine service user sets language. -* @since_tizen 4.0 -* @remarks The @a language can be used only in the callback. To use outside, make a copy. -* @param[in] language A language. -* @return 0 on success, otherwise a negative error value -* @retval #VCE_ERROR_NONE Successful -* @retval #VCE_ERROR_INVALID_LANGUAGE Invalid language -* @retval #VCE_ERROR_INVALID_STATE Not initialized -* @retval #VCE_ERROR_NOT_SUPPORTED_FEATURE Not supported feature -*/ + * @brief Called when the engine service user sets language. + * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + * @remarks The @a language can be used only in the callback. To use outside, make a copy. + * @param[in] language A language. + * @return 0 on success, otherwise a negative error value + * @retval #VCE_ERROR_NONE Successful + * @retval #VCE_ERROR_INVALID_LANGUAGE Invalid language + * @retval #VCE_ERROR_INVALID_STATE Not initialized + * @retval #VCE_ERROR_NOT_SUPPORTED_FEATURE Not supported feature + */ typedef int (*vce_set_language_cb)(const char* language); /** -* @brief Called when the engine service user sets command list before recognition. -* @since_tizen 4.0 -* @remarks This function should set commands via vcd_foreach_command(). -* The @a vc_command should not be released. -* The @a vc_command can be used only in the callback. To use outside, make a copy. -* @param[in] vc_command command handle. The @a vc_command can be used only in the callback. To use outside, make a copy. -* @return 0 on success, otherwise a negative error value -* @retval #VCE_ERROR_NONE Successful -* @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter -* @retval #VCE_ERROR_INVALID_STATE Invalid state -* @retval #VCE_ERROR_OPERATION_FAILED Operation failed -* @retval #VCE_ERROR_NOT_SUPPORTED_FEATURE Not supported command type -* @post vce_start() is called after this function is successful. -* @see vce_start() -* @see vcd_foreach_command() -* @see vce_unset_commands() -* @see vce_get_command_count() -*/ + * @brief Called when the engine service user sets command list before recognition. + * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + * @remarks This function should set commands via vcd_foreach_command(). + * The @a vc_command should not be released. + * The @a vc_command can be used only in the callback. To use outside, make a copy. + * @param[in] vc_command command handle. The @a vc_command can be used only in the callback. To use outside, make a copy. + * @return 0 on success, otherwise a negative error value + * @retval #VCE_ERROR_NONE Successful + * @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #VCE_ERROR_INVALID_STATE Invalid state + * @retval #VCE_ERROR_OPERATION_FAILED Operation failed + * @retval #VCE_ERROR_NOT_SUPPORTED_FEATURE Not supported command type + * @post vce_start() is called after this function is successful. + * @see vce_start() + * @see vcd_foreach_command() + * @see vce_unset_commands() + * @see vce_get_command_count() + */ typedef int (*vce_set_commands_cb)(vce_cmd_h vc_command); /** -* @brief Called when the engine service user unsets command list for reset. -* @since_tizen 4.0 -* @return 0 on success, otherwise a negative error value -* @retval #VCE_ERROR_NONE Successful -* @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter -* @retval #VCE_ERROR_INVALID_STATE Invalid state -* @retval #VCE_ERROR_OPERATION_FAILED Operation failed -* @retval #VCE_ERROR_NOT_SUPPORTED_FEATURE Not supported feature -* @see vce_set_commands_cb() -*/ + * @brief Called when the engine service user unsets command list for reset. + * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + * @return 0 on success, otherwise a negative error value + * @retval #VCE_ERROR_NONE Successful + * @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #VCE_ERROR_INVALID_STATE Invalid state + * @retval #VCE_ERROR_OPERATION_FAILED Operation failed + * @retval #VCE_ERROR_NOT_SUPPORTED_FEATURE Not supported feature + * @see vce_set_commands_cb() + */ typedef int (*vce_unset_commands_cb)(void); /** -* @brief Called when the engine service user starts recognition. -* @since_tizen 4.0 -* @remarks This callback function is mandatory and must be registered using vce_main(). -* @param[in] stop_by_silence Silence detection option. -* @c true to detect the silence, -* @c false not to detect the silence -* @return 0 on success, otherwise a negative error value -* @retval #VCE_ERROR_NONE Successful -* @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter -* @retval #VCE_ERROR_INVALID_STATE Invalid state -* @retval #VCE_ERROR_INVALID_LANGUAGE Invalid language -* @retval #VCE_ERROR_OUT_OF_NETWORK Out of network -* @retval #VCE_ERROR_OPERATION_FAILED Operation failed -* @pre vcd_foreach_command() is successful. -* @see vce_set_recording_data_cb() -* @see vce_stop() -* @see vce_cancel() -*/ + * @brief Called when the engine service user starts recognition. + * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + * @remarks This callback function is mandatory and must be registered using vce_main(). + * @param[in] stop_by_silence Silence detection option. + * @c true to detect the silence, + * @c false not to detect the silence + * @return 0 on success, otherwise a negative error value + * @retval #VCE_ERROR_NONE Successful + * @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #VCE_ERROR_INVALID_STATE Invalid state + * @retval #VCE_ERROR_INVALID_LANGUAGE Invalid language + * @retval #VCE_ERROR_OUT_OF_NETWORK Out of network + * @retval #VCE_ERROR_OPERATION_FAILED Operation failed + * @pre vcd_foreach_command() is successful. + * @see vce_set_recording_data_cb() + * @see vce_stop() + * @see vce_cancel() + */ typedef int (*vce_start_cb)(bool stop_by_silence); /** -* @brief Called when the engine service user sets recording data for speech recognition from recorder. -* @since_tizen 4.0 -* @remarks This function should be returned immediately after recording data copy. -* The @a data can be used only in the callback. To use outside, make a copy. -* The @a speech_detected should not be released. This is managed by the platform. -* @param[in] data A recording data -* @param[in] length A length of recording data -* @param[out] speech_detected The status of speech (e.g. #VCE_SPEECH_DETECT_BEGIN or #VCE_SPEECH_DETECT_END). The @a speech_detected can be used only in the callback. To use outside, make a copy. -* @return 0 on success, otherwise a negative error value -* @retval #VCE_ERROR_NONE Successful -* @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter -* @retval #VCE_ERROR_INVALID_STATE Invalid state -* @retval #VCE_ERROR_OPERATION_FAILED Operation failed -* @pre vce_start() is successful. -* @see vce_start() -* @see vce_cancel() -* @see vce_stop() -*/ + * @brief Called when the engine service user sets recording data for speech recognition from recorder. + * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + * @remarks This function should be returned immediately after recording data copy. + * The @a data can be used only in the callback. To use outside, make a copy. + * The @a speech_detected should not be released. This is managed by the platform. + * @param[in] data A recording data + * @param[in] length A length of recording data + * @param[out] speech_detected The status of speech (e.g. #VCE_SPEECH_DETECT_BEGIN or #VCE_SPEECH_DETECT_END). The @a speech_detected can be used only in the callback. To use outside, make a copy. + * @return 0 on success, otherwise a negative error value + * @retval #VCE_ERROR_NONE Successful + * @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #VCE_ERROR_INVALID_STATE Invalid state + * @retval #VCE_ERROR_OPERATION_FAILED Operation failed + * @pre vce_start() is successful. + * @see vce_start() + * @see vce_cancel() + * @see vce_stop() + */ typedef int(*vce_set_recording_data_cb)(const void* data, unsigned int length, vce_speech_detect_e* speech_detected); /** -* @brief Called when the engine service user stops to get the result of recognition. -* @since_tizen 4.0 -* @return 0 on success, otherwise a negative error value -* @retval #VCE_ERROR_NONE Successful -* @retval #VCE_ERROR_INVALID_STATE Invalid state -* @retval #VCE_ERROR_OPERATION_FAILED Operation failed -* @retval #VCE_ERROR_OUT_OF_NETWORK Out of network -* @pre vce_set_recording_data() is successful. -* @see vce_start() -* @see vce_set_recording_data() -* @see vce_result_cb() -* @see vce_cancel() -*/ + * @brief Called when the engine service user stops to get the result of recognition. + * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + * @return 0 on success, otherwise a negative error value + * @retval #VCE_ERROR_NONE Successful + * @retval #VCE_ERROR_INVALID_STATE Invalid state + * @retval #VCE_ERROR_OPERATION_FAILED Operation failed + * @retval #VCE_ERROR_OUT_OF_NETWORK Out of network + * @pre vce_set_recording_data() is successful. + * @see vce_start() + * @see vce_set_recording_data() + * @see vce_result_cb() + * @see vce_cancel() + */ typedef int (*vce_stop_cb)(void); /** -* @brief Called when the engine service user cancels the recognition process. -* @since_tizen 4.0 -* @return 0 on success, otherwise a negative error value. -* @retval #VCE_ERROR_NONE Successful. -* @retval #VCE_ERROR_INVALID_STATE Invalid state. -* @pre vce_start() is successful. -* @see vce_start() -* @see vce_stop() -*/ + * @brief Called when the engine service user cancels the recognition process. + * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + * @return 0 on success, otherwise a negative error value. + * @retval #VCE_ERROR_NONE Successful. + * @retval #VCE_ERROR_INVALID_STATE Invalid state. + * @pre vce_start() is successful. + * @see vce_start() + * @see vce_stop() + */ typedef int (*vce_cancel_cb)(void); /** -* @brief Called when the engine service user sets audio recording type. -* @since_tizen 4.0 -* @remarks The @a audio_type can be used only in the callback. To use outside, make a copy. -* @param[in] audio_type Current audio type (e.g. #VCE_AUDIO_ID_BLUETOOTH or #VCE_AUDIO_ID_WIFI) -* @return 0 on success, otherwise a negative error value. -* @retval #VCE_ERROR_NONE Successful. -* @retval #VCE_ERROR_NOT_SUPPORTED_FEATURE Not supported feature. -*/ + * @brief Called when the engine service user sets audio recording type. + * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + * @remarks The @a audio_type can be used only in the callback. To use outside, make a copy. + * @param[in] audio_type Current audio type (e.g. #VCE_AUDIO_ID_BLUETOOTH or #VCE_AUDIO_ID_WIFI) + * @return 0 on success, otherwise a negative error value. + * @retval #VCE_ERROR_NONE Successful. + * @retval #VCE_ERROR_NOT_SUPPORTED_FEATURE Not supported feature. + */ typedef int (*vce_set_audio_type_cb)(const char* audio_type); /** -* @brief Called when the engine service user sets app id which is want to ask server dialog. -* @since_tizen 4.0 -* @remarks The @a app_id and @a credential can be used only in the callback. To use outside, make a copy. -* @param[in] app_id App id which is to want to ask server dialog. -* @param[in] credential Credential key. -* @return 0 on success, otherwise a negative error value. -* @retval #VCE_ERROR_NONE Successful. -* @retval #VCE_ERROR_NOT_SUPPORTED_FEATURE Not supported feature. -* @retval #VCE_ERROR_PERMISSION_DENIED Permission denied. -*/ + * @brief Called when the engine service user sets app id which is want to ask server dialog. + * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + * @remarks The @a app_id and @a credential can be used only in the callback. To use outside, make a copy. + * @param[in] app_id App id which is to want to ask server dialog. + * @param[in] credential Credential key. + * @return 0 on success, otherwise a negative error value. + * @retval #VCE_ERROR_NONE Successful. + * @retval #VCE_ERROR_NOT_SUPPORTED_FEATURE Not supported feature. + * @retval #VCE_ERROR_PERMISSION_DENIED Permission denied. + */ typedef int (*vce_set_server_dialog_cb)(const char* app_id, const char* credential); /** -* @brief Called when the engine service user sets domain (agent or device type). -* @since_tizen 4.0 -* @remarks The @a domain can be used only in the callback. To use outside, make a copy. -* @param[in] domain Agent (e.g. "music", "news", etc) or device type (e.g. "tv", "mobile", etc) corresponding to the command -* @return 0 on success, otherwise a negative error value. -* @retval #VCE_ERROR_NONE Successful. -* @retval #VCE_ERROR_NOT_SUPPORTED_FEATURE Not supported feature -*/ + * @brief Called when the engine service user sets domain (agent or device type). + * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + * @remarks The @a domain can be used only in the callback. To use outside, make a copy. + * @param[in] domain Agent (e.g. "music", "news", etc) or device type (e.g. "tv", "mobile", etc) corresponding to the command + * @return 0 on success, otherwise a negative error value. + * @retval #VCE_ERROR_NONE Successful. + * @retval #VCE_ERROR_NOT_SUPPORTED_FEATURE Not supported feature + */ typedef int (*vce_set_domain_cb)(const char* domain); /** -* @brief Called when the engine service user requests essential value from NLU result. -* @since_tizen 4.0 -* @remarks The @a key can be used only in the callback. To use outside, make a copy. -* The @a value is managed by the platform and will be released when this callback function is completed. -* @param[in] key NLU base info key. -* @param[out] value NLU base info value. -* @return 0 on success, otherwise a negative error value. -* @retval #VCE_ERROR_NONE Successful. -* @retval #VCE_ERROR_NOT_SUPPORTED_FEATURE Not supported feature. -*/ + * @brief Called when the engine service user requests essential value from NLU result. + * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + * @remarks The @a key can be used only in the callback. To use outside, make a copy. + * The @a value is managed by the platform and will be released when this callback function is completed. + * @param[in] key NLU base info key. + * @param[out] value NLU base info value. + * @return 0 on success, otherwise a negative error value. + * @retval #VCE_ERROR_NONE Successful. + * @retval #VCE_ERROR_NOT_SUPPORTED_FEATURE Not supported feature. + */ typedef int (*vce_nlu_base_info_requested_cb)(const char* key, char** value); /** -* @brief Called when client gets the specific engine's request from the engine service user. -* @since_tizen 4.0 -* @remarks The @a engine_app_id is managed by the platform and will be released when this callback function is completed. -* The @a event is managed by the platform and will be released when this callback function is completed. -* The @a request is managed by the platform and will be released when this callback function is completed. -* -* @param[in] engine_app_id The specific engine's app id -* @param[in] event The specific engine event type -* @param[in] request The specific engine request -* -* @return 0 on success, otherwise a negative error value. -* @retval #VCE_ERROR_NONE Successful -* @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter -* @retval #VCE_ERROR_OPERATION_FAILED Operation failure -* -* @pre An application registers callback function using vce_set_specific_engine_request_cb(). -* -* @see vce_set_specific_engine_request_cb() -* @see vce_unset_specific_engine_request_cb() -*/ + * @brief Called when client gets the specific engine's request from the engine service user. + * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + * @remarks The @a engine_app_id is managed by the platform and will be released when this callback function is completed. + * The @a event is managed by the platform and will be released when this callback function is completed. + * The @a request is managed by the platform and will be released when this callback function is completed. + * + * @param[in] engine_app_id The specific engine's app id + * @param[in] event The specific engine event type + * @param[in] request The specific engine request + * + * @return 0 on success, otherwise a negative error value. + * @retval #VCE_ERROR_NONE Successful + * @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #VCE_ERROR_OPERATION_FAILED Operation failure + * + * @pre An application registers callback function using vce_set_specific_engine_request_cb(). + * + * @see vce_set_specific_engine_request_cb() + * @see vce_unset_specific_engine_request_cb() + */ typedef int (*vce_specific_engine_request_cb)(const char* engine_app_id, const char* event, const char* request); /** -* @brief Called when the engine service user sets private data between app and engine. -* @since_tizen 4.0 -* @remarks The @a key, @a data can be used only in the callback. To use outside, make a copy. -* @param[in] key Private key. -* @param[in] data Private data. -* @return 0 on success, otherwise a negative error value. -* @retval #VCE_ERROR_NONE Successful. -* @retval #VCE_ERROR_NOT_SUPPORTED_FEATURE Not supported feature. -*/ + * @brief Called when the engine service user sets private data between app and engine. + * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + * @remarks The @a key, @a data can be used only in the callback. To use outside, make a copy. + * @param[in] key Private key. + * @param[in] data Private data. + * @return 0 on success, otherwise a negative error value. + * @retval #VCE_ERROR_NONE Successful. + * @retval #VCE_ERROR_NOT_SUPPORTED_FEATURE Not supported feature. + */ typedef int (*vce_private_data_set_cb)(const char* key, const char* data); /** -* @brief Called when the engine service user requests private data between app and engine. -* @since_tizen 4.0 -* @remarks The @a key can be used only in the callback. To use outside, make a copy. -* The @a data is managed by the platform and will be released when this callback function is completed. -* @param[in] key Private key. -* @param[out] data Private data. -* @return 0 on success, otherwise a negative error value. -* @retval #VCE_ERROR_NONE Successful. -* @retval #VCE_ERROR_NOT_SUPPORTED_FEATURE Not supported feature. -*/ + * @brief Called when the engine service user requests private data between app and engine. + * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + * @remarks The @a key can be used only in the callback. To use outside, make a copy. + * The @a data is managed by the platform and will be released when this callback function is completed. + * @param[in] key Private key. + * @param[out] data Private data. + * @return 0 on success, otherwise a negative error value. + * @retval #VCE_ERROR_NONE Successful. + * @retval #VCE_ERROR_NOT_SUPPORTED_FEATURE Not supported feature. + */ typedef int (*vce_private_data_requested_cb)(const char* key, char** data); /** -* @brief Called when the engine service user requests process text. -* @since_tizen 4.0 -* @remarks The @a text can be used only in the callback. To use outside, make a copy. -* @param[in] text Requested text -* @return 0 on success, otherwise a negative error value. -* @retval #VCE_ERROR_NONE Successful. -* @retval #VCE_ERROR_NOT_SUPPORTED_FEATURE Not supported feature. -*/ + * @brief Called when the engine service user requests process text. + * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + * @remarks The @a text can be used only in the callback. To use outside, make a copy. + * @param[in] text Requested text + * @return 0 on success, otherwise a negative error value. + * @retval #VCE_ERROR_NONE Successful. + * @retval #VCE_ERROR_NOT_SUPPORTED_FEATURE Not supported feature. + */ typedef int (*vce_process_text_cb)(const char* text); /** -* @brief Called when the engine service user requests list event. -* @since_tizen 4.0 -* @remarks The @a event can be used only in the callback. To use outside, make a copy. -* @param[in] event Requested list event -* @return 0 on success, otherwise a negative error value. -* @retval #VCE_ERROR_NONE Successful. -* @retval #VCE_ERROR_NOT_SUPPORTED_FEATURE Not supported feature. -*/ + * @brief Called when the engine service user requests list event. + * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + * @remarks The @a event can be used only in the callback. To use outside, make a copy. + * @param[in] event Requested list event + * @return 0 on success, otherwise a negative error value. + * @retval #VCE_ERROR_NONE Successful. + * @retval #VCE_ERROR_NOT_SUPPORTED_FEATURE Not supported feature. + */ typedef int (*vce_process_list_event_cb)(const char* event); /** -* @brief Called when the engine service user requests haptic event. -* @since_tizen 4.0 -* @remarks The @a event can be used only in the callback. To use outside, make a copy. -* @param[in] event Requested haptic event -* @return 0 on success, otherwise a negative error value. -* @retval #VCE_ERROR_NONE Successful. -* @retval #VCE_ERROR_NOT_SUPPORTED_FEATURE Not supported feature. -*/ + * @brief Called when the engine service user requests haptic event. + * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + * @remarks The @a event can be used only in the callback. To use outside, make a copy. + * @param[in] event Requested haptic event + * @return 0 on success, otherwise a negative error value. + * @retval #VCE_ERROR_NONE Successful. + * @retval #VCE_ERROR_NOT_SUPPORTED_FEATURE Not supported feature. + */ typedef int (*vce_process_haptic_event_cb)(const char* event); /** -* @brief Called when the engine service user requests the base information of VC engine. -* @since_tizen 4.0 -* @remarks This callback function is mandatory and must be registered using vce_main(). -* The @a engine_uuid is managed by the platform and will be released when this callback function is completed. -* The @a engine_name is managed by the platform and will be released when this callback function is completed. -* The @a engine_settings_app_id is managed by the platform and will be released when this callback function is completed. -* The @a use_network is managed by the platform and will be released when this callback function is completed. -* In order to upload the engine to Tizen Appstore, both the service app and the UI app (engine settings) are necessary. -* Therefore, @a engine_settings_app_id should be set to the application ID of the UI application. -* If there is no UI application, then @a engine_settings_app_id should be set to NULL. -* @param[out] engine_uuid The engine id -* @param[out] engine_name The engine name -* @param[out] engine_settings_app_id The ID of the engine settings application (the UI application) -* @param[out] use_network @c true to need network @c false not to need network. -* @return @c 0 on success, otherwise a negative error code on failure -* @retval #VCE_ERROR_NONE Successful -* @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter -* @retval #VCE_ERROR_OPERATION_FAILED Operation failure -*/ + * @brief Called when the engine service user requests the base information of VC engine. + * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + * @remarks This callback function is mandatory and must be registered using vce_main(). + * The @a engine_uuid is managed by the platform and will be released when this callback function is completed. + * The @a engine_name is managed by the platform and will be released when this callback function is completed. + * The @a engine_settings_app_id is managed by the platform and will be released when this callback function is completed. + * The @a use_network is managed by the platform and will be released when this callback function is completed. + * In order to upload the engine to Tizen Appstore, both the service app and the UI app (engine settings) are necessary. + * Therefore, @a engine_settings_app_id should be set to the application ID of the UI application. + * If there is no UI application, then @a engine_settings_app_id should be set to NULL. + * @param[out] engine_uuid The engine id + * @param[out] engine_name The engine name + * @param[out] engine_settings_app_id The ID of the engine settings application (the UI application) + * @param[out] use_network @c true to need network @c false not to need network. + * @return @c 0 on success, otherwise a negative error code on failure + * @retval #VCE_ERROR_NONE Successful + * @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #VCE_ERROR_OPERATION_FAILED Operation failure + */ typedef int (*vce_get_info_cb)(char** engine_uuid, char** engine_name, char** engine_settings_app_id, bool* use_network); /** -* @brief Called to retrieve the commands. -* @since_tizen 4.0 -* @remarks The @a command, @a param can be used only in the callback. To use outside, make a copy. -* @param[in] id command id -* @param[in] type command type -* @param[in] format command format -* @param[in] command command text -* @param[in] param parameter text -* @param[in] domain command domain -* @param[in] user_data The user data passed from the foreach function -* @return @c true to continue with the next iteration of the loop, \n @c false to break out of the loop. -* @pre vce_get_foreach_command() will invoke this callback. -* @see vce_get_foreach_command() -*/ + * @brief Called to retrieve the commands. + * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + * @remarks The @a command, @a param can be used only in the callback. To use outside, make a copy. + * @param[in] id command id + * @param[in] type command type + * @param[in] format command format + * @param[in] command command text + * @param[in] param parameter text + * @param[in] domain command domain + * @param[in] user_data The user data passed from the foreach function + * @return @c true to continue with the next iteration of the loop, \n @c false to break out of the loop. + * @pre vce_get_foreach_command() will invoke this callback. + * @see vce_get_foreach_command() + */ typedef bool (*vce_command_cb)(int id, int type, int format, const char* command, const char* param, int domain, void* user_data); /** -* @brief A structure for the VC engine functions. -* @details This structure contains essential callback functions for operating VC engine. -* @since_tizen 4.0 -* @remarks These functions ar mandatory for operating VC engine. Therefore, all functions MUST be implemented. -*/ + * @brief A structure for the VC engine functions. + * @details This structure contains essential callback functions for operating VC engine. + * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + * @remarks These functions ar mandatory for operating VC engine. Therefore, all functions MUST be implemented. + */ typedef struct { int version; /**< Version */ @@ -603,27 +603,27 @@ typedef struct { } vce_request_callback_s; /** -* @brief Starts the main function for Voice Control (VC) engine. -* @details This function is the main function for operating VC engine. -* @since_tizen 4.0 -* @privlevel public -* @privilege %http://tizen.org/privilege/recorder -* @remarks The service_app_main() should be used for working the engine after this function. -* @param[in] argc The argument count(original) -* @param[in] argv The argument(original) -* @param[in] callback The structure of engine request callback function -* @return This function returns @c zero on success, or negative with error code on failure -* @retval #VCE_ERROR_NONE Successful -* @retval #VCE_ERROR_OUT_OF_MEMORY Out of Memory -* @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter -* @retval #VCE_ERROR_PERMISSION_DENIED Permission denied -* @retval #VCE_ERROR_NOT_SUPPORTED Not supported -* @retval #VCE_ERROR_OPERATION_FAILED Operation failed -* @pre The vce_get_engine_info() should be successful. -* @see vce_get_engine_info() -* @see vce_unload_engine() -* @see vce_request_callback_s -* @code + * @brief Starts the main function for Voice Control (VC) engine. + * @details This function is the main function for operating VC engine. + * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + * @privlevel public + * @privilege %http://tizen.org/privilege/recorder + * @remarks The service_app_main() should be used for working the engine after this function. + * @param[in] argc The argument count(original) + * @param[in] argv The argument(original) + * @param[in] callback The structure of engine request callback function + * @return This function returns @c zero on success, or negative with error code on failure + * @retval #VCE_ERROR_NONE Successful + * @retval #VCE_ERROR_OUT_OF_MEMORY Out of Memory + * @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #VCE_ERROR_PERMISSION_DENIED Permission denied + * @retval #VCE_ERROR_NOT_SUPPORTED Not supported + * @retval #VCE_ERROR_OPERATION_FAILED Operation failed + * @pre The vce_get_engine_info() should be successful. + * @see vce_get_engine_info() + * @see vce_unload_engine() + * @see vce_request_callback_s + * @code #include // Required callback functions - MUST BE IMPLEMENTED @@ -709,334 +709,333 @@ int main(int argc, char* argv[]) return service_app_main(argc, argv, &event_callback, ad); } -* @endcode -*/ + * @endcode + */ int vce_main(int argc, char** argv, vce_request_callback_s* callback); /** -* @brief Sends the results to the engine service user. -* @since_tizen 4.0 -* @param[in] event A result event -* @param[in] result_id Result ids -* @param[in] count Result count -* @param[in] all_result All result text -* @param[in] non_fixed_result Non-fixed command result text -* @param[in] nlu_result NLU result text -* @param[in] msg Engine message (e.g. #VC_RESULT_MESSAGE_NONE, #VC_RESULT_MESSAGE_ERROR_TOO_LOUD) -* @param[out] user_info A user info (e.g. If ASR result is consumed, the value is 0x01. If not, the value is 0x00.) -* @param[in] user_data The user data passed from set callback function -* @return @c 0 on success, otherwise a negative error value -* @retval #VCE_ERROR_NONE Successful -* @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter -* @retval #VCE_ERROR_OUT_OF_MEMORY Out of Memory -* @retval #VCE_ERROR_INVALID_STATE Invalid state -* @retval #VCE_ERROR_OPERATION_FAILED Operation failure -* @pre The vce_main() function should be invoked before this function is called. -* vce_stop_cb() will invoke this callback. -* @see vce_stop_cb() -*/ + * @brief Sends the results to the engine service user. + * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + * @param[in] event A result event + * @param[in] result_id Result ids + * @param[in] count Result count + * @param[in] all_result All result text + * @param[in] non_fixed_result Non-fixed command result text + * @param[in] nlu_result NLU result text + * @param[in] msg Engine message (e.g. #VC_RESULT_MESSAGE_NONE, #VC_RESULT_MESSAGE_ERROR_TOO_LOUD) + * @param[out] user_info A user info (e.g. If ASR result is consumed, the value is 0x01. If not, the value is 0x00.) + * @param[in] user_data The user data passed from set callback function + * @return @c 0 on success, otherwise a negative error value + * @retval #VCE_ERROR_NONE Successful + * @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #VCE_ERROR_OUT_OF_MEMORY Out of Memory + * @retval #VCE_ERROR_INVALID_STATE Invalid state + * @retval #VCE_ERROR_OPERATION_FAILED Operation failure + * @pre The vce_main() function should be invoked before this function is called. + * vce_stop_cb() will invoke this callback. + * @see vce_stop_cb() + */ int vce_send_result(vce_result_event_e event, int* result_id, int count, const char* all_result, const char* non_fixed_result, const char* nlu_result, const char* msg, int* user_info, void* user_data); /** -* @brief Sends the ASR result to the engine service user. -* @since_tizen 4.0 -* @param[in] event A asr result event -* @param[in] asr_result A asr result text -* @param[in] user_data The user data passed from the start -* @return @c 0 on success, otherwise a negative error value -* @retval #VCE_ERROR_NONE Successful -* @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter -* @retval #VCE_ERROR_OUT_OF_MEMORY Out of Memory -* @retval #VCE_ERROR_OPERATION_FAILED Operation failure -* @pre The vce_main() function should be invoked before this function is called. -* @see vce_start_cb() -*/ + * @brief Sends the ASR result to the engine service user. + * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + * @param[in] event A asr result event + * @param[in] asr_result A asr result text + * @param[in] user_data The user data passed from the start + * @return @c 0 on success, otherwise a negative error value + * @retval #VCE_ERROR_NONE Successful + * @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #VCE_ERROR_OUT_OF_MEMORY Out of Memory + * @retval #VCE_ERROR_OPERATION_FAILED Operation failure + * @pre The vce_main() function should be invoked before this function is called. + * @see vce_start_cb() + */ int vce_send_asr_result(vce_asr_result_event_e event, const char* asr_result, void* user_data); /** -* @brief Sends the NLG (Natural Language Generation) result to the engine service user. -* @since_tizen 4.0 -* @param[in] nlg_result A nlg result -* @param[in] user_data The user data passed from the start -* @return @c 0 on success, otherwise a negative error value -* @retval #VCE_ERROR_NONE Successful -* @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter -* @retval #VCE_ERROR_OUT_OF_MEMORY Out of Memory -* @retval #VCE_ERROR_OPERATION_FAILED Operation failure -* @pre The vce_main() function should be invoked before this function is called. -* @see vce_start_cb() -*/ + * @brief Sends the NLG (Natural Language Generation) result to the engine service user. + * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + * @param[in] nlg_result A nlg result + * @param[in] user_data The user data passed from the start + * @return @c 0 on success, otherwise a negative error value + * @retval #VCE_ERROR_NONE Successful + * @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #VCE_ERROR_OUT_OF_MEMORY Out of Memory + * @retval #VCE_ERROR_OPERATION_FAILED Operation failure + * @pre The vce_main() function should be invoked before this function is called. + * @see vce_start_cb() + */ int vce_send_nlg_result(const char* nlg_result, void* user_data); /** -* @brief Sends the specific engine result to the engine service user. -* @since_tizen 4.0 -* -* @param[in] engine_app_id A specific engine's app id -* @param[in] event A specific engine result event -* @param[in] result A specific engine result text -* @param[in] user_info The user info passed from the start -* -* @return 0 on success, otherwise a negative error value -* @retval #VCE_ERROR_NONE Successful -* @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter -* @retval #VCE_ERROR_OUT_OF_MEMORY Out of Memory -* @retval #VCE_ERROR_OPERATION_FAILED Operation failure -* @pre The vce_main() function should be invoked before this function is called. -*/ + * @brief Sends the specific engine result to the engine service user. + * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + * + * @param[in] engine_app_id A specific engine's app id + * @param[in] event A specific engine result event + * @param[in] result A specific engine result text + * @param[in] user_info The user info passed from the start + * + * @return 0 on success, otherwise a negative error value + * @retval #VCE_ERROR_NONE Successful + * @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #VCE_ERROR_OUT_OF_MEMORY Out of Memory + * @retval #VCE_ERROR_OPERATION_FAILED Operation failure + * @pre The vce_main() function should be invoked before this function is called. + */ int vce_send_specific_engine_result(const char* engine_app_id, const char* event, const char* result, void *user_info); /** -* @brief Sends the error to the engine service user. -* @details The following error codes can be delivered. \n -* #VCE_ERROR_NONE, \n -* #VCE_ERROR_OUT_OF_MEMORY, \n -* #VCE_ERROR_IO_ERROR, \n -* #VCE_ERROR_INVALID_PARAMETER, \n -* #VCE_ERROR_OUT_OF_NETWORK, \n -* #VCE_ERROR_RECORDER_BUSY, \n -* #VCE_ERROR_NOT_SUPPORTED, \n -* #VCE_ERROR_INVALID_STATE, \n -* #VCE_ERROR_INVALID_LANGUAGE, \n -* #VCE_ERROR_OPERATION_FAILED, \n -* #VCE_ERROR_PERMISSION_DENIED, \n -* #VCE_ERROR_NOT_SUPPORTED_FEATURE. -* @since_tizen 4.0 -* @param[in] error Error type -* @param[in] msg Error message -* @param[in] user_data The user data passed from set callback function -* @return @c 0 on success, otherwise a negative error value -* @retval #VCE_ERROR_NONE Successful -* @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter -* @retval #VCE_ERROR_OUT_OF_MEMORY Out of Memory -* @retval #VCE_ERROR_OPERATION_FAILED Operation failure -* @pre The vce_main() function should be invoked before this function is called. -*/ + * @brief Sends the error to the engine service user. + * @details The following error codes can be delivered. \n + * #VCE_ERROR_NONE, \n + * #VCE_ERROR_OUT_OF_MEMORY, \n + * #VCE_ERROR_IO_ERROR, \n + * #VCE_ERROR_INVALID_PARAMETER, \n + * #VCE_ERROR_OUT_OF_NETWORK, \n + * #VCE_ERROR_RECORDER_BUSY, \n + * #VCE_ERROR_NOT_SUPPORTED, \n + * #VCE_ERROR_INVALID_STATE, \n + * #VCE_ERROR_INVALID_LANGUAGE, \n + * #VCE_ERROR_OPERATION_FAILED, \n + * #VCE_ERROR_PERMISSION_DENIED, \n + * #VCE_ERROR_NOT_SUPPORTED_FEATURE. + * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + * @param[in] error Error type + * @param[in] msg Error message + * @param[in] user_data The user data passed from set callback function + * @return @c 0 on success, otherwise a negative error value + * @retval #VCE_ERROR_NONE Successful + * @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #VCE_ERROR_OUT_OF_MEMORY Out of Memory + * @retval #VCE_ERROR_OPERATION_FAILED Operation failure + * @pre The vce_main() function should be invoked before this function is called. + */ int vce_send_error(vce_error_e error, const char* msg, void* user_data); /** -* @brief Sets a callback function for setting the private data to the engine service. -* @since_tizen 4.0 -* @privlevel public -* @privilege %http://tizen.org/privilege/recorder -* @remarks The vce_private_data_set_cb() function is called when the engine service user sets the private data to the engine service. -* @param[in] callback_func vce_private_data_set event callback function -* @return @c 0 on success, otherwise a negative error value -* @retval #VCE_ERROR_NONE Successful -* @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter -* @retval #VCE_ERROR_PERMISSION_DENIED Permission denied -* @retval #VCE_ERROR_NOT_SUPPORTED Not supported -* @retval #VCE_ERROR_OPERATION_FAILED Operation failure -* @retval #VCE_ERROR_NOT_SUPPORTED_FEATURE Not supported feature -* @pre The vce_main() function should be invoked before this function is called. -* @see vce_private_data_set_cb() -*/ + * @brief Sets a callback function for setting the private data to the engine service. + * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + * @privlevel public + * @privilege %http://tizen.org/privilege/recorder + * @remarks The vce_private_data_set_cb() function is called when the engine service user sets the private data to the engine service. + * @param[in] callback_func vce_private_data_set event callback function + * @return @c 0 on success, otherwise a negative error value + * @retval #VCE_ERROR_NONE Successful + * @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #VCE_ERROR_PERMISSION_DENIED Permission denied + * @retval #VCE_ERROR_NOT_SUPPORTED Not supported + * @retval #VCE_ERROR_OPERATION_FAILED Operation failure + * @retval #VCE_ERROR_NOT_SUPPORTED_FEATURE Not supported feature + * @pre The vce_main() function should be invoked before this function is called. + * @see vce_private_data_set_cb() + */ int vce_set_private_data_set_cb(vce_private_data_set_cb callback_func); /** -* @brief Sets a callback function for requesting the private data to the engine service. -* @since_tizen 4.0 -* @privlevel public -* @privilege %http://tizen.org/privilege/recorder -* @remarks The vce_private_data_requested_cb() function is called when the engine service user requests the private data to the engine service. -* @param[in] callback_func vce_private_data_requested event callback function -* @return @c 0 on success, otherwise a negative error value -* @retval #VCE_ERROR_NONE Successful -* @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter -* @retval #VCE_ERROR_PERMISSION_DENIED Permission denied -* @retval #VCE_ERROR_NOT_SUPPORTED Not supported -* @retval #VCE_ERROR_OPERATION_FAILED Operation failure -* @see vce_private_data_requested_cb() -*/ + * @brief Sets a callback function for requesting the private data to the engine service. + * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + * @privlevel public + * @privilege %http://tizen.org/privilege/recorder + * @remarks The vce_private_data_requested_cb() function is called when the engine service user requests the private data to the engine service. + * @param[in] callback_func vce_private_data_requested event callback function + * @return @c 0 on success, otherwise a negative error value + * @retval #VCE_ERROR_NONE Successful + * @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #VCE_ERROR_PERMISSION_DENIED Permission denied + * @retval #VCE_ERROR_NOT_SUPPORTED Not supported + * @retval #VCE_ERROR_OPERATION_FAILED Operation failure + * @see vce_private_data_requested_cb() + */ int vce_set_private_data_requested_cb(vce_private_data_requested_cb callback_func); /** -* @brief Sets a callback function for requesting the NLU base information to the engine service. -* @since_tizen 4.0 -* @remarks The vce_nlu_base_info_requested_cb() function is called when the engine service user requests the NLU base information to the engine service. -* @param[in] callback_func vce_nlu_base_info_requested event callback function -* @return @c 0 on success, otherwise a negative error value -* @retval #VCE_ERROR_NONE Successful -* @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter -* @retval #VCE_ERROR_OPERATION_FAILED Operation failure -* @retval #VCE_ERROR_NOT_SUPPORTED_FEATURE Not supported feature -* @see vce_nlu_base_info_requested_cb() -*/ + * @brief Sets a callback function for requesting the NLU base information to the engine service. + * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + * @remarks The vce_nlu_base_info_requested_cb() function is called when the engine service user requests the NLU base information to the engine service. + * @param[in] callback_func vce_nlu_base_info_requested event callback function + * @return @c 0 on success, otherwise a negative error value + * @retval #VCE_ERROR_NONE Successful + * @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #VCE_ERROR_OPERATION_FAILED Operation failure + * @retval #VCE_ERROR_NOT_SUPPORTED_FEATURE Not supported feature + * @see vce_nlu_base_info_requested_cb() + */ int vce_set_nlu_base_info_requested_cb(vce_nlu_base_info_requested_cb callback_func); /** -* @brief Sets a callback function for getting the engine service request. -* @since_tizen 4.0 -* -* @param[in] callback_func Callback function to register -* -* @return 0 on success, otherwise a negative error value -* @retval #VCE_ERROR_NONE Successful -* @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter -* @retval #VCE_ERROR_NOT_SUPPORTED Not supported -* -* @see vce_unset_specific_engine_request_cb() -*/ + * @brief Sets a callback function for getting the engine service request. + * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + * + * @param[in] callback_func Callback function to register + * + * @return 0 on success, otherwise a negative error value + * @retval #VCE_ERROR_NONE Successful + * @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #VCE_ERROR_NOT_SUPPORTED Not supported + * + * @see vce_unset_specific_engine_request_cb() + */ int vce_set_specific_engine_request_cb(vce_specific_engine_request_cb callback_func); /** -* @brief Unsets the engine service request callback function. -* @since_tizen 4.0 -* -* @return 0 on success, otherwise a negative error value -* @retval #VC_ERROR_NONE Successful -* @retval #VC_ERROR_NOT_SUPPORTED Not supported -* -* @see vce_set_specific_engine_request_cb() -*/ + * @brief Unsets the engine service request callback function. + * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + * + * @return 0 on success, otherwise a negative error value + * @retval #VC_ERROR_NONE Successful + * @retval #VC_ERROR_NOT_SUPPORTED Not supported + * + * @see vce_set_specific_engine_request_cb() + */ int vce_unset_specific_engine_request_cb(void); /** -* @brief Retrieves all commands using callback function. -* @since_tizen 4.0 -* -* @param[in] vce_command The handle to be passed to the vce_set_commands() function -* @param[in] callback The callback function to invoke -* @param[in] user_data The user data to be passed to the callback function -* -* @return 0 on success, otherwise a negative error value -* @retval #VCE_ERROR_NONE Successful -* @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter -* @retval #VCE_ERROR_OPERATION_FAILED Operation failure -* @retval #VCE_ERROR_INVALID_STATE Invalid state -* @post This function invokes vce_command_cb() repeatedly for getting commands. -* @see vce_foreach_command_cb() -* @see vce_set_commands() -*/ + * @brief Retrieves all commands using callback function. + * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + * + * @param[in] vce_command The handle to be passed to the vce_set_commands() function + * @param[in] callback The callback function to invoke + * @param[in] user_data The user data to be passed to the callback function + * + * @return 0 on success, otherwise a negative error value + * @retval #VCE_ERROR_NONE Successful + * @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #VCE_ERROR_OPERATION_FAILED Operation failure + * @retval #VCE_ERROR_INVALID_STATE Invalid state + * @post This function invokes vce_command_cb() repeatedly for getting commands. + * @see vce_foreach_command_cb() + * @see vce_set_commands() + */ int vce_get_foreach_command(vce_cmd_h vce_command, vce_command_cb callback, void* user_data); /** -* @brief Gets command length. -* @since_tizen 4.0 -* -* @param[in] vce_command The handle to be passed to the vce_set_commands() function -* @param[out] count The command count value -* -* @return 0 on success, otherwise a negative error value. -* @retval #VCE_ERROR_NONE Successful -* @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter -* @retval #VCE_ERROR_OPERATION_FAILED Operation failure -* @see vce_set_commands() -*/ + * @brief Gets command length. + * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + * + * @param[in] vce_command The handle to be passed to the vce_set_commands() function + * @param[out] count The command count value + * + * @return 0 on success, otherwise a negative error value. + * @retval #VCE_ERROR_NONE Successful + * @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #VCE_ERROR_OPERATION_FAILED Operation failure + * @see vce_set_commands() + */ int vce_get_command_count(vce_cmd_h vce_command, int* count); /** -* @brief Gets current audio type. -* @since_tizen 4.0 -* @privlevel public -* @privilege %http://tizen.org/privilege/recorder -* @remarks The @a audio_type must be released using free() when it is no longer required. -* @param[in] audio_type Current audio type (e.g. #VCE_AUDIO_ID_BLUETOOTH or #VCE_AUDIO_ID_WIFI) -* @return the value greater than 0 on success, otherwise a negative error value -* @retval #VCE_ERROR_NONE Successful -* @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter -* @retval #VCE_ERROR_PERMISSION_DENIED Permission denied -* @retval #VCE_ERROR_NOT_SUPPORTED Not supported -*/ + * @brief Gets current audio type. + * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + * @privlevel public + * @privilege %http://tizen.org/privilege/recorder + * @remarks The @a audio_type must be released using free() when it is no longer required. + * @param[in] audio_type Current audio type (e.g. #VCE_AUDIO_ID_BLUETOOTH or #VCE_AUDIO_ID_WIFI) + * @return the value greater than 0 on success, otherwise a negative error value + * @retval #VCE_ERROR_NONE Successful + * @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #VCE_ERROR_PERMISSION_DENIED Permission denied + * @retval #VCE_ERROR_NOT_SUPPORTED Not supported + */ int vce_get_audio_type(char** audio_type); /** -* @brief Sets private data to a voice manager client. -* @since_tizen 4.0 -* @privlevel public -* @privilege %http://tizen.org/privilege/recorder -* @param[in] key Private key -* @param[in] data Private data -* @return 0 on success, otherwise a negative error value. -* @retval #VCE_ERROR_NONE Successful -* @retval #VCE_ERROR_OUT_OF_MEMORY Out of Memory -* @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter -* @retval #VCE_ERROR_INVALID_STATE Invalid state -* @retval #VCE_ERROR_PERMISSION_DENIED Permission denied -* @retval #VCE_ERROR_NOT_SUPPORTED Not supported -* @retval #VCE_ERROR_OPERATION_FAILED Operation failed -*/ + * @brief Sets private data to a voice manager client. + * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + * @privlevel public + * @privilege %http://tizen.org/privilege/recorder + * @param[in] key Private key + * @param[in] data Private data + * @return 0 on success, otherwise a negative error value. + * @retval #VCE_ERROR_NONE Successful + * @retval #VCE_ERROR_OUT_OF_MEMORY Out of Memory + * @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #VCE_ERROR_INVALID_STATE Invalid state + * @retval #VCE_ERROR_PERMISSION_DENIED Permission denied + * @retval #VCE_ERROR_NOT_SUPPORTED Not supported + * @retval #VCE_ERROR_OPERATION_FAILED Operation failed + */ int vce_set_private_data(const char* key, const char* data); /** -* @brief Gets private data from a voice manager client. -* @since_tizen 4.0 -* @privlevel public -* @privilege %http://tizen.org/privilege/recorder -* @remarks The @a data must be released using free() when it is no longer required. -* @param[in] key Private key -* @param[out] data Private data -* @return 0 on success, otherwise a negative error value. -* @retval #VCE_ERROR_NONE Successful -* @retval #VCE_ERROR_OUT_OF_MEMORY Out of Memory -* @retval #VCE_ERROR_PERMISSION_DENIED Permission denied -* @retval #VCE_ERROR_NOT_SUPPORTED Not supported -* @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter -* @retval #VCE_ERROR_INVALID_STATE Invalid state -* @retval #VCE_ERROR_OPERATION_FAILED Operation failed -*/ + * @brief Gets private data from a voice manager client. + * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + * @privlevel public + * @privilege %http://tizen.org/privilege/recorder + * @remarks The @a data must be released using free() when it is no longer required. + * @param[in] key Private key + * @param[out] data Private data + * @return 0 on success, otherwise a negative error value. + * @retval #VCE_ERROR_NONE Successful + * @retval #VCE_ERROR_OUT_OF_MEMORY Out of Memory + * @retval #VCE_ERROR_PERMISSION_DENIED Permission denied + * @retval #VCE_ERROR_NOT_SUPPORTED Not supported + * @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #VCE_ERROR_INVALID_STATE Invalid state + * @retval #VCE_ERROR_OPERATION_FAILED Operation failed + */ int vce_get_private_data(const char* key, char** data); /** -* @brief Starts recording voice. -* @since_tizen 4.0 -* @privlevel public -* @privilege %http://tizen.org/privilege/recorder -* @return 0 on success, otherwise a negative error value. -* @retval #VCE_ERROR_NONE Successful -* @retval #VCE_ERROR_PERMISSION_DENIED Permission denied -* @retval #VCE_ERROR_NOT_SUPPORTED Not supported -* @retval #VCE_ERROR_OPERATION_FAILED Operation failure -* @retval #VCE_ERROR_RECORDER_BUSY Busy recorder -*/ + * @brief Starts recording voice. + * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + * @privlevel public + * @privilege %http://tizen.org/privilege/recorder + * @return 0 on success, otherwise a negative error value. + * @retval #VCE_ERROR_NONE Successful + * @retval #VCE_ERROR_PERMISSION_DENIED Permission denied + * @retval #VCE_ERROR_NOT_SUPPORTED Not supported + * @retval #VCE_ERROR_OPERATION_FAILED Operation failure + * @retval #VCE_ERROR_RECORDER_BUSY Busy recorder + */ int vce_start_recording(void); /** -* @brief Stops recording voice. -* @since_tizen 4.0 -* @privlevel public -* @privilege %http://tizen.org/privilege/recorder -* @return 0 on success, otherwise a negative error value. -* @retval #VCE_ERROR_NONE Successful -* @retval #VCE_ERROR_PERMISSION_DENIED Permission denied -* @retval #VCE_ERROR_NOT_SUPPORTED Not supported -* @retval #VCE_ERROR_OPERATION_FAILED Operation failure -*/ + * @brief Stops recording voice. + * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + * @privlevel public + * @privilege %http://tizen.org/privilege/recorder + * @return 0 on success, otherwise a negative error value. + * @retval #VCE_ERROR_NONE Successful + * @retval #VCE_ERROR_PERMISSION_DENIED Permission denied + * @retval #VCE_ERROR_NOT_SUPPORTED Not supported + * @retval #VCE_ERROR_OPERATION_FAILED Operation failure + */ int vce_stop_recording(void); -/* for TTS feeadback */ -/** -* @brief Sends audio formats necessary for playing TTS feedback. -* @since_tizen 4.0 -* -* @param[in] rate A sampling rate -* @param[in] channel The audio channel -* @param[in] audio_type The audio type -* -* @return 0 on success, otherwise a negative error value. -* @retval #VCE_ERROR_NONE Successful -* @retval #VCE_ERROR_NOT_SUPPORTED Not supported -* @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter -* @retval #VCE_ERROR_OPERATION_FAILED Operation failure -* @retval #VCE_ERROR_OUT_OF_MEMORY Out of Memory -*/ +/** + * @brief Sends audio formats necessary for playing TTS feedback. + * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + * + * @param[in] rate A sampling rate + * @param[in] channel The audio channel + * @param[in] audio_type The audio type + * + * @return 0 on success, otherwise a negative error value. + * @retval #VCE_ERROR_NONE Successful + * @retval #VCE_ERROR_NOT_SUPPORTED Not supported + * @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #VCE_ERROR_OPERATION_FAILED Operation failure + * @retval #VCE_ERROR_OUT_OF_MEMORY Out of Memory + */ int vce_send_feedback_audio_format(int rate, vce_audio_channel_e channel, vce_audio_type_e audio_type); /** -* @brief Sends audio streaming necessary for playing TTS feedback. -* @since_tizen 4.0 -* -* @param[in] event A feedback event -* @param[in] buffer The feedback data -* @param[in] len The length of the feedback data -* -* @return 0 on success, otherwise a negative error value. -* @retval #VCE_ERROR_NONE Successful -* @retval #VCE_ERROR_NOT_SUPPORTED Not supported -* @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter -* @retval #VCE_ERROR_OPERATION_FAILED Operation failure -* @retval #VCE_ERROR_OUT_OF_MEMORY Out of Memory -*/ + * @brief Sends audio streaming necessary for playing TTS feedback. + * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + * + * @param[in] event A feedback event + * @param[in] buffer The feedback data + * @param[in] len The length of the feedback data + * + * @return 0 on success, otherwise a negative error value. + * @retval #VCE_ERROR_NONE Successful + * @retval #VCE_ERROR_NOT_SUPPORTED Not supported + * @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #VCE_ERROR_OPERATION_FAILED Operation failure + * @retval #VCE_ERROR_OUT_OF_MEMORY Out of Memory + */ int vce_send_feedback_streaming(vce_feedback_event_e event, char* buffer, int len); @@ -1045,8 +1044,8 @@ int vce_send_feedback_streaming(vce_feedback_event_e event, char* buffer, int le #endif /** -* @} -*/ + * @} + */ #endif /* __VCE_H__ */ -- 2.7.4 From 86f610f7fc5872a5f7804537475ff6707e81ba60 Mon Sep 17 00:00:00 2001 From: sungrae jo Date: Tue, 24 Jul 2018 16:20:04 +0900 Subject: [PATCH 09/16] Add not supported logic for VCE Change-Id: Icda734be455ffb1edd2a98fab7604c20215c0714 Signed-off-by: sungrae jo --- server/vce.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/server/vce.c b/server/vce.c index 36e842d..56ef2b2 100644 --- a/server/vce.c +++ b/server/vce.c @@ -176,6 +176,10 @@ int vce_main(int argc, char** argv, vce_request_callback_s *callback) int vce_send_result(vce_result_event_e event, int* result_id, int count, const char* all_result, const char* non_fixed_result, const char* nlu_result, const char* msg, int* user_info, void *user_data) { + if (0 != __vce_get_feature_enabled()) { + return VCE_ERROR_NOT_SUPPORTED; + } + int ret = VCE_ERROR_NONE; if (event < VCE_RESULT_EVENT_SUCCESS || event > VCE_RESULT_EVENT_ERROR) { @@ -200,6 +204,10 @@ int vce_send_result(vce_result_event_e event, int* result_id, int count, const c int vce_send_asr_result(vce_asr_result_event_e event, const char* asr_result, void *user_data) { + if (0 != __vce_get_feature_enabled()) { + return VCE_ERROR_NOT_SUPPORTED; + } + int ret = VCE_ERROR_NONE; if (event < VCE_ASR_RESULT_EVENT_FINAL_RESULT || event > VCE_ASR_RESULT_EVENT_ERROR) { @@ -223,6 +231,10 @@ int vce_send_asr_result(vce_asr_result_event_e event, const char* asr_result, vo int vce_send_specific_engine_result(const char* engine_app_id, const char* event, const char* result, void *user_info) { + if (0 != __vce_get_feature_enabled()) { + return VCE_ERROR_NOT_SUPPORTED; + } + int ret = VCE_ERROR_NONE; if (NULL == engine_app_id || NULL == event) { @@ -246,6 +258,10 @@ int vce_send_specific_engine_result(const char* engine_app_id, const char* event int vce_send_nlg_result(const char* nlg_result, void *user_data) { + if (0 != __vce_get_feature_enabled()) { + return VCE_ERROR_NOT_SUPPORTED; + } + int ret = VCE_ERROR_NONE; if (NULL == nlg_result) { @@ -264,6 +280,10 @@ int vce_send_nlg_result(const char* nlg_result, void *user_data) int vce_send_error(vce_error_e error, const char* msg, void *user_data) { + if (0 != __vce_get_feature_enabled()) { + return VCE_ERROR_NOT_SUPPORTED; + } + int ret = VCE_ERROR_NONE; if (NULL == msg) { @@ -283,6 +303,10 @@ int vce_send_error(vce_error_e error, const char* msg, void *user_data) /* Daemon API */ int vce_get_foreach_command(vce_cmd_h vce_command, vce_command_cb callback, void* user_data) { + if (0 != __vce_get_feature_enabled()) { + return VCE_ERROR_NOT_SUPPORTED; + } + int ret = VCE_ERROR_NONE; ret = vcd_get_foreach_command(vce_command, callback, user_data); @@ -295,6 +319,10 @@ int vce_get_foreach_command(vce_cmd_h vce_command, vce_command_cb callback, void int vce_get_command_count(vce_cmd_h vce_command, int* count) { + if (0 != __vce_get_feature_enabled()) { + return VCE_ERROR_NOT_SUPPORTED; + } + int ret = VCE_ERROR_NONE; if (NULL == count) { @@ -460,6 +488,10 @@ int vce_set_private_data_requested_cb(vce_private_data_requested_cb callback_fun int vce_set_nlu_base_info_requested_cb(vce_nlu_base_info_requested_cb callback_func) { + if (0 != __vce_get_feature_enabled()) { + return VCE_ERROR_NOT_SUPPORTED; + } + if (NULL == callback_func) { SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Invalid parameter"); return VCE_ERROR_INVALID_PARAMETER; @@ -475,6 +507,10 @@ int vce_set_nlu_base_info_requested_cb(vce_nlu_base_info_requested_cb callback_f int vce_set_specific_engine_request_cb(vce_specific_engine_request_cb callback_func) { + if (0 != __vce_get_feature_enabled()) { + return VCE_ERROR_NOT_SUPPORTED; + } + if (NULL == callback_func) { SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Invalid parameter"); return VCE_ERROR_INVALID_PARAMETER; @@ -490,6 +526,10 @@ int vce_set_specific_engine_request_cb(vce_specific_engine_request_cb callback_f int vce_unset_specific_engine_request_cb(void) { + if (0 != __vce_get_feature_enabled()) { + return VCE_ERROR_NOT_SUPPORTED; + } + int ret = vcd_set_specific_engine_request_cb(NULL); if (0 != ret) { SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to set specific engine request cb"); @@ -501,6 +541,10 @@ int vce_unset_specific_engine_request_cb(void) /* for TTS feedback */ int vce_send_feedback_audio_format(int rate, vce_audio_channel_e channel, vce_audio_type_e audio_type) { + if (0 != __vce_get_feature_enabled()) { + return VCE_ERROR_NOT_SUPPORTED; + } + int ret = VCE_ERROR_NONE; if (channel < VCE_AUDIO_CHANNEL_MONO || channel > VCE_AUDIO_CHANNEL_STEREO) { @@ -523,6 +567,10 @@ int vce_send_feedback_audio_format(int rate, vce_audio_channel_e channel, vce_au int vce_send_feedback_streaming(vce_feedback_event_e event, char* buffer, int len) { + if (0 != __vce_get_feature_enabled()) { + return VCE_ERROR_NOT_SUPPORTED; + } + int ret = VCE_ERROR_NONE; if (NULL == buffer) { -- 2.7.4 From b1d7b60b7dff945bd755b0294f12c8645a75c30f Mon Sep 17 00:00:00 2001 From: "sooyeon.kim" Date: Mon, 30 Jul 2018 14:47:53 +0900 Subject: [PATCH 10/16] Fix dbus delay when requesting hello Change-Id: I376556d68ed3d1a3b6ad2ab59830d91aaeb5e46d Signed-off-by: sooyeon.kim --- client/vc_dbus.c | 2 +- client/vc_mgr_dbus.c | 2 +- client/vc_widget_dbus.c | 2 +- server/vcd_dbus.c | 5 +++++ 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/client/vc_dbus.c b/client/vc_dbus.c index dfe0228..c72dff6 100644 --- a/client/vc_dbus.c +++ b/client/vc_dbus.c @@ -402,7 +402,7 @@ int vc_dbus_request_hello() DBusMessage* result_msg = NULL; int result = 0; - result_msg = dbus_connection_send_with_reply_and_block(g_conn_sender, msg, 500, &err); + result_msg = dbus_connection_send_with_reply_and_block(g_conn_sender, msg, -1, &err); if (dbus_error_is_set(&err)) { SLOG(LOG_DEBUG, TAG_VCC, "[ERROR] Dbus Error (%s)", err.message); diff --git a/client/vc_mgr_dbus.c b/client/vc_mgr_dbus.c index 040ebcb..bc69307 100644 --- a/client/vc_mgr_dbus.c +++ b/client/vc_mgr_dbus.c @@ -842,7 +842,7 @@ int vc_mgr_dbus_request_hello() DBusMessage* result_msg = NULL; int result = 0; - result_msg = dbus_connection_send_with_reply_and_block(g_m_conn_sender, msg, 500, &err); + result_msg = dbus_connection_send_with_reply_and_block(g_m_conn_sender, msg, -1, &err); if (dbus_error_is_set(&err)) { SLOG(LOG_DEBUG, TAG_VCM, "[ERROR] Dbus Error (%s)", err.message); diff --git a/client/vc_widget_dbus.c b/client/vc_widget_dbus.c index 6883ad0..8dbca3c 100644 --- a/client/vc_widget_dbus.c +++ b/client/vc_widget_dbus.c @@ -485,7 +485,7 @@ int vc_widget_dbus_request_hello() DBusMessage* result_msg = NULL; int result = 0; - result_msg = dbus_connection_send_with_reply_and_block(g_w_conn_sender, msg, 500, &err); + result_msg = dbus_connection_send_with_reply_and_block(g_w_conn_sender, msg, -1, &err); if (dbus_error_is_set(&err)) { if (!strncmp(err.name, DBUS_ERROR_SERVICE_UNKNOWN, strlen(err.name))) diff --git a/server/vcd_dbus.c b/server/vcd_dbus.c index 5b3d4ee..e53814c 100644 --- a/server/vcd_dbus.c +++ b/server/vcd_dbus.c @@ -1250,6 +1250,11 @@ int vcd_dbus_open_connection() return VCD_ERROR_OPERATION_FAILED; } + /* Flush messages which are received before fd event handler registration */ + while (DBUS_DISPATCH_DATA_REMAINS == dbus_connection_get_dispatch_status(g_conn_listener)) { + listener_event_callback(NULL, NULL); + } + /* add a rule for getting signal */ char rule[128]; snprintf(rule, 128, "type='signal',interface='%s'", VC_SERVER_SERVICE_INTERFACE); -- 2.7.4 From 3663cad825331f5e8b3838b54297474d45d65259 Mon Sep 17 00:00:00 2001 From: yhji Date: Mon, 30 Jul 2018 17:21:43 +0900 Subject: [PATCH 11/16] Fix Wformat build error Change-Id: I1bf6bacb6c229e07031441cda09b3da9df679864 Signed-off-by: yhji --- server/vcd_server.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/vcd_server.c b/server/vcd_server.c index 8bdf090..fdfdbcb 100644 --- a/server/vcd_server.c +++ b/server/vcd_server.c @@ -2815,7 +2815,7 @@ int vcd_get_private_data(const char* key, char** 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_DEBUG, TAG_VCD, "[Server] Get private data from the manager client, key(%s), data(%s)", key, data); + SLOG(LOG_DEBUG, TAG_VCD, "[Server] Get private data from the manager client, key(%s), data(%s)", key, *data); } return ret; -- 2.7.4 From b6939fd466002a11078ce9d5d5462e00fa44781d Mon Sep 17 00:00:00 2001 From: "sooyeon.kim" Date: Tue, 31 Jul 2018 19:02:11 +0900 Subject: [PATCH 12/16] Add line coverage tags Change-Id: I8250db7b983662cd1e3f2317bfa0f34986755dd8 Signed-off-by: sooyeon.kim --- client/vc.c | 194 +++++++++++++++++++++++++++++++---------------------- client/vc_client.c | 26 +++++-- client/vc_dbus.c | 130 ++++++++++++++++++----------------- 3 files changed, 205 insertions(+), 145 deletions(-) diff --git a/client/vc.c b/client/vc.c index 1152606..dd813d5 100644 --- a/client/vc.c +++ b/client/vc.c @@ -62,8 +62,10 @@ static void __vc_notify_error(void *data); static int __vc_get_feature_enabled() { if (0 == g_feature_enabled) { + //LCOV_EXCL_START SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Voice control feature NOT supported"); return VC_ERROR_NOT_SUPPORTED; + //LCOV_EXCL_STOP } else if (-1 == g_feature_enabled) { bool vc_supported = false; bool mic_supported = false; @@ -77,11 +79,11 @@ static int __vc_get_feature_enabled() g_feature_enabled = 1; } else { - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to get feature value"); + SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to get feature value"); //LCOV_EXCL_LINE return VC_ERROR_NOT_SUPPORTED; } } else { - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to get feature value"); + SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to get feature value"); //LCOV_EXCL_LINE return VC_ERROR_NOT_SUPPORTED; } } @@ -93,7 +95,7 @@ static int __check_privilege_initialize() { int ret = cynara_initialize(&p_cynara, NULL); if (CYNARA_API_SUCCESS != ret) - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] fail to initialize"); + SLOG(LOG_ERROR, TAG_VCC, "[ERROR] fail to initialize"); //LCOV_EXCL_LINE return ret == CYNARA_API_SUCCESS; } @@ -111,7 +113,7 @@ static int __check_privilege(const char* uid, const char * privilege) fp = fopen(label_path, "r"); if (fp != NULL) { if (0 >= fread(smack_label, 1, sizeof(smack_label), fp)) - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] fail to fread"); + SLOG(LOG_ERROR, TAG_VCC, "[ERROR] fail to fread"); //LCOV_EXCL_LINE fclose(fp); } @@ -140,11 +142,13 @@ static int __vc_check_privilege() char uid[16]; if (0 == g_privilege_allowed) { + //LCOV_EXCL_START SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Permission is denied"); return VC_ERROR_PERMISSION_DENIED; + //LCOV_EXCL_STOP } else if (-1 == g_privilege_allowed) { if (false == __check_privilege_initialize()) { - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] privilege initialize is failed"); + SLOG(LOG_ERROR, TAG_VCC, "[ERROR] privilege initialize is failed"); //LCOV_EXCL_LINE return VC_ERROR_PERMISSION_DENIED; } snprintf(uid, 16, "%d", getuid()); @@ -161,6 +165,7 @@ static int __vc_check_privilege() return VC_ERROR_NONE; } +//LCOV_EXCL_START static const char* __vc_get_error_code(vc_error_e err) { switch (err) { @@ -297,6 +302,7 @@ static Eina_Bool __focus_changed_cb(void *data, int type, void *event) return ECORE_CALLBACK_RENEW; } +//LCOV_EXCL_STOP int vc_initialize(void) { @@ -311,46 +317,46 @@ int vc_initialize(void) /* check handle */ if (true == vc_client_is_valid(g_vc)) { - SLOG(LOG_DEBUG, TAG_VCC, "[DEBUG] Already initialized"); - return VC_ERROR_NONE; + SLOG(LOG_DEBUG, TAG_VCC, "[DEBUG] Already initialized"); //LCOV_EXCL_LINE + return VC_ERROR_NONE; //LCOV_EXCL_LINE } if (0 < vc_client_get_count()) { - SLOG(LOG_DEBUG, TAG_VCC, "[DEBUG] Already initialized"); - return VC_ERROR_NONE; + SLOG(LOG_DEBUG, TAG_VCC, "[DEBUG] Already initialized"); //LCOV_EXCL_LINE + return VC_ERROR_NONE; //LCOV_EXCL_LINE } if (0 != vc_dbus_open_connection()) { - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to open connection"); - return VC_ERROR_OPERATION_FAILED; + SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to open connection"); //LCOV_EXCL_LINE + return VC_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE } if (0 != vc_client_create(&g_vc)) { - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to create client!!!!!"); - return VC_ERROR_OUT_OF_MEMORY; + SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to create client!!!!!"); //LCOV_EXCL_LINE + return VC_ERROR_OUT_OF_MEMORY; //LCOV_EXCL_LINE } int ret = vc_config_mgr_initialize(g_vc->handle); if (0 != ret) { SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to init config manager : %s", - __vc_get_error_code(__vc_convert_config_error_code(ret))); - vc_client_destroy(g_vc); - return __vc_convert_config_error_code(ret); + __vc_get_error_code(__vc_convert_config_error_code(ret))); //LCOV_EXCL_LINE + vc_client_destroy(g_vc); //LCOV_EXCL_LINE + return __vc_convert_config_error_code(ret); //LCOV_EXCL_LINE } ret = vc_config_mgr_set_lang_cb(g_vc->handle, __vc_lang_changed_cb); if (0 != ret) { - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to set config changed : %d", ret); - vc_config_mgr_finalize(g_vc->handle); - vc_client_destroy(g_vc); + SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to set config changed : %d", ret); //LCOV_EXCL_LINE + vc_config_mgr_finalize(g_vc->handle); //LCOV_EXCL_LINE + vc_client_destroy(g_vc); //LCOV_EXCL_LINE return __vc_convert_config_error_code(ret); } ret = vc_db_initialize(); if (0 != ret) { - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to initialize DB : %d", ret); - vc_config_mgr_finalize(g_vc->handle); - vc_client_destroy(g_vc); + SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to initialize DB : %d", ret); //LCOV_EXCL_LINE + vc_config_mgr_finalize(g_vc->handle); //LCOV_EXCL_LINE + vc_client_destroy(g_vc); //LCOV_EXCL_LINE return ret; } @@ -366,18 +372,18 @@ static void __vc_internal_unprepare(void) /* return authority */ vc_auth_state_e state = VC_AUTH_STATE_NONE; if (0 != vc_client_get_auth_state(g_vc, &state)) { - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to get auth state"); + SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to get auth state"); //LCOV_EXCL_LINE } if (VC_AUTH_STATE_NONE != state) { if (0 != vc_auth_disable()) { - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to auth disable"); + SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to auth disable"); //LCOV_EXCL_LINE } } int ret = vc_dbus_request_finalize(g_vc->handle); if (0 != ret) { - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to request finalize : %s", __vc_get_error_code(ret)); + SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to request finalize : %s", __vc_get_error_code(ret)); //LCOV_EXCL_LINE } if (NULL != g_focus_in_handler) { @@ -391,7 +397,7 @@ static void __vc_internal_unprepare(void) ret = vc_cmd_parser_delete_file(getpid(), VC_COMMAND_TYPE_FOREGROUND); if (0 != ret) - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to delete file, type(%d), ret(%d)", VC_COMMAND_TYPE_FOREGROUND, ret); + SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to delete file, type(%d), ret(%d)", VC_COMMAND_TYPE_FOREGROUND, ret); //LCOV_EXCL_LINE return; } @@ -425,7 +431,7 @@ int vc_deinitialize(void) /* no break. need to next step*/ case VC_STATE_INITIALIZED: if (NULL != g_connect_timer) { - SLOG(LOG_DEBUG, TAG_VCC, "Connect Timer is deleted"); + SLOG(LOG_DEBUG, TAG_VCC, "Connect Timer is deleted"); //LCOV_EXCL_LINE ecore_timer_del(g_connect_timer); g_connect_timer = NULL; } @@ -446,17 +452,17 @@ int vc_deinitialize(void) if (true == g_backup) { ret = vc_db_backup_command(); if (0 != ret) { - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to backup command, ret(%d)", ret); + SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to backup command, ret(%d)", ret); //LCOV_EXCL_LINE } } ret = vc_db_finalize(); if (0 != ret) { - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to finalize DB, ret(%d)", ret); + SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to finalize DB, ret(%d)", ret); //LCOV_EXCL_LINE } if (0 != vc_dbus_close_connection()) { - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to close connection"); + SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to close connection"); //LCOV_EXCL_LINE } SLOG(LOG_DEBUG, TAG_VCC, "@@@"); @@ -482,13 +488,14 @@ static Eina_Bool __vc_connect_daemon(void *data) ret = vc_cmd_parser_delete_file(getpid(), VC_COMMAND_TYPE_FOREGROUND); if (0 != ret) - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to delete file, type(%d), ret(%d)", VC_COMMAND_TYPE_FOREGROUND, ret); + SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to delete file, type(%d), ret(%d)", VC_COMMAND_TYPE_FOREGROUND, ret); //LCOV_EXCL_LINE /* check handle */ if (true == vc_client_is_valid(g_vc)) { SLOG(LOG_DEBUG, TAG_VCC, "[DEBUG] g_vc is valid"); ret = vc_dbus_request_initialize(g_vc->handle, &mgr_pid, &service_state, &g_daemon_pid); + //LCOV_EXCL_START if (VC_ERROR_ENGINE_NOT_FOUND == ret) { SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to initialize : %s", __vc_get_error_code(ret)); @@ -497,9 +504,9 @@ static Eina_Bool __vc_connect_daemon(void *data) SLOG(LOG_DEBUG, TAG_VCC, "@@@"); return EINA_FALSE; - + //LCOV_EXCL_STOP } else if (0 != ret) { - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to initialize :%s", __vc_get_error_code(ret)); + SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to initialize :%s", __vc_get_error_code(ret)); //LCOV_EXCL_LINE vc_client_set_error(g_vc, VC_ERROR_TIMED_OUT); ecore_main_loop_thread_safe_call_async(__vc_notify_error, (void*)g_vc); @@ -524,9 +531,9 @@ static Eina_Bool __vc_connect_daemon(void *data) vc_client_use_callback(g_vc); service_changed_callback(previous_service_state, service_state, user_data); vc_client_not_use_callback(g_vc); - SLOG(LOG_DEBUG, TAG_VCC, "Service state changed callback is called"); + SLOG(LOG_DEBUG, TAG_VCC, "Service state changed callback is called"); //LCOV_EXCL_LINE } else { - SLOG(LOG_WARN, TAG_VCC, "[WARNING] Service state changed callback is null"); + SLOG(LOG_WARN, TAG_VCC, "[WARNING] Service state changed callback is null"); //LCOV_EXCL_LINE } /* Register focus handler */ @@ -538,21 +545,21 @@ static Eina_Bool __vc_connect_daemon(void *data) int status = aul_app_get_status(appid); if (STATUS_FOCUS == status) { - SLOG(LOG_DEBUG, TAG_VCC, "@@@ Set foreground"); + SLOG(LOG_DEBUG, TAG_VCC, "@@@ Set foreground"); //LCOV_EXCL_LINE ret = vc_dbus_set_foreground(getpid(), true); if (0 != ret) { - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to set foreground (true) : %d", ret); + SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to set foreground (true) : %d", ret); //LCOV_EXCL_LINE } ret = vc_client_set_is_foreground(g_vc, true); if (0 != ret) { - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to save is_foreground (true) : %d", ret); + SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to save is_foreground (true) : %d", ret); //LCOV_EXCL_LINE } /* set authority valid */ vc_auth_state_e state = VC_AUTH_STATE_NONE; if (0 != vc_client_get_auth_state(g_vc, &state)) { - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to get auth state"); + SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to get auth state"); //LCOV_EXCL_LINE } if (VC_AUTH_STATE_INVALID == state) { vc_client_set_auth_state(g_vc, VC_AUTH_STATE_VALID); @@ -567,7 +574,7 @@ static Eina_Bool __vc_connect_daemon(void *data) vc_client_set_mgr_pid(g_vc, mgr_pid); } else { - SLOG(LOG_ERROR, TAG_VCC, "[Not ERROR] g_vc is not valid. It is destroyed."); + SLOG(LOG_ERROR, TAG_VCC, "[Not ERROR] g_vc is not valid. It is destroyed."); //LCOV_EXCL_LINE return EINA_FALSE; } @@ -584,7 +591,7 @@ static void __start_prepare_thread(void *data, Ecore_Thread *thread) /* Send hello */ while (0 != ret) { if (retry_count == 10) { - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to request hello !!"); + SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to request hello !!"); //LCOV_EXCL_LINE return; } @@ -601,7 +608,7 @@ static void __start_prepare_thread(void *data, Ecore_Thread *thread) retry_count = 0; while (0 != ret) { if (retry_count == 10) { - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to connect daemon !!"); + SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to connect daemon !!"); //LCOV_EXCL_LINE return; } ret = __vc_connect_daemon(NULL); @@ -632,14 +639,14 @@ int vc_prepare(void) vc_state_e state; if (0 != vc_client_get_client_state(g_vc, &state)) { - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] A handle is not available"); + SLOG(LOG_ERROR, TAG_VCC, "[ERROR] A handle is not available"); //LCOV_EXCL_LINE SLOG(LOG_DEBUG, TAG_VCC, "@@@"); return VC_ERROR_INVALID_STATE; } /* check state */ if (state != VC_STATE_INITIALIZED) { - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Invalid State: Current state is not 'CREATED'"); + SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Invalid State: Current state is not 'CREATED'"); //LCOV_EXCL_LINE SLOG(LOG_DEBUG, TAG_VCC, "@@@"); return VC_ERROR_INVALID_STATE; } @@ -651,6 +658,7 @@ int vc_prepare(void) return VC_ERROR_NONE; } +//LCOV_EXCL_START int vc_prepare_sync(void) { if (0 != __vc_get_feature_enabled()) { @@ -690,6 +698,7 @@ int vc_prepare_sync(void) return VC_ERROR_NONE; } +//LCOV_EXCL_STOP int vc_unprepare(void) { @@ -711,7 +720,7 @@ int vc_unprepare(void) /* check state */ if (state != VC_STATE_READY) { - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Invalid State: Current state is not 'READY'"); + SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Invalid State: Current state is not 'READY'"); //LCOV_EXCL_LINE SLOG(LOG_DEBUG, TAG_VCC, "@@@"); return VC_ERROR_INVALID_STATE; } @@ -754,7 +763,7 @@ int vc_foreach_supported_languages(vc_supported_language_cb callback, void* user ret = vc_config_mgr_get_language_list(callback, user_data); if (0 != ret) { ret = vc_config_convert_error_code((vc_config_error_e)ret); - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to get languages : %s", __vc_get_error_code(ret)); + SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to get languages : %s", __vc_get_error_code(ret)); //LCOV_EXCL_LINE } SLOG(LOG_DEBUG, TAG_VCC, "@@@"); @@ -791,7 +800,7 @@ int vc_get_current_language(char** language) ret = vc_config_mgr_get_default_language(language); if (0 != ret) { ret = vc_config_convert_error_code((vc_config_error_e)ret); - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to get current languages : %s", __vc_get_error_code(ret)); + SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to get current languages : %s", __vc_get_error_code(ret)); //LCOV_EXCL_LINE } SLOG(LOG_DEBUG, TAG_VCC, "@@@"); @@ -825,10 +834,12 @@ int vc_get_state(vc_state_e* state) *state = temp; switch (*state) { + //LCOV_EXCL_START case VC_STATE_NONE: SLOG(LOG_DEBUG, TAG_VCC, "Current state is 'None'"); break; case VC_STATE_INITIALIZED: SLOG(LOG_DEBUG, TAG_VCC, "Current state is 'Created'"); break; case VC_STATE_READY: SLOG(LOG_DEBUG, TAG_VCC, "Current state is 'Ready'"); break; default: SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Invalid state"); + //LCOV_EXCL_STOP } SLOG(LOG_DEBUG, TAG_VCC, "@@@"); @@ -860,26 +871,28 @@ int vc_get_service_state(vc_service_state_e* state) } if (VC_STATE_READY != temp) { - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Invalid State: Current state is not 'READY'"); - SLOG(LOG_DEBUG, TAG_VCC, "@@@"); + SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Invalid State: Current state is not 'READY'"); //LCOV_EXCL_LINE + SLOG(LOG_DEBUG, TAG_VCC, "@@@"); //LCOV_EXCL_LINE return VC_ERROR_INVALID_STATE; } /* get service state */ vc_service_state_e service_state; if (0 != vc_client_get_service_state(g_vc, &service_state)) { - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to get service state"); + SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to get service state"); //LCOV_EXCL_LINE return VC_ERROR_OPERATION_FAILED; } *state = service_state; switch (*state) { + //LCOV_EXCL_START case VC_SERVICE_STATE_NONE: SLOG(LOG_DEBUG, TAG_VCC, "Current service state is 'None'"); break; case VC_SERVICE_STATE_READY: SLOG(LOG_DEBUG, TAG_VCC, "Current service state is 'Ready'"); break; case VC_SERVICE_STATE_RECORDING: SLOG(LOG_DEBUG, TAG_VCC, "Current service state is 'Recording'"); break; case VC_SERVICE_STATE_PROCESSING: SLOG(LOG_DEBUG, TAG_VCC, "Current service state is 'Processing'"); break; default: SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Invalid state"); + //LCOV_EXCL_STOP } SLOG(LOG_DEBUG, TAG_VCC, "@@@"); @@ -912,8 +925,8 @@ int vc_get_system_command_list(vc_cmd_list_h* vc_sys_cmd_list) /* check state */ if (state != VC_STATE_READY) { - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Invalid State: Current state is not 'READY'"); - SLOG(LOG_DEBUG, TAG_VCC, "@@@"); + SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Invalid State: Current state is not 'READY'"); //LCOV_EXCL_LINE + SLOG(LOG_DEBUG, TAG_VCC, "@@@"); //LCOV_EXCL_LINE return VC_ERROR_INVALID_STATE; } @@ -921,8 +934,8 @@ int vc_get_system_command_list(vc_cmd_list_h* vc_sys_cmd_list) vc_service_state_e service_state = -1; vc_client_get_service_state(g_vc, &service_state); if (service_state != VC_SERVICE_STATE_READY) { - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Invalid State: service state is not 'READY'"); - SLOG(LOG_DEBUG, TAG_VCC, "@@@"); + SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Invalid State: service state is not 'READY'"); //LCOV_EXCL_LINE + SLOG(LOG_DEBUG, TAG_VCC, "@@@"); //LCOV_EXCL_LINE return VC_ERROR_INVALID_STATE; } @@ -933,6 +946,7 @@ int vc_get_system_command_list(vc_cmd_list_h* vc_sys_cmd_list) do { ret = vc_dbus_request_is_system_command_valid(g_vc->handle, &is_sys_cmd_valid); if (0 != ret) { + //LCOV_EXCL_START if (VC_ERROR_INVALID_PARAMETER == ret && false == is_prepared) { vc_client_set_client_state(g_vc, VC_STATE_INITIALIZED); if (0 == vc_prepare_sync()) { @@ -951,13 +965,14 @@ int vc_get_system_command_list(vc_cmd_list_h* vc_sys_cmd_list) break; } } + //LCOV_EXCL_STOP } } while (0 != ret); int mgr_pid = -1; ret = vc_client_get_mgr_pid(g_vc, &mgr_pid); if (0 != ret) { - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to get the manager pid"); + SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to get the manager pid"); //LCOV_EXCL_LINE return VC_ERROR_OPERATION_FAILED; } @@ -966,17 +981,17 @@ int vc_get_system_command_list(vc_cmd_list_h* vc_sys_cmd_list) if (true == is_sys_cmd_valid) { ret = vc_cmd_parser_get_commands(mgr_pid, VC_COMMAND_TYPE_SYSTEM, &(list->list)); if (0 != ret) { - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to get parsing commands"); + SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to get parsing commands"); //LCOV_EXCL_LINE return ret; } ret = vc_cmd_parser_get_commands(mgr_pid, VC_COMMAND_TYPE_SYSTEM_BACKGROUND, &(list->list)); if (0 != ret) { - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to get parsing commands"); + SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to get parsing commands"); //LCOV_EXCL_LINE return ret; } *vc_sys_cmd_list = (vc_cmd_list_h)list; } else { - SLOG(LOG_WARN, TAG_VCC, "[WARNING] No system commands"); + SLOG(LOG_WARN, TAG_VCC, "[WARNING] No system commands"); //LCOV_EXCL_LINE *vc_sys_cmd_list = NULL; return VC_ERROR_NONE; } @@ -986,6 +1001,7 @@ int vc_get_system_command_list(vc_cmd_list_h* vc_sys_cmd_list) return ret; } +//LCOV_EXCL_START /** * @brief Checks whether the command format is supported. * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif @@ -1040,13 +1056,14 @@ int vc_is_command_format_supported(vc_cmd_format_e format, bool* support) return VC_ERROR_NONE; } +//LCOV_EXCL_STOP static int __vc_get_invocation_name(char** invocation_name) { int ret = vc_client_get_invocation_name(g_vc, invocation_name); if (0 != ret) { - SLOG(LOG_WARN, TAG_VCC, "Fail to get invocation name"); - return ret; + SLOG(LOG_WARN, TAG_VCC, "Fail to get invocation name"); //LCOV_EXCL_LINE + return ret; //LCOV_EXCL_LINE } if (NULL == *invocation_name) { @@ -1056,7 +1073,7 @@ static int __vc_get_invocation_name(char** invocation_name) ret = app_manager_get_app_id(getpid(), &appid); if (0 != ret || NULL == appid) { - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to get appid, ret(%d)", ret); + SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to get appid, ret(%d)", ret); //LCOV_EXCL_LINE if (NULL != appid) { free(appid); appid = NULL; @@ -1066,7 +1083,7 @@ static int __vc_get_invocation_name(char** invocation_name) ret = vc_get_current_language(&lang); if (0 != ret || NULL == lang) { - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to get current laguage, ret(%d)", ret); + SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to get current laguage, ret(%d)", ret); //LCOV_EXCL_LINE free(appid); appid = NULL; if (NULL != lang) { @@ -1078,7 +1095,7 @@ static int __vc_get_invocation_name(char** invocation_name) ret = app_info_get_localed_label(appid, lang, &temp_label); if (0 != ret || NULL == temp_label) { - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to get localed label, ret(%d) appid(%s) lang(%s)", ret, appid, lang); + SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to get localed label, ret(%d) appid(%s) lang(%s)", ret, appid, lang); //LCOV_EXCL_LINE free(appid); appid = NULL; free(lang); @@ -1092,7 +1109,7 @@ static int __vc_get_invocation_name(char** invocation_name) *invocation_name = strdup(temp_label); if (NULL == *invocation_name) { - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to allocate memory"); + SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to allocate memory"); //LCOV_EXCL_LINE return VC_ERROR_OUT_OF_MEMORY; } @@ -1133,14 +1150,14 @@ int vc_set_command_list(vc_cmd_list_h vc_cmd_list, int type) /* check state */ if (state != VC_STATE_READY) { - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Invalid State: Current state is not 'READY'"); + SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Invalid State: Current state is not 'READY'"); //LCOV_EXCL_LINE SLOG(LOG_DEBUG, TAG_VCC, "@@@"); return VC_ERROR_INVALID_STATE; } /* check type */ if ((VC_COMMAND_TYPE_FOREGROUND != type) && (VC_COMMAND_TYPE_BACKGROUND != type)) { - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Invalid command type: input type is %d", type); + SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Invalid command type: input type is %d", type); //LCOV_EXCL_LINE SLOG(LOG_DEBUG, TAG_VCC, "@@@"); return VC_ERROR_INVALID_PARAMETER; } @@ -1149,7 +1166,7 @@ int vc_set_command_list(vc_cmd_list_h vc_cmd_list, int type) list = (vc_cmd_list_s*)vc_cmd_list; if (NULL == list->list) { - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Invalid command list"); + SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Invalid command list"); //LCOV_EXCL_LINE return VC_ERROR_INVALID_PARAMETER; } @@ -1158,7 +1175,7 @@ int vc_set_command_list(vc_cmd_list_h vc_cmd_list, int type) if (VC_COMMAND_TYPE_BACKGROUND == type) { ret = __vc_get_invocation_name(&invocation_name); if (0 != ret || NULL == invocation_name) { - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to get invocation name, ret(%d)", ret); + SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to get invocation name, ret(%d)", ret); //LCOV_EXCL_LINE return ret; } } @@ -1176,6 +1193,7 @@ int vc_set_command_list(vc_cmd_list_h vc_cmd_list, int type) do { ret = vc_dbus_request_set_command(g_vc->handle, (vc_cmd_type_e)type); if (0 != ret) { + //LCOV_EXCL_START if (VC_ERROR_INVALID_PARAMETER == ret && false == is_prepared) { vc_client_set_client_state(g_vc, VC_STATE_INITIALIZED); if (0 == vc_prepare_sync()) { @@ -1194,6 +1212,7 @@ int vc_set_command_list(vc_cmd_list_h vc_cmd_list, int type) break; } } + //LCOV_EXCL_STOP } } while (0 != ret); } @@ -1242,6 +1261,7 @@ int vc_unset_command_list(int type) while (0 != ret) { ret = vc_dbus_request_unset_command(g_vc->handle, (vc_cmd_type_e)type); if (0 != ret) { + //LCOV_EXCL_START if (VC_ERROR_INVALID_PARAMETER == ret && false == is_prepared) { vc_client_set_client_state(g_vc, VC_STATE_INITIALIZED); if (0 == vc_prepare_sync()) { @@ -1260,13 +1280,14 @@ int vc_unset_command_list(int type) break; } } + //LCOV_EXCL_STOP } } ret = vc_cmd_parser_delete_file(getpid(), (vc_cmd_type_e)type); if (0 != ret) { ret = vc_config_convert_error_code((vc_config_error_e)ret); - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] cmd_type(%d), Fail to delete command list : %s", type, __vc_get_error_code(ret)); + SLOG(LOG_ERROR, TAG_VCC, "[ERROR] cmd_type(%d), Fail to delete command list : %s", type, __vc_get_error_code(ret)); //LCOV_EXCL_LINE } SLOG(LOG_DEBUG, TAG_VCC, "@@@"); @@ -1274,6 +1295,7 @@ int vc_unset_command_list(int type) return ret; } +//LCOV_EXCL_START int vc_set_command_list_from_file(const char* file_path, int type) { if (0 != __vc_get_feature_enabled()) { @@ -1329,6 +1351,7 @@ int vc_set_command_list_from_file(const char* file_path, int type) do { ret = vc_dbus_request_set_command(g_vc->handle, (vc_cmd_type_e)type); if (0 != ret) { + //LCOV_EXCL_START if (VC_ERROR_INVALID_PARAMETER == ret && false == is_prepared) { vc_client_set_client_state(g_vc, VC_STATE_INITIALIZED); if (0 == vc_prepare_sync()) { @@ -1347,6 +1370,7 @@ int vc_set_command_list_from_file(const char* file_path, int type) break; } } + //LCOV_EXCL_STOP } } while (0 != ret); } @@ -1359,6 +1383,7 @@ int vc_set_command_list_from_file(const char* file_path, int type) SLOG(LOG_DEBUG, TAG_VCC, "@@@"); return ret; } +//LCOV_EXCL_STOP #if 0 int vc_get_exclusive_command_option(bool* value) @@ -1617,6 +1642,7 @@ int vc_request_cancel(void) } #endif +//LCOV_EXCL_START static void __vc_notify_error(void *data) { vc_h vc = (vc_h)data; @@ -1746,6 +1772,7 @@ void __vc_cb_result(void) return; } +//LCOV_EXCL_STOP int vc_get_result(vc_result_cb callback, void* user_data) { @@ -1767,13 +1794,13 @@ int vc_get_result(vc_result_cb callback, void* user_data) /* check state */ if (state != VC_STATE_READY) { - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Invalid State: Current state is not 'READY'"); - SLOG(LOG_DEBUG, TAG_VCC, "@@@"); + SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Invalid State: Current state is not 'READY'"); //LCOV_EXCL_LINE + SLOG(LOG_DEBUG, TAG_VCC, "@@@"); //LCOV_EXCL_LINE return VC_ERROR_INVALID_STATE; } if (NULL == callback) { - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Client result callback is NULL"); + SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Client result callback is NULL"); //LCOV_EXCL_LINE return VC_ERROR_INVALID_PARAMETER; } @@ -1782,17 +1809,17 @@ int vc_get_result(vc_result_cb callback, void* user_data) vc_cmd_list_h vc_cmd_list = NULL; if (0 != vc_cmd_list_create(&vc_cmd_list)) { - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to create command list"); + SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to create command list"); //LCOV_EXCL_LINE return VC_ERROR_INVALID_PARAMETER; } int ret = vc_info_parser_get_result(&temp_text, &event, NULL, getpid(), vc_cmd_list, false); if (0 != ret || NULL == temp_text) { - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to get result, ret(%d) temp_text(%s)", ret, temp_text); + SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to get result, ret(%d) temp_text(%s)", ret, temp_text); //LCOV_EXCL_LINE return ret; } - SLOG(LOG_DEBUG, TAG_VCC, "Result info : result text(%s) event(%d)", temp_text, event); + SLOG(LOG_DEBUG, TAG_VCC, "Result info : result text(%s) event(%d)", temp_text, event); //LCOV_EXCL_LINE vc_cmd_print_list(vc_cmd_list); @@ -1868,6 +1895,7 @@ int vc_unset_result_cb(void) return 0; } +//LCOV_EXCL_START int __vc_cb_service_state(int state) { vc_service_state_e current_state = (vc_service_state_e)state; @@ -1899,10 +1927,11 @@ int __vc_cb_service_state(int state) return 0; } +//LCOV_EXCL_STOP int __vc_cb_manager_pid(int manager_pid) { - SLOG(LOG_DEBUG, TAG_VCC, "Manager pid is changed : %d", manager_pid); + SLOG(LOG_DEBUG, TAG_VCC, "Manager pid is changed : %d", manager_pid); //LCOV_EXCL_LINE /* Save service state */ vc_client_set_mgr_pid(g_vc, manager_pid); @@ -2163,6 +2192,7 @@ int vc_set_invocation_name(const char* name) return ret; } +//LCOV_EXCL_START int vc_set_server_dialog(const char* app_id, const char* credential) { vc_state_e state; @@ -2342,7 +2372,7 @@ int vc_unset_server_dialog(const char* app_id) return ret; } - +//LCOV_EXCL_STOP int vc_request_dialog(const char* disp_text, const char* utt_text, bool auto_start) { @@ -2364,8 +2394,8 @@ int vc_request_dialog(const char* disp_text, const char* utt_text, bool auto_sta /* check state */ if (state != VC_STATE_READY) { - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Invalid State: Current state is not 'READY'"); - SLOG(LOG_DEBUG, TAG_VCC, "@@@"); + SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Invalid State: Current state is not 'READY'"); //LCOV_EXCL_LINE + SLOG(LOG_DEBUG, TAG_VCC, "@@@"); //LCOV_EXCL_LINE return VC_ERROR_INVALID_STATE; } @@ -2373,8 +2403,8 @@ int vc_request_dialog(const char* disp_text, const char* utt_text, bool auto_sta vc_service_state_e service_state = -1; vc_client_get_service_state(g_vc, &service_state); if (service_state != VC_SERVICE_STATE_READY) { - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Invalid State: service state is not 'READY'"); - SLOG(LOG_DEBUG, TAG_VCC, "@@@"); + SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Invalid State: service state is not 'READY'"); //LCOV_EXCL_LINE + SLOG(LOG_DEBUG, TAG_VCC, "@@@"); //LCOV_EXCL_LINE return VC_ERROR_INVALID_STATE; } @@ -2390,6 +2420,7 @@ int vc_request_dialog(const char* disp_text, const char* utt_text, bool auto_sta return VC_ERROR_NONE; } +//LCOV_EXCL_START /* Authority */ int vc_auth_enable(void) { @@ -2834,3 +2865,4 @@ int vc_auth_cancel(void) return ret; } +//LCOV_EXCL_STOP diff --git a/client/vc_client.c b/client/vc_client.c index 515c9c1..70c4b4b 100644 --- a/client/vc_client.c +++ b/client/vc_client.c @@ -93,7 +93,7 @@ static vc_client_s* __client_get(vc_h vc) } } - SLOG(LOG_DEBUG, TAG_VCC, "[DEBUG] Fail to get client by vc"); + SLOG(LOG_DEBUG, TAG_VCC, "[DEBUG] Fail to get client by vc"); //LCOV_EXCL_LINE return NULL; } @@ -104,13 +104,13 @@ int vc_client_create(vc_h* vc) client = (vc_client_s*)calloc(1, sizeof(vc_client_s)); if (NULL == client) { - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to allocate memory"); + SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to allocate memory"); //LCOV_EXCL_LINE return VC_ERROR_OUT_OF_MEMORY; } vc_h temp = (vc_h)calloc(1, sizeof(struct vc_s)); if (NULL == temp) { - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to allocate memory"); + SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to allocate memory"); //LCOV_EXCL_LINE free(client); return VC_ERROR_OUT_OF_MEMORY; } @@ -164,7 +164,7 @@ int vc_client_create(vc_h* vc) int vc_client_destroy(vc_h vc) { if (vc == NULL) { - SLOG(LOG_ERROR, TAG_VCC, "Input parameter is NULL"); + SLOG(LOG_ERROR, TAG_VCC, "Input parameter is NULL"); //LCOV_EXCL_LINE return 0; } @@ -235,6 +235,7 @@ bool vc_client_is_valid_by_uid(int uid) return false; } +//LCOV_EXCL_START int vc_client_get_handle(int uid, vc_h* vc) { vc_client_s *data = NULL; @@ -255,6 +256,7 @@ int vc_client_get_handle(int uid, vc_h* vc) return -1; } +//LCOV_EXCL_STOP /* set/get callback function */ int vc_client_set_result_cb(vc_h vc, vc_result_cb callback, void* user_data) @@ -271,6 +273,7 @@ int vc_client_set_result_cb(vc_h vc, vc_result_cb callback, void* user_data) return 0; } +//LCOV_EXCL_START int vc_client_get_result_cb(vc_h vc, vc_result_cb* callback, void** user_data) { vc_client_s* client = __client_get(vc); @@ -284,6 +287,7 @@ int vc_client_get_result_cb(vc_h vc, vc_result_cb* callback, void** user_data) return 0; } +//LCOV_EXCL_STOP int vc_client_set_service_state_changed_cb(vc_h vc, vc_service_state_changed_cb callback, void* user_data) { @@ -299,6 +303,7 @@ int vc_client_set_service_state_changed_cb(vc_h vc, vc_service_state_changed_cb return 0; } +//LCOV_EXCL_START int vc_client_get_service_state_changed_cb(vc_h vc, vc_service_state_changed_cb* callback, void** user_data) { vc_client_s* client = __client_get(vc); @@ -312,6 +317,7 @@ int vc_client_get_service_state_changed_cb(vc_h vc, vc_service_state_changed_cb* return 0; } +//LCOV_EXCL_STOP int vc_client_set_state_changed_cb(vc_h vc, vc_state_changed_cb callback, void* user_data) { @@ -327,6 +333,7 @@ int vc_client_set_state_changed_cb(vc_h vc, vc_state_changed_cb callback, void* return 0; } +//LCOV_EXCL_START int vc_client_get_state_changed_cb(vc_h vc, vc_state_changed_cb* callback, void** user_data) { vc_client_s* client = __client_get(vc); @@ -340,6 +347,7 @@ int vc_client_get_state_changed_cb(vc_h vc, vc_state_changed_cb* callback, void* return 0; } +//LCOV_EXCL_STOP int vc_client_set_current_lang_changed_cb(vc_h vc, vc_current_language_changed_cb callback, void* user_data) { @@ -355,6 +363,7 @@ int vc_client_set_current_lang_changed_cb(vc_h vc, vc_current_language_changed_c return 0; } +//LCOV_EXCL_START int vc_client_get_current_lang_changed_cb(vc_h vc, vc_current_language_changed_cb* callback, void** user_data) { vc_client_s* client = __client_get(vc); @@ -368,6 +377,7 @@ int vc_client_get_current_lang_changed_cb(vc_h vc, vc_current_language_changed_c return 0; } +//LCOV_EXCL_STOP int vc_client_set_error_cb(vc_h vc, vc_error_cb callback, void* user_data) { @@ -383,6 +393,7 @@ int vc_client_set_error_cb(vc_h vc, vc_error_cb callback, void* user_data) return 0; } +//LCOV_EXCL_START int vc_client_get_error_cb(vc_h vc, vc_error_cb* callback, void** user_data) { vc_client_s* client = __client_get(vc); @@ -396,6 +407,7 @@ int vc_client_get_error_cb(vc_h vc, vc_error_cb* callback, void** user_data) return 0; } +//LCOV_EXCL_STOP /* set/get option */ int vc_client_set_service_state(vc_h vc, vc_service_state_e state) @@ -518,6 +530,7 @@ int vc_client_get_invocation_name(vc_h vc, char** invocation_name) return 0; } +//LCOV_EXCL_START int vc_client_set_xid(vc_h vc, int xid) { vc_client_s* client = __client_get(vc); @@ -543,6 +556,7 @@ int vc_client_get_xid(vc_h vc, int* xid) return 0; } +//LCOV_EXCL_STOP int vc_client_set_is_foreground(vc_h vc, bool value) { @@ -569,6 +583,7 @@ int vc_client_get_is_foreground(vc_h vc, bool* value) return 0; } +//LCOV_EXCL_START #if 0 int vc_client_set_exclusive_cmd(vc_h vc, bool value) { @@ -596,6 +611,7 @@ int vc_client_get_exclusive_cmd(vc_h vc, bool* value) return 0; } #endif +//LCOV_EXCL_STOP int vc_client_set_error(vc_h vc, int reason) { @@ -654,6 +670,7 @@ int vc_client_not_use_callback(vc_h vc) return 0; } +//LCOV_EXCL_START /* Authority */ int vc_client_set_auth_state_changed_cb(vc_h vc, vc_auth_state_changed_cb callback, void* user_data) { @@ -737,6 +754,7 @@ int vc_client_get_before_auth_state(vc_h vc, vc_auth_state_e* before, vc_auth_st return 0; } +//LCOV_EXCL_STOP int vc_client_set_mgr_pid(vc_h vc, int mgr_pid) { diff --git a/client/vc_dbus.c b/client/vc_dbus.c index dfe0228..5ec8f8d 100644 --- a/client/vc_dbus.c +++ b/client/vc_dbus.c @@ -34,7 +34,7 @@ extern int __vc_cb_service_state(int state); extern int __vc_cb_manager_pid(int manager_pid); - +//LCOV_EXCL_START static Eina_Bool listener_event_callback(void* data, Ecore_Fd_Handler *fd_handler) { if (NULL == g_conn_listener) return ECORE_CALLBACK_RENEW; @@ -187,6 +187,7 @@ static Eina_Bool listener_event_callback(void* data, Ecore_Fd_Handler *fd_handle return ECORE_CALLBACK_PASS_ON; } +//LCOV_EXCL_STOP static void __vc_dbus_connection_free() { @@ -205,7 +206,7 @@ static void __vc_dbus_connection_free() int vc_dbus_open_connection() { if (NULL != g_conn_sender && NULL != g_conn_listener) { - SLOG(LOG_WARN, TAG_VCC, "already existed connection "); + SLOG(LOG_WARN, TAG_VCC, "already existed connection "); //LCOV_EXCL_LINE return 0; } @@ -219,12 +220,12 @@ int vc_dbus_open_connection() g_conn_sender = dbus_bus_get_private(DBUS_BUS_SESSION, &err); if (dbus_error_is_set(&err)) { - SLOG(LOG_ERROR, TAG_VCC, "Dbus Connection Error (%s)", err.message); + SLOG(LOG_ERROR, TAG_VCC, "Dbus Connection Error (%s)", err.message); //LCOV_EXCL_LINE dbus_error_free(&err); } if (NULL == g_conn_sender) { - SLOG(LOG_ERROR, TAG_VCC, "Fail to get dbus connection "); + SLOG(LOG_ERROR, TAG_VCC, "Fail to get dbus connection "); //LCOV_EXCL_LINE return VC_ERROR_OPERATION_FAILED; } @@ -233,12 +234,12 @@ int vc_dbus_open_connection() g_conn_listener = dbus_bus_get_private(DBUS_BUS_SESSION, &err); if (dbus_error_is_set(&err)) { - SLOG(LOG_ERROR, TAG_VCC, "Dbus Connection Error (%s)", err.message); + SLOG(LOG_ERROR, TAG_VCC, "Dbus Connection Error (%s)", err.message); //LCOV_EXCL_LINE dbus_error_free(&err); } if (NULL == g_conn_listener) { - SLOG(LOG_ERROR, TAG_VCC, "Fail to get dbus connection "); + SLOG(LOG_ERROR, TAG_VCC, "Fail to get dbus connection "); //LCOV_EXCL_LINE __vc_dbus_connection_free(); return VC_ERROR_OPERATION_FAILED; } @@ -257,18 +258,18 @@ int vc_dbus_open_connection() ret = dbus_bus_request_name(g_conn_listener, service_name, DBUS_NAME_FLAG_REPLACE_EXISTING, &err); if (dbus_error_is_set(&err)) { - SLOG(LOG_ERROR, TAG_VCC, "Name Error (%s)", err.message); + SLOG(LOG_ERROR, TAG_VCC, "Name Error (%s)", err.message); //LCOV_EXCL_LINE dbus_error_free(&err); } if (DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER != ret) { - SLOG(LOG_ERROR, TAG_VCC, "fail dbus_bus_request_name()"); + SLOG(LOG_ERROR, TAG_VCC, "fail dbus_bus_request_name()"); //LCOV_EXCL_LINE __vc_dbus_connection_free(); return -2; } if (NULL != g_fd_handler) { - SLOG(LOG_WARN, TAG_VCC, "The handler already exists."); + SLOG(LOG_WARN, TAG_VCC, "The handler already exists."); //LCOV_EXCL_LINE __vc_dbus_connection_free(); return 0; } @@ -280,7 +281,7 @@ int vc_dbus_open_connection() dbus_bus_add_match(g_conn_listener, rule, &err); if (dbus_error_is_set(&err)) { - SLOG(LOG_ERROR, TAG_VCC, "Match Error (%s)", err.message); + SLOG(LOG_ERROR, TAG_VCC, "Match Error (%s)", err.message); //LCOV_EXCL_LINE dbus_error_free(&err); __vc_dbus_connection_free(); return VC_ERROR_OPERATION_FAILED; @@ -288,7 +289,7 @@ int vc_dbus_open_connection() int fd = 0; if (1 != dbus_connection_get_unix_fd(g_conn_listener, &fd)) { - SLOG(LOG_ERROR, TAG_VCC, "fail to get fd from dbus "); + SLOG(LOG_ERROR, TAG_VCC, "fail to get fd from dbus "); //LCOV_EXCL_LINE __vc_dbus_connection_free(); return VC_ERROR_OPERATION_FAILED; } else { @@ -297,7 +298,7 @@ int vc_dbus_open_connection() g_fd_handler = ecore_main_fd_handler_add(fd, ECORE_FD_READ, (Ecore_Fd_Cb)listener_event_callback, g_conn_listener, NULL, NULL); if (NULL == g_fd_handler) { - SLOG(LOG_ERROR, TAG_VCC, "fail to get fd handler from ecore "); + SLOG(LOG_ERROR, TAG_VCC, "fail to get fd handler from ecore "); //LCOV_EXCL_LINE __vc_dbus_connection_free(); return VC_ERROR_OPERATION_FAILED; } @@ -325,7 +326,7 @@ int vc_dbus_close_connection() dbus_bus_release_name(g_conn_listener, service_name, &err); if (dbus_error_is_set(&err)) { - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Dbus Error (%s)", err.message); + SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Dbus Error (%s)", err.message); //LCOV_EXCL_LINE dbus_error_free(&err); } } @@ -341,28 +342,28 @@ int vc_dbus_reconnect() vc_dbus_close_connection(); if (0 != vc_dbus_open_connection()) { - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to reconnect"); + SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to reconnect"); //LCOV_EXCL_LINE return -1; } - SLOG(LOG_DEBUG, TAG_VCC, "[DBUS] Reconnect"); + SLOG(LOG_DEBUG, TAG_VCC, "[DBUS] Reconnect"); //LCOV_EXCL_LINE return 0; } bool sender_connected = dbus_connection_get_is_connected(g_conn_sender); bool listener_connected = dbus_connection_get_is_connected(g_conn_listener); SLOG(LOG_WARN, TAG_VCC, "[DBUS] Sender(%s) Listener(%s)", - sender_connected ? "Connected" : "Not connected", listener_connected ? "Connected" : "Not connected"); + sender_connected ? "Connected" : "Not connected", listener_connected ? "Connected" : "Not connected"); //LCOV_EXCL_LINE if (false == sender_connected || false == listener_connected) { vc_dbus_close_connection(); if (0 != vc_dbus_open_connection()) { - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to reconnect"); + SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to reconnect"); //LCOV_EXCL_LINE return -1; } - SLOG(LOG_DEBUG, TAG_VCC, "[DBUS] Reconnect"); + SLOG(LOG_DEBUG, TAG_VCC, "[DBUS] Reconnect"); //LCOV_EXCL_LINE } return 0; @@ -371,7 +372,7 @@ int vc_dbus_reconnect() static int __dbus_check() { if (NULL == g_conn_sender) { - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] NULL connection"); + SLOG(LOG_ERROR, TAG_VCC, "[ERROR] NULL connection"); //LCOV_EXCL_LINE return vc_dbus_reconnect(); } return 0; @@ -392,7 +393,7 @@ int vc_dbus_request_hello() VC_METHOD_HELLO); if (NULL == msg) { - SLOG(LOG_ERROR, TAG_VCC, "@@ Request vc hello : Fail to make message"); + SLOG(LOG_ERROR, TAG_VCC, "@@ Request vc hello : Fail to make message"); //LCOV_EXCL_LINE return VC_ERROR_OPERATION_FAILED; } @@ -405,7 +406,7 @@ int vc_dbus_request_hello() result_msg = dbus_connection_send_with_reply_and_block(g_conn_sender, msg, 500, &err); if (dbus_error_is_set(&err)) { - SLOG(LOG_DEBUG, TAG_VCC, "[ERROR] Dbus Error (%s)", err.message); + SLOG(LOG_DEBUG, TAG_VCC, "[ERROR] Dbus Error (%s)", err.message); //LCOV_EXCL_LINE dbus_error_free(&err); } @@ -437,7 +438,7 @@ int vc_dbus_request_initialize(int pid, int* mgr_pid, int* service_state, int* d VC_METHOD_INITIALIZE); if (NULL == msg) { - SLOG(LOG_ERROR, TAG_VCC, "@@ vc initialize : Fail to make message "); + SLOG(LOG_ERROR, TAG_VCC, "@@ vc initialize : Fail to make message "); //LCOV_EXCL_LINE return VC_ERROR_OPERATION_FAILED; } else { SLOG(LOG_DEBUG, TAG_VCC, "@@ vc initialize : pid(%d)", pid); @@ -457,7 +458,7 @@ int vc_dbus_request_initialize(int pid, int* mgr_pid, int* service_state, int* d dbus_message_unref(msg); if (dbus_error_is_set(&err)) { - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Dbus Error (%s)", err.message); + SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Dbus Error (%s)", err.message); //LCOV_EXCL_LINE dbus_error_free(&err); } @@ -473,7 +474,7 @@ int vc_dbus_request_initialize(int pid, int* mgr_pid, int* service_state, int* d DBUS_TYPE_INVALID); if (dbus_error_is_set(&err)) { - SLOG(LOG_ERROR, TAG_VCC, "@@ Get arguments error (%s)", err.message); + SLOG(LOG_ERROR, TAG_VCC, "@@ Get arguments error (%s)", err.message); //LCOV_EXCL_LINE dbus_error_free(&err); result = VC_ERROR_OPERATION_FAILED; } @@ -491,16 +492,16 @@ int vc_dbus_request_initialize(int pid, int* mgr_pid, int* service_state, int* d dbus_bus_add_match(g_conn_listener, rule, &err); if (dbus_error_is_set(&err)) { - SLOG(LOG_ERROR, TAG_VCC, "Match Error (%s)", err.message); + SLOG(LOG_ERROR, TAG_VCC, "Match Error (%s)", err.message); //LCOV_EXCL_LINE dbus_error_free(&err); } - SLOG(LOG_DEBUG, TAG_VCC, "@@ vc initialize : result = %d mgr = %d service = %d daemon_pid = %d", result, *mgr_pid, *service_state, *daemon_pid); + SLOG(LOG_DEBUG, TAG_VCC, "@@ vc initialize : result = %d mgr = %d service = %d daemon_pid = %d", result, *mgr_pid, *service_state, *daemon_pid); //LCOV_EXCL_LINE } else { - SLOG(LOG_ERROR, TAG_VCC, "@@ vc initialize : result = %d", result); + SLOG(LOG_ERROR, TAG_VCC, "@@ vc initialize : result = %d", result); //LCOV_EXCL_LINE } } else { - SLOG(LOG_ERROR, TAG_VCC, "@@ Result message is NULL "); + SLOG(LOG_ERROR, TAG_VCC, "@@ Result message is NULL "); //LCOV_EXCL_LINE vc_dbus_reconnect(); result = VC_ERROR_TIMED_OUT; } @@ -524,7 +525,7 @@ int vc_dbus_request_finalize(int pid) dbus_connection_flush(g_conn_listener); if (dbus_error_is_set(&err)) { - SLOG(LOG_ERROR, TAG_VCC, "Match Error (%s)", err.message); + SLOG(LOG_ERROR, TAG_VCC, "Match Error (%s)", err.message); //LCOV_EXCL_LINE dbus_error_free(&err); } @@ -537,7 +538,7 @@ int vc_dbus_request_finalize(int pid) VC_METHOD_FINALIZE); if (NULL == msg) { - SLOG(LOG_ERROR, TAG_VCC, "@@ vc finalize : Fail to make message "); + SLOG(LOG_ERROR, TAG_VCC, "@@ vc finalize : Fail to make message "); //LCOV_EXCL_LINE return VC_ERROR_OPERATION_FAILED; } else { SLOG(LOG_DEBUG, TAG_VCC, "@@ vc finalize : pid(%d)", pid); @@ -552,7 +553,7 @@ int vc_dbus_request_finalize(int pid) dbus_message_unref(msg); if (dbus_error_is_set(&err)) { - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Dbus Error (%s)", err.message); + SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Dbus Error (%s)", err.message); //LCOV_EXCL_LINE dbus_error_free(&err); } @@ -562,7 +563,7 @@ int vc_dbus_request_finalize(int pid) DBUS_TYPE_INVALID); if (dbus_error_is_set(&err)) { - SLOG(LOG_ERROR, TAG_VCC, "@@ Get arguments error (%s)", err.message); + SLOG(LOG_ERROR, TAG_VCC, "@@ Get arguments error (%s)", err.message); //LCOV_EXCL_LINE dbus_error_free(&err); result = VC_ERROR_OPERATION_FAILED; } @@ -575,7 +576,7 @@ int vc_dbus_request_finalize(int pid) SLOG(LOG_ERROR, TAG_VCC, "@@ vc finalize : result = %d", result); } } else { - SLOG(LOG_ERROR, TAG_VCC, "@@ Result message is NULL "); + SLOG(LOG_ERROR, TAG_VCC, "@@ Result message is NULL "); //LCOV_EXCL_LINE vc_dbus_reconnect(); result = VC_ERROR_TIMED_OUT; } @@ -583,6 +584,7 @@ int vc_dbus_request_finalize(int pid) return result; } +//LCOV_EXCL_START int vc_dbus_request_set_exclusive_command(int pid, bool value) { if (0 != __dbus_check()) { @@ -598,7 +600,7 @@ int vc_dbus_request_set_exclusive_command(int pid, bool value) VC_METHOD_SET_EXCLUSIVE_CMD); if (NULL == msg) { - SLOG(LOG_ERROR, TAG_VCC, "@@ vc set exclusive command : Fail to make message"); + SLOG(LOG_ERROR, TAG_VCC, "@@ vc set exclusive command : Fail to make message"); //LCOV_EXCL_LINE return VC_ERROR_OPERATION_FAILED; } else { SLOG(LOG_DEBUG, TAG_VCC, "@@ vc set exclusive command : pid(%d)", pid); @@ -621,7 +623,7 @@ int vc_dbus_request_set_exclusive_command(int pid, bool value) dbus_message_unref(msg); if (dbus_error_is_set(&err)) { - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Dbus Error (%s)", err.message); + SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Dbus Error (%s)", err.message); //LCOV_EXCL_LINE dbus_error_free(&err); } @@ -631,7 +633,7 @@ int vc_dbus_request_set_exclusive_command(int pid, bool value) DBUS_TYPE_INVALID); if (dbus_error_is_set(&err)) { - SLOG(LOG_ERROR, TAG_VCC, "@@ Get arguments error (%s)", err.message); + SLOG(LOG_ERROR, TAG_VCC, "@@ Get arguments error (%s)", err.message); //LCOV_EXCL_LINE dbus_error_free(&err); result = VC_ERROR_OPERATION_FAILED; } @@ -643,13 +645,14 @@ int vc_dbus_request_set_exclusive_command(int pid, bool value) SLOG(LOG_DEBUG, TAG_VCC, "@@ vc set exclusive command : result = %d", result); } } else { - SLOG(LOG_ERROR, TAG_VCC, "@@ Result message is NULL"); + SLOG(LOG_ERROR, TAG_VCC, "@@ Result message is NULL"); //LCOV_EXCL_LINE vc_dbus_reconnect(); result = VC_ERROR_TIMED_OUT; } return result; } +//LCOV_EXCL_STOP int vc_dbus_request_set_command(int pid, vc_cmd_type_e cmd_type) { @@ -666,7 +669,7 @@ int vc_dbus_request_set_command(int pid, vc_cmd_type_e cmd_type) VC_METHOD_SET_COMMAND); if (NULL == msg) { - SLOG(LOG_ERROR, TAG_VCC, "@@ vc set command : Fail to make message"); + SLOG(LOG_ERROR, TAG_VCC, "@@ vc set command : Fail to make message"); //LCOV_EXCL_LINE return VC_ERROR_OPERATION_FAILED; } else { SLOG(LOG_DEBUG, TAG_VCC, "@@ vc set command : pid(%d)", pid); @@ -687,7 +690,7 @@ int vc_dbus_request_set_command(int pid, vc_cmd_type_e cmd_type) dbus_message_unref(msg); if (dbus_error_is_set(&err)) { - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Dbus Error (%s)", err.message); + SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Dbus Error (%s)", err.message); //LCOV_EXCL_LINE dbus_error_free(&err); } @@ -697,7 +700,7 @@ int vc_dbus_request_set_command(int pid, vc_cmd_type_e cmd_type) DBUS_TYPE_INVALID); if (dbus_error_is_set(&err)) { - SLOG(LOG_ERROR, TAG_VCC, "@@ Get arguments error (%s)", err.message); + SLOG(LOG_ERROR, TAG_VCC, "@@ Get arguments error (%s)", err.message); //LCOV_EXCL_LINE dbus_error_free(&err); result = VC_ERROR_OPERATION_FAILED; } @@ -709,7 +712,7 @@ int vc_dbus_request_set_command(int pid, vc_cmd_type_e cmd_type) SLOG(LOG_ERROR, TAG_VCC, "@@ vc set command : result = %d", result); } } else { - SLOG(LOG_ERROR, TAG_VCC, "@@ Result message is NULL"); + SLOG(LOG_ERROR, TAG_VCC, "@@ Result message is NULL"); //LCOV_EXCL_LINE vc_dbus_reconnect(); result = VC_ERROR_TIMED_OUT; } @@ -732,7 +735,7 @@ int vc_dbus_request_unset_command(int pid, vc_cmd_type_e cmd_type) VC_METHOD_UNSET_COMMAND); if (NULL == msg) { - SLOG(LOG_ERROR, TAG_VCC, "@@ vc unset command : Fail to make message"); + SLOG(LOG_ERROR, TAG_VCC, "@@ vc unset command : Fail to make message"); //LCOV_EXCL_LINE return VC_ERROR_OPERATION_FAILED; } else { SLOG(LOG_DEBUG, TAG_VCC, "@@ vc unset command : pid(%d), type(%d)", pid, cmd_type); @@ -753,7 +756,7 @@ int vc_dbus_request_unset_command(int pid, vc_cmd_type_e cmd_type) dbus_message_unref(msg); if (dbus_error_is_set(&err)) { - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Dbus Error (%s)", err.message); + SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Dbus Error (%s)", err.message); //LCOV_EXCL_LINE dbus_error_free(&err); } @@ -763,7 +766,7 @@ int vc_dbus_request_unset_command(int pid, vc_cmd_type_e cmd_type) DBUS_TYPE_INVALID); if (dbus_error_is_set(&err)) { - SLOG(LOG_ERROR, TAG_VCC, "@@ Get arguments error (%s)", err.message); + SLOG(LOG_ERROR, TAG_VCC, "@@ Get arguments error (%s)", err.message); //LCOV_EXCL_LINE dbus_error_free(&err); result = VC_ERROR_OPERATION_FAILED; } @@ -775,7 +778,7 @@ int vc_dbus_request_unset_command(int pid, vc_cmd_type_e cmd_type) SLOG(LOG_ERROR, TAG_VCC, "@@ vc unset command : result = %d", result); } } else { - SLOG(LOG_ERROR, TAG_VCC, "@@ Result message is NULL"); + SLOG(LOG_ERROR, TAG_VCC, "@@ Result message is NULL"); //LCOV_EXCL_LINE vc_dbus_reconnect(); result = VC_ERROR_TIMED_OUT; } @@ -800,7 +803,7 @@ int vc_dbus_set_foreground(int pid, bool value) VCC_MANAGER_METHOD_SET_FOREGROUND); if (NULL == msg) { - SLOG(LOG_ERROR, TAG_VCC, "@@ vc set foreground to manager : Fail to make message"); + SLOG(LOG_ERROR, TAG_VCC, "@@ vc set foreground to manager : Fail to make message"); //LCOV_EXCL_LINE return VC_ERROR_OPERATION_FAILED; } else { SLOG(LOG_DEBUG, TAG_VCC, "@@ vc set foreground to manager : client pid(%d), value(%s)", pid, tmp_value ? "true" : "false"); @@ -812,7 +815,7 @@ int vc_dbus_set_foreground(int pid, bool value) DBUS_TYPE_INVALID); if (1 != dbus_connection_send(g_conn_sender, msg, NULL)) { - SLOG(LOG_ERROR, TAG_VCC, "[Dbus ERROR] Fail to Send"); + SLOG(LOG_ERROR, TAG_VCC, "[Dbus ERROR] Fail to Send"); //LCOV_EXCL_LINE return VC_ERROR_OPERATION_FAILED; } @@ -826,7 +829,7 @@ int vc_dbus_set_foreground(int pid, bool value) VC_METHOD_SET_FOREGROUND); if (NULL == msg) { - SLOG(LOG_ERROR, TAG_VCC, "@@ vc set foreground to daemon : Fail to make message"); + SLOG(LOG_ERROR, TAG_VCC, "@@ vc set foreground to daemon : Fail to make message"); //LCOV_EXCL_LINE return VC_ERROR_OPERATION_FAILED; } else { SLOG(LOG_DEBUG, TAG_VCC, "@@ vc set foreground to daemon : client pid(%d), value(%s)", pid, tmp_value ? "true" : "false"); @@ -840,7 +843,7 @@ int vc_dbus_set_foreground(int pid, bool value) dbus_message_set_no_reply(msg, TRUE); if (1 != dbus_connection_send(g_conn_sender, msg, NULL)) { - SLOG(LOG_ERROR, TAG_VCC, "[Dbus ERROR] Fail to Send"); + SLOG(LOG_ERROR, TAG_VCC, "[Dbus ERROR] Fail to Send"); //LCOV_EXCL_LINE return VC_ERROR_OPERATION_FAILED; } @@ -851,6 +854,7 @@ int vc_dbus_set_foreground(int pid, bool value) return 0; } +//LCOV_EXCL_START int vc_dbus_set_server_dialog(int pid, const char* app_id, const char* credential) { if (NULL == g_conn_sender) { @@ -919,13 +923,14 @@ int vc_dbus_set_server_dialog(int pid, const char* app_id, const char* credentia return result; } +//LCOV_EXCL_STOP int vc_dbus_request_dialog(int pid, const char* disp_text, const char* utt_text, bool continuous) { if (NULL == g_conn_sender) { - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] NULL connection"); + SLOG(LOG_ERROR, TAG_VCC, "[ERROR] NULL connection"); //LCOV_EXCL_LINE if (0 != vc_dbus_reconnect()) { - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to reconnect"); + SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to reconnect"); //LCOV_EXCL_LINE } } @@ -941,7 +946,7 @@ int vc_dbus_request_dialog(int pid, const char* disp_text, const char* utt_text, VC_METHOD_DIALOG); if (NULL == msg) { - SLOG(LOG_ERROR, TAG_VCC, "@@ vc request dialog to manager : Fail to make message"); + SLOG(LOG_ERROR, TAG_VCC, "@@ vc request dialog to manager : Fail to make message"); //LCOV_EXCL_LINE return VC_ERROR_OPERATION_FAILED; } else { SLOG(LOG_DEBUG, TAG_VCC, "@@ vc request dialog to manager : client pid(%d), disp_text(%s), utt_text(%s), continuous(%d)", getpid(), disp_text, utt_text, continuous); @@ -957,7 +962,7 @@ int vc_dbus_request_dialog(int pid, const char* disp_text, const char* utt_text, dbus_message_set_no_reply(msg, TRUE); if (1 != dbus_connection_send(g_conn_sender, msg, NULL)) { - SLOG(LOG_ERROR, TAG_VCC, "[Dbus ERROR] Fail to Send"); + SLOG(LOG_ERROR, TAG_VCC, "[Dbus ERROR] Fail to Send"); //LCOV_EXCL_LINE return VC_ERROR_OPERATION_FAILED; } else { SLOG(LOG_DEBUG, TAG_VCC, "[Dbus DEBUG] Success to Send"); @@ -968,6 +973,7 @@ int vc_dbus_request_dialog(int pid, const char* disp_text, const char* utt_text, return 0; +//LCOV_EXCL_START /* DBusError err; dbus_error_init(&err); @@ -1008,14 +1014,15 @@ int vc_dbus_request_dialog(int pid, const char* disp_text, const char* utt_text, return result; */ +//LCOV_EXCL_STOP } int vc_dbus_request_is_system_command_valid(int pid, bool* is_sys_cmd_valid) { if (NULL == g_conn_sender) { - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] NULL connection"); + SLOG(LOG_ERROR, TAG_VCC, "[ERROR] NULL connection"); //LCOV_EXCL_LINE if (0 != vc_dbus_reconnect()) { - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to reconnect"); + SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to reconnect"); //LCOV_EXCL_LINE } } @@ -1028,7 +1035,7 @@ int vc_dbus_request_is_system_command_valid(int pid, bool* is_sys_cmd_valid) VC_METHOD_IS_SYS_COMMAND_VALID); if (NULL == msg) { - SLOG(LOG_ERROR, TAG_VCC, "@@ vc is system command valid : Fail to make message"); + SLOG(LOG_ERROR, TAG_VCC, "@@ vc is system command valid : Fail to make message"); //LCOV_EXCL_LINE return VC_ERROR_OPERATION_FAILED; } else { SLOG(LOG_DEBUG, TAG_VCC, "@@ vc is system command valid : pid(%d)", pid); @@ -1049,7 +1056,7 @@ int vc_dbus_request_is_system_command_valid(int pid, bool* is_sys_cmd_valid) dbus_message_unref(msg); if (dbus_error_is_set(&err)) { - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Dbus Error (%s)", err.message); + SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Dbus Error (%s)", err.message); //LCOV_EXCL_LINE dbus_error_free(&err); } @@ -1060,7 +1067,7 @@ int vc_dbus_request_is_system_command_valid(int pid, bool* is_sys_cmd_valid) DBUS_TYPE_INVALID); if (dbus_error_is_set(&err)) { - SLOG(LOG_ERROR, TAG_VCC, "@@ Get arguments error (%s)", err.message); + SLOG(LOG_ERROR, TAG_VCC, "@@ Get arguments error (%s)", err.message); //LCOV_EXCL_LINE dbus_error_free(&err); result = VC_ERROR_OPERATION_FAILED; } @@ -1073,7 +1080,7 @@ int vc_dbus_request_is_system_command_valid(int pid, bool* is_sys_cmd_valid) SLOG(LOG_ERROR, TAG_VCC, "@@ vc is system command valid : result = %d", result); } } else { - SLOG(LOG_ERROR, TAG_VCC, "@@ Result message is NULL"); + SLOG(LOG_ERROR, TAG_VCC, "@@ Result message is NULL"); //LCOV_EXCL_LINE vc_dbus_reconnect(); result = VC_ERROR_TIMED_OUT; } @@ -1081,7 +1088,7 @@ int vc_dbus_request_is_system_command_valid(int pid, bool* is_sys_cmd_valid) return result; } - +//LCOV_EXCL_START #if 0 int vc_dbus_request_start(int pid, int silence) { @@ -1272,7 +1279,9 @@ int vc_dbus_request_cancel(int pid) return result; } #endif +//LCOV_EXCL_STOP +//LCOV_EXCL_START /* Authority */ int vc_dbus_request_auth_enable(int pid, int mgr_pid) { @@ -1645,3 +1654,4 @@ int vc_dbus_request_auth_cancel(int pid, int mgr_pid) return result; } +//LCOV_EXCL_STOP -- 2.7.4 From 17b97bdf8b419c9c144fd0d0f99482dab92cbde2 Mon Sep 17 00:00:00 2001 From: Wonnam Jang Date: Wed, 8 Aug 2018 19:23:16 +0900 Subject: [PATCH 13/16] Remove changing to ready state when specific engine result comes Change-Id: I45d4d8dbbc674b1064b9b615b17700ff9f55af56 Signed-off-by: Wonnam Jang (cherry picked from commit d36d77a02c00a8a7ca69f51bf6c52c8ed6867139) --- server/vcd_server.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/server/vcd_server.c b/server/vcd_server.c index fdfdbcb..559efb7 100644 --- a/server/vcd_server.c +++ b/server/vcd_server.c @@ -452,11 +452,6 @@ int vcd_send_specific_engine_result(const char* engine_app_id, const char* event vcdc_send_specific_engine_result_to_manager(vcd_client_manager_get_pid(), engine_app_id, event, result); } - if (VCD_RECOGNITION_MODE_RESTART_CONTINUOUSLY != vcd_client_get_recognition_mode()) { - vcd_config_set_service_state(VCD_STATE_READY); - vcdc_send_service_state(VCD_STATE_READY); - } - return VCD_ERROR_NONE; } -- 2.7.4 From 9c5916b1bdf3eb0102cad9910af92177ac06fc1c Mon Sep 17 00:00:00 2001 From: sungrae jo Date: Thu, 16 Aug 2018 18:31:06 +0900 Subject: [PATCH 14/16] Remove command expand header for voice_control_manager.h. Change-Id: Ie25445400f297e228701d4dd8938651fdf52a27e Signed-off-by: sungrae jo --- client/vc_mgr.c | 2 +- include/voice_control_manager.h | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/client/vc_mgr.c b/client/vc_mgr.c index ff628fc..bdc2028 100644 --- a/client/vc_mgr.c +++ b/client/vc_mgr.c @@ -803,7 +803,7 @@ int vc_mgr_unset_demandable_client_rule(void) return 0; } -int vc_mgr_is_command_format_supported(vc_cmd_format_e format, bool* support) +int vc_mgr_is_command_format_supported(int format, bool* support) { SLOG(LOG_ERROR, TAG_VCM, "@@@ [Manager] Is command type supported"); diff --git a/include/voice_control_manager.h b/include/voice_control_manager.h index a1aab2b..f906607 100644 --- a/include/voice_control_manager.h +++ b/include/voice_control_manager.h @@ -19,7 +19,6 @@ #define __VOICE_CONTROL_MANAGER_H__ #include -#include #include /** @@ -483,6 +482,8 @@ int vc_mgr_get_service_state(vc_service_state_e *state); * @privlevel platform * @privilege %http://tizen.org/privilege/voicecontrol.manager * + * @remarks The command formats are defined in the #voice_control_command.h. (e.g. #VC_COMMAND_FORMAT_FIXED, #VC_COMMAND_FORMAT_FIXED_AND_NONFIXED, and so on). Please refer to #voice_control_command.h. + * * @param[in] format The command format * @param[out] support The result status @c true = supported, @c false = not supported * @@ -495,7 +496,7 @@ int vc_mgr_get_service_state(vc_service_state_e *state); * * @pre The state should be #VC_STATE_READY. */ -int vc_mgr_is_command_format_supported(vc_cmd_format_e format, bool *support); +int vc_mgr_is_command_format_supported(int format, bool *support); /** * @platform -- 2.7.4 From 0fb10008f3dcdc16a5937afb3d918d40749eae7c Mon Sep 17 00:00:00 2001 From: "sooyeon.kim" Date: Tue, 28 Aug 2018 15:03:03 +0900 Subject: [PATCH 15/16] Fix spelling errata Change-Id: Id319e2d0e7f37231dbe06d4af604a2210da5d9a9 Signed-off-by: sooyeon.kim --- client/vc.c | 8 ++++---- client/vc_dbus.c | 2 +- client/vc_mgr.c | 10 +++++----- client/vc_mgr_client.c | 2 +- client/vc_mgr_dbus.c | 6 +++--- client/vc_setting_dbus.c | 2 +- client/vc_widget_dbus.c | 2 +- common/vc_cmd_db.c | 6 +++--- common/vc_command.c | 30 +++++++++++++++--------------- common/vc_json_parser.c | 8 ++++---- common/vc_regex_rule.h | 8 ++++---- doc/uix_vc_mgr_doc.h | 4 ++-- engine-parser/src/vc-engine-parser.c | 2 +- include/voice_control_command_expand.h | 4 ++-- include/voice_control_manager.h | 2 +- include/voice_control_setting.h | 18 +++++++++--------- server/vcd_client_data.c | 4 ++-- server/vcd_engine_agent.c | 2 +- server/vcd_recorder.c | 8 ++++---- server/vcd_server.c | 28 ++++++++++++++-------------- 20 files changed, 78 insertions(+), 78 deletions(-) diff --git a/client/vc.c b/client/vc.c index dd813d5..594c2ef 100644 --- a/client/vc.c +++ b/client/vc.c @@ -1083,7 +1083,7 @@ static int __vc_get_invocation_name(char** invocation_name) ret = vc_get_current_language(&lang); if (0 != ret || NULL == lang) { - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to get current laguage, ret(%d)", ret); //LCOV_EXCL_LINE + SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to get current language, ret(%d)", ret); //LCOV_EXCL_LINE free(appid); appid = NULL; if (NULL != lang) { @@ -2499,7 +2499,7 @@ int vc_auth_disable(void) return VC_ERROR_INVALID_STATE; } - /* check autority */ + /* check authority */ vc_auth_state_e auth_state = VC_AUTH_STATE_NONE; if (0 != vc_client_get_auth_state(g_vc, &auth_state)) { SLOG(LOG_ERROR, TAG_VCC, "[ERROR] handle is not available"); @@ -2523,7 +2523,7 @@ int vc_auth_disable(void) } if (0 != vc_dbus_request_auth_disable(g_vc->handle, mgr_pid)) { - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to authority disble"); + SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to authority disable"); return VC_ERROR_OPERATION_FAILED; } @@ -2554,7 +2554,7 @@ int vc_auth_get_state(vc_auth_state_e* state) return VC_ERROR_INVALID_STATE; } - /* get autority */ + /* get authority */ vc_auth_state_e temp = VC_AUTH_STATE_NONE; if (0 != vc_client_get_auth_state(g_vc, &temp)) { SLOG(LOG_ERROR, TAG_VCC, "[ERROR] handle is not available"); diff --git a/client/vc_dbus.c b/client/vc_dbus.c index 1be3aea..fb2af05 100644 --- a/client/vc_dbus.c +++ b/client/vc_dbus.c @@ -213,7 +213,7 @@ int vc_dbus_open_connection() DBusError err; int ret; - /* initialise the error value */ + /* initialize the error value */ dbus_error_init(&err); /* connect to the DBUS system bus, and check for errors */ diff --git a/client/vc_mgr.c b/client/vc_mgr.c index bdc2028..d47002d 100644 --- a/client/vc_mgr.c +++ b/client/vc_mgr.c @@ -2034,7 +2034,7 @@ int vc_mgr_start(bool exclusive_command_option) vc_internal_state_e internal_state = -1; vc_mgr_client_get_internal_state(g_vc_m, &internal_state); if (internal_state != VC_INTERNAL_STATE_NONE) { - SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Invaid State : Internal state is NOT none : %d", internal_state); + SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Invalid State : Internal state is NOT none : %d", internal_state); return VC_ERROR_IN_PROGRESS_TO_RECORDING; } @@ -2362,7 +2362,7 @@ int vc_mgr_set_selected_results(vc_cmd_list_h vc_cmd_list) return VC_ERROR_PERMISSION_DENIED; } - /* Do not check state for 'restart continusly' mode */ + /* Do not check state for 'restart continuously' mode */ vc_service_state_e service_state = -1; vc_mgr_client_get_service_state(g_vc_m, &service_state); @@ -2371,7 +2371,7 @@ int vc_mgr_set_selected_results(vc_cmd_list_h vc_cmd_list) vc_mgr_get_recognition_mode(&recognition_mode); if (VC_RECOGNITION_MODE_RESTART_CONTINUOUSLY != recognition_mode) { - SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Invalid State: service state is not 'PROCESSING' and mode is not 'Restart continously'"); + SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Invalid State: service state is not 'PROCESSING' and mode is not 'Restart continuously'"); SLOG(LOG_DEBUG, TAG_VCM, "@@@"); return VC_ERROR_INVALID_STATE; } @@ -3047,7 +3047,7 @@ int vc_mgr_set_service_state_changed_cb(vc_service_state_changed_cb callback, vo vc_mgr_client_set_service_state_changed_cb(g_vc_m, callback, user_data); - SLOG(LOG_DEBUG, TAG_VCM, "[SUCCESS] Set sevice state changed callback"); + SLOG(LOG_DEBUG, TAG_VCM, "[SUCCESS] Set service state changed callback"); return 0; } @@ -3267,7 +3267,7 @@ int __vc_mgr_cb_dialog(int pid, const char* disp_text, const char* utt_text, boo vc_mgr_client_use_callback(g_vc_m); callback(pid, disp_text, utt_text, continuous, user_data); vc_mgr_client_not_use_callback(g_vc_m); - SLOG(LOG_DEBUG, TAG_VCM, "Dialog callback is called, disp_text(%s), utt)text(%s), continous(%d)", disp_text, utt_text, continuous); + SLOG(LOG_DEBUG, TAG_VCM, "Dialog callback is called, disp_text(%s), utt)text(%s), continuous(%d)", disp_text, utt_text, continuous); } else { SLOG(LOG_WARN, TAG_VCM, "[WARNING] Error callback is null"); } diff --git a/client/vc_mgr_client.c b/client/vc_mgr_client.c index f6b9603..861c64d 100644 --- a/client/vc_mgr_client.c +++ b/client/vc_mgr_client.c @@ -216,7 +216,7 @@ int vc_mgr_client_create(vc_h* vc) client->cb_ref_count = 0; - /* Authoriry */ + /* Authority */ client->authorized_client_list = NULL; client->valid_authorized_pid = -1; client->start_by_client = false; diff --git a/client/vc_mgr_dbus.c b/client/vc_mgr_dbus.c index bc69307..3ee9075 100644 --- a/client/vc_mgr_dbus.c +++ b/client/vc_mgr_dbus.c @@ -323,7 +323,7 @@ static Eina_Bool vc_mgr_listener_event_callback(void* data, Ecore_Fd_Handler *fd SLOG(LOG_DEBUG, TAG_VCM, "@@ vc mgr get request set private data : pid(%d) ", pid); ret = __vc_mgr_cb_private_data_set(key, private_data); } else { - SLOG(LOG_ERROR, TAG_VCM, "@@ vc mgr get requset set private data : invalid pid "); + SLOG(LOG_ERROR, TAG_VCM, "@@ vc mgr get request set private data : invalid pid "); } DBusMessage *reply = NULL; @@ -616,7 +616,7 @@ static Eina_Bool vc_mgr_listener_event_callback(void* data, Ecore_Fd_Handler *fd SLOG(LOG_DEBUG, TAG_VCM, "@@@ Owner Changed"); /* remove a rule for daemon error */ DBusError err; - /* initialise the error value */ + /* initialize the error value */ dbus_error_init(&err); char rule_err[256] = {0, }; snprintf(rule_err, 256, "sender='org.freedesktop.DBus',path='/org/freedesktop/DBus',interface='org.freedesktop.DBus',member='NameOwnerChanged',type='signal',arg0='%s'", VC_SERVER_SERVICE_INTERFACE); @@ -668,7 +668,7 @@ int vc_mgr_dbus_open_connection() DBusError err; int ret; - /* initialise the error value */ + /* initialize the error value */ dbus_error_init(&err); /* connect to the DBUS system bus, and check for errors */ diff --git a/client/vc_setting_dbus.c b/client/vc_setting_dbus.c index 1f88a64..d82c436 100755 --- a/client/vc_setting_dbus.c +++ b/client/vc_setting_dbus.c @@ -121,7 +121,7 @@ int vc_setting_dbus_open_connection() DBusError err; int ret; - /* initialise the error value */ + /* initialize the error value */ dbus_error_init(&err); /* connect to the DBUS system bus, and check for errors */ diff --git a/client/vc_widget_dbus.c b/client/vc_widget_dbus.c index 8dbca3c..2289060 100644 --- a/client/vc_widget_dbus.c +++ b/client/vc_widget_dbus.c @@ -294,7 +294,7 @@ int vc_widget_dbus_open_connection() DBusError err; int ret; - /* initialise the error value */ + /* initialize the error value */ dbus_error_init(&err); /* connect to the DBUS system bus, and check for errors */ diff --git a/common/vc_cmd_db.c b/common/vc_cmd_db.c index 928dfac..164dff8 100644 --- a/common/vc_cmd_db.c +++ b/common/vc_cmd_db.c @@ -975,7 +975,7 @@ static int __vc_db_get_appid(sqlite3* db_handle, const char* result, GSList** ap vc_deactivated_app_s* temp_app = NULL; temp_app = (vc_deactivated_app_s*)calloc(1, sizeof(vc_deactivated_app_s)); if (NULL == temp_app) { - SLOG(LOG_ERROR, vc_db_tag(), "[ERROR] memory allcation fail"); + SLOG(LOG_ERROR, vc_db_tag(), "[ERROR] memory allocation fail"); if (NULL != temp_app_list) { g_slist_free_full(temp_app_list, __vc_db_demandable_client_free); @@ -1042,7 +1042,7 @@ int __vc_db_get_result_pid_list(sqlite3* db_handle, const char* result, GSList** vc_cmd_s* temp_cmd = NULL; temp_cmd = (vc_cmd_s*)calloc(1, sizeof(vc_cmd_s)); if (NULL == temp_cmd) { - SLOG(LOG_ERROR, vc_db_tag(), "[ERROR] memory allcation fail"); + SLOG(LOG_ERROR, vc_db_tag(), "[ERROR] memory allocation fail"); if (NULL != temp_pid_list) { g_slist_free_full(temp_pid_list, free); @@ -1814,7 +1814,7 @@ static int __vc_db_insert_commands_list(sqlite3* db_handle, int pid, vc_cmd_type temp_cmd = iter->data; if (NULL == temp_cmd) { - SLOG(LOG_ERROR, vc_db_tag(), "comamnd is NULL"); + SLOG(LOG_ERROR, vc_db_tag(), "command is NULL"); break; } diff --git a/common/vc_command.c b/common/vc_command.c index 282f9a4..08f5c9f 100644 --- a/common/vc_command.c +++ b/common/vc_command.c @@ -1884,7 +1884,7 @@ static int __vc_cmd_tabsolute_check(const char *str, struct tm *td, int *exist) } if (0 > hour || 24 <= hour || (0 == flag && 12 < hour)) { - SLOG(LOG_DEBUG, TAG_VCCMD, "[REGEX] Incomming sentence is weird"); + SLOG(LOG_DEBUG, TAG_VCCMD, "[REGEX] Incoming sentence is weird"); return VC_ERROR_NONE; } @@ -1896,7 +1896,7 @@ static int __vc_cmd_tabsolute_check(const char *str, struct tm *td, int *exist) if (0 > sidx || pmatch[0].rm_so < sidx) sidx = pmatch[0].rm_so; if (0 > eidx || pmatch[0].rm_eo > eidx) eidx = pmatch[0].rm_eo; } else if (0 < flag) { - SLOG(LOG_DEBUG, TAG_VCCMD, "[REGEX] Incomming sentence is weird"); + SLOG(LOG_DEBUG, TAG_VCCMD, "[REGEX] Incoming sentence is weird"); return VC_ERROR_NONE; } @@ -1915,7 +1915,7 @@ static int __vc_cmd_tabsolute_check(const char *str, struct tm *td, int *exist) min = atoi(tempstr); if (0 > min || 60 <= min) { - SLOG(LOG_DEBUG, TAG_VCCMD, "[REGEX] Incomming sentence is weird"); + SLOG(LOG_DEBUG, TAG_VCCMD, "[REGEX] Incoming sentence is weird"); return VC_ERROR_NONE; } @@ -1952,7 +1952,7 @@ static int __vc_cmd_tabsolute_check(const char *str, struct tm *td, int *exist) } if (!strcmp("en_US", lang)) { - SLOG(LOG_DEBUG, TAG_VCCMD, "[REGEX] Incomming sentence is weird"); + SLOG(LOG_DEBUG, TAG_VCCMD, "[REGEX] Incoming sentence is weird"); free(lang); lang = NULL; return VC_ERROR_NONE; @@ -2076,7 +2076,7 @@ static int __vc_cmd_dabsolute_check(const char *str, struct tm *td, int *exist) sidx = pmatch[0].rm_so; eidx = pmatch[0].rm_eo; } else { - SLOG(LOG_DEBUG, TAG_VCCMD, "[REGEX] Incomming sentence is weird"); + SLOG(LOG_DEBUG, TAG_VCCMD, "[REGEX] Incoming sentence is weird"); return VC_ERROR_NONE; } @@ -2106,7 +2106,7 @@ static int __vc_cmd_dabsolute_check(const char *str, struct tm *td, int *exist) } if (!strcmp("en_US", lang)) { - SLOG(LOG_DEBUG, TAG_VCCMD, "[REGEX] Incomming sentence is weird"); + SLOG(LOG_DEBUG, TAG_VCCMD, "[REGEX] Incoming sentence is weird"); free(lang); lang = NULL; return VC_ERROR_NONE; @@ -2155,7 +2155,7 @@ static int __vc_cmd_dabsolute_check(const char *str, struct tm *td, int *exist) td->tm_min = 0; td->tm_sec = 0; } else if (2 == g_time_flag) { - SLOG(LOG_DEBUG, TAG_VCCMD, "[REGEX] Incomming sentence is weird"); + SLOG(LOG_DEBUG, TAG_VCCMD, "[REGEX] Incoming sentence is weird"); return VC_ERROR_NONE; } @@ -2163,7 +2163,7 @@ static int __vc_cmd_dabsolute_check(const char *str, struct tm *td, int *exist) if ((0 == (year + 1900) % 4 && 0 != (year + 1900) % 100) || 0 == (year + 1900) % 400) max_day[1] = 29; if (max_day[mon] < day || 1 > day) { - SLOG(LOG_DEBUG, TAG_VCCMD, "[REGEX] Incomming sentence is weird"); + SLOG(LOG_DEBUG, TAG_VCCMD, "[REGEX] Incoming sentence is weird"); return VC_ERROR_NONE; } @@ -2201,7 +2201,7 @@ 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 occured > (%d)", ret); + SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Error is occurred > (%d)", ret); return ret; } @@ -2212,7 +2212,7 @@ 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 occured > (%d)", ret); + SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Error is occurred > (%d)", ret); return ret; } @@ -2223,7 +2223,7 @@ 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 occured > (%d)", ret); + SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Error is occurred > (%d)", ret); return ret; } @@ -2245,7 +2245,7 @@ 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 occured > (%d)", ret); + SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Error is occurred > (%d)", ret); return ret; } @@ -2256,7 +2256,7 @@ 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 occured > (%d)", ret); + SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Error is occurred > (%d)", ret); return ret; } @@ -2298,13 +2298,13 @@ int vc_cmd_get_datetime(const char *text, time_t *result, char **remain) ret = __vc_cmd_time_check(text, &td); if (VC_ERROR_NONE != ret) { - SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Error is occured in the check > (%d)", ret); + SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Error is occurred in the check > (%d)", ret); return ret; } ret = __vc_cmd_date_check(text, &td); if (VC_ERROR_NONE != ret) { - SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Error is occured in the check > (%d)", ret); + SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Error is occurred in the check > (%d)", ret); return ret; } diff --git a/common/vc_json_parser.c b/common/vc_json_parser.c index 06386f4..65957db 100644 --- a/common/vc_json_parser.c +++ b/common/vc_json_parser.c @@ -40,7 +40,7 @@ static int __vc_json_get_invocation_name(const char* appid, char** invocation_na ret = vc_config_mgr_get_default_language(&lang); if (0 != ret || NULL == lang) { - SLOG(LOG_ERROR, vc_json_tag(), "[ERROR] Fail to get current laguage, ret(%d) lang(%s)", ret, lang); + SLOG(LOG_ERROR, vc_json_tag(), "[ERROR] Fail to get current language, ret(%d) lang(%s)", ret, lang); return ret; } ret = app_info_get_localed_label(appid, lang, &temp_lable); @@ -69,12 +69,12 @@ static int __vc_json_get_invocation_name(const char* appid, char** invocation_na static int __vc_json_set_commands(JsonObject *root_obj, int type, char* invocation_name) { if (NULL == root_obj) { - SLOG(LOG_ERROR, vc_json_tag(), "[ERROR] Invalid paramget"); + SLOG(LOG_ERROR, vc_json_tag(), "[ERROR] Invalid parameter"); return VC_ERROR_INVALID_PARAMETER; } if (VC_COMMAND_TYPE_NONE > type || VC_COMMAND_TYPE_EXCLUSIVE < type) { - SLOG(LOG_ERROR, vc_json_tag(), "[ERROR] Invalid paramget, type(%d)", type); + SLOG(LOG_ERROR, vc_json_tag(), "[ERROR] Invalid parameter, type(%d)", type); return VC_ERROR_INVALID_PARAMETER; } @@ -277,7 +277,7 @@ static int __vc_json_set_commands(JsonObject *root_obj, int type, char* invocati } if (0 != strncmp(cmd->appid, prev_appid, strlen(cmd->appid))) { - //delete bacground commands with appid and type + //delete background commands with appid and type ret = vc_db_delete_commands(cmd->pid, type, cmd->appid); if (VC_ERROR_NONE != ret) { SLOG(LOG_ERROR, vc_json_tag(), "[ERROR] Fail to insert command into db, ret(%d) pid(%d) type(%d), appid(%s)", ret, cmd->pid, type, cmd->appid); diff --git a/common/vc_regex_rule.h b/common/vc_regex_rule.h index 973cbe4..95ab6c7 100755 --- a/common/vc_regex_rule.h +++ b/common/vc_regex_rule.h @@ -38,13 +38,13 @@ const char *DATE_ABS2_REGEX[2] = {"(1월)|(2월)|(3월)|(4월)|(5월)|(6월)|(7 "(January)|(February)|(March)|(April)|(May)|(June)|(July)|(August)|(September)|(October)|(November)|(December)"}; const char *DATE_ABS3_REGEX[2] = {"([1-9]|[1-2][0-9]|3[0-1])일", "([1-9]|[1-2][0-9]|3[0-1])(st|nd|rd|th)"}; -//today / tommorow / the day after tommorow +//today / tomorrow / the day after tomorrow const char *DATE_PHR1_REGEX[2] = {"(오늘)|(내일)|(모레)|(글피)", - "(today)|(tommorow)|(the day after tommorow)"}; + "(today)|(tomorrow)|(the day after tomorrow)"}; const char *DATE_PHR2_REGEX[2] = {"(이틀)|(사흘)|(나흘)|(닷새)|(엿새)|(이레)|(여드레)|(아흐레)|(열흘)", "(이틀)|(사흘)|(나흘)|(닷새)|(엿새)|(이레)|(여드레)|(아흐레)|(열흘)"}; -//Monday / Tuesday / Wednesday / Thursday / Satruday / Sunday +//Monday / Tuesday / Wednesday / Thursday / Saturday / Sunday const char *DATE_PHR3_REGEX[2] = {"(월|화|수|목|금|토|일)(요일)?", "(Mon|Tues|Wednes|Thurs|Fri|Satur|Sun)(day)?"}; @@ -54,4 +54,4 @@ const char *DATE_PHR3_REGEX[2] = {"(월|화|수|목|금|토|일)(요일)?", #endif -#endif \ No newline at end of file +#endif diff --git a/doc/uix_vc_mgr_doc.h b/doc/uix_vc_mgr_doc.h index 0a659fd..0fa61eb 100644 --- a/doc/uix_vc_mgr_doc.h +++ b/doc/uix_vc_mgr_doc.h @@ -30,8 +30,8 @@ * A main function of Voice Control Manager API records voice and gives responses for recognized voice commands. * A Voice Control Manager application can start recording user's utterance and get responses from Voice Control engine service. * The responses are dependent on the Voice Control engine service. For example, the engine service may send ASR(Automatic Speech Recognition) results or NLU(Natural Language Understanding) results. - * Also, it may send plural results. Therefore, the application can get various recognition results from the engine service and handle them by showing responses to users or controling Voice Control applications. - * Like this, the Voice Control Manager application takes a role of controlling Voice Control applcations. + * Also, it may send plural results. Therefore, the application can get various recognition results from the engine service and handle them by showing responses to users or controlling Voice Control applications. + * Like this, the Voice Control Manager application takes a role of controlling Voice Control applications. * For this reason, developers who have an authority granted by Tizen platform can make the Voice Control Manager application.

* To use of Voice Control Manager, use the following steps:
* 1. Initialize
diff --git a/engine-parser/src/vc-engine-parser.c b/engine-parser/src/vc-engine-parser.c index 0e4a92a..8af3cd4 100644 --- a/engine-parser/src/vc-engine-parser.c +++ b/engine-parser/src/vc-engine-parser.c @@ -304,7 +304,7 @@ static int __remove_engine_info_xml(const char *pkgid, gchar *ut, uid_t uid) if (0 == access(path, F_OK)) { LOGD("Remove engine info xml(%s)", path); if (0 != remove(path)) { - LOGE("[ERROR] Fail to emove engine info xml(%s)", path); + LOGE("[ERROR] Fail to remove engine info xml(%s)", path); } } diff --git a/include/voice_control_command_expand.h b/include/voice_control_command_expand.h index c188e77..d8d02c3 100755 --- a/include/voice_control_command_expand.h +++ b/include/voice_control_command_expand.h @@ -184,7 +184,7 @@ int vc_cmd_set_unfixed_command(vc_cmd_h vc_command, const char* command); int vc_cmd_get_nlu_json(vc_cmd_h vc_cmd, char** json); /** -* @brief Gets the datetime value from the setence. +* @brief Gets the datetime value from the sentence. * @since_tizen 3.0 * * @param[in] text The sentence to analyze @@ -216,7 +216,7 @@ int vc_cmd_get_datetime(const char *text, time_t *result, char **remain); * * @remark This function can modify @a src_list by the result, So if you want to keep the content of @a src_list, * make a copy of @a src_list before running this function. And also, you need to create the list handle of -* @a dst_list before runnig this function, because this function does not create the handle internally. +* @a dst_list before running this function, because this function does not create the handle internally. * * @return 0 on success, otherwise a negative error value * @retval #VC_ERROR_NONE Successful diff --git a/include/voice_control_manager.h b/include/voice_control_manager.h index f906607..574fccb 100644 --- a/include/voice_control_manager.h +++ b/include/voice_control_manager.h @@ -772,7 +772,7 @@ int vc_mgr_get_private_data(const char *key, char **data); /** * @platform - * @brief Requests to do action as if utterence is spoken. + * @brief Requests to do action as if utterance is spoken. * @since_tizen 5.0 * * @privlevel platform diff --git a/include/voice_control_setting.h b/include/voice_control_setting.h index bb35f8e..348593e 100755 --- a/include/voice_control_setting.h +++ b/include/voice_control_setting.h @@ -77,7 +77,7 @@ typedef bool(*vc_setting_supported_language_cb)(const char* language, void* user typedef void (*vc_setting_current_language_changed_cb)(const char* previous, const char* current, void* user_data); /** -* @brief Initialize voice control setting +* @brief Initializes voice control setting * * @remarks If the function succeeds, @a vc mgr must be released with vc_setting_finalize(). * @@ -91,7 +91,7 @@ typedef void (*vc_setting_current_language_changed_cb)(const char* previous, con int vc_setting_initialize(void); /** -* @brief Deinitialize vc setting +* @brief Deinitializes vc setting * * @return 0 on success, otherwise a negative error value. * @retval #VC_ERROR_NONE Success. @@ -103,7 +103,7 @@ int vc_setting_initialize(void); int vc_setting_deinitialize(void); /** -* @brief Get supported languages of current engine +* @brief Gets supported languages of current engine * * @param[in] callback callback function * @param[in] user_data User data to be passed to the callback function @@ -121,7 +121,7 @@ int vc_setting_deinitialize(void); int vc_setting_foreach_supported_languages(vc_setting_supported_language_cb callback, void* user_data); /** -* @brief Get the default language. +* @brief Gets the default language. * * @remark If the function is success, @a language must be released with free() by you. * @@ -139,7 +139,7 @@ int vc_setting_foreach_supported_languages(vc_setting_supported_language_cb call int vc_setting_get_language(char** language); /** -* @brief Set the default language. +* @brief Sets the default language. * * @param[in] language language * @@ -154,7 +154,7 @@ int vc_setting_get_language(char** language); int vc_setting_set_language(const char* language); /** -* @brief Set a automatic option of language. +* @brief Sets a automatic option of language. * * @param[in] value The automatic option * @@ -169,7 +169,7 @@ int vc_setting_set_language(const char* language); int vc_setting_set_auto_language(bool value); /** -* @brief Get a automatic option of voice. +* @brief Gets a automatic option of voice. * * @param[out] value The automatic option * @@ -184,7 +184,7 @@ int vc_setting_set_auto_language(bool value); int vc_setting_get_auto_language(bool* value); /** -* @brief Set voice control service enabled. +* @brief Sets voice control service enabled. * * @param[in] value The enabled option * @@ -199,7 +199,7 @@ int vc_setting_get_auto_language(bool* value); int vc_setting_set_enabled(bool value); /** -* @brief Get voice control service enabled. +* @brief Gets voice control service enabled. * * @param[out] value The enabled option * diff --git a/server/vcd_client_data.c b/server/vcd_client_data.c index 6953e17..8639155 100644 --- a/server/vcd_client_data.c +++ b/server/vcd_client_data.c @@ -137,7 +137,7 @@ bool vcd_client_manager_is_system_command_valid(int pid) int vcd_client_manager_set_demandable_client(int pid, GSList* client_list) { if (0 != g_slist_length(g_demandable_client)) { - /* releaes data */ + /* release data */ GSList *iter = NULL; vc_demandable_client_s* temp_client; iter = g_slist_nth(g_demandable_client, 0); @@ -1500,7 +1500,7 @@ int vcd_client_widget_set_waiting_for_recording(int pid, bool waiting) { if (TRUE == waiting && pid != vcd_client_widget_get_foreground_pid()) { - SLOG(LOG_ERROR, TAG_VCD, "[Client Data ERROR] pid(%d) is NOT forground pid", pid); + SLOG(LOG_ERROR, TAG_VCD, "[Client Data ERROR] pid(%d) is NOT foreground pid", pid); return -1; } diff --git a/server/vcd_engine_agent.c b/server/vcd_engine_agent.c index da79346..27aa722 100644 --- a/server/vcd_engine_agent.c +++ b/server/vcd_engine_agent.c @@ -277,7 +277,7 @@ int vcd_engine_agent_load_current_engine(vce_request_callback_s* callback) return VCD_ERROR_ENGINE_NOT_FOUND; } - /* initalize engine */ + /* initialize engine */ ret = g_dynamic_engine.callbacks->initialize(); if (0 != ret) { SLOG(LOG_ERROR, TAG_VCD, "[Engine Agent ERROR] Fail to initialize vc engine service"); diff --git a/server/vcd_recorder.c b/server/vcd_recorder.c index 5d1f689..ca49fb9 100644 --- a/server/vcd_recorder.c +++ b/server/vcd_recorder.c @@ -241,7 +241,7 @@ static void __recorder_focus_state_cb(sound_stream_info_h stream_info, sound_str return; } - SLOG(LOG_WARN, TAG_VCD, "[Recorder] focus state chagned to (%d) with reason (%s)", (int)focus_state, __get_focus_changed_reason_code(reason)); + SLOG(LOG_WARN, TAG_VCD, "[Recorder] focus state changed to (%d) with reason (%s)", (int)focus_state, __get_focus_changed_reason_code(reason)); if (VCD_RECORDER_STATE_RECORDING == g_recorder_state && SOUND_STREAM_FOCUS_STATE_RELEASED == focus_state) { SLOG(LOG_WARN, TAG_VCD, "[Recorder] Focus released as interrupt"); @@ -267,7 +267,7 @@ static int __apply_device_for_stream_routing() int ret = -1; while (0 == sound_manager_get_next_device(device_list, &device)) { if (0 != sound_manager_get_device_type(device, &type)) { - SLOG(LOG_ERROR, TAG_VCD, "[Recorder ERROR] Fail to get device tyep"); + SLOG(LOG_ERROR, TAG_VCD, "[Recorder ERROR] Fail to get device type"); continue; } if (0 != sound_manager_get_device_io_direction(device, &io_direction)) { @@ -304,7 +304,7 @@ static void __device_connection_changed_cb(sound_device_h device, bool is_connec sound_device_type_e type; if (is_connected) { if (0 != sound_manager_get_device_type(device, &type)) { - SLOG(LOG_ERROR, TAG_VCD, "[Recorder ERROR] Fail to get device tyep"); + SLOG(LOG_ERROR, TAG_VCD, "[Recorder ERROR] Fail to get device type"); return; } if (type == SOUND_DEVICE_USB_AUDIO) { @@ -369,7 +369,7 @@ int vcd_recorder_create(vcd_recoder_audio_cb audio_cb, vcd_recorder_interrupt_cb audio_channel_e audio_ch; audio_sample_type_e audio_type; - SLOG(LOG_DEBUG, TAG_VCD, "[Recorder] AUdio type(%d) rate(%d) channel(%d)", g_audio_type, g_audio_rate, g_audio_channel); + SLOG(LOG_DEBUG, TAG_VCD, "[Recorder] Audio type(%d) rate(%d) channel(%d)", g_audio_type, g_audio_rate, g_audio_channel); switch (g_audio_channel) { case 1: audio_ch = AUDIO_CHANNEL_MONO; break; diff --git a/server/vcd_server.c b/server/vcd_server.c index 3c468c9..f949962 100644 --- a/server/vcd_server.c +++ b/server/vcd_server.c @@ -311,7 +311,7 @@ static bool __vcd_launch_app(const char* result) } if (0 != g_slist_length(app_list)) { - /* releaes data */ + /* release data */ GSList *iter = NULL; vc_deactivated_app_s* temp_app = NULL; iter = g_slist_nth(app_list, 0); @@ -514,7 +514,7 @@ int vcd_send_result(vce_result_event_e event, int* result_id, int count, const c } /* priority filter */ - /* system > exclusive > widget > foreground > system_background > widget partial > foreground paritial > background */ + /* system > exclusive > widget > foreground > system_background > widget partial > foreground partial > background */ int i = 0; int* filtered_id = (int*)calloc(count, sizeof(int)); if (!filtered_id) { @@ -633,7 +633,7 @@ int vcd_send_result(vce_result_event_e event, int* result_id, int count, const c temp_cmd = NULL; } } else { - SLOG(LOG_WARN, TAG_VCD, "[Server WARNING] NOT found matached result(%d)", filtered_id[i]); + SLOG(LOG_WARN, TAG_VCD, "[Server WARNING] NOT found matched result(%d)", filtered_id[i]); } } @@ -972,7 +972,7 @@ int vcd_send_result(vce_result_event_e event, int* result_id, int count, const c temp_cmd->parameter = strdup(non_fixed_result); } } else { - SLOG(LOG_WARN, TAG_VCD, "[Server WARNING] Command type is NOT vaild. Parameter (%s)", temp_cmd->parameter); + SLOG(LOG_WARN, TAG_VCD, "[Server WARNING] Command type is NOT valid. Parameter (%s)", temp_cmd->parameter); } break; case VC_CMD_FORMAT_NONFIXED_AND_FIXED: @@ -981,7 +981,7 @@ int vcd_send_result(vce_result_event_e event, int* result_id, int count, const c temp_cmd->command = strdup(non_fixed_result); } } else { - SLOG(LOG_WARN, TAG_VCD, "[Server WARNING] Command type is NOT vaild. Command (%s)", temp_cmd->command); + SLOG(LOG_WARN, TAG_VCD, "[Server WARNING] Command type is NOT valid. Command (%s)", temp_cmd->command); } break; @@ -995,7 +995,7 @@ int vcd_send_result(vce_result_event_e event, int* result_id, int count, const c vc_cmd_destroy((vc_cmd_h)temp_cmd); } } else { - SLOG(LOG_WARN, TAG_VCD, "[Server WARNING] NOT found matached result(%d)", result_id[i]); + SLOG(LOG_WARN, TAG_VCD, "[Server WARNING] NOT found matched result(%d)", result_id[i]); } } @@ -1673,7 +1673,7 @@ int vcd_server_mgr_set_client_info(int pid) static int __reset_waiting_for_widget_recording(void) { - SLOG(LOG_ERROR, TAG_VCD, "[Server] Reet waiting for widget recording"); + SLOG(LOG_ERROR, TAG_VCD, "[Server] Reset waiting for widget recording"); // Delete timer to check that widget client is terminated if (g_check_widget_client_timer) { ecore_timer_del(g_check_widget_client_timer); @@ -1704,7 +1704,7 @@ static Eina_Bool __send_waiting_timeout_start_recording(void* data) int ret = __start_internal_recognition(); if (0 != ret) { - SLOG(LOG_ERROR, TAG_VCD, "[Server ERROR] Fail to start recongition : %d", ret); + SLOG(LOG_ERROR, TAG_VCD, "[Server ERROR] Fail to start recognition : %d", ret); return ret; } return EINA_FALSE; @@ -1857,7 +1857,7 @@ int vcd_server_mgr_start(vcd_recognition_mode_e recognition_mode, bool exclusive int ret = __start_internal_recognition(); if (0 != ret) { - SLOG(LOG_ERROR, TAG_VCD, "[Server ERROR] Fail to start recongition : %d", ret); + SLOG(LOG_ERROR, TAG_VCD, "[Server ERROR] Fail to start recognition : %d", ret); return ret; } @@ -2088,7 +2088,7 @@ int vcd_server_mgr_do_action(int pid, int type, const char* action) return VCD_ERROR_INVALID_STATE; } - /* Reqeust do action to engine */ + /* Request do action to engine */ if (VCD_SEND_EVENT_TYPE_TEXT == type) ret = vcd_engine_process_text(pid, action); else if (VCD_SEND_EVENT_TYPE_LIST_EVENT == type) @@ -2448,7 +2448,7 @@ int vcd_server_request_start(int pid, bool stop_by_silence) { /* check if pid is valid */ if (false == vcd_client_is_available(pid)) { - SLOG(LOG_ERROR, TAG_VCD, "[Server ERROR] pid(%d) is NOT forground client", pid); + SLOG(LOG_ERROR, TAG_VCD, "[Server ERROR] pid(%d) is NOT foreground client", pid); return VCD_ERROR_INVALID_PARAMETER; } @@ -2570,7 +2570,7 @@ static void __vcd_server_widget_start_recording(void *data) SLOG(LOG_ERROR, TAG_VCD, "[Server INFO] start recording"); if (0 != __start_internal_recognition()) { - SLOG(LOG_ERROR, TAG_VCD, "[Server ERROR] Fail to start recongition"); + SLOG(LOG_ERROR, TAG_VCD, "[Server ERROR] Fail to start recognition"); } } @@ -2627,10 +2627,10 @@ int vcd_server_widget_start_recording(int pid, bool widget_command) SLOG(LOG_WARN, TAG_VCD, "[Server] widget command is NOT available"); } - SLOG(LOG_ERROR, TAG_VCD, "[Server] start internal recongition : %d", widget_command); + SLOG(LOG_ERROR, TAG_VCD, "[Server] start internal recognition : %d", widget_command); int ret = __start_internal_recognition(); if (0 != ret) { - SLOG(LOG_ERROR, TAG_VCD, "[Server ERROR] Fail to start recongition : %d", ret); + SLOG(LOG_ERROR, TAG_VCD, "[Server ERROR] Fail to start recognition : %d", ret); ecore_timer_add(0, __vcd_request_show_tooltip, (void*)false); } -- 2.7.4 From 3d4dc546f537fc68cc57d2fc18b5627904455f8e Mon Sep 17 00:00:00 2001 From: "sooyeon.kim" Date: Fri, 13 Jul 2018 14:53:33 +0900 Subject: [PATCH 16/16] Add a program to get vc engine app id Change-Id: Ib2a0c901a9034e9fe1c942749ca69500cc9512ab Signed-off-by: sooyeon.kim (cherry picked from commit b5bfc019092b25ed8845ae5b97d8b9d2962c2da5) --- CMakeLists.txt | 16 ++++++++++++++++ bin/aarch64/vc_getengine | Bin 0 -> 12464 bytes bin/armv7l/vc_getengine | Bin 0 -> 8776 bytes bin/i586/vc_getengine | Bin 0 -> 13852 bytes bin/x86_64/vc_getengine | Bin 0 -> 14672 bytes org.tizen.voice.vcserver.service | 3 ++- packaging/voice-control.spec | 11 ++++++----- 7 files changed, 24 insertions(+), 6 deletions(-) create mode 100755 bin/aarch64/vc_getengine create mode 100755 bin/armv7l/vc_getengine create mode 100755 bin/i586/vc_getengine create mode 100755 bin/x86_64/vc_getengine diff --git a/CMakeLists.txt b/CMakeLists.txt index 8819be3..22994bb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,6 +28,9 @@ SET(PREFIX ${CMAKE_INSTALL_PREFIX}) SET(EXEC_PREFIX "${PREFIX}") SET(VERSION 0.2.10) +FIND_PROGRAM(UNAME NAMES uname) +EXEC_PROGRAM("${UNAME}" ARGS "-m" OUTPUT_VARIABLE "ARCH") + ADD_DEFINITIONS("-DVOICE_LIBDIR=\"${LIBDIR}\"") ADD_DEFINITIONS("-Werror") @@ -71,3 +74,16 @@ INSTALL(FILES ${CMAKE_SOURCE_DIR}/vc-config.xml DESTINATION ${TZ_SYS_RO_SHARE}/v INSTALL(FILES ${CMAKE_SOURCE_DIR}/org.tizen.voice.vcserver.service DESTINATION ${TZ_SYS_RO_SHARE}/dbus-1/services) INSTALL(FILES ${CMAKE_SOURCE_DIR}/vc-server.conf DESTINATION /etc/dbus-1/session.d) + +## vc_getengine ## +IF("${ARCH}" MATCHES "^arm.*") +INSTALL(PROGRAMS ${CMAKE_SOURCE_DIR}/bin/armv7l/vc_getengine DESTINATION ${TZ_SYS_BIN}) +ELSEIF("${ARCH}" MATCHES "^i586.*") +INSTALL(PROGRAMS ${CMAKE_SOURCE_DIR}/bin/i586/vc_getengine DESTINATION ${TZ_SYS_BIN}) +ELSEIF("${ARCH}" MATCHES "^i686.*") +INSTALL(PROGRAMS ${CMAKE_SOURCE_DIR}/bin/i586/vc_getengine DESTINATION ${TZ_SYS_BIN}) +ELSEIF("${ARCH}" MATCHES "^aarch64.*") +INSTALL(PROGRAMS ${CMAKE_SOURCE_DIR}/bin/aarch64/vc_getengine DESTINATION ${TZ_SYS_BIN}) +ELSEIF("${ARCH}" MATCHES "^x86_64.*") +INSTALL(PROGRAMS ${CMAKE_SOURCE_DIR}/bin/x86_64/vc_getengine DESTINATION ${TZ_SYS_BIN}) +ENDIF() diff --git a/bin/aarch64/vc_getengine b/bin/aarch64/vc_getengine new file mode 100755 index 0000000000000000000000000000000000000000..126ccd9184615bc3e1151e8c3dee309863fab7be GIT binary patch literal 12464 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 KC!(D@*8c*lbA@sM literal 0 HcmV?d00001 diff --git a/bin/armv7l/vc_getengine b/bin/armv7l/vc_getengine new file mode 100755 index 0000000000000000000000000000000000000000..570f0cdce3dde6d7291e933066c130cabbb9f13c GIT binary patch literal 8776 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 literal 0 HcmV?d00001 diff --git a/bin/i586/vc_getengine b/bin/i586/vc_getengine new file mode 100755 index 0000000000000000000000000000000000000000..35926fa4652c4da0d9dfecd7be1ab87b8cbede7d GIT binary patch literal 13852 zcmeHOeUMbumA^AI(84f1;w+AlgjO3tg`OEi3qR8X%>ZU3qYTI{VAFKJp6=LmPj$Z@ zLC4)0-we=p9+`@oq-u3TLdr5#CN))LU1HR283ezoGP0M~U7*US%kpI_SL3PLL7Q#>bsGVU9n0_j{tNeH z-h6iQ){Z%crd{#*cJtnA{x}<-$w9KbXMaIws(2jfgTlL6lVP>1O0xki}0Wj7~9>4`MC&Ua3SE6Sz(A-dD8>Wl;FVsyx zuB&JqY0d{bxsiDd`dfU8<3>%LDl4CqU(JDRCHBSE3Yz7=0^RRZ0u9u!s_*wG_p@P0 z(-EDAs`S@a(ci0}FNRL2f@XcMfVTZ*eV0^~N2=<-tBQ`$5i7ZYGd2NC`;%dBJ^W?- z&&4R-UZsCuRecXvmH!FlBN)`0v{x_kpm+E{AT?mLUtOjD257EhOzgi8K(DQ+|6|bo z7|2&(z_WZ$Reir@5eR)O#0ue?ESi`e6)ggBVU3& z9|rGiVA_AJqMY_#s|V~K#4&{HujEdndLZVrUCl-3sqSo<|XlD zLhA}{ifd;WL@~)*j8~hEiHk*OW$?7f+&LmaT4B=?%s+S|GhO5wf|e z29_m)o6EAv9xZ{uhU3ZZKu;=`&~0&LK*rrN%e+-98bJ-!)gVI5U5zgNE_x@7PR^te z{(!O=3523|h@Om¨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 literal 0 HcmV?d00001 diff --git a/bin/x86_64/vc_getengine b/bin/x86_64/vc_getengine new file mode 100755 index 0000000000000000000000000000000000000000..5adce35a2b05e6e52f71e001d400435eb8ccea96 GIT binary patch literal 14672 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 HzODZO1joxV literal 0 HcmV?d00001 diff --git a/org.tizen.voice.vcserver.service b/org.tizen.voice.vcserver.service index c5006a2..aa51fd1 100644 --- a/org.tizen.voice.vcserver.service +++ b/org.tizen.voice.vcserver.service @@ -1,4 +1,5 @@ [D-BUS Service] Name=org.tizen.voice.vcserver #Exec=/usr/bin/vc-daemon -Exec=/bin/sh -c "launch_app org.tizen.vc-engine-default" +#Exec=/bin/sh -c "launch_app org.tizen.vc-engine-default" +Exec=/bin/sh -c "vc_getengine get system db/voice/vc/engine/default | awk '{print$5}' | xargs -t -i launch_app {}" diff --git a/packaging/voice-control.spec b/packaging/voice-control.spec index 6d0cc6d..908a6b2 100644 --- a/packaging/voice-control.spec +++ b/packaging/voice-control.spec @@ -9,7 +9,7 @@ Source1001: %{name}.manifest Source1002: %{name}-devel.manifest Requires(post): /sbin/ldconfig Requires(postun): /sbin/ldconfig - +Requires: gawk BuildRequires: pkgconfig(aul) BuildRequires: pkgconfig(capi-appfw-app-control) BuildRequires: pkgconfig(capi-appfw-app-manager) @@ -96,11 +96,11 @@ cp %{SOURCE1001} %{SOURCE1002} . %build %if "%{tizen_profile_name}" == "tv" export CFLAGS="$CFLAGS -DTV_PRODUCT" -cmake . -DCMAKE_INSTALL_PREFIX=/usr -DLIBDIR=%{_libdir} -DINCLUDEDIR=%{_includedir} \ - -DTZ_SYS_RO_SHARE=%TZ_SYS_RO_SHARE -D_TV_PRODUCT=TRUE +cmake . -DCMAKE_INSTALL_PREFIX=/usr -DLIBDIR=%{_libdir} -DBINDIR=%{_bindir} -DINCLUDEDIR=%{_includedir} \ + -DTZ_SYS_RO_SHARE=%TZ_SYS_RO_SHARE -D_TV_PRODUCT=TRUE -DTZ_SYS_BIN=%TZ_SYS_BIN %else -cmake . -DCMAKE_INSTALL_PREFIX=/usr -DLIBDIR=%{_libdir} -DINCLUDEDIR=%{_includedir} \ - -DTZ_SYS_RO_SHARE=%TZ_SYS_RO_SHARE +cmake . -DCMAKE_INSTALL_PREFIX=/usr -DLIBDIR=%{_libdir} -DBINDIR=%{_bindir} -DINCLUDEDIR=%{_includedir} \ + -DTZ_SYS_RO_SHARE=%TZ_SYS_RO_SHARE -DTZ_SYS_BIN=%TZ_SYS_BIN %endif make %{?jobs:-j%jobs} @@ -129,6 +129,7 @@ mkdir -p %{_libdir}/voice/vc %{_libdir}/libvc_widget.so %{_libdir}/libvc_manager.so %{_libdir}/libvc_engine.so +%{_bindir}/vc_getengine %{TZ_SYS_RO_SHARE}/voice/vc/1.0/vc-config.xml %{TZ_SYS_RO_SHARE}/dbus-1/services/org.tizen.voice* %{TZ_SYS_RO_ETC}/package-manager/parserlib/metadata/libvc-engine-parser.so* -- 2.7.4