From 5ea4cb4f5953f1d15a2c55e2f46a67c17349f034 Mon Sep 17 00:00:00 2001 From: "ky85.kim" Date: Thu, 7 Apr 2016 16:49:19 +0900 Subject: [PATCH 01/16] update directory path for migration Change-Id: I40dc8958b5a80cb3bd1fceee5bb26a364670237c Signed-off-by: ky85.kim --- CMakeLists.txt | 4 ++-- common/vc_defs.h | 19 +++++++++++-------- packaging/voice-control.spec | 13 +++++++------ server/vcd_engine_agent.c | 7 +++---- server/vcd_main.h | 9 --------- 5 files changed, 23 insertions(+), 29 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1158e48..acadb9d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -54,8 +54,8 @@ ADD_SUBDIRECTORY(client) ADD_SUBDIRECTORY(server) ## config ## -INSTALL(FILES ${CMAKE_SOURCE_DIR}/vc-config.xml DESTINATION ${LIBDIR}/voice/vc/1.0) +INSTALL(FILES ${CMAKE_SOURCE_DIR}/vc-config.xml DESTINATION ${TZ_SYS_RO_SHARE}/voice/vc/1.0) -INSTALL(FILES ${CMAKE_SOURCE_DIR}/org.tizen.voice.vcserver.service DESTINATION /usr/share/dbus-1/services) +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) diff --git a/common/vc_defs.h b/common/vc_defs.h index 53e1ba6..268a2d8 100644 --- a/common/vc_defs.h +++ b/common/vc_defs.h @@ -141,21 +141,21 @@ extern "C" { * Defines for configuration *******************************************************************************************/ -#define VC_DAEMON_PATH "/usr/bin/vc-daemon" +#define VC_DAEMON_PATH tzplatform_mkpath(TZ_SYS_BIN, "vc-daemon") -#define VC_CONFIG_DEFAULT VOICE_LIBDIR"/voice/vc/1.0/vc-config.xml" +#define VC_CONFIG_DEFAULT tzplatform_mkpath(TZ_SYS_RO_SHARE, "voice/vc/vc-config.xml") -#define VC_CONFIG_BASE tzplatform_mkpath(TZ_USER_HOME, "share/.voice") -#define VC_CONFIG tzplatform_mkpath(TZ_USER_HOME, "share/.voice/vc-config.xml") +#define VC_DEFAULT_BASE tzplatform_mkpath(TZ_SYS_RO_SHARE, "voice/vc/1.0") -#define VC_DEFAULT_ENGINE_INFO VOICE_LIBDIR"/voice/vc/1.0/engine-info" +#define VC_DEFAULT_ENGINE tzplatform_mkpath(TZ_SYS_RO_SHARE, "voice/vc/1.0/engine") -#define VC_NO_FOREGROUND_PID 0 +#define VC_DEFAULT_ENGINE_SETTING tzplatform_mkpath(TZ_SYS_RO_SHARE, "voice/vc/1.0/engine-setting") -#define VC_BASE_LANGUAGE "en_US" +#define VC_DEFAULT_ENGINE_INFO tzplatform_mkpath(TZ_SYS_RO_SHARE, "voice/vc/1.0/engine-info") -#define VC_RETRY_COUNT 5 +#define VC_CONFIG_BASE tzplatform_mkpath(TZ_USER_HOME, "share/.voice") +#define VC_CONFIG tzplatform_mkpath(TZ_USER_HOME, "share/.voice/vc-config.xml") #define VC_RUNTIME_INFO_ROOT tzplatform_mkpath(TZ_USER_HOME, "share/.voice/vc") @@ -169,6 +169,9 @@ extern "C" { #define VC_RUNTIME_INFO_CLIENT tzplatform_mkpath(TZ_USER_HOME, "share/.voice/vc/vc-client-info.xml") +#define VC_NO_FOREGROUND_PID 0 +#define VC_BASE_LANGUAGE "en_US" +#define VC_RETRY_COUNT 5 #define VC_RUNTIME_INFO_NO_FOREGROUND -1 #define VC_FEATURE_PATH "tizen.org/feature/speech.control" diff --git a/packaging/voice-control.spec b/packaging/voice-control.spec index c54ffaf..cf2580a 100644 --- a/packaging/voice-control.spec +++ b/packaging/voice-control.spec @@ -84,13 +84,14 @@ export CFLAGS="$CFLAGS -DTIZEN_ENGINEER_MODE" export CXXFLAGS="$CXXFLAGS -DTIZEN_ENGINEER_MODE" export FFLAGS="$FFLAGS -DTIZEN_ENGINEER_MODE" %endif -cmake . -DCMAKE_INSTALL_PREFIX=/usr -DLIBDIR=%{_libdir} -DINCLUDEDIR=%{_includedir} +cmake . -DCMAKE_INSTALL_PREFIX=/usr -DLIBDIR=%{_libdir} -DINCLUDEDIR=%{_includedir} \ + -DTZ_SYS_RO_SHARE=%TZ_SYS_RO_SHARE make %{?jobs:-j%jobs} %install rm -rf %{buildroot} -mkdir -p %{buildroot}/usr/share/license -install LICENSE %{buildroot}/usr/share/license/%{name} +mkdir -p %{buildroot}%{TZ_SYS_RO_SHARE}/license +install LICENSE %{buildroot}%{TZ_SYS_RO_SHARE}/license/%{name} %make_install @@ -109,10 +110,10 @@ mkdir -p %{_libdir}/voice/vc %{_libdir}/libvc_widget.so %{_libdir}/libvc_manager.so %{_bindir}/vc-daemon -%{_libdir}/voice/vc/1.0/vc-config.xml -/usr/share/dbus-1/services/org.tizen.voice* +%{TZ_SYS_RO_SHARE}/voice/vc/1.0/vc-config.xml +%{TZ_SYS_RO_SHARE}/dbus-1/services/org.tizen.voice* +%{TZ_SYS_RO_SHARE}/license/%{name} /etc/dbus-1/session.d/vc-server.conf -/usr/share/license/%{name} %files devel %manifest %{name}-devel.manifest diff --git a/server/vcd_engine_agent.c b/server/vcd_engine_agent.c index 3b99ae5..cdba7fe 100644 --- a/server/vcd_engine_agent.c +++ b/server/vcd_engine_agent.c @@ -293,7 +293,6 @@ int __internal_get_engine_info(const char* filepath, vcengine_info_s** info) void* handle; handle = dlopen(filepath, RTLD_LAZY); - if (!handle) { SLOG(LOG_WARN, TAG_VCD, "[Engine Agent] Invalid engine : %s", filepath); return -1; @@ -389,7 +388,7 @@ int __internal_update_engine_list() struct dirent entry; struct dirent *dirp = NULL; - dp = opendir(ENGINE_DIRECTORY_DEFAULT); + dp = opendir(VC_DEFAULT_ENGINE); if (NULL != dp) { do { ret = readdir_r(dp, &entry, &dirp); @@ -403,11 +402,11 @@ int __internal_update_engine_list() char* filepath = NULL; int filesize = 0; - filesize = strlen(ENGINE_DIRECTORY_DEFAULT) + strlen(dirp->d_name) + 5; + filesize = strlen(VC_DEFAULT_ENGINE) + strlen(dirp->d_name) + 5; filepath = (char*)calloc(filesize, sizeof(char)); if (NULL != filepath) { - snprintf(filepath, filesize, "%s/%s", ENGINE_DIRECTORY_DEFAULT, dirp->d_name); + snprintf(filepath, filesize, "%s/%s", VC_DEFAULT_ENGINE, dirp->d_name); } else { SLOG(LOG_ERROR, TAG_VCD, "[Engine Agent ERROR] Memory not enough!!"); continue; diff --git a/server/vcd_main.h b/server/vcd_main.h index 51af598..b56650c 100644 --- a/server/vcd_main.h +++ b/server/vcd_main.h @@ -41,15 +41,6 @@ extern "C" { #define TAG_VCD "vcd" -#define BASE_DIRECTORY_DEFAULT "/usr/lib/voice/vc/1.0" -#define ENGINE_DIRECTORY_DEFAULT "/usr/lib/voice/vc/1.0/engine" -#define ENGINE_DIRECTORY_DEFAULT_SETTING "/usr/lib/voice/vc/setting" - -#define CONFIG_DIRECTORY "/opt/home/app/.voice" - -#define ENGINE_DIRECTORY_DOWNLOAD "/opt/usr/voice/vc/engine" -#define ENGINE_DIRECTORY_DOWNLOAD_SETTING "/opt/usr/voice/vc/setting" - /* for debug message */ /* #define RECORDER_DEBUG */ #define CLIENT_DATA_DEBUG -- 2.7.4 From 0349c3b69b9d72e451f997a6bbd4b9b836f96285 Mon Sep 17 00:00:00 2001 From: "sooyeon.kim" Date: Mon, 18 Apr 2016 09:46:38 +0900 Subject: [PATCH 02/16] check and revise by coding rule Change-Id: I5017fbb7b886a290b93ab8c30f7c146300edb9a9 Signed-off-by: sooyeon.kim --- include/voice_control_plugin_engine.h | 30 +++++++++++++++--------------- server/vcd_server.c | 6 ++---- 2 files changed, 17 insertions(+), 19 deletions(-) mode change 100644 => 100755 include/voice_control_plugin_engine.h mode change 100644 => 100755 server/vcd_server.c diff --git a/include/voice_control_plugin_engine.h b/include/voice_control_plugin_engine.h old mode 100644 new mode 100755 index 878c596..ff091d3 --- a/include/voice_control_plugin_engine.h +++ b/include/voice_control_plugin_engine.h @@ -148,7 +148,7 @@ typedef bool (*vcpe_supported_language_cb)(const char* language, void* user_data * * @see vcpe_deinitialize() */ -typedef int (* vcpe_initialize)(void); +typedef int (*vcpe_initialize)(void); /** * @brief Deinitializes the engine @@ -159,7 +159,7 @@ typedef int (* vcpe_initialize)(void); * * @see vcpe_initialize() */ -typedef void (* vcpe_deinitialize)(void); +typedef void (*vcpe_deinitialize)(void); /** * @brief Registers a callback function for getting recognition result. @@ -173,7 +173,7 @@ typedef void (* vcpe_deinitialize)(void); * * @see vcpe_result_cb() */ -typedef int (* vcpe_set_result_cb)(vcpe_result_cb callback, void* user_data); +typedef int (*vcpe_set_result_cb)(vcpe_result_cb callback, void* user_data); /** * @brief Gets recording format of the engine. @@ -187,7 +187,7 @@ typedef int (* vcpe_set_result_cb)(vcpe_result_cb callback, void* user_data); * @retval #VCP_ERROR_NONE Successful * @retval #VCP_ERROR_INVALID_PARAMETER Not initialized */ -typedef int (* vcpe_get_recording_format)(const char* audio_id, vcp_audio_type_e* types, int* rate, int* channels); +typedef int (*vcpe_get_recording_format)(const char* audio_id, vcp_audio_type_e* types, int* rate, int* channels); /** * @brief Retrieves all supported languages of the engine. @@ -204,7 +204,7 @@ typedef int (* vcpe_get_recording_format)(const char* audio_id, vcp_audio_type_e * * @see vcpe_supported_language_cb() */ -typedef int (* vcpe_foreach_supported_languages)(vcpe_supported_language_cb callback, void* user_data); +typedef int (*vcpe_foreach_supported_languages)(vcpe_supported_language_cb callback, void* user_data); /** * @brief Checks whether a language is supported or not. @@ -213,7 +213,7 @@ typedef int (* vcpe_foreach_supported_languages)(vcpe_supported_language_cb call * * @return @c true = supported, \n @c false = not supported. */ -typedef bool (* vcpe_is_language_supported)(const char* language); +typedef bool (*vcpe_is_language_supported)(const char* language); /** * @brief Sets language. @@ -247,7 +247,7 @@ typedef int (*vcpe_set_language)(const char* language); * @see vcpd_foreach_command() * @see vcpe_unset_commands() */ -typedef int (* vcpe_set_commands)(vcp_cmd_h vcp_command); +typedef int (*vcpe_set_commands)(vcp_cmd_h vcp_command); /** * @brief Unset command list for reset. @@ -260,7 +260,7 @@ typedef int (* vcpe_set_commands)(vcp_cmd_h vcp_command); * * @see vcpe_set_commands() */ -typedef int (* vcpe_unset_commands)(); +typedef int (*vcpe_unset_commands)(); /** * @brief Start recognition. @@ -279,7 +279,7 @@ typedef int (* vcpe_unset_commands)(); * @see vcpe_stop() * @see vcpe_cancel() */ -typedef int (* vcpe_start)(bool stop_by_silence); +typedef int (*vcpe_start)(bool stop_by_silence); /** * @brief Sets recording data for speech recognition from recorder. @@ -320,7 +320,7 @@ typedef int(*vcpe_set_recording_data)(const void* data, unsigned int length, vcp * @see vcpe_result_cb() * @see vcpe_cancel() */ -typedef int (* vcpe_stop)(void); +typedef int (*vcpe_stop)(void); /** * @brief Cancels the recognition process. @@ -334,7 +334,7 @@ typedef int (* vcpe_stop)(void); * @see vcpe_start() * @see vcpe_stop() */ -typedef int (* vcpe_cancel)(void); +typedef int (*vcpe_cancel)(void); /** @@ -356,7 +356,7 @@ typedef int (* vcpe_cancel)(void); * * @see vcpd_foreach_command() */ -typedef bool (* vcpd_foreach_command_cb)(int id, int type, const char* command, const char* param, int domain, void* user_data); +typedef bool (*vcpd_foreach_command_cb)(int id, int type, const char* command, const char* param, int domain, void* user_data); /** * @brief Retrieves all commands using callback function. @@ -376,7 +376,7 @@ typedef bool (* vcpd_foreach_command_cb)(int id, int type, const char* command, * @see vcpd_foreach_command_cb() * @see vcpe_set_commands() */ -typedef int (* vcpd_foreach_command)(vcp_cmd_h vcp_command, vcpd_foreach_command_cb callback, void* user_data); +typedef int (*vcpd_foreach_command)(vcp_cmd_h vcp_command, vcpd_foreach_command_cb callback, void* user_data); /** * @brief Gets command length. @@ -387,7 +387,7 @@ typedef int (* vcpd_foreach_command)(vcp_cmd_h vcp_command, vcpd_foreach_command * * @see vcpe_set_commands() */ -typedef int (* vcpd_get_command_count)(vcp_cmd_h vcp_command); +typedef int (*vcpd_get_command_count)(vcp_cmd_h vcp_command); /** * @brief Gets current audio type. @@ -399,7 +399,7 @@ typedef int (* vcpd_get_command_count)(vcp_cmd_h vcp_command); * @return the value greater than 0 on success, otherwise a negative error value * */ -typedef int (* vcpd_get_audio_type)(char** audio_type); +typedef int (*vcpd_get_audio_type)(char** audio_type); /** * @brief A structure of the engine functions. diff --git a/server/vcd_server.c b/server/vcd_server.c old mode 100644 new mode 100755 index cfb8289..345d9f3 --- a/server/vcd_server.c +++ b/server/vcd_server.c @@ -630,11 +630,9 @@ static void __vcd_cleanup_client(vcd_client_type_e type) if (VCD_CLIENT_TYPE_NORMAL == type) { ret = vcd_client_get_list(&client_list, &client_count); - } - else if (VCD_CLIENT_TYPE_WIDGET == type) { + } else if (VCD_CLIENT_TYPE_WIDGET == type) { ret = vcd_client_widget_get_list(&client_list, &client_count); - } - else if (VCD_CLIENT_TYPE_MANAGER == type) { + } else if (VCD_CLIENT_TYPE_MANAGER == type) { mgr_pid = vcd_client_manager_get_pid(); client_list = &mgr_pid; client_count = 1; -- 2.7.4 From 37087f876003c25f62339441c1e5d55d1d6525de Mon Sep 17 00:00:00 2001 From: "ky85.kim" Date: Tue, 19 Apr 2016 12:01:18 +0900 Subject: [PATCH 03/16] Fix directory path Change-Id: I48dde6ac870270cbc0d6695ae182eaa232f86aaa --- common/vc_defs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/vc_defs.h b/common/vc_defs.h index 268a2d8..3f09203 100644 --- a/common/vc_defs.h +++ b/common/vc_defs.h @@ -143,7 +143,7 @@ extern "C" { #define VC_DAEMON_PATH tzplatform_mkpath(TZ_SYS_BIN, "vc-daemon") -#define VC_CONFIG_DEFAULT tzplatform_mkpath(TZ_SYS_RO_SHARE, "voice/vc/vc-config.xml") +#define VC_CONFIG_DEFAULT tzplatform_mkpath(TZ_SYS_RO_SHARE, "voice/vc/1.0/vc-config.xml") #define VC_DEFAULT_BASE tzplatform_mkpath(TZ_SYS_RO_SHARE, "voice/vc/1.0") -- 2.7.4 From d40032323b5f09a198d88305d27601acbb3d0739 Mon Sep 17 00:00:00 2001 From: "ky85.kim" Date: Tue, 19 Apr 2016 20:07:36 +0900 Subject: [PATCH 04/16] Fix directory bug Change-Id: I11d3505d7746a29d6363791551c21e09e8d11531 --- common/vc_config_mgr.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/common/vc_config_mgr.c b/common/vc_config_mgr.c index c86ec92..71afe04 100644 --- a/common/vc_config_mgr.c +++ b/common/vc_config_mgr.c @@ -534,6 +534,23 @@ int vc_config_mgr_initialize(int uid) 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); + return -1; + } else { + SLOG(LOG_DEBUG, vc_config_tag(), "Success to make directory : %s", VC_CONFIG_BASE); + } + } + 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); + return -1; + } else { + SLOG(LOG_DEBUG, vc_config_tag(), "Success to make directory : %s", VC_RUNTIME_INFO_ROOT); + } + } + dp = opendir(VC_DEFAULT_ENGINE_INFO); if (NULL != dp) { do { @@ -1292,4 +1309,4 @@ int __vc_config_mgr_print_client_info() SLOG(LOG_DEBUG, vc_config_tag(), "--------------------------------------------"); return 0; -} \ No newline at end of file +} -- 2.7.4 From 46b86b7a315996b7cc4ae98df5f4026f0b11ddae Mon Sep 17 00:00:00 2001 From: "ky85.kim" Date: Fri, 22 Apr 2016 15:29:58 +0900 Subject: [PATCH 05/16] Apply command priority Add api for filtering command by type Change-Id: Ib21e77bf9cb681db1572f38840b438a2e34793ac --- common/vc_command.c | 86 ++++++++++++++++++++++++++++++++++ common/vc_command.h | 18 ------- include/voice_control_command_expand.h | 37 +++++++++++++++ server/vcd_server.c | 30 +++++++++++- 4 files changed, 152 insertions(+), 19 deletions(-) mode change 100755 => 100644 server/vcd_server.c diff --git a/common/vc_command.c b/common/vc_command.c index 1925731..293efdb 100644 --- a/common/vc_command.c +++ b/common/vc_command.c @@ -302,6 +302,92 @@ int vc_cmd_list_foreach_commands(vc_cmd_list_h vc_cmd_list, vc_cmd_list_cb callb return VC_ERROR_NONE; } +int vc_cmd_list_filter_by_type(vc_cmd_list_h original, int type, vc_cmd_list_h* filtered) +{ + SLOG(LOG_DEBUG, TAG_VCCMD, "===== Filter by type"); + + if (0 != __vc_cmd_get_feature_enabled()) { + return VC_ERROR_NOT_SUPPORTED; + } + + if (NULL == original) { + SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Input parameter is NULL"); + return VC_ERROR_INVALID_PARAMETER; + } + + if (VC_COMMAND_TYPE_NONE >= type || VC_COMMAND_TYPE_EXCLUSIVE < type) { + SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Invalid type"); + return VC_ERROR_INVALID_PARAMETER; + } + + vc_cmd_list_s* list = NULL; + list = (vc_cmd_list_s*)original; + + vc_cmd_list_h temp_list; + if (0 != vc_cmd_list_create(&temp_list)) { + SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Fail to list create"); + return VC_ERROR_OPERATION_FAILED; + } + + int count = g_slist_length(list->list); + int i; + + GSList *iter = NULL; + vc_cmd_s *iter_cmd; + + iter = g_slist_nth(list->list, 0); + + for (i = 0; i < count; i++) { + if (NULL != iter->data) { + iter_cmd = iter->data; + + if (NULL != iter_cmd) { + int iter_type; + if (0 != vc_cmd_get_type((vc_cmd_h)iter_cmd, &iter_type)) { + SLOG(LOG_ERROR,TAG_VCCMD, "[ERROR] Fail to get command type"); + continue; + } + + if (iter_type == type) { + vc_cmd_h temp_cmd; + if (0 != vc_cmd_create(&temp_cmd)) { + SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Fail to create cmd"); + continue; + } + + memcpy(temp_cmd, iter_cmd, sizeof(vc_cmd_s)); + if (NULL != iter_cmd->command) { + ((vc_cmd_s*)temp_cmd)->command = strdup(iter_cmd->command); + } + if (NULL != iter_cmd->parameter) { + ((vc_cmd_s*)temp_cmd)->parameter = strdup(iter_cmd->parameter); + } + + if (0 != vc_cmd_list_add(temp_list, temp_cmd)) { + SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Fail to cmd list add"); + vc_cmd_destroy(temp_cmd); + continue; + } + } + } + } + iter = g_slist_next(iter); + } + + count = 0; + if (0 != vc_cmd_list_get_count(temp_list, &count)) { + SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Fail to get count"); + } else { + SLOG(LOG_DEBUG, TAG_VCCMD, "Filtering result : (%d) command", count); + } + + *filtered = temp_list; + + SLOG(LOG_DEBUG, TAG_VCCMD, "====="); + + return VC_ERROR_NONE; +} + int vc_cmd_list_first(vc_cmd_list_h vc_cmd_list) { if (0 != __vc_cmd_get_feature_enabled()) { diff --git a/common/vc_command.h b/common/vc_command.h index 605edd6..5fc66d4 100644 --- a/common/vc_command.h +++ b/common/vc_command.h @@ -67,24 +67,6 @@ int vc_cmd_get_id(vc_cmd_h vc_command, int* id); int vc_cmd_print_list(vc_cmd_list_h vc_cmd_list); /** -* @brief Remove all commands from command list. -* @since_tizen 2.4 -* -* @param[in] vc_cmd_list The command list handle -* @param[in] free_command The command free option @c true = release each commands in list, -* @c false = remove command from list -* -* @return 0 on success, otherwise a negative error value -* @retval #VC_CMD_ERROR_NONE Successful -* @retval #VC_CMD_ERROR_INVALID_PARAMETER Invalid parameter -* @retval #VC_CMD_ERROR_PERMISSION_DENIED Permission denied -* @retval #VC_CMD_ERROR_NOT_SUPPORTED Not supported feature -* -* @see vc_cmd_list_add() -*/ -int vc_cmd_list_remove_all(vc_cmd_list_h vc_cmd_list, bool free_command); - -/** * @brief Sets extra unfixed command. * @since_tizen 2.4 * diff --git a/include/voice_control_command_expand.h b/include/voice_control_command_expand.h index 8200285..03179f9 100644 --- a/include/voice_control_command_expand.h +++ b/include/voice_control_command_expand.h @@ -129,6 +129,43 @@ int vc_cmd_set_domain(vc_cmd_h vc_command, int domain); */ int vc_cmd_get_domain(vc_cmd_h vc_command, int* domain); +/** +* @brief Remove all commands from command list. +* @since_tizen 2.4 +* +* @param[in] vc_cmd_list The command list handle +* @param[in] free_command The command free option @c true = release each commands in list, +* @c false = remove command from list +* +* @return 0 on success, otherwise a negative error value +* @retval #VC_CMD_ERROR_NONE Successful +* @retval #VC_CMD_ERROR_INVALID_PARAMETER Invalid parameter +* @retval #VC_CMD_ERROR_PERMISSION_DENIED Permission denied +* @retval #VC_CMD_ERROR_NOT_SUPPORTED Not supported feature +* +* @see vc_cmd_list_add() +*/ +int vc_cmd_list_remove_all(vc_cmd_list_h vc_cmd_list, bool free_command); + +/** +* @brief Retrieves all commands of command list using callback function. +* @since_tizen 3.0 +* +* @param[in] vc_cmd_list The command list handle +* @param[in] callback 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 #VC_ERROR_NONE Successful +* @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter +* @retval #VC_ERROR_PERMISSION_DENIED Permission denied +* @retval #VC_ERROR_NOT_SUPPORTED Not supported +* +* @post This function invokes vc_cmd_list_cb() repeatedly for getting commands. +* +* @see vc_cmd_list_cb() +*/ +int vc_cmd_list_filter_by_type(vc_cmd_list_h original, int type, vc_cmd_list_h* filtered); #ifdef __cplusplus } diff --git a/server/vcd_server.c b/server/vcd_server.c old mode 100755 new mode 100644 index 345d9f3..cb1dc7d --- a/server/vcd_server.c +++ b/server/vcd_server.c @@ -244,6 +244,19 @@ static Eina_Bool __vcd_send_selected_result(void *data) return EINA_FALSE; } +static int __convert_type_to_priority(vc_cmd_type_e type) +{ + switch (type) { + case VC_COMMAND_TYPE_NONE: return 0; break; + case VC_COMMAND_TYPE_BACKGROUND: return 1; break; + case VC_COMMAND_TYPE_FOREGROUND: return 2; break; + case VC_COMMAND_TYPE_WIDGET: return 2; break; + case VC_COMMAND_TYPE_SYSTEM: return 3; break; + case VC_COMMAND_TYPE_EXCLUSIVE: return 3; break; + default: return 0; break; + } +} + static void __vcd_server_result_cb(vcp_result_event_e event, int* result_id, int count, const char* all_result, const char* non_fixed_result, const char* msg, void *user_data) { @@ -330,7 +343,7 @@ static void __vcd_server_result_cb(vcp_result_event_e event, int* result_id, int vc_cmd_list_h vc_cmd_list = NULL; if (0 != vc_cmd_list_create(&vc_cmd_list)) { - SLOG(LOG_DEBUG, TAG_VCD, "[Server] Fail to create command list"); + SLOG(LOG_ERROR, TAG_VCD, "[Server] Fail to create command list"); vcd_client_manager_set_exclusive(false); vcd_config_set_service_state(VCD_STATE_READY); vcdc_send_service_state(VCD_STATE_READY); @@ -338,6 +351,7 @@ static void __vcd_server_result_cb(vcp_result_event_e event, int* result_id, int } int i = 0; + int priority = 0; for (i = 0; i < count; i++) { SLOG(LOG_DEBUG, TAG_VCD, "[Server] [%d] Result ID(%d)", i, result_id[i]); @@ -348,6 +362,20 @@ static void __vcd_server_result_cb(vcp_result_event_e event, int* result_id, int ret = vcd_client_get_cmd_from_result_id(result_id[i], &temp_cmd); if (0 == ret && NULL != temp_cmd) { + /* Add priority filter */ + int temp_priority = __convert_type_to_priority(temp_cmd->type); + if (priority > temp_priority) { + SLOG(LOG_DEBUG, TAG_VCD, "[Server] Ignore result by priority"); + continue; + } else if (priority < temp_priority) { + SLOG(LOG_DEBUG, TAG_VCD, "[Server] High priority result!!"); + priority = temp_priority; + + if (0 != vc_cmd_list_remove_all(vc_cmd_list, true)) { + SLOG(LOG_ERROR, TAG_VCD, "[Server] Fail to list remove all"); + } + } + switch (temp_cmd->format) { case VC_CMD_FORMAT_FIXED: /* Nonfixed result is NOT valid */ -- 2.7.4 From 6d253da1e3d6de6b97d7a4521b7dd9c1ca3ff5b9 Mon Sep 17 00:00:00 2001 From: "sooyeon.kim" Date: Tue, 26 Apr 2016 14:02:38 +0900 Subject: [PATCH 06/16] check and revise by coding rule Change-Id: Ia258492f0fd553f3ce0dd7d0b2705e16cd8fca11 Signed-off-by: sooyeon.kim --- client/vc.c | 40 ++++++++++++++++++++-------------------- client/vc_mgr.c | 40 ++++++++++++++++++++-------------------- client/vc_widget.c | 36 ++++++++++++++++++------------------ 3 files changed, 58 insertions(+), 58 deletions(-) mode change 100644 => 100755 client/vc.c mode change 100644 => 100755 client/vc_mgr.c mode change 100644 => 100755 client/vc_widget.c diff --git a/client/vc.c b/client/vc.c old mode 100644 new mode 100755 index 2379dfc..e3161b6 --- a/client/vc.c +++ b/client/vc.c @@ -77,17 +77,17 @@ static int __vc_get_feature_enabled() static const char* __vc_get_error_code(vc_error_e err) { switch (err) { - case VC_ERROR_NONE: return "VC_ERROR_NONE"; break; - case VC_ERROR_OUT_OF_MEMORY: return "VC_ERROR_OUT_OF_MEMORY"; break; - case VC_ERROR_IO_ERROR: return "VC_ERROR_IO_ERROR"; break; - case VC_ERROR_INVALID_PARAMETER: return "VC_ERROR_INVALID_PARAMETER"; break; - case VC_ERROR_TIMED_OUT: return "VC_ERROR_TIMED_OUT"; break; - case VC_ERROR_RECORDER_BUSY: return "VC_ERROR_RECORDER_BUSY"; break; - case VC_ERROR_INVALID_STATE: return "VC_ERROR_INVALID_STATE"; break; - case VC_ERROR_INVALID_LANGUAGE: return "VC_ERROR_INVALID_LANGUAGE"; break; - case VC_ERROR_ENGINE_NOT_FOUND: return "VC_ERROR_ENGINE_NOT_FOUND"; break; - case VC_ERROR_OPERATION_FAILED: return "VC_ERROR_OPERATION_FAILED"; break; - default: return "Invalid error code"; break; + case VC_ERROR_NONE: return "VC_ERROR_NONE"; break; + case VC_ERROR_OUT_OF_MEMORY: return "VC_ERROR_OUT_OF_MEMORY"; break; + case VC_ERROR_IO_ERROR: return "VC_ERROR_IO_ERROR"; break; + case VC_ERROR_INVALID_PARAMETER: return "VC_ERROR_INVALID_PARAMETER"; break; + case VC_ERROR_TIMED_OUT: return "VC_ERROR_TIMED_OUT"; break; + case VC_ERROR_RECORDER_BUSY: return "VC_ERROR_RECORDER_BUSY"; break; + case VC_ERROR_INVALID_STATE: return "VC_ERROR_INVALID_STATE"; break; + case VC_ERROR_INVALID_LANGUAGE: return "VC_ERROR_INVALID_LANGUAGE"; break; + case VC_ERROR_ENGINE_NOT_FOUND: return "VC_ERROR_ENGINE_NOT_FOUND"; break; + case VC_ERROR_OPERATION_FAILED: return "VC_ERROR_OPERATION_FAILED"; break; + default: return "Invalid error code"; break; } return NULL; } @@ -648,10 +648,10 @@ int vc_get_state(vc_state_e* state) *state = temp; switch (*state) { - 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"); break; + 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"); break; } SLOG(LOG_DEBUG, TAG_VCC, "====="); @@ -698,11 +698,11 @@ int vc_get_service_state(vc_service_state_e* state) *state = service_state; switch (*state) { - 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"); break; + 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"); break; } SLOG(LOG_DEBUG, TAG_VCC, "====="); diff --git a/client/vc_mgr.c b/client/vc_mgr.c old mode 100644 new mode 100755 index cdeeee5..df07965 --- a/client/vc_mgr.c +++ b/client/vc_mgr.c @@ -46,17 +46,17 @@ static Eina_Bool __vc_mgr_notify_result(void *data); static const char* __vc_mgr_get_error_code(vc_error_e err) { switch (err) { - case VC_ERROR_NONE: return "VC_ERROR_NONE"; break; - case VC_ERROR_OUT_OF_MEMORY: return "VC_ERROR_OUT_OF_MEMORY"; break; - case VC_ERROR_IO_ERROR: return "VC_ERROR_IO_ERROR"; break; - case VC_ERROR_INVALID_PARAMETER: return "VC_ERROR_INVALID_PARAMETER"; break; - case VC_ERROR_TIMED_OUT: return "VC_ERROR_TIMED_OUT"; break; - case VC_ERROR_RECORDER_BUSY: return "VC_ERROR_RECORDER_BUSY"; break; - case VC_ERROR_INVALID_STATE: return "VC_ERROR_INVALID_STATE"; break; - case VC_ERROR_INVALID_LANGUAGE: return "VC_ERROR_INVALID_LANGUAGE"; break; - case VC_ERROR_ENGINE_NOT_FOUND: return "VC_ERROR_ENGINE_NOT_FOUND"; break; - case VC_ERROR_OPERATION_FAILED: return "VC_ERROR_OPERATION_FAILED"; break; - default: return "Invalid error code"; break; + case VC_ERROR_NONE: return "VC_ERROR_NONE"; break; + case VC_ERROR_OUT_OF_MEMORY: return "VC_ERROR_OUT_OF_MEMORY"; break; + case VC_ERROR_IO_ERROR: return "VC_ERROR_IO_ERROR"; break; + case VC_ERROR_INVALID_PARAMETER: return "VC_ERROR_INVALID_PARAMETER"; break; + case VC_ERROR_TIMED_OUT: return "VC_ERROR_TIMED_OUT"; break; + case VC_ERROR_RECORDER_BUSY: return "VC_ERROR_RECORDER_BUSY"; break; + case VC_ERROR_INVALID_STATE: return "VC_ERROR_INVALID_STATE"; break; + case VC_ERROR_INVALID_LANGUAGE: return "VC_ERROR_INVALID_LANGUAGE"; break; + case VC_ERROR_ENGINE_NOT_FOUND: return "VC_ERROR_ENGINE_NOT_FOUND"; break; + case VC_ERROR_OPERATION_FAILED: return "VC_ERROR_OPERATION_FAILED"; break; + default: return "Invalid error code"; break; } return NULL; } @@ -392,10 +392,10 @@ int vc_mgr_get_state(vc_state_e* state) *state = temp; switch (*state) { - case VC_STATE_NONE: SLOG(LOG_DEBUG, TAG_VCM, "Current state is 'None'"); break; - case VC_STATE_INITIALIZED: SLOG(LOG_DEBUG, TAG_VCM, "Current state is 'Created'"); break; - case VC_STATE_READY: SLOG(LOG_DEBUG, TAG_VCM, "Current state is 'Ready'"); break; - default: SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Invalid state"); break; + case VC_STATE_NONE: SLOG(LOG_DEBUG, TAG_VCM, "Current state is 'None'"); break; + case VC_STATE_INITIALIZED: SLOG(LOG_DEBUG, TAG_VCM, "Current state is 'Created'"); break; + case VC_STATE_READY: SLOG(LOG_DEBUG, TAG_VCM, "Current state is 'Ready'"); break; + default: SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Invalid state"); break; } SLOG(LOG_DEBUG, TAG_VCM, "====="); @@ -435,11 +435,11 @@ int vc_mgr_get_service_state(vc_service_state_e* state) *state = service_state; switch (*state) { - case VC_SERVICE_STATE_NONE: SLOG(LOG_DEBUG, TAG_VCM, "Current service state is 'None'"); break; - case VC_SERVICE_STATE_READY: SLOG(LOG_DEBUG, TAG_VCM, "Current service state is 'Ready'"); break; - case VC_SERVICE_STATE_RECORDING: SLOG(LOG_DEBUG, TAG_VCM, "Current service state is 'Recording'"); break; - case VC_SERVICE_STATE_PROCESSING: SLOG(LOG_DEBUG, TAG_VCM, "Current service state is 'Processing'"); break; - default: SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Invalid state"); break; + case VC_SERVICE_STATE_NONE: SLOG(LOG_DEBUG, TAG_VCM, "Current service state is 'None'"); break; + case VC_SERVICE_STATE_READY: SLOG(LOG_DEBUG, TAG_VCM, "Current service state is 'Ready'"); break; + case VC_SERVICE_STATE_RECORDING: SLOG(LOG_DEBUG, TAG_VCM, "Current service state is 'Recording'"); break; + case VC_SERVICE_STATE_PROCESSING: SLOG(LOG_DEBUG, TAG_VCM, "Current service state is 'Processing'"); break; + default: SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Invalid state"); break; } SLOG(LOG_DEBUG, TAG_VCM, "====="); diff --git a/client/vc_widget.c b/client/vc_widget.c old mode 100644 new mode 100755 index 98ecd1e..7002bda --- a/client/vc_widget.c +++ b/client/vc_widget.c @@ -46,15 +46,15 @@ const char* vc_tag() static const char* __vc_widget_get_error_code(vc_error_e err) { switch (err) { - case VC_ERROR_NONE: return "VC_ERROR_NONE"; break; - case VC_ERROR_OUT_OF_MEMORY: return "VC_ERROR_OUT_OF_MEMORY"; break; - case VC_ERROR_IO_ERROR: return "VC_ERROR_IO_ERROR"; break; - case VC_ERROR_INVALID_PARAMETER:return "VC_ERROR_INVALID_PARAMETER"; break; - case VC_ERROR_TIMED_OUT: return "VC_ERROR_TIMED_OUT"; break; - case VC_ERROR_INVALID_STATE: return "VC_ERROR_INVALID_STATE"; break; - case VC_ERROR_ENGINE_NOT_FOUND: return "VC_ERROR_ENGINE_NOT_FOUND"; break; - case VC_ERROR_OPERATION_FAILED: return "VC_ERROR_OPERATION_FAILED"; break; - default: return "Invalid error code"; break; + case VC_ERROR_NONE: return "VC_ERROR_NONE"; break; + case VC_ERROR_OUT_OF_MEMORY: return "VC_ERROR_OUT_OF_MEMORY"; break; + case VC_ERROR_IO_ERROR: return "VC_ERROR_IO_ERROR"; break; + case VC_ERROR_INVALID_PARAMETER:return "VC_ERROR_INVALID_PARAMETER"; break; + case VC_ERROR_TIMED_OUT: return "VC_ERROR_TIMED_OUT"; break; + case VC_ERROR_INVALID_STATE: return "VC_ERROR_INVALID_STATE"; break; + case VC_ERROR_ENGINE_NOT_FOUND: return "VC_ERROR_ENGINE_NOT_FOUND"; break; + case VC_ERROR_OPERATION_FAILED: return "VC_ERROR_OPERATION_FAILED"; break; + default: return "Invalid error code"; break; } return NULL; } @@ -396,10 +396,10 @@ int vc_widget_get_state(vc_state_e* state) *state = temp; switch (*state) { - case VC_STATE_NONE: SLOG(LOG_DEBUG, TAG_VCW, "Current state is 'None'"); break; - case VC_STATE_INITIALIZED: SLOG(LOG_DEBUG, TAG_VCW, "Current state is 'Created'"); break; - case VC_STATE_READY: SLOG(LOG_DEBUG, TAG_VCW, "Current state is 'Ready'"); break; - default: SLOG(LOG_ERROR, TAG_VCW, "Invalid state"); break; + case VC_STATE_NONE: SLOG(LOG_DEBUG, TAG_VCW, "Current state is 'None'"); break; + case VC_STATE_INITIALIZED: SLOG(LOG_DEBUG, TAG_VCW, "Current state is 'Created'"); break; + case VC_STATE_READY: SLOG(LOG_DEBUG, TAG_VCW, "Current state is 'Ready'"); break; + default: SLOG(LOG_ERROR, TAG_VCW, "Invalid state"); break; } SLOG(LOG_DEBUG, TAG_VCW, "====="); @@ -442,11 +442,11 @@ int vc_widget_get_service_state(vc_service_state_e* state) *state = service_state; switch (*state) { - case VC_SERVICE_STATE_NONE: SLOG(LOG_DEBUG, TAG_VCW, "Current service state is 'None'"); break; - case VC_SERVICE_STATE_READY: SLOG(LOG_DEBUG, TAG_VCW, "Current service state is 'Ready'"); break; - case VC_SERVICE_STATE_RECORDING: SLOG(LOG_DEBUG, TAG_VCW, "Current service state is 'Recording'"); break; - case VC_SERVICE_STATE_PROCESSING: SLOG(LOG_DEBUG, TAG_VCW, "Current service state is 'Processing'"); break; - default: SLOG(LOG_ERROR, TAG_VCW, "Invalid service state"); break; + case VC_SERVICE_STATE_NONE: SLOG(LOG_DEBUG, TAG_VCW, "Current service state is 'None'"); break; + case VC_SERVICE_STATE_READY: SLOG(LOG_DEBUG, TAG_VCW, "Current service state is 'Ready'"); break; + case VC_SERVICE_STATE_RECORDING: SLOG(LOG_DEBUG, TAG_VCW, "Current service state is 'Recording'"); break; + case VC_SERVICE_STATE_PROCESSING: SLOG(LOG_DEBUG, TAG_VCW, "Current service state is 'Processing'"); break; + default: SLOG(LOG_ERROR, TAG_VCW, "Invalid service state"); break; } SLOG(LOG_DEBUG, TAG_VCW, "====="); -- 2.7.4 From 763f067da86e7f010df9d2f86367a95468c597c7 Mon Sep 17 00:00:00 2001 From: "sooyeon.kim" Date: Tue, 3 May 2016 13:41:04 +0900 Subject: [PATCH 07/16] change Tizen version for wearable Change-Id: I712947c1e207d8414b270570f44536008a5817ee Signed-off-by: sooyeon.kim --- client/vc.c | 2 +- common/vc_command.h | 10 ++++---- include/voice_control.h | 44 +++++++++++++++++----------------- include/voice_control_command.h | 40 +++++++++++++++---------------- include/voice_control_command_expand.h | 12 +++++----- include/voice_control_common.h | 20 ++++++++-------- include/voice_control_manager.h | 10 ++++---- include/voice_control_setting.h | 4 ++-- include/voice_control_widget.h | 2 +- 9 files changed, 72 insertions(+), 72 deletions(-) mode change 100644 => 100755 common/vc_command.h mode change 100644 => 100755 include/voice_control.h mode change 100644 => 100755 include/voice_control_command.h mode change 100644 => 100755 include/voice_control_command_expand.h mode change 100644 => 100755 include/voice_control_common.h mode change 100644 => 100755 include/voice_control_manager.h mode change 100644 => 100755 include/voice_control_setting.h mode change 100644 => 100755 include/voice_control_widget.h diff --git a/client/vc.c b/client/vc.c index e3161b6..1ee1350 100755 --- a/client/vc.c +++ b/client/vc.c @@ -806,7 +806,7 @@ int vc_get_window_id(int* wid) /** * @brief Checks whether the command format is supported. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * * @param[in] format The command format * @param[out] support The result status @c true = supported, @c false = not supported diff --git a/common/vc_command.h b/common/vc_command.h old mode 100644 new mode 100755 index 605edd6..b99e140 --- a/common/vc_command.h +++ b/common/vc_command.h @@ -48,7 +48,7 @@ typedef struct { /** * @brief Enumerations of command type. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif */ typedef enum { VC_COMMAND_TYPE_NONE = 0, /**< No command position */ @@ -68,7 +68,7 @@ int vc_cmd_print_list(vc_cmd_list_h vc_cmd_list); /** * @brief Remove all commands from command list. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * * @param[in] vc_cmd_list The command list handle * @param[in] free_command The command free option @c true = release each commands in list, @@ -86,7 +86,7 @@ int vc_cmd_list_remove_all(vc_cmd_list_h vc_cmd_list, bool free_command); /** * @brief Sets extra unfixed command. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * * @param[in] vc_command The command handle * @param[in] command The unfixed command @@ -103,7 +103,7 @@ int vc_cmd_set_unfixed_command(vc_cmd_h vc_command, const char* command); /** * @brief Sets pid. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * * @param[in] vc_command The command handle * @param[in] pid process id @@ -118,7 +118,7 @@ int vc_cmd_set_pid(vc_cmd_h vc_command, int pid); /** * @brief Sets command domain -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * * @param[in] vc_command The command handle * @param[in] domain domain diff --git a/include/voice_control.h b/include/voice_control.h old mode 100644 new mode 100755 index 8e7b5f3..8bf4d15 --- a/include/voice_control.h +++ b/include/voice_control.h @@ -48,20 +48,20 @@ extern "C" /** * @brief Definitions for foreground command type. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif */ #define VC_COMMAND_TYPE_FOREGROUND 1 /** * @brief Definitions for background command type. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif */ #define VC_COMMAND_TYPE_BACKGROUND 2 /** * @brief Initializes voice control. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * @privlevel public * @privilege %http://tizen.org/privilege/recorder * @@ -82,7 +82,7 @@ int vc_initialize(void); /** * @brief Deinitializes voice control. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * @privlevel public * @privilege %http://tizen.org/privilege/recorder * @@ -99,7 +99,7 @@ int vc_deinitialize(void); /** * @brief Connects the voice control service. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * @privlevel public * @privilege %http://tizen.org/privilege/recorder * @@ -119,7 +119,7 @@ int vc_prepare(void); /** * @brief Disconnects the voice control service. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * @privlevel public * @privilege %http://tizen.org/privilege/recorder * @@ -138,7 +138,7 @@ int vc_unprepare(void); /** * @brief Retrieves all supported languages using callback function. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * @privlevel public * @privilege %http://tizen.org/privilege/recorder * @@ -163,7 +163,7 @@ int vc_foreach_supported_languages(vc_supported_language_cb callback, void* user /** * @brief Gets current language. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * @privlevel public * @privilege %http://tizen.org/privilege/recorder * @@ -190,7 +190,7 @@ int vc_get_current_language(char** language); /** * @brief Gets current state of voice control client. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * @privlevel public * @privilege %http://tizen.org/privilege/recorder * @@ -209,7 +209,7 @@ int vc_get_state(vc_state_e* state); /** * @brief Gets current state of voice control service. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * @privlevel public * @privilege %http://tizen.org/privilege/recorder * @@ -233,7 +233,7 @@ int vc_get_service_state(vc_service_state_e* state); /** * @brief Sets command list. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * @privlevel public * @privilege %http://tizen.org/privilege/recorder * @@ -258,7 +258,7 @@ int vc_set_command_list(vc_cmd_list_h vc_cmd_list, int type); /** * @brief Unsets command list. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * @privlevel public * @privilege %http://tizen.org/privilege/recorder * @@ -280,7 +280,7 @@ int vc_unset_command_list(int type); /** * @brief Registers a callback function for getting recognition result. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * @privlevel public * @privilege %http://tizen.org/privilege/recorder * @@ -303,7 +303,7 @@ int vc_set_result_cb(vc_result_cb callback, void* user_data); /** * @brief Unregisters the callback function. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * @privlevel public * @privilege %http://tizen.org/privilege/recorder * @@ -320,7 +320,7 @@ int vc_unset_result_cb(void); /** * @brief Registers a callback function to be called when state is changed. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * @privlevel public * @privilege %http://tizen.org/privilege/recorder * @@ -343,7 +343,7 @@ int vc_set_service_state_changed_cb(vc_service_state_changed_cb callback, void* /** * @brief Unregisters the callback function. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * @privlevel public * @privilege %http://tizen.org/privilege/recorder * @@ -361,7 +361,7 @@ int vc_unset_service_state_changed_cb(void); /** * @brief Registers a callback function to be called when state is changed. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * @privlevel public * @privilege %http://tizen.org/privilege/recorder * @@ -384,7 +384,7 @@ int vc_set_state_changed_cb(vc_state_changed_cb callback, void* user_data); /** * @brief Unregisters the callback function. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * @privlevel public * @privilege %http://tizen.org/privilege/recorder * @@ -402,7 +402,7 @@ int vc_unset_state_changed_cb(void); /** * @brief Registers a callback function to be called when current language is changed. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * @privlevel public * @privilege %http://tizen.org/privilege/recorder * @@ -425,7 +425,7 @@ int vc_set_current_language_changed_cb(vc_current_language_changed_cb callback, /** * @brief Unregisters the callback function. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * @privlevel public * @privilege %http://tizen.org/privilege/recorder * @@ -443,7 +443,7 @@ int vc_unset_current_language_changed_cb(void); /** * @brief Registers a callback function to be called when an error occurred. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * @privlevel public * @privilege %http://tizen.org/privilege/recorder * @@ -466,7 +466,7 @@ int vc_set_error_cb(vc_error_cb callback, void* user_data); /** * @brief Unregisters the callback function. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * @privlevel public * @privilege %http://tizen.org/privilege/recorder * diff --git a/include/voice_control_command.h b/include/voice_control_command.h old mode 100644 new mode 100755 index afb7810..82a7849 --- a/include/voice_control_command.h +++ b/include/voice_control_command.h @@ -37,19 +37,19 @@ extern "C" /** * @brief The voice command handle. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif */ typedef struct vc_cmd_s* vc_cmd_h; /** * @brief The voice command list handle. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif */ typedef struct vc_cmd_list_s* vc_cmd_list_h; /** * @brief Called to retrieve The commands in list. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * * @param[in] vc_command The command handle * @param[in] user_data The user data passed from the foreach function @@ -64,7 +64,7 @@ typedef bool (*vc_cmd_list_cb)(vc_cmd_h vc_command, void* user_data); /** * @brief Creates a handle for command list. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * * @remarks If the function succeeds, @a The list handle must be released with vc_cmd_list_destroy(). * @@ -83,7 +83,7 @@ int vc_cmd_list_create(vc_cmd_list_h* vc_cmd_list); /** * @brief Destroys the handle for command list. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * * @param[in] vc_cmd_list The command list handle * @param[in] free_command The command free option @c true = release each commands in list, @@ -101,7 +101,7 @@ int vc_cmd_list_destroy(vc_cmd_list_h vc_cmd_list, bool free_command); /** * @brief Gets command count of list. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * * @param[in] vc_cmd_list The command list handle * @param[out] count The count @@ -116,7 +116,7 @@ int vc_cmd_list_get_count(vc_cmd_list_h vc_cmd_list, int* count); /** * @brief Adds command to command list. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * * @param[in] vc_cmd_list The command list handle * @param[in] vc_command The command handle @@ -133,7 +133,7 @@ int vc_cmd_list_add(vc_cmd_list_h vc_cmd_list, vc_cmd_h vc_command); /** * @brief Removes command from command list. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * * @param[in] vc_cmd_list The command list handle * @param[in] vc_command The command handle @@ -150,7 +150,7 @@ int vc_cmd_list_remove(vc_cmd_list_h vc_cmd_list, vc_cmd_h vc_command); /** * @brief Retrieves all commands of command list using callback function. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * * @param[in] vc_cmd_list The command list handle * @param[in] callback Callback function to invoke @@ -170,7 +170,7 @@ int vc_cmd_list_foreach_commands(vc_cmd_list_h vc_cmd_list, vc_cmd_list_cb callb /** * @brief Moves index to first command. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * * @param[in] vc_cmd_list The command list handle * @@ -187,7 +187,7 @@ int vc_cmd_list_first(vc_cmd_list_h vc_cmd_list); /** * @brief Moves index to last command. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * * @param[in] vc_cmd_list The command list handle * @@ -204,7 +204,7 @@ int vc_cmd_list_last(vc_cmd_list_h vc_cmd_list); /** * @brief Moves index to next command. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * * @param[in] vc_cmd_list The command list handle * @@ -222,7 +222,7 @@ int vc_cmd_list_next(vc_cmd_list_h vc_cmd_list); /** * @brief Moves index to previous command. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * * @param[in] vc_cmd_list The command list handle * @@ -240,7 +240,7 @@ int vc_cmd_list_prev(vc_cmd_list_h vc_cmd_list); /** * @brief Get current command from command list by index. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * * @param[in] vc_cmd_list The command list handle * @param[out] vc_command The command handle @@ -262,7 +262,7 @@ int vc_cmd_list_get_current(vc_cmd_list_h vc_cmd_list, vc_cmd_h* vc_command); /** * @brief Creates a handle for command. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * * @remarks If the function succeeds, @a The command handle must be released * with vc_cmd_destroy() or vc_cmd_list_destroy(). @@ -283,7 +283,7 @@ int vc_cmd_create(vc_cmd_h* vc_command); /** * @brief Destroys the handle. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * * @param[in] vc_command The command handle * @@ -299,7 +299,7 @@ int vc_cmd_destroy(vc_cmd_h vc_command); /** * @brief Sets command. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * * @param[in] vc_command The command handle * @param[in] command The command text @@ -316,7 +316,7 @@ int vc_cmd_set_command(vc_cmd_h vc_command, const char* command); /** * @brief Gets command. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * * @remark If the function succeeds, @a command must be released with free() by you if they are not NULL. * @@ -335,7 +335,7 @@ int vc_cmd_get_command(vc_cmd_h vc_command, char** command); /** * @brief Sets command type. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * * @remark If you do not set the command type, the default value is -1. * You should set type if command is valid @@ -355,7 +355,7 @@ int vc_cmd_set_type(vc_cmd_h vc_command, int type); /** * @brief Gets command type. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * * @param[in] vc_command The command handle * @param[out] type The command type diff --git a/include/voice_control_command_expand.h b/include/voice_control_command_expand.h old mode 100644 new mode 100755 index 8200285..f767d83 --- a/include/voice_control_command_expand.h +++ b/include/voice_control_command_expand.h @@ -30,7 +30,7 @@ extern "C" /** * @brief Enumerations of command format. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif */ typedef enum { VC_CMD_FORMAT_FIXED = 0, /**< fixed command only */ @@ -42,7 +42,7 @@ typedef enum { /** * @brief Gets extra unfixed command. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * * @remark If the function succeeds, @a The command must be released with free() by you if they are not NULL. * If you get the result command list in result callback and the command type of commands has non-fixed format, @@ -61,7 +61,7 @@ int vc_cmd_get_unfixed_command(vc_cmd_h vc_command, char** command); /** * @brief Sets command format. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * * @param[in] vc_command The command handle * @param[in] format The command format @@ -78,7 +78,7 @@ int vc_cmd_set_format(vc_cmd_h vc_command, vc_cmd_format_e format); /** * @brief Gets command format. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * * @remark If you do not set the format, the default format is #VC_CMD_FORMAT_FIXED. * @@ -97,7 +97,7 @@ int vc_cmd_get_format(vc_cmd_h vc_command, vc_cmd_format_e* format); /** * @brief Sets command domain -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * * @param[in] vc_command The command handle * @param[in] domain The domain @@ -114,7 +114,7 @@ int vc_cmd_set_domain(vc_cmd_h vc_command, int domain); /** * @brief Gets command domain. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * * @param[in] vc_command The command handle * @param[out] domain The domain diff --git a/include/voice_control_common.h b/include/voice_control_common.h old mode 100644 new mode 100755 index 5d52a04..5724437 --- a/include/voice_control_common.h +++ b/include/voice_control_common.h @@ -32,7 +32,7 @@ extern "C" /** * @brief Enumerations of error codes. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif */ typedef enum { VC_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */ @@ -54,7 +54,7 @@ typedef enum { /** * @brief Enumerations of result event. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif */ typedef enum { VC_RESULT_EVENT_RESULT_SUCCESS = 0, /**< Normal result */ @@ -63,7 +63,7 @@ typedef enum { /** * @brief Enumerations of service state. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif */ typedef enum { VC_SERVICE_STATE_NONE = 0, /**< 'None' state */ @@ -74,7 +74,7 @@ typedef enum { /** * @brief Enumerations of client state. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif */ typedef enum { VC_STATE_NONE = 0, /**< 'None' state */ @@ -85,7 +85,7 @@ typedef enum { /** * @brief Called when client gets the recognition result. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * * @remarks If the duplicated commands are recognized, the event(e.g. #VC_RESULT_EVENT_REJECTED) of command may be rejected \n * for selecting command as priority. If you set similar or same commands or the recognized results are multi-results, @@ -104,7 +104,7 @@ typedef void (*vc_result_cb)(vc_result_event_e event, vc_cmd_list_h vc_cmd_list, /** * @brief Called when default language is changed. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * * @param[in] previous Previous language * @param[in] current Current language @@ -118,7 +118,7 @@ typedef void (*vc_current_language_changed_cb)(const char* previous, const char* /** * @brief Called to retrieve supported language. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * * @param[in] language A language is specified as an ISO 3166 alpha-2 two letter country-code \n * followed by ISO 639-1 for the two-letter language code. \n @@ -133,7 +133,7 @@ typedef bool (*vc_supported_language_cb)(const char* language, void* user_data); /** * @brief Called when the state of voice control client is changed. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * * @param[in] previous A previous state * @param[in] current A current state @@ -147,7 +147,7 @@ typedef void (*vc_state_changed_cb)(vc_state_e previous, vc_state_e current, voi /** * @brief Called when the state of voice control service is changed. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * * @param[in] previous A previous state * @param[in] current A current state @@ -161,7 +161,7 @@ typedef void (*vc_service_state_changed_cb)(vc_service_state_e previous, vc_serv /** * @brief Called when error occurred. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * * @param[in] reason The error type (e.g. #VC_ERROR_OUT_OF_MEMORY, #VC_ERROR_TIMED_OUT) * @param[in] user_data The user data passed from the callback registration function diff --git a/include/voice_control_manager.h b/include/voice_control_manager.h old mode 100644 new mode 100755 index e1c96fa..80476c6 --- a/include/voice_control_manager.h +++ b/include/voice_control_manager.h @@ -40,31 +40,31 @@ extern "C" /** * @brief Definitions for foreground command type. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif */ #define VC_COMMAND_TYPE_FOREGROUND 1 /** * @brief Definitions for background command type. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif */ #define VC_COMMAND_TYPE_BACKGROUND 2 /** * @brief Definitions for widget command type. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif */ #define VC_COMMAND_TYPE_WIDGET 3 /** * @brief Definitions for system command type. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif */ #define VC_COMMAND_TYPE_SYSTEM 4 /** * @brief Definitions for exclusive command type. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif */ #define VC_COMMAND_TYPE_EXCLUSIVE 5 diff --git a/include/voice_control_setting.h b/include/voice_control_setting.h old mode 100644 new mode 100755 index b5ea1e1..29b95bd --- a/include/voice_control_setting.h +++ b/include/voice_control_setting.h @@ -49,7 +49,7 @@ typedef void (*vc_setting_enabled_changed_cb)(bool enabled, void* user_data); /** * @brief Called to retrieve supported language. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * * @param[in] language A language is specified as an ISO 3166 alpha-2 two letter country-code \n * followed by ISO 639-1 for the two-letter language code. \n @@ -64,7 +64,7 @@ typedef bool(*vc_setting_supported_language_cb)(const char* language, void* user /** * @brief Called when default language is changed. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * * @param[in] previous Previous language * @param[in] current Current language diff --git a/include/voice_control_widget.h b/include/voice_control_widget.h old mode 100644 new mode 100755 index f9ecd2c..91ddf74 --- a/include/voice_control_widget.h +++ b/include/voice_control_widget.h @@ -35,7 +35,7 @@ extern "C" /** * @brief Definitions for widget command type. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif */ #define VC_COMMAND_TYPE_WIDGET 3 -- 2.7.4 From d10579347098122df3dc75b654118b69065b1599 Mon Sep 17 00:00:00 2001 From: Wonnam Jang Date: Mon, 2 May 2016 21:59:43 -0700 Subject: [PATCH 08/16] Revert "change Tizen version for wearable" This reverts commit 763f067da86e7f010df9d2f86367a95468c597c7. Change-Id: I03e2ffddb65dacef6246c61bcd76ec777a920b80 --- client/vc.c | 2 +- common/vc_command.h | 10 ++++---- include/voice_control.h | 44 +++++++++++++++++----------------- include/voice_control_command.h | 40 +++++++++++++++---------------- include/voice_control_command_expand.h | 12 +++++----- include/voice_control_common.h | 20 ++++++++-------- include/voice_control_manager.h | 10 ++++---- include/voice_control_setting.h | 4 ++-- include/voice_control_widget.h | 2 +- 9 files changed, 72 insertions(+), 72 deletions(-) mode change 100755 => 100644 common/vc_command.h mode change 100755 => 100644 include/voice_control.h mode change 100755 => 100644 include/voice_control_command.h mode change 100755 => 100644 include/voice_control_command_expand.h mode change 100755 => 100644 include/voice_control_common.h mode change 100755 => 100644 include/voice_control_manager.h mode change 100755 => 100644 include/voice_control_setting.h mode change 100755 => 100644 include/voice_control_widget.h diff --git a/client/vc.c b/client/vc.c index 1ee1350..e3161b6 100755 --- a/client/vc.c +++ b/client/vc.c @@ -806,7 +806,7 @@ int vc_get_window_id(int* wid) /** * @brief Checks whether the command format is supported. -* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif +* @since_tizen 2.4 * * @param[in] format The command format * @param[out] support The result status @c true = supported, @c false = not supported diff --git a/common/vc_command.h b/common/vc_command.h old mode 100755 new mode 100644 index b99e140..605edd6 --- a/common/vc_command.h +++ b/common/vc_command.h @@ -48,7 +48,7 @@ typedef struct { /** * @brief Enumerations of command type. -* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif +* @since_tizen 2.4 */ typedef enum { VC_COMMAND_TYPE_NONE = 0, /**< No command position */ @@ -68,7 +68,7 @@ int vc_cmd_print_list(vc_cmd_list_h vc_cmd_list); /** * @brief Remove all commands from command list. -* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif +* @since_tizen 2.4 * * @param[in] vc_cmd_list The command list handle * @param[in] free_command The command free option @c true = release each commands in list, @@ -86,7 +86,7 @@ int vc_cmd_list_remove_all(vc_cmd_list_h vc_cmd_list, bool free_command); /** * @brief Sets extra unfixed command. -* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif +* @since_tizen 2.4 * * @param[in] vc_command The command handle * @param[in] command The unfixed command @@ -103,7 +103,7 @@ int vc_cmd_set_unfixed_command(vc_cmd_h vc_command, const char* command); /** * @brief Sets pid. -* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif +* @since_tizen 2.4 * * @param[in] vc_command The command handle * @param[in] pid process id @@ -118,7 +118,7 @@ int vc_cmd_set_pid(vc_cmd_h vc_command, int pid); /** * @brief Sets command domain -* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif +* @since_tizen 2.4 * * @param[in] vc_command The command handle * @param[in] domain domain diff --git a/include/voice_control.h b/include/voice_control.h old mode 100755 new mode 100644 index 8bf4d15..8e7b5f3 --- a/include/voice_control.h +++ b/include/voice_control.h @@ -48,20 +48,20 @@ extern "C" /** * @brief Definitions for foreground command type. -* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif +* @since_tizen 2.4 */ #define VC_COMMAND_TYPE_FOREGROUND 1 /** * @brief Definitions for background command type. -* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif +* @since_tizen 2.4 */ #define VC_COMMAND_TYPE_BACKGROUND 2 /** * @brief Initializes voice control. -* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif +* @since_tizen 2.4 * @privlevel public * @privilege %http://tizen.org/privilege/recorder * @@ -82,7 +82,7 @@ int vc_initialize(void); /** * @brief Deinitializes voice control. -* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif +* @since_tizen 2.4 * @privlevel public * @privilege %http://tizen.org/privilege/recorder * @@ -99,7 +99,7 @@ int vc_deinitialize(void); /** * @brief Connects the voice control service. -* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif +* @since_tizen 2.4 * @privlevel public * @privilege %http://tizen.org/privilege/recorder * @@ -119,7 +119,7 @@ int vc_prepare(void); /** * @brief Disconnects the voice control service. -* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif +* @since_tizen 2.4 * @privlevel public * @privilege %http://tizen.org/privilege/recorder * @@ -138,7 +138,7 @@ int vc_unprepare(void); /** * @brief Retrieves all supported languages using callback function. -* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif +* @since_tizen 2.4 * @privlevel public * @privilege %http://tizen.org/privilege/recorder * @@ -163,7 +163,7 @@ int vc_foreach_supported_languages(vc_supported_language_cb callback, void* user /** * @brief Gets current language. -* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif +* @since_tizen 2.4 * @privlevel public * @privilege %http://tizen.org/privilege/recorder * @@ -190,7 +190,7 @@ int vc_get_current_language(char** language); /** * @brief Gets current state of voice control client. -* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif +* @since_tizen 2.4 * @privlevel public * @privilege %http://tizen.org/privilege/recorder * @@ -209,7 +209,7 @@ int vc_get_state(vc_state_e* state); /** * @brief Gets current state of voice control service. -* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif +* @since_tizen 2.4 * @privlevel public * @privilege %http://tizen.org/privilege/recorder * @@ -233,7 +233,7 @@ int vc_get_service_state(vc_service_state_e* state); /** * @brief Sets command list. -* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif +* @since_tizen 2.4 * @privlevel public * @privilege %http://tizen.org/privilege/recorder * @@ -258,7 +258,7 @@ int vc_set_command_list(vc_cmd_list_h vc_cmd_list, int type); /** * @brief Unsets command list. -* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif +* @since_tizen 2.4 * @privlevel public * @privilege %http://tizen.org/privilege/recorder * @@ -280,7 +280,7 @@ int vc_unset_command_list(int type); /** * @brief Registers a callback function for getting recognition result. -* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif +* @since_tizen 2.4 * @privlevel public * @privilege %http://tizen.org/privilege/recorder * @@ -303,7 +303,7 @@ int vc_set_result_cb(vc_result_cb callback, void* user_data); /** * @brief Unregisters the callback function. -* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif +* @since_tizen 2.4 * @privlevel public * @privilege %http://tizen.org/privilege/recorder * @@ -320,7 +320,7 @@ int vc_unset_result_cb(void); /** * @brief Registers a callback function to be called when state is changed. -* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif +* @since_tizen 2.4 * @privlevel public * @privilege %http://tizen.org/privilege/recorder * @@ -343,7 +343,7 @@ int vc_set_service_state_changed_cb(vc_service_state_changed_cb callback, void* /** * @brief Unregisters the callback function. -* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif +* @since_tizen 2.4 * @privlevel public * @privilege %http://tizen.org/privilege/recorder * @@ -361,7 +361,7 @@ int vc_unset_service_state_changed_cb(void); /** * @brief Registers a callback function to be called when state is changed. -* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif +* @since_tizen 2.4 * @privlevel public * @privilege %http://tizen.org/privilege/recorder * @@ -384,7 +384,7 @@ int vc_set_state_changed_cb(vc_state_changed_cb callback, void* user_data); /** * @brief Unregisters the callback function. -* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif +* @since_tizen 2.4 * @privlevel public * @privilege %http://tizen.org/privilege/recorder * @@ -402,7 +402,7 @@ int vc_unset_state_changed_cb(void); /** * @brief Registers a callback function to be called when current language is changed. -* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif +* @since_tizen 2.4 * @privlevel public * @privilege %http://tizen.org/privilege/recorder * @@ -425,7 +425,7 @@ int vc_set_current_language_changed_cb(vc_current_language_changed_cb callback, /** * @brief Unregisters the callback function. -* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif +* @since_tizen 2.4 * @privlevel public * @privilege %http://tizen.org/privilege/recorder * @@ -443,7 +443,7 @@ int vc_unset_current_language_changed_cb(void); /** * @brief Registers a callback function to be called when an error occurred. -* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif +* @since_tizen 2.4 * @privlevel public * @privilege %http://tizen.org/privilege/recorder * @@ -466,7 +466,7 @@ int vc_set_error_cb(vc_error_cb callback, void* user_data); /** * @brief Unregisters the callback function. -* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif +* @since_tizen 2.4 * @privlevel public * @privilege %http://tizen.org/privilege/recorder * diff --git a/include/voice_control_command.h b/include/voice_control_command.h old mode 100755 new mode 100644 index 82a7849..afb7810 --- a/include/voice_control_command.h +++ b/include/voice_control_command.h @@ -37,19 +37,19 @@ extern "C" /** * @brief The voice command handle. -* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif +* @since_tizen 2.4 */ typedef struct vc_cmd_s* vc_cmd_h; /** * @brief The voice command list handle. -* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif +* @since_tizen 2.4 */ typedef struct vc_cmd_list_s* vc_cmd_list_h; /** * @brief Called to retrieve The commands in list. -* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif +* @since_tizen 2.4 * * @param[in] vc_command The command handle * @param[in] user_data The user data passed from the foreach function @@ -64,7 +64,7 @@ typedef bool (*vc_cmd_list_cb)(vc_cmd_h vc_command, void* user_data); /** * @brief Creates a handle for command list. -* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif +* @since_tizen 2.4 * * @remarks If the function succeeds, @a The list handle must be released with vc_cmd_list_destroy(). * @@ -83,7 +83,7 @@ int vc_cmd_list_create(vc_cmd_list_h* vc_cmd_list); /** * @brief Destroys the handle for command list. -* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif +* @since_tizen 2.4 * * @param[in] vc_cmd_list The command list handle * @param[in] free_command The command free option @c true = release each commands in list, @@ -101,7 +101,7 @@ int vc_cmd_list_destroy(vc_cmd_list_h vc_cmd_list, bool free_command); /** * @brief Gets command count of list. -* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif +* @since_tizen 2.4 * * @param[in] vc_cmd_list The command list handle * @param[out] count The count @@ -116,7 +116,7 @@ int vc_cmd_list_get_count(vc_cmd_list_h vc_cmd_list, int* count); /** * @brief Adds command to command list. -* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif +* @since_tizen 2.4 * * @param[in] vc_cmd_list The command list handle * @param[in] vc_command The command handle @@ -133,7 +133,7 @@ int vc_cmd_list_add(vc_cmd_list_h vc_cmd_list, vc_cmd_h vc_command); /** * @brief Removes command from command list. -* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif +* @since_tizen 2.4 * * @param[in] vc_cmd_list The command list handle * @param[in] vc_command The command handle @@ -150,7 +150,7 @@ int vc_cmd_list_remove(vc_cmd_list_h vc_cmd_list, vc_cmd_h vc_command); /** * @brief Retrieves all commands of command list using callback function. -* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif +* @since_tizen 2.4 * * @param[in] vc_cmd_list The command list handle * @param[in] callback Callback function to invoke @@ -170,7 +170,7 @@ int vc_cmd_list_foreach_commands(vc_cmd_list_h vc_cmd_list, vc_cmd_list_cb callb /** * @brief Moves index to first command. -* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif +* @since_tizen 2.4 * * @param[in] vc_cmd_list The command list handle * @@ -187,7 +187,7 @@ int vc_cmd_list_first(vc_cmd_list_h vc_cmd_list); /** * @brief Moves index to last command. -* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif +* @since_tizen 2.4 * * @param[in] vc_cmd_list The command list handle * @@ -204,7 +204,7 @@ int vc_cmd_list_last(vc_cmd_list_h vc_cmd_list); /** * @brief Moves index to next command. -* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif +* @since_tizen 2.4 * * @param[in] vc_cmd_list The command list handle * @@ -222,7 +222,7 @@ int vc_cmd_list_next(vc_cmd_list_h vc_cmd_list); /** * @brief Moves index to previous command. -* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif +* @since_tizen 2.4 * * @param[in] vc_cmd_list The command list handle * @@ -240,7 +240,7 @@ int vc_cmd_list_prev(vc_cmd_list_h vc_cmd_list); /** * @brief Get current command from command list by index. -* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif +* @since_tizen 2.4 * * @param[in] vc_cmd_list The command list handle * @param[out] vc_command The command handle @@ -262,7 +262,7 @@ int vc_cmd_list_get_current(vc_cmd_list_h vc_cmd_list, vc_cmd_h* vc_command); /** * @brief Creates a handle for command. -* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif +* @since_tizen 2.4 * * @remarks If the function succeeds, @a The command handle must be released * with vc_cmd_destroy() or vc_cmd_list_destroy(). @@ -283,7 +283,7 @@ int vc_cmd_create(vc_cmd_h* vc_command); /** * @brief Destroys the handle. -* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif +* @since_tizen 2.4 * * @param[in] vc_command The command handle * @@ -299,7 +299,7 @@ int vc_cmd_destroy(vc_cmd_h vc_command); /** * @brief Sets command. -* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif +* @since_tizen 2.4 * * @param[in] vc_command The command handle * @param[in] command The command text @@ -316,7 +316,7 @@ int vc_cmd_set_command(vc_cmd_h vc_command, const char* command); /** * @brief Gets command. -* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif +* @since_tizen 2.4 * * @remark If the function succeeds, @a command must be released with free() by you if they are not NULL. * @@ -335,7 +335,7 @@ int vc_cmd_get_command(vc_cmd_h vc_command, char** command); /** * @brief Sets command type. -* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif +* @since_tizen 2.4 * * @remark If you do not set the command type, the default value is -1. * You should set type if command is valid @@ -355,7 +355,7 @@ int vc_cmd_set_type(vc_cmd_h vc_command, int type); /** * @brief Gets command type. -* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif +* @since_tizen 2.4 * * @param[in] vc_command The command handle * @param[out] type The command type diff --git a/include/voice_control_command_expand.h b/include/voice_control_command_expand.h old mode 100755 new mode 100644 index f767d83..8200285 --- a/include/voice_control_command_expand.h +++ b/include/voice_control_command_expand.h @@ -30,7 +30,7 @@ extern "C" /** * @brief Enumerations of command format. -* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif +* @since_tizen 2.4 */ typedef enum { VC_CMD_FORMAT_FIXED = 0, /**< fixed command only */ @@ -42,7 +42,7 @@ typedef enum { /** * @brief Gets extra unfixed command. -* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif +* @since_tizen 2.4 * * @remark If the function succeeds, @a The command must be released with free() by you if they are not NULL. * If you get the result command list in result callback and the command type of commands has non-fixed format, @@ -61,7 +61,7 @@ int vc_cmd_get_unfixed_command(vc_cmd_h vc_command, char** command); /** * @brief Sets command format. -* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif +* @since_tizen 2.4 * * @param[in] vc_command The command handle * @param[in] format The command format @@ -78,7 +78,7 @@ int vc_cmd_set_format(vc_cmd_h vc_command, vc_cmd_format_e format); /** * @brief Gets command format. -* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif +* @since_tizen 2.4 * * @remark If you do not set the format, the default format is #VC_CMD_FORMAT_FIXED. * @@ -97,7 +97,7 @@ int vc_cmd_get_format(vc_cmd_h vc_command, vc_cmd_format_e* format); /** * @brief Sets command domain -* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif +* @since_tizen 2.4 * * @param[in] vc_command The command handle * @param[in] domain The domain @@ -114,7 +114,7 @@ int vc_cmd_set_domain(vc_cmd_h vc_command, int domain); /** * @brief Gets command domain. -* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif +* @since_tizen 2.4 * * @param[in] vc_command The command handle * @param[out] domain The domain diff --git a/include/voice_control_common.h b/include/voice_control_common.h old mode 100755 new mode 100644 index 5724437..5d52a04 --- a/include/voice_control_common.h +++ b/include/voice_control_common.h @@ -32,7 +32,7 @@ extern "C" /** * @brief Enumerations of error codes. -* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif +* @since_tizen 2.4 */ typedef enum { VC_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */ @@ -54,7 +54,7 @@ typedef enum { /** * @brief Enumerations of result event. -* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif +* @since_tizen 2.4 */ typedef enum { VC_RESULT_EVENT_RESULT_SUCCESS = 0, /**< Normal result */ @@ -63,7 +63,7 @@ typedef enum { /** * @brief Enumerations of service state. -* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif +* @since_tizen 2.4 */ typedef enum { VC_SERVICE_STATE_NONE = 0, /**< 'None' state */ @@ -74,7 +74,7 @@ typedef enum { /** * @brief Enumerations of client state. -* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif +* @since_tizen 2.4 */ typedef enum { VC_STATE_NONE = 0, /**< 'None' state */ @@ -85,7 +85,7 @@ typedef enum { /** * @brief Called when client gets the recognition result. -* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif +* @since_tizen 2.4 * * @remarks If the duplicated commands are recognized, the event(e.g. #VC_RESULT_EVENT_REJECTED) of command may be rejected \n * for selecting command as priority. If you set similar or same commands or the recognized results are multi-results, @@ -104,7 +104,7 @@ typedef void (*vc_result_cb)(vc_result_event_e event, vc_cmd_list_h vc_cmd_list, /** * @brief Called when default language is changed. -* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif +* @since_tizen 2.4 * * @param[in] previous Previous language * @param[in] current Current language @@ -118,7 +118,7 @@ typedef void (*vc_current_language_changed_cb)(const char* previous, const char* /** * @brief Called to retrieve supported language. -* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif +* @since_tizen 2.4 * * @param[in] language A language is specified as an ISO 3166 alpha-2 two letter country-code \n * followed by ISO 639-1 for the two-letter language code. \n @@ -133,7 +133,7 @@ typedef bool (*vc_supported_language_cb)(const char* language, void* user_data); /** * @brief Called when the state of voice control client is changed. -* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif +* @since_tizen 2.4 * * @param[in] previous A previous state * @param[in] current A current state @@ -147,7 +147,7 @@ typedef void (*vc_state_changed_cb)(vc_state_e previous, vc_state_e current, voi /** * @brief Called when the state of voice control service is changed. -* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif +* @since_tizen 2.4 * * @param[in] previous A previous state * @param[in] current A current state @@ -161,7 +161,7 @@ typedef void (*vc_service_state_changed_cb)(vc_service_state_e previous, vc_serv /** * @brief Called when error occurred. -* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif +* @since_tizen 2.4 * * @param[in] reason The error type (e.g. #VC_ERROR_OUT_OF_MEMORY, #VC_ERROR_TIMED_OUT) * @param[in] user_data The user data passed from the callback registration function diff --git a/include/voice_control_manager.h b/include/voice_control_manager.h old mode 100755 new mode 100644 index 80476c6..e1c96fa --- a/include/voice_control_manager.h +++ b/include/voice_control_manager.h @@ -40,31 +40,31 @@ extern "C" /** * @brief Definitions for foreground command type. -* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif +* @since_tizen 2.4 */ #define VC_COMMAND_TYPE_FOREGROUND 1 /** * @brief Definitions for background command type. -* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif +* @since_tizen 2.4 */ #define VC_COMMAND_TYPE_BACKGROUND 2 /** * @brief Definitions for widget command type. -* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif +* @since_tizen 2.4 */ #define VC_COMMAND_TYPE_WIDGET 3 /** * @brief Definitions for system command type. -* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif +* @since_tizen 2.4 */ #define VC_COMMAND_TYPE_SYSTEM 4 /** * @brief Definitions for exclusive command type. -* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif +* @since_tizen 2.4 */ #define VC_COMMAND_TYPE_EXCLUSIVE 5 diff --git a/include/voice_control_setting.h b/include/voice_control_setting.h old mode 100755 new mode 100644 index 29b95bd..b5ea1e1 --- a/include/voice_control_setting.h +++ b/include/voice_control_setting.h @@ -49,7 +49,7 @@ typedef void (*vc_setting_enabled_changed_cb)(bool enabled, void* user_data); /** * @brief Called to retrieve supported language. -* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif +* @since_tizen 2.4 * * @param[in] language A language is specified as an ISO 3166 alpha-2 two letter country-code \n * followed by ISO 639-1 for the two-letter language code. \n @@ -64,7 +64,7 @@ typedef bool(*vc_setting_supported_language_cb)(const char* language, void* user /** * @brief Called when default language is changed. -* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif +* @since_tizen 2.4 * * @param[in] previous Previous language * @param[in] current Current language diff --git a/include/voice_control_widget.h b/include/voice_control_widget.h old mode 100755 new mode 100644 index 91ddf74..f9ecd2c --- a/include/voice_control_widget.h +++ b/include/voice_control_widget.h @@ -35,7 +35,7 @@ extern "C" /** * @brief Definitions for widget command type. -* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif +* @since_tizen 2.4 */ #define VC_COMMAND_TYPE_WIDGET 3 -- 2.7.4 From 46a670fa2975152a4c4c1388c49dc5bb701f72df Mon Sep 17 00:00:00 2001 From: "sooyeon.kim" Date: Tue, 3 May 2016 14:18:24 +0900 Subject: [PATCH 09/16] change Tizen version for wearable Change-Id: I13ff53f011f824f3fc7e9157ec3adf637a5ad5bc Signed-off-by: sooyeon.kim --- client/vc.c | 2 +- common/vc_command.h | 8 +++---- include/voice_control.h | 44 +++++++++++++++++----------------- include/voice_control_command.h | 40 +++++++++++++++---------------- include/voice_control_command_expand.h | 14 +++++------ include/voice_control_common.h | 20 ++++++++-------- include/voice_control_manager.h | 10 ++++---- include/voice_control_setting.h | 4 ++-- include/voice_control_widget.h | 2 +- 9 files changed, 72 insertions(+), 72 deletions(-) mode change 100644 => 100755 common/vc_command.h mode change 100644 => 100755 include/voice_control.h mode change 100644 => 100755 include/voice_control_command.h mode change 100644 => 100755 include/voice_control_command_expand.h mode change 100644 => 100755 include/voice_control_common.h mode change 100644 => 100755 include/voice_control_manager.h mode change 100644 => 100755 include/voice_control_setting.h mode change 100644 => 100755 include/voice_control_widget.h diff --git a/client/vc.c b/client/vc.c index e3161b6..1ee1350 100755 --- a/client/vc.c +++ b/client/vc.c @@ -806,7 +806,7 @@ int vc_get_window_id(int* wid) /** * @brief Checks whether the command format is supported. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * * @param[in] format The command format * @param[out] support The result status @c true = supported, @c false = not supported diff --git a/common/vc_command.h b/common/vc_command.h old mode 100644 new mode 100755 index 5fc66d4..236c8af --- a/common/vc_command.h +++ b/common/vc_command.h @@ -48,7 +48,7 @@ typedef struct { /** * @brief Enumerations of command type. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif */ typedef enum { VC_COMMAND_TYPE_NONE = 0, /**< No command position */ @@ -68,7 +68,7 @@ int vc_cmd_print_list(vc_cmd_list_h vc_cmd_list); /** * @brief Sets extra unfixed command. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * * @param[in] vc_command The command handle * @param[in] command The unfixed command @@ -85,7 +85,7 @@ int vc_cmd_set_unfixed_command(vc_cmd_h vc_command, const char* command); /** * @brief Sets pid. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * * @param[in] vc_command The command handle * @param[in] pid process id @@ -100,7 +100,7 @@ int vc_cmd_set_pid(vc_cmd_h vc_command, int pid); /** * @brief Sets command domain -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * * @param[in] vc_command The command handle * @param[in] domain domain diff --git a/include/voice_control.h b/include/voice_control.h old mode 100644 new mode 100755 index 8e7b5f3..8bf4d15 --- a/include/voice_control.h +++ b/include/voice_control.h @@ -48,20 +48,20 @@ extern "C" /** * @brief Definitions for foreground command type. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif */ #define VC_COMMAND_TYPE_FOREGROUND 1 /** * @brief Definitions for background command type. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif */ #define VC_COMMAND_TYPE_BACKGROUND 2 /** * @brief Initializes voice control. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * @privlevel public * @privilege %http://tizen.org/privilege/recorder * @@ -82,7 +82,7 @@ int vc_initialize(void); /** * @brief Deinitializes voice control. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * @privlevel public * @privilege %http://tizen.org/privilege/recorder * @@ -99,7 +99,7 @@ int vc_deinitialize(void); /** * @brief Connects the voice control service. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * @privlevel public * @privilege %http://tizen.org/privilege/recorder * @@ -119,7 +119,7 @@ int vc_prepare(void); /** * @brief Disconnects the voice control service. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * @privlevel public * @privilege %http://tizen.org/privilege/recorder * @@ -138,7 +138,7 @@ int vc_unprepare(void); /** * @brief Retrieves all supported languages using callback function. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * @privlevel public * @privilege %http://tizen.org/privilege/recorder * @@ -163,7 +163,7 @@ int vc_foreach_supported_languages(vc_supported_language_cb callback, void* user /** * @brief Gets current language. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * @privlevel public * @privilege %http://tizen.org/privilege/recorder * @@ -190,7 +190,7 @@ int vc_get_current_language(char** language); /** * @brief Gets current state of voice control client. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * @privlevel public * @privilege %http://tizen.org/privilege/recorder * @@ -209,7 +209,7 @@ int vc_get_state(vc_state_e* state); /** * @brief Gets current state of voice control service. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * @privlevel public * @privilege %http://tizen.org/privilege/recorder * @@ -233,7 +233,7 @@ int vc_get_service_state(vc_service_state_e* state); /** * @brief Sets command list. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * @privlevel public * @privilege %http://tizen.org/privilege/recorder * @@ -258,7 +258,7 @@ int vc_set_command_list(vc_cmd_list_h vc_cmd_list, int type); /** * @brief Unsets command list. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * @privlevel public * @privilege %http://tizen.org/privilege/recorder * @@ -280,7 +280,7 @@ int vc_unset_command_list(int type); /** * @brief Registers a callback function for getting recognition result. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * @privlevel public * @privilege %http://tizen.org/privilege/recorder * @@ -303,7 +303,7 @@ int vc_set_result_cb(vc_result_cb callback, void* user_data); /** * @brief Unregisters the callback function. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * @privlevel public * @privilege %http://tizen.org/privilege/recorder * @@ -320,7 +320,7 @@ int vc_unset_result_cb(void); /** * @brief Registers a callback function to be called when state is changed. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * @privlevel public * @privilege %http://tizen.org/privilege/recorder * @@ -343,7 +343,7 @@ int vc_set_service_state_changed_cb(vc_service_state_changed_cb callback, void* /** * @brief Unregisters the callback function. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * @privlevel public * @privilege %http://tizen.org/privilege/recorder * @@ -361,7 +361,7 @@ int vc_unset_service_state_changed_cb(void); /** * @brief Registers a callback function to be called when state is changed. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * @privlevel public * @privilege %http://tizen.org/privilege/recorder * @@ -384,7 +384,7 @@ int vc_set_state_changed_cb(vc_state_changed_cb callback, void* user_data); /** * @brief Unregisters the callback function. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * @privlevel public * @privilege %http://tizen.org/privilege/recorder * @@ -402,7 +402,7 @@ int vc_unset_state_changed_cb(void); /** * @brief Registers a callback function to be called when current language is changed. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * @privlevel public * @privilege %http://tizen.org/privilege/recorder * @@ -425,7 +425,7 @@ int vc_set_current_language_changed_cb(vc_current_language_changed_cb callback, /** * @brief Unregisters the callback function. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * @privlevel public * @privilege %http://tizen.org/privilege/recorder * @@ -443,7 +443,7 @@ int vc_unset_current_language_changed_cb(void); /** * @brief Registers a callback function to be called when an error occurred. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * @privlevel public * @privilege %http://tizen.org/privilege/recorder * @@ -466,7 +466,7 @@ int vc_set_error_cb(vc_error_cb callback, void* user_data); /** * @brief Unregisters the callback function. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * @privlevel public * @privilege %http://tizen.org/privilege/recorder * diff --git a/include/voice_control_command.h b/include/voice_control_command.h old mode 100644 new mode 100755 index afb7810..82a7849 --- a/include/voice_control_command.h +++ b/include/voice_control_command.h @@ -37,19 +37,19 @@ extern "C" /** * @brief The voice command handle. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif */ typedef struct vc_cmd_s* vc_cmd_h; /** * @brief The voice command list handle. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif */ typedef struct vc_cmd_list_s* vc_cmd_list_h; /** * @brief Called to retrieve The commands in list. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * * @param[in] vc_command The command handle * @param[in] user_data The user data passed from the foreach function @@ -64,7 +64,7 @@ typedef bool (*vc_cmd_list_cb)(vc_cmd_h vc_command, void* user_data); /** * @brief Creates a handle for command list. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * * @remarks If the function succeeds, @a The list handle must be released with vc_cmd_list_destroy(). * @@ -83,7 +83,7 @@ int vc_cmd_list_create(vc_cmd_list_h* vc_cmd_list); /** * @brief Destroys the handle for command list. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * * @param[in] vc_cmd_list The command list handle * @param[in] free_command The command free option @c true = release each commands in list, @@ -101,7 +101,7 @@ int vc_cmd_list_destroy(vc_cmd_list_h vc_cmd_list, bool free_command); /** * @brief Gets command count of list. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * * @param[in] vc_cmd_list The command list handle * @param[out] count The count @@ -116,7 +116,7 @@ int vc_cmd_list_get_count(vc_cmd_list_h vc_cmd_list, int* count); /** * @brief Adds command to command list. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * * @param[in] vc_cmd_list The command list handle * @param[in] vc_command The command handle @@ -133,7 +133,7 @@ int vc_cmd_list_add(vc_cmd_list_h vc_cmd_list, vc_cmd_h vc_command); /** * @brief Removes command from command list. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * * @param[in] vc_cmd_list The command list handle * @param[in] vc_command The command handle @@ -150,7 +150,7 @@ int vc_cmd_list_remove(vc_cmd_list_h vc_cmd_list, vc_cmd_h vc_command); /** * @brief Retrieves all commands of command list using callback function. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * * @param[in] vc_cmd_list The command list handle * @param[in] callback Callback function to invoke @@ -170,7 +170,7 @@ int vc_cmd_list_foreach_commands(vc_cmd_list_h vc_cmd_list, vc_cmd_list_cb callb /** * @brief Moves index to first command. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * * @param[in] vc_cmd_list The command list handle * @@ -187,7 +187,7 @@ int vc_cmd_list_first(vc_cmd_list_h vc_cmd_list); /** * @brief Moves index to last command. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * * @param[in] vc_cmd_list The command list handle * @@ -204,7 +204,7 @@ int vc_cmd_list_last(vc_cmd_list_h vc_cmd_list); /** * @brief Moves index to next command. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * * @param[in] vc_cmd_list The command list handle * @@ -222,7 +222,7 @@ int vc_cmd_list_next(vc_cmd_list_h vc_cmd_list); /** * @brief Moves index to previous command. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * * @param[in] vc_cmd_list The command list handle * @@ -240,7 +240,7 @@ int vc_cmd_list_prev(vc_cmd_list_h vc_cmd_list); /** * @brief Get current command from command list by index. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * * @param[in] vc_cmd_list The command list handle * @param[out] vc_command The command handle @@ -262,7 +262,7 @@ int vc_cmd_list_get_current(vc_cmd_list_h vc_cmd_list, vc_cmd_h* vc_command); /** * @brief Creates a handle for command. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * * @remarks If the function succeeds, @a The command handle must be released * with vc_cmd_destroy() or vc_cmd_list_destroy(). @@ -283,7 +283,7 @@ int vc_cmd_create(vc_cmd_h* vc_command); /** * @brief Destroys the handle. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * * @param[in] vc_command The command handle * @@ -299,7 +299,7 @@ int vc_cmd_destroy(vc_cmd_h vc_command); /** * @brief Sets command. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * * @param[in] vc_command The command handle * @param[in] command The command text @@ -316,7 +316,7 @@ int vc_cmd_set_command(vc_cmd_h vc_command, const char* command); /** * @brief Gets command. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * * @remark If the function succeeds, @a command must be released with free() by you if they are not NULL. * @@ -335,7 +335,7 @@ int vc_cmd_get_command(vc_cmd_h vc_command, char** command); /** * @brief Sets command type. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * * @remark If you do not set the command type, the default value is -1. * You should set type if command is valid @@ -355,7 +355,7 @@ int vc_cmd_set_type(vc_cmd_h vc_command, int type); /** * @brief Gets command type. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * * @param[in] vc_command The command handle * @param[out] type The command type diff --git a/include/voice_control_command_expand.h b/include/voice_control_command_expand.h old mode 100644 new mode 100755 index 03179f9..98fe563 --- a/include/voice_control_command_expand.h +++ b/include/voice_control_command_expand.h @@ -30,7 +30,7 @@ extern "C" /** * @brief Enumerations of command format. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif */ typedef enum { VC_CMD_FORMAT_FIXED = 0, /**< fixed command only */ @@ -42,7 +42,7 @@ typedef enum { /** * @brief Gets extra unfixed command. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * * @remark If the function succeeds, @a The command must be released with free() by you if they are not NULL. * If you get the result command list in result callback and the command type of commands has non-fixed format, @@ -61,7 +61,7 @@ int vc_cmd_get_unfixed_command(vc_cmd_h vc_command, char** command); /** * @brief Sets command format. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * * @param[in] vc_command The command handle * @param[in] format The command format @@ -78,7 +78,7 @@ int vc_cmd_set_format(vc_cmd_h vc_command, vc_cmd_format_e format); /** * @brief Gets command format. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * * @remark If you do not set the format, the default format is #VC_CMD_FORMAT_FIXED. * @@ -97,7 +97,7 @@ int vc_cmd_get_format(vc_cmd_h vc_command, vc_cmd_format_e* format); /** * @brief Sets command domain -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * * @param[in] vc_command The command handle * @param[in] domain The domain @@ -114,7 +114,7 @@ int vc_cmd_set_domain(vc_cmd_h vc_command, int domain); /** * @brief Gets command domain. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * * @param[in] vc_command The command handle * @param[out] domain The domain @@ -131,7 +131,7 @@ int vc_cmd_get_domain(vc_cmd_h vc_command, int* domain); /** * @brief Remove all commands from command list. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * * @param[in] vc_cmd_list The command list handle * @param[in] free_command The command free option @c true = release each commands in list, diff --git a/include/voice_control_common.h b/include/voice_control_common.h old mode 100644 new mode 100755 index 5d52a04..5724437 --- a/include/voice_control_common.h +++ b/include/voice_control_common.h @@ -32,7 +32,7 @@ extern "C" /** * @brief Enumerations of error codes. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif */ typedef enum { VC_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */ @@ -54,7 +54,7 @@ typedef enum { /** * @brief Enumerations of result event. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif */ typedef enum { VC_RESULT_EVENT_RESULT_SUCCESS = 0, /**< Normal result */ @@ -63,7 +63,7 @@ typedef enum { /** * @brief Enumerations of service state. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif */ typedef enum { VC_SERVICE_STATE_NONE = 0, /**< 'None' state */ @@ -74,7 +74,7 @@ typedef enum { /** * @brief Enumerations of client state. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif */ typedef enum { VC_STATE_NONE = 0, /**< 'None' state */ @@ -85,7 +85,7 @@ typedef enum { /** * @brief Called when client gets the recognition result. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * * @remarks If the duplicated commands are recognized, the event(e.g. #VC_RESULT_EVENT_REJECTED) of command may be rejected \n * for selecting command as priority. If you set similar or same commands or the recognized results are multi-results, @@ -104,7 +104,7 @@ typedef void (*vc_result_cb)(vc_result_event_e event, vc_cmd_list_h vc_cmd_list, /** * @brief Called when default language is changed. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * * @param[in] previous Previous language * @param[in] current Current language @@ -118,7 +118,7 @@ typedef void (*vc_current_language_changed_cb)(const char* previous, const char* /** * @brief Called to retrieve supported language. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * * @param[in] language A language is specified as an ISO 3166 alpha-2 two letter country-code \n * followed by ISO 639-1 for the two-letter language code. \n @@ -133,7 +133,7 @@ typedef bool (*vc_supported_language_cb)(const char* language, void* user_data); /** * @brief Called when the state of voice control client is changed. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * * @param[in] previous A previous state * @param[in] current A current state @@ -147,7 +147,7 @@ typedef void (*vc_state_changed_cb)(vc_state_e previous, vc_state_e current, voi /** * @brief Called when the state of voice control service is changed. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * * @param[in] previous A previous state * @param[in] current A current state @@ -161,7 +161,7 @@ typedef void (*vc_service_state_changed_cb)(vc_service_state_e previous, vc_serv /** * @brief Called when error occurred. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * * @param[in] reason The error type (e.g. #VC_ERROR_OUT_OF_MEMORY, #VC_ERROR_TIMED_OUT) * @param[in] user_data The user data passed from the callback registration function diff --git a/include/voice_control_manager.h b/include/voice_control_manager.h old mode 100644 new mode 100755 index e1c96fa..80476c6 --- a/include/voice_control_manager.h +++ b/include/voice_control_manager.h @@ -40,31 +40,31 @@ extern "C" /** * @brief Definitions for foreground command type. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif */ #define VC_COMMAND_TYPE_FOREGROUND 1 /** * @brief Definitions for background command type. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif */ #define VC_COMMAND_TYPE_BACKGROUND 2 /** * @brief Definitions for widget command type. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif */ #define VC_COMMAND_TYPE_WIDGET 3 /** * @brief Definitions for system command type. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif */ #define VC_COMMAND_TYPE_SYSTEM 4 /** * @brief Definitions for exclusive command type. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif */ #define VC_COMMAND_TYPE_EXCLUSIVE 5 diff --git a/include/voice_control_setting.h b/include/voice_control_setting.h old mode 100644 new mode 100755 index b5ea1e1..29b95bd --- a/include/voice_control_setting.h +++ b/include/voice_control_setting.h @@ -49,7 +49,7 @@ typedef void (*vc_setting_enabled_changed_cb)(bool enabled, void* user_data); /** * @brief Called to retrieve supported language. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * * @param[in] language A language is specified as an ISO 3166 alpha-2 two letter country-code \n * followed by ISO 639-1 for the two-letter language code. \n @@ -64,7 +64,7 @@ typedef bool(*vc_setting_supported_language_cb)(const char* language, void* user /** * @brief Called when default language is changed. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif * * @param[in] previous Previous language * @param[in] current Current language diff --git a/include/voice_control_widget.h b/include/voice_control_widget.h old mode 100644 new mode 100755 index f9ecd2c..91ddf74 --- a/include/voice_control_widget.h +++ b/include/voice_control_widget.h @@ -35,7 +35,7 @@ extern "C" /** * @brief Definitions for widget command type. -* @since_tizen 2.4 +* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif */ #define VC_COMMAND_TYPE_WIDGET 3 -- 2.7.4 From 97439360af9f1c05c2dd6f95db83a79ace2015f1 Mon Sep 17 00:00:00 2001 From: "sooyeon.kim" Date: Tue, 3 May 2016 23:36:27 +0900 Subject: [PATCH 10/16] fix SVACE - NULL_AFTER_DEREF Change-Id: I1443b0ba94dce12c23648a7c62c8947b6e8758b6 Signed-off-by: sooyeon.kim --- common/vc_config_mgr.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) mode change 100644 => 100755 common/vc_config_mgr.c diff --git a/common/vc_config_mgr.c b/common/vc_config_mgr.c old mode 100644 new mode 100755 index 71afe04..e8d8dc5 --- a/common/vc_config_mgr.c +++ b/common/vc_config_mgr.c @@ -377,7 +377,18 @@ int __vc_config_set_auto_language() SLOG(LOG_DEBUG, vc_config_tag(), "[Config] Display language : %s", candidate_lang); + /* Check current config info */ + if (NULL == g_config_info) { + SLOG(LOG_ERROR, vc_config_tag(), "Current config info is NULL"); + return VC_CONFIG_ERROR_OPERATION_FAILED; + } + /* Check current language */ + if (NULL == g_config_info->language) { + SLOG(LOG_ERROR, vc_config_tag(), "Current config language is NULL"); + return VC_CONFIG_ERROR_OPERATION_FAILED; + } + if (0 == strncmp(g_config_info->language, candidate_lang, 5)) { SLOG(LOG_DEBUG, vc_config_tag(), "[Config] VC language(%s) is same with display language", g_config_info->language); return 0; @@ -385,11 +396,6 @@ int __vc_config_set_auto_language() if (true == __vc_config_mgr_check_lang_is_valid(g_config_info->engine_id, candidate_lang)) { /* stt default language change */ - if (NULL == g_config_info->language) { - SLOG(LOG_ERROR, vc_config_tag(), "Current config language is NULL"); - return -1; - } - char* before_lang = NULL; if (0 != vc_parser_set_language(candidate_lang)) { SLOG(LOG_ERROR, vc_config_tag(), "Fail to save default language"); @@ -445,10 +451,8 @@ int __vc_config_set_auto_language() before_lang = strdup(g_config_info->language); - if (NULL != g_config_info->language) { - free(g_config_info->language); - g_config_info->language = strdup(tmp_language); - } + free(g_config_info->language); + g_config_info->language = strdup(tmp_language); free(tmp_language); SLOG(LOG_DEBUG, vc_config_tag(), "[Config] Default language change : before(%s) current(%s)", -- 2.7.4 From 99b59ed6b8decd6af7985a5189bc8c58fb7ee8d8 Mon Sep 17 00:00:00 2001 From: Wonnam Jang Date: Fri, 13 May 2016 10:12:41 +0900 Subject: [PATCH 11/16] add codes to support various audio input on one branch Change-Id: Ia00bb87769dc55fc0ca70ba3555262e38b6f55ae Signed-off-by: Wonnam Jang --- CMakeLists.txt | 8 ++ packaging/voice-control.spec | 11 +- server/vcd_recorder.c | 257 ++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 274 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index acadb9d..ab6f0bd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -39,10 +39,18 @@ INCLUDE_DIRECTORIES("${CMAKE_SOURCE_DIR}/include") ## Dependent packages ## INCLUDE(FindPkgConfig) +IF("${_TV_PRODUCT}" STREQUAL "TRUE") +pkg_check_modules(pkgs REQUIRED + aul capi-base-common capi-media-audio-io capi-media-sound-manager capi-network-bluetooth capi-system-info + dbus-1 dlog ecore glib-2.0 libtzplatform-config libxml-2.0 vconf #msfapi +) +ELSE() pkg_check_modules(pkgs REQUIRED aul capi-base-common capi-media-audio-io capi-media-sound-manager capi-network-bluetooth capi-system-info dbus-1 dlog ecore glib-2.0 libtzplatform-config libxml-2.0 vconf ) +ENDIF() + ## API ## ADD_SUBDIRECTORY(include) diff --git a/packaging/voice-control.spec b/packaging/voice-control.spec index cf2580a..ed54462 100644 --- a/packaging/voice-control.spec +++ b/packaging/voice-control.spec @@ -22,6 +22,9 @@ BuildRequires: pkgconfig(ecore) BuildRequires: pkgconfig(glib-2.0) BuildRequires: pkgconfig(libtzplatform-config) BuildRequires: pkgconfig(libxml-2.0) +%if "%{PRODUCT_TYPE}" == "TV" +#BuildRequires: pkgconfig(msfapi) #not be applied yet. +%endif BuildRequires: pkgconfig(vconf) BuildRequires: cmake @@ -84,8 +87,14 @@ export CFLAGS="$CFLAGS -DTIZEN_ENGINEER_MODE" export CXXFLAGS="$CXXFLAGS -DTIZEN_ENGINEER_MODE" export FFLAGS="$FFLAGS -DTIZEN_ENGINEER_MODE" %endif +%if "%{PRODUCT_TYPE}" == "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 +%else cmake . -DCMAKE_INSTALL_PREFIX=/usr -DLIBDIR=%{_libdir} -DINCLUDEDIR=%{_includedir} \ - -DTZ_SYS_RO_SHARE=%TZ_SYS_RO_SHARE + -DTZ_SYS_RO_SHARE=%TZ_SYS_RO_SHARE +%endif make %{?jobs:-j%jobs} %install diff --git a/server/vcd_recorder.c b/server/vcd_recorder.c index e2692a9..5e7f0d0 100644 --- a/server/vcd_recorder.c +++ b/server/vcd_recorder.c @@ -14,10 +14,22 @@ * limitations under the License. */ +#ifdef TV_PRODUCT +#define TV_BT_MODE +//#define TV_MSF_WIFI_MODE +#endif #include #include #include +#ifdef TV_PRODUCT +#ifdef TV_BT_MODE +#include +#endif +#ifdef TV_MSF_WIFI_MODE +#include +#endif +#endif #include "vcd_client_data.h" #include "vcd_dbus.h" @@ -67,6 +79,111 @@ static int g_count = 1; static float get_volume_decibel(char* data, int size); +#ifdef TV_MSF_WIFI_MODE +static void __msf_wifi_audio_data_receive_cb(msf_wifi_voice_data_s *voice_data, void* user_data) +{ + if (VCD_RECORDER_STATE_RECORDING != g_recorder_state) { + /*SLOG(LOG_DEBUG, TAG_VCD, "[Recorder] Exit audio reading normal func");*/ + return; + } + + if (NULL != g_audio_cb) { + if (0 != g_audio_cb((void*)voice_data->audio_buf, (unsigned int)voice_data->length)) { + SLOG(LOG_ERROR, TAG_VCD, "[Recorder ERROR] Fail to read audio"); + vcd_recorder_stop(); + } + } + + /* Set volume */ + if (0 == g_buffer_count % 30) { + float vol_db = get_volume_decibel((char*)voice_data->audio_buf, (unsigned int)voice_data->length); + if (0 != vcdc_send_set_volume(vcd_client_manager_get_pid(), vol_db)) { + SLOG(LOG_ERROR, TAG_VCD, "[Recorder] Fail to send recording volume(%f)", vol_db); + } + } + + if (0 == g_buffer_count || 0 == g_buffer_count % 50) { + SLOG(LOG_WARN, TAG_VCD, "[Recorder][%d] Recording... : read_size(%d)", g_buffer_count, voice_data->length); + + if (100000 == g_buffer_count) + g_buffer_count = 0; + } + + g_buffer_count++; + +#ifdef BUF_SAVE_MODE + /* write pcm buffer */ + fwrite(voice_data->audio_buf, 1, voice_data->length, g_normal_file); +#endif + return; +} + +#endif + + +#ifdef TV_BT_MODE +static int g_bt_extend_count; + +#define SMART_CONTROL_EXTEND_CMD 0x03 +#define SMART_CONTROL_START_CMD 0x04 + +static void _bt_cb_hid_state_changed(int result, bool connected, const char *remote_address, void *user_data) +{ + SLOG(LOG_DEBUG, TAG_VCD, "[Recorder] Bluetooth Event [%d] Received address [%s]", result, remote_address); + return; +} + +static void _bt_hid_audio_data_receive_cb(bt_hid_voice_data_s *voice_data, void *user_data) +{ + if (VCD_RECORDER_STATE_RECORDING != g_recorder_state) { + /*SLOG(LOG_DEBUG, TAG_VCD, "[Recorder] Exit audio reading normal func");*/ + return; + } + + if (NULL != g_audio_cb) { + if (0 != g_audio_cb((void*)voice_data->audio_buf, (unsigned int)voice_data->length)) { + SLOG(LOG_ERROR, TAG_VCD, "[Recorder ERROR] Fail to read audio"); + vcd_recorder_stop(); + } + } + + /* Set volume */ + if (0 == g_buffer_count % 30) { + float vol_db = get_volume_decibel((char*)voice_data->audio_buf, (unsigned int)voice_data->length); + if (0 != vcdc_send_set_volume(vcd_client_manager_get_pid(), vol_db)) { + SLOG(LOG_ERROR, TAG_VCD, "[Recorder] Fail to send recording volume(%f)", vol_db); + } + } + + if (0 == g_buffer_count || 0 == g_buffer_count % 50) { + SLOG(LOG_WARN, TAG_VCD, "[Recorder][%d] Recording... : read_size(%d)", g_buffer_count, voice_data->length); + + if (0 == g_bt_extend_count % 5 && 0 != g_buffer_count) { + const unsigned char input_data[2] = {SMART_CONTROL_EXTEND_CMD, 0x10 }; + if (BT_ERROR_NONE != bt_hid_send_rc_command(NULL, input_data, sizeof(input_data))) { + SLOG(LOG_ERROR, TAG_VCD, "[Recorder ERROR] Fail bt_hid_send_rc_command(NULL, %s, %d)", input_data, sizeof(input_data)); + } else { + SLOG(LOG_DEBUG, TAG_VCD, "[Recorder] Extend bt audio recorder"); + } + } + g_bt_extend_count++; + + if (100000 == g_buffer_count) { + g_buffer_count = 0; + } + } + + g_buffer_count++; + +#ifdef BUF_SAVE_MODE + /* write pcm buffer */ + fwrite(voice_data->audio_buf, 1, voice_data->length, g_normal_file); +#endif + return; +} + +#endif + int vcd_recorder_create(vcd_recoder_audio_cb audio_cb, vcd_recorder_interrupt_cb interrupt_cb) { if (NULL == audio_cb || NULL == interrupt_cb) { @@ -119,6 +236,31 @@ int vcd_recorder_create(vcd_recoder_audio_cb audio_cb, vcd_recorder_interrupt_cb g_interrupt_cb = interrupt_cb; g_recorder_state = VCD_RECORDER_STATE_READY; +#ifdef TV_BT_MODE + + bool is_bt_failed = false; + + if (false == is_bt_failed && BT_ERROR_NONE != bt_initialize()) { + SLOG(LOG_ERROR, TAG_VCD, "[Recorder ERROR] Fail to init bt"); + is_bt_failed = true; + } + + if (false == is_bt_failed && BT_ERROR_NONE != bt_hid_host_initialize(_bt_cb_hid_state_changed, NULL)) { + SLOG(LOG_ERROR, TAG_VCD, "[Recorder ERROR] Fail bt_hid_host_initialize()"); + is_bt_failed = true; + } + + if (false == is_bt_failed && BT_ERROR_NONE != bt_hid_set_audio_data_receive_cb(_bt_hid_audio_data_receive_cb, NULL)) { + SLOG(LOG_ERROR, TAG_VCD, "[Recorder ERROR] Fail bt_hid_set_audio_data_receive_cb()"); + is_bt_failed = true; + } + + + if (false == is_bt_failed) { + SLOG(LOG_DEBUG, TAG_VCD, "[Recorder] Bluetooth is available"); + g_is_valid_bt_in = true; + } +#endif /* Select default audio type */ if (true == g_is_valid_bt_in) { g_current_audio_type = strdup(VCP_AUDIO_ID_BLUETOOTH); @@ -134,7 +276,15 @@ int vcd_recorder_create(vcd_recoder_audio_cb audio_cb, vcd_recorder_interrupt_cb int vcd_recorder_destroy() { if (VCD_RECORDER_STATE_RECORDING == g_recorder_state) { - if (0 != strncmp(VCP_AUDIO_ID_BLUETOOTH, g_current_audio_type, strlen(VCP_AUDIO_ID_BLUETOOTH))) { + if (0 == strncmp(VCP_AUDIO_ID_BLUETOOTH, g_current_audio_type, strlen(VCP_AUDIO_ID_BLUETOOTH))) { +#ifdef TV_BT_MODE + bt_hid_unset_audio_data_receive_cb(); +#endif + } else if (0 == strncmp(VCP_AUDIO_ID_MSF, g_current_audio_type, strlen(VCP_AUDIO_ID_MSF))) { +#ifdef TV_MSF_WIFI_MODE + UnRegisterMSFAudioCallback(); +#endif + } else { audio_in_unprepare(g_audio_h); } g_recorder_state = VCD_RECORDER_STATE_READY; @@ -142,6 +292,14 @@ int vcd_recorder_destroy() audio_in_destroy(g_audio_h); +#ifdef TV_BT_MODE + bt_hid_unset_audio_data_receive_cb(); + + bt_hid_host_deinitialize(); + + bt_deinitialize(); +#endif + g_audio_cb = NULL; if (NULL != g_current_audio_type) { @@ -184,6 +342,13 @@ int vcd_recorder_set(const char* audio_type, vcp_audio_type_e type, int rate, in } g_current_audio_type = strdup(audio_type); + } else if (0 == strncmp(VCP_AUDIO_ID_MSF, audio_type, strlen(VCP_AUDIO_ID_MSF))) { + if (NULL != g_current_audio_type) { + free(g_current_audio_type); + g_current_audio_type = NULL; + } + + g_current_audio_type = strdup(audio_type); } else { if (false == g_is_valid_audio_in) { SLOG(LOG_ERROR, TAG_VCD, "[Recorder ERROR] Audio-in is NOT valid"); @@ -225,6 +390,15 @@ int vcd_recorder_set(const char* audio_type, vcp_audio_type_e type, int rate, in g_audio_rate = rate; g_audio_channel = channel; } + +#ifdef TV_BT_MODE + if (NULL != g_current_audio_type) { + free(g_current_audio_type); + g_current_audio_type = NULL; + } + + g_current_audio_type = strdup(audio_type); +#endif } SLOG(LOG_DEBUG, TAG_VCD, "[Recorder] Current audio type is changed : %s", g_current_audio_type); @@ -335,9 +509,57 @@ int vcd_recorder_start() int ret = -1; g_buffer_count = 0; + SLOG(LOG_ERROR, TAG_VCD, "[Recorder] Enter, recorder state(%d)", g_recorder_state); + if (VCD_RECORDER_STATE_RECORDING == g_recorder_state) return 0; bool started = false; + SLOG(LOG_ERROR, TAG_VCD, "[Recorder] audio type : %s", g_current_audio_type); + + if (NULL != g_current_audio_type) { + if (0 == strncmp(VCP_AUDIO_ID_BLUETOOTH, g_current_audio_type, strlen(VCP_AUDIO_ID_BLUETOOTH))) { +#ifdef TV_BT_MODE + const unsigned char input_data[2] = {SMART_CONTROL_START_CMD, 0x00}; + int bt_retry = 0; + while (5 > bt_retry) { + ret = bt_hid_send_rc_command(NULL, input_data, sizeof(input_data)); + if (BT_ERROR_NONE == ret) { + SLOG(LOG_DEBUG, TAG_VCD, "[Recorder] Start bt audio recorder"); + started = true; + break; + } else if (BT_ERROR_NOW_IN_PROGRESS == ret) { + SLOG(LOG_ERROR, TAG_VCD, "[Recorder ERROR] Fail bt_hid_send_rc_command(NULL, %s, %d) : %d", input_data, sizeof(input_data), ret); + usleep(50000); + bt_retry++; + } else { + break; + } + } + if (false == started) { + SLOG(LOG_ERROR, TAG_VCD, "[Recorder ERROR] Fail to start bt audio"); + return VCD_ERROR_OPERATION_FAILED; + } + + g_bt_extend_count = 0; +#endif + } + else if (0 == strncmp(VCP_AUDIO_ID_MSF, g_current_audio_type, strlen(VCP_AUDIO_ID_MSF))) { + SLOG(LOG_ERROR, TAG_VCD, "[Recorder] call RegisterMSFAudioCallback() function"); +#ifdef TV_MSF_WIFI_MODE + + ret = RegisterMSFAudioCallback(__msf_wifi_audio_data_receive_cb, NULL); + SLOG(LOG_ERROR, TAG_VCD, "[Recorder] ret = %d", ret); + if (MSFResult_OK == ret) { + started = true; + } else { + SLOG(LOG_ERROR, TAG_VCD, "[Recorder ERROR] Fail to start MSF(wifi) audio"); + return VCD_ERROR_OPERATION_FAILED; + } +#endif + } + } + + SLOG(LOG_ERROR, TAG_VCD, "[Recorder] started = %d", started); if (false == started) { ret = audio_in_prepare(g_audio_h); if (AUDIO_IO_ERROR_NONE != ret) { @@ -387,6 +609,39 @@ int vcd_recorder_stop() #endif bool stoped = false; + + if (NULL != g_current_audio_type) { + if (0 == strncmp(VCP_AUDIO_ID_BLUETOOTH, g_current_audio_type, strlen(VCP_AUDIO_ID_BLUETOOTH))) { +#ifdef TV_BT_MODE + int bt_retry = 0; + while (5 > bt_retry) { + ret = bt_hid_rc_stop_sending_voice(NULL); + if (BT_ERROR_NONE == ret) { + SLOG(LOG_DEBUG, TAG_VCD, "[Recorder] Stop bt audio recorder"); + stoped = true; + break; + } else if (BT_ERROR_NOW_IN_PROGRESS == ret) { + SLOG(LOG_ERROR, TAG_VCD, "[Recorder ERROR] Fail bt_hid_rc_stop_sending_voice()"); + usleep(50000); + bt_retry++; + } else { + break; + } + } + if (false == stoped) { + SLOG(LOG_ERROR, TAG_VCD, "[Recorder ERROR] Fail to stop bt audio"); + return VCD_ERROR_OPERATION_FAILED; + } +#endif + } + else if (0 == strncmp(VCP_AUDIO_ID_MSF, g_current_audio_type, strlen(VCP_AUDIO_ID_MSF))) { +#ifdef TV_MSF_WIFI_MODE + UnRegisterMSFAudioCallback(); + stoped = true; +#endif + } + } + if (false == stoped) { ret = audio_in_unprepare(g_audio_h); if (AUDIO_IO_ERROR_NONE != ret) { -- 2.7.4 From e99ec30f7d2aa8344f1df9e8609b0d44137d8553 Mon Sep 17 00:00:00 2001 From: Wonnam Jang Date: Wed, 18 May 2016 10:47:19 +0900 Subject: [PATCH 12/16] Add missing file Change-Id: Ie6646a0d173ca3497ac8e20440d4cace22b78aaa Signed-off-by: Wonnam Jang --- include/voice_control_plugin_engine.h | 5 +++++ 1 file changed, 5 insertions(+) mode change 100755 => 100644 include/voice_control_plugin_engine.h diff --git a/include/voice_control_plugin_engine.h b/include/voice_control_plugin_engine.h old mode 100755 new mode 100644 index ff091d3..1c124c6 --- a/include/voice_control_plugin_engine.h +++ b/include/voice_control_plugin_engine.h @@ -90,6 +90,11 @@ typedef int vcp_cmd_h; #define VCP_AUDIO_ID_BLUETOOTH "VC_AUDIO_ID_BLUETOOTH" /**< Bluetooth audio id */ /** + * @brief Defines of MSF(wifi) audio id. +*/ +#define VCP_AUDIO_ID_MSF "VC_AUDIO_ID_MSF" /**< MSF (wifi) audio id */ + +/** * @brief Definition for none message. */ #define VC_RESULT_MESSAGE_NONE "vc.result.message.none" -- 2.7.4 From d647f2c4abd27fbe20e6a61beb2c6000bc45aa14 Mon Sep 17 00:00:00 2001 From: Wonnam Jang Date: Wed, 18 May 2016 21:29:44 +0900 Subject: [PATCH 13/16] Add restore logic and function to get nlp info and pre result Change-Id: Ic979cfd21d99f7b7b5d55f234a980c926bcf91ba Signed-off-by: Wonnam Jang --- client/vc_dbus.c | 3 + client/vc_mgr.c | 264 ++++++++++++++++++++++++++++- client/vc_mgr_client.c | 96 +++++++++++ client/vc_mgr_client.h | 9 + client/vc_mgr_dbus.c | 311 +++++++++++++++++++++++++++++----- client/vc_mgr_dbus.h | 2 +- client/vc_widget_dbus.c | 3 + common/vc_config_mgr.c | 2 +- common/vc_defs.h | 3 + common/vc_info_parser.c | 88 ++++++++++ common/vc_info_parser.h | 4 + include/voice_control_common.h | 3 +- include/voice_control_manager.h | 24 ++- include/voice_control_plugin_engine.h | 34 +++- server/vcd_dbus.c | 145 ++++++++++++++-- server/vcd_dbus.h | 6 +- server/vcd_dbus_server.c | 5 +- server/vcd_engine_agent.c | 50 +++++- server/vcd_engine_agent.h | 6 +- server/vcd_main.c | 4 +- server/vcd_main.h | 3 +- server/vcd_server.c | 58 ++++++- 22 files changed, 1035 insertions(+), 88 deletions(-) mode change 100755 => 100644 client/vc_mgr.c mode change 100755 => 100644 common/vc_config_mgr.c mode change 100755 => 100644 include/voice_control_common.h mode change 100755 => 100644 include/voice_control_manager.h diff --git a/client/vc_dbus.c b/client/vc_dbus.c index 8519d42..2f8ca3d 100644 --- a/client/vc_dbus.c +++ b/client/vc_dbus.c @@ -277,6 +277,9 @@ int vc_dbus_close_connection() dbus_connection_close(g_conn_sender); dbus_connection_close(g_conn_listener); + dbus_connection_unref(g_conn_sender); + dbus_connection_unref(g_conn_listener); + g_conn_sender = NULL; g_conn_listener = NULL; diff --git a/client/vc_mgr.c b/client/vc_mgr.c old mode 100755 new mode 100644 index df07965..06da0dc --- a/client/vc_mgr.c +++ b/client/vc_mgr.c @@ -15,6 +15,7 @@ */ #include +#include #include "vc_info_parser.h" #include "vc_config_mgr.h" @@ -39,6 +40,10 @@ static GSList* g_demandable_client_list = NULL; static float g_volume_db = 0; +static int g_daemon_pid = 0; + +static int g_feature_enabled = -1; + static Eina_Bool __vc_mgr_notify_state_changed(void *data); static Eina_Bool __vc_mgr_notify_error(void *data); static Eina_Bool __vc_mgr_notify_result(void *data); @@ -82,10 +87,40 @@ static void __vc_mgr_lang_changed_cb(const char* before_lang, const char* curren return; } +static int __vc_mgr_get_feature_enabled() +{ + if (0 == g_feature_enabled) { + SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Voice control feature NOT supported"); + return VC_ERROR_NOT_SUPPORTED; + } else if (-1 == g_feature_enabled) { + bool vc_supported = false; + bool mic_supported = false; + if (0 == system_info_get_platform_bool(VC_FEATURE_PATH, &vc_supported)) { + if (0 == system_info_get_platform_bool(VC_MIC_FEATURE_PATH, &mic_supported)) { + if (false == vc_supported || false == mic_supported) { + SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Voice control feature NOT supported"); + g_feature_enabled = 0; + return VC_ERROR_NOT_SUPPORTED; + } + + g_feature_enabled = 1; + } + } + } + + return 0; +} + int vc_mgr_initialize() { SLOG(LOG_DEBUG, TAG_VCM, "===== [Manager] Initialize"); + + if (0 != __vc_mgr_get_feature_enabled()) { + SLOG(LOG_DEBUG, TAG_VCM, "===== [Manager] not supported"); + return VC_ERROR_NOT_SUPPORTED; + } + /* check handle */ if (true == vc_mgr_client_is_valid(g_vc_m)) { SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Already initialized"); @@ -190,6 +225,69 @@ int vc_mgr_deinitialize() static Eina_Bool __vc_mgr_connect_daemon(void *data) { + /* request initialization */ + int ret = -1; + int service_state = 0; + int foreground = VC_RUNTIME_INFO_NO_FOREGROUND; + + g_m_connect_timer = NULL; + + ret = vc_mgr_dbus_request_initialize(g_vc_m->handle, &service_state, &foreground, &g_daemon_pid); + + if (VC_ERROR_ENGINE_NOT_FOUND == ret) { + SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Fail to initialize : %s", __vc_mgr_get_error_code(ret)); + + vc_mgr_client_set_error(g_vc_m, VC_ERROR_ENGINE_NOT_FOUND); + ecore_timer_add(0, __vc_mgr_notify_error, g_vc_m); + + SLOG(LOG_DEBUG, TAG_VCM, "====="); + SLOG(LOG_DEBUG, TAG_VCM, " "); + return EINA_FALSE; + + } else if (0 != ret) { + SLOG(LOG_ERROR, TAG_VCM, "[WARNING] Fail to connection. Retry to connect : %s", __vc_mgr_get_error_code(ret)); + return EINA_TRUE; + } else { + /* Success to connect */ + } + + /* Set service state */ + vc_mgr_client_set_service_state(g_vc_m, (vc_service_state_e)service_state); + + /* Set foreground */ + vc_mgr_client_set_foreground(g_vc_m, foreground, true); + + SLOG(LOG_DEBUG, TAG_VCM, "[SUCCESS] Connected daemon"); + + 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; + vc_state_e before_state; + + vc_mgr_client_get_before_state(g_vc_m, ¤t_state, &before_state); + + if (NULL != changed_callback) { + vc_mgr_client_use_callback(g_vc_m); + changed_callback(before_state, current_state, user_data); + vc_mgr_client_not_use_callback(g_vc_m); + SLOG(LOG_DEBUG, TAG_VCM, "State changed callback is called"); + } else { + SLOG(LOG_WARN, TAG_VCM, "[WARNING] State changed callback is null"); + } + + SLOG(LOG_DEBUG, TAG_VCM, "====="); + SLOG(LOG_DEBUG, TAG_VCM, " "); + + return EINA_FALSE; +} + +static Eina_Bool __vc_mgr_prepare_daemon(void *data) +{ /* Send hello */ if (0 != vc_mgr_dbus_request_hello()) { return EINA_TRUE; @@ -198,11 +296,14 @@ static Eina_Bool __vc_mgr_connect_daemon(void *data) g_m_connect_timer = NULL; SLOG(LOG_DEBUG, TAG_VCM, "===== [Manager] Connect daemon"); + g_m_connect_timer = ecore_idler_add(__vc_mgr_connect_daemon, data); + +#if 0 /* request initialization */ int ret = -1; int service_state = 0; int foreground = VC_RUNTIME_INFO_NO_FOREGROUND; - ret = vc_mgr_dbus_request_initialize(g_vc_m->handle, &service_state, &foreground); + ret = vc_mgr_dbus_request_initialize(g_vc_m->handle, &service_state, &foreground, &g_daemon_pid); if (VC_ERROR_ENGINE_NOT_FOUND == ret) { SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Fail to initialize : %s", __vc_mgr_get_error_code(ret)); @@ -252,7 +353,7 @@ static Eina_Bool __vc_mgr_connect_daemon(void *data) SLOG(LOG_DEBUG, TAG_VCM, "====="); SLOG(LOG_DEBUG, TAG_VCM, " "); - +#endif return EINA_FALSE; } @@ -276,7 +377,7 @@ int vc_mgr_prepare() return VC_ERROR_INVALID_STATE; } - g_m_connect_timer = ecore_timer_add(0, __vc_mgr_connect_daemon, NULL); + g_m_connect_timer = ecore_timer_add(0, __vc_mgr_prepare_daemon, NULL); SLOG(LOG_DEBUG, TAG_VCM, "====="); SLOG(LOG_DEBUG, TAG_VCM, " "); @@ -795,6 +896,11 @@ int vc_mgr_get_audio_type(char** audio_id) vc_mgr_client_get_audio_type(g_vc_m, &temp); + if (NULL != temp) { + free(temp); + temp = NULL; + } + if (NULL == temp) { /* Not initiallized */ int ret = -1; @@ -1412,6 +1518,90 @@ static Eina_Bool __vc_mgr_set_select_result(void *data) return EINA_FALSE; } +int vc_mgr_set_nlp_info(const char* info) +{ + return 0; +} + +int vc_mgr_get_nlp_info(char** info) +{ + SLOG(LOG_DEBUG, TAG_VCM, "===== [Manager] Get nlp info"); + + vc_service_state_e service_state = -1; + vc_mgr_client_get_service_state(g_vc_m, &service_state); + if (service_state != VC_SERVICE_STATE_PROCESSING) { + vc_recognition_mode_e recognition_mode; + 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_DEBUG, TAG_VCM, "====="); + SLOG(LOG_DEBUG, TAG_VCM, " "); + return VC_ERROR_INVALID_STATE; + } + } + + int ret = -1; + ret = vc_info_parser_get_nlp_info(info); + if (0 != ret) { + SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Fail to get nlp_info"); + } + + if (0 == strncmp(*info, "null", strlen("null"))) { + SLOG(LOG_DEBUG, TAG_VCM, "Get nlp info (NULL)"); + *info = NULL; + } + + SLOG(LOG_DEBUG, TAG_VCM, "====="); + SLOG(LOG_DEBUG, TAG_VCM, " "); + + return 0; +} + +int vc_mgr_set_pre_result_cb(vc_mgr_pre_result_cb callback, void* user_data) +{ + if (NULL == callback){ + SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Set error callback : callback is NULL"); + 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 error 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 error callback : Current state is not 'Initialized'"); + return VC_ERROR_INVALID_STATE; + } + + vc_mgr_client_set_pre_result_cb(g_vc_m, callback, user_data); + + SLOG(LOG_DEBUG, TAG_VCM, "[SUCCESS] Set pre result callback"); + return 0; +} + +int vc_mgr_unset_pre_result_cb() +{ + vc_state_e state; + if (0 != vc_mgr_client_get_client_state(g_vc_m, &state)) { + SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Unset error 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 error callback : Current state is not 'Initialized'"); + return VC_ERROR_INVALID_STATE; + } + + vc_mgr_client_set_pre_result_cb(g_vc_m, NULL, NULL); + + return 0; +} + static void __vc_mgr_notify_all_result(vc_result_type_e result_type) { char* temp_text = NULL; @@ -1542,6 +1732,46 @@ static Eina_Bool __vc_mgr_notify_result(void *data) return EINA_FALSE; } +static Eina_Bool __vc_mgr_notify_pre_result(void *data) +{ + vc_mgr_pre_result_cb callback = NULL; + void* user_data = NULL; + int event = -1; + char* pre_result = NULL; + + vc_mgr_client_get_pre_resut_cb(g_vc_m, &callback, &user_data); + if (NULL == callback) { + SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Client speech detected callback is NULL"); + return EINA_FALSE; + } + + vc_mgr_client_get_pre_result(g_vc_m, &event, &pre_result); + + vc_mgr_client_use_callback(g_vc_m); + callback(event, pre_result, user_data); + vc_mgr_client_not_use_callback(g_vc_m); + SLOG(LOG_DEBUG, TAG_VCM, "Speech detected callback called"); + + if (NULL != pre_result) { + free(pre_result); + } + + vc_mgr_client_unset_pre_result(g_vc_m); + + return EINA_FALSE; +} + +void __vc_mgr_cb_pre_result(int event, const char* pre_result) +{ + if (0 != vc_mgr_client_set_pre_result(g_vc_m, event, pre_result)) { + SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Client speech detected callback is NULL"); + } + + ecore_timer_add(0, __vc_mgr_notify_pre_result, NULL); + + return; +} + void __vc_mgr_cb_all_result(vc_result_type_e type) { if (false == vc_mgr_client_get_exclusive_command(g_vc_m)) { @@ -1692,13 +1922,31 @@ static Eina_Bool __vc_mgr_notify_error(void *data) return EINA_FALSE; } -int __vc_mgr_cb_error(int pid, int reason) +int __vc_mgr_cb_error(int reason, int daemon_pid, char* msg) { - if (0 != vc_mgr_client_get_handle(pid, &g_vc_m)) { - SLOG(LOG_ERROR, TAG_VCM, "Handle is not valid"); + vc_state_e state; + if (0 != vc_mgr_client_get_client_state(g_vc_m, &state)) { + SLOG(LOG_ERROR, TAG_VCM, "[WARNING] Invalid client"); + return -1; + } + + /* check state */ + if (state != VC_STATE_READY) { + SLOG(LOG_ERROR, TAG_VCM, "[WARNING] not connected client yet"); return -1; } + if ((daemon_pid == g_daemon_pid) && (VC_ERROR_SERVICE_RESET == reason)) { + SLOG(LOG_ERROR, TAG_VCM, "[WARNING] This is first initializing, not daemon reset"); + return -1; + } + SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Error reason(%d), msg(%s)", reason, msg); + + if (VC_ERROR_SERVICE_RESET == reason) { + vc_mgr_client_set_client_state(g_vc_m, VC_STATE_INITIALIZED); + __vc_mgr_notify_state_changed(NULL); + } + vc_mgr_client_set_error(g_vc_m, reason); __vc_mgr_notify_error(g_vc_m); @@ -1748,6 +1996,7 @@ int vc_mgr_set_state_changed_cb(vc_state_changed_cb callback, void* user_data) vc_mgr_client_set_state_changed_cb(g_vc_m, callback, user_data); + SLOG(LOG_DEBUG, TAG_VCM, "[SUCCESS] Set state changed callback"); return 0; } @@ -1823,6 +2072,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"); return 0; } @@ -1863,6 +2113,7 @@ int vc_mgr_set_speech_detected_cb(vc_mgr_begin_speech_detected_cb callback, void vc_mgr_client_set_speech_detected_cb(g_vc_m, callback, user_data); + SLOG(LOG_DEBUG, TAG_VCM, "[SUCCESS] Set speech detected callback"); return 0; } @@ -1903,6 +2154,7 @@ int vc_mgr_set_current_language_changed_cb(vc_current_language_changed_cb callba vc_mgr_client_set_current_lang_changed_cb(g_vc_m, callback, user_data); + SLOG(LOG_DEBUG, TAG_VCM, "[SUCCESS] Set current language changed callback"); return 0; } diff --git a/client/vc_mgr_client.c b/client/vc_mgr_client.c index f0855db..68d0866 100644 --- a/client/vc_mgr_client.c +++ b/client/vc_mgr_client.c @@ -39,11 +39,17 @@ typedef struct { void* speech_detected_user_data; vc_current_language_changed_cb current_lang_changed_cb; void* current_lang_changed_user_data; + vc_mgr_pre_result_cb pre_result_cb; + void* pre_result_user_data; /* All result */ vc_result_event_e all_result_event; char* all_result_text; + /* Pre result */ + vc_pre_result_event_e pre_result_event; + char* pre_result_text; + /* exclusive command flag */ bool exclusive_cmd_option; @@ -155,11 +161,15 @@ int vc_mgr_client_create(vc_h* vc) client->speech_detected_user_data = NULL; client->current_lang_changed_cb = NULL; client->current_lang_changed_user_data = NULL; + client->pre_result_cb = NULL; + client->pre_result_user_data = NULL; client->exclusive_cmd_option = false; client->all_result_event = 0; client->all_result_text = NULL; + client->pre_result_event = 0; + client->pre_result_text = NULL; client->result_event = -1; client->result_text = NULL; @@ -175,6 +185,8 @@ int vc_mgr_client_create(vc_h* vc) client->audio_id = NULL; client->recognition_mode = VC_RECOGNITION_MODE_STOP_BY_SILENCE; + client->reason = 0; + client->cb_ref_count = 0; /* Authoriry */ @@ -504,6 +516,33 @@ int vc_mgr_client_get_error_cb(vc_h vc, vc_error_cb* callback, void** user_data) return 0; } +int vc_mgr_client_set_pre_result_cb(vc_h vc, vc_mgr_pre_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->pre_result_cb = callback; + client->pre_result_user_data = user_data; + + return 0; +} + +int vc_mgr_client_get_pre_resut_cb(vc_h vc, vc_mgr_pre_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->pre_result_cb; + *user_data = client->pre_result_user_data; + + return 0; +} /* set/get option */ int vc_mgr_client_set_service_state(vc_h vc, vc_service_state_e state) @@ -698,6 +737,63 @@ int vc_mgr_client_unset_all_result(vc_h vc) return 0; } +int vc_mgr_client_set_pre_result(vc_h vc, int event, const char* pre_result) +{ + vc_mgr_client_s* client = __mgr_client_get(vc); + + /* check handle */ + if (NULL == client) + return VC_ERROR_INVALID_PARAMETER; + + client->pre_result_event = event; + + if (NULL != client->pre_result_text) { + free(client->pre_result_text); + } + client->pre_result_text = strdup(pre_result); + + return 0; +} + +int vc_mgr_client_get_pre_result(vc_h vc, int* event, char** pre_result) +{ + vc_mgr_client_s* client = __mgr_client_get(vc); + + /* check handle */ + if (NULL == client) + return VC_ERROR_INVALID_PARAMETER; + + *event = client->pre_result_event; + + if (NULL != pre_result) { + if (NULL != client->pre_result_text) { + *pre_result = strdup(client->pre_result_text); + } else { + *pre_result = NULL; + } + } + + return 0; +} + +int vc_mgr_client_unset_pre_result(vc_h vc) +{ + vc_mgr_client_s* client = __mgr_client_get(vc); + + /* check handle */ + if (NULL == client) + return VC_ERROR_INVALID_PARAMETER; + + client->pre_result_event = -1; + + if (NULL != client->pre_result_text) { + free(client->pre_result_text); + client->pre_result_text = NULL; + } + + return 0; +} + int vc_mgr_client_set_audio_type(vc_h vc, const char* audio_id) { vc_mgr_client_s* client = __mgr_client_get(vc); diff --git a/client/vc_mgr_client.h b/client/vc_mgr_client.h index e69fed9..d29598e 100644 --- a/client/vc_mgr_client.h +++ b/client/vc_mgr_client.h @@ -72,6 +72,9 @@ int vc_mgr_client_set_error_cb(vc_h vc, vc_error_cb callback, void* user_data); int vc_mgr_client_get_error_cb(vc_h vc, vc_error_cb* callback, void** user_data); +int vc_mgr_client_set_pre_result_cb(vc_h vc, vc_mgr_pre_result_cb callback, void* user_data); + +int vc_mgr_client_get_pre_resut_cb(vc_h vc, vc_mgr_pre_result_cb* callback, void** user_data); /* * set/get option @@ -102,6 +105,12 @@ int vc_mgr_client_get_all_result(vc_h vc, int* event, char** result_text); int vc_mgr_client_unset_all_result(vc_h vc); +int vc_mgr_client_set_pre_result(vc_h vc, int event, const char* pre_result); + +int vc_mgr_client_get_pre_result(vc_h vc, int* event, char** pre_result); + +int vc_mgr_client_unset_pre_result(vc_h vc); + int vc_mgr_client_set_audio_type(vc_h vc, const char* audio_id); int vc_mgr_client_get_audio_type(vc_h vc, char** audio_id); diff --git a/client/vc_mgr_dbus.c b/client/vc_mgr_dbus.c index 5a35278..40f345e 100644 --- a/client/vc_mgr_dbus.c +++ b/client/vc_mgr_dbus.c @@ -30,6 +30,7 @@ static DBusConnection* g_m_conn_listener = NULL; static int g_volume_count = 0; +extern void __vc_mgr_cb_pre_result(int event, const char* pre_result); extern void __vc_mgr_cb_all_result(vc_result_type_e type); @@ -37,7 +38,7 @@ extern void __vc_mgr_cb_system_result(); extern void __vc_mgr_cb_speech_detected(); -extern int __vc_mgr_cb_error(int pid, int reason); +extern int __vc_mgr_cb_error(int reason, int daemon_pid, char* msg); extern int __vc_mgr_cb_set_volume(float volume); @@ -164,6 +165,22 @@ static Eina_Bool vc_mgr_listener_event_callback(void* data, Ecore_Fd_Handler *fd } /* VCD_MANAGER_METHOD_SPEECH_DETECTED */ + else if (dbus_message_is_method_call(msg, if_name, VCD_MANAGER_METHOD_PRE_RESULT)) { + SLOG(LOG_DEBUG, TAG_VCM, "===== Get Pre Result"); + int event; + char* pre_result = NULL; + + dbus_message_get_args(msg, &err, DBUS_TYPE_INT32, &event, DBUS_TYPE_STRING, &pre_result, DBUS_TYPE_INVALID); + + if (NULL != pre_result) { + __vc_mgr_cb_pre_result(event, pre_result); + } + + SLOG(LOG_DEBUG, TAG_VCM, "====="); + SLOG(LOG_DEBUG, TAG_VCM, " "); + + } /* VCD_MANAGER_METHOD_PRE_RESULT */ + else if (dbus_message_is_method_call(msg, if_name, VCD_MANAGER_METHOD_ALL_RESULT)) { SLOG(LOG_DEBUG, TAG_VCM, "===== Get All Result"); int result_type = 0; @@ -208,24 +225,25 @@ static Eina_Bool vc_mgr_listener_event_callback(void* data, Ecore_Fd_Handler *fd SLOG(LOG_DEBUG, TAG_VCM, " "); } /* VCC_MANAGER_METHOD_SET_FOREGROUND */ - else if (dbus_message_is_method_call(msg, if_name, VCD_MANAGER_METHOD_ERROR)) { + else if (dbus_message_is_signal(msg, if_name, VCD_MANAGER_METHOD_ERROR)) { SLOG(LOG_DEBUG, TAG_VCM, "===== Get Error"); - int pid; int reason; + int daemon_pid; char* err_msg; dbus_message_get_args(msg, &err, - DBUS_TYPE_INT32, &pid, DBUS_TYPE_INT32, &reason, + DBUS_TYPE_INT32, &daemon_pid, DBUS_TYPE_STRING, &err_msg, DBUS_TYPE_INVALID); if (dbus_error_is_set(&err)) { SLOG(LOG_ERROR, TAG_VCM, "<<<< vc mgr Get Error message : Get arguments error (%s)", err.message); dbus_error_free(&err); - } else { - SLOG(LOG_DEBUG, TAG_VCM, "<<<< vc mgr Get Error message : pid(%d), reason(%d), msg(%s)", pid, reason, err_msg); - __vc_mgr_cb_error(pid, reason); + } + else { + SLOG(LOG_ERROR, TAG_VCM, "<<<< vc mgr Get Error message : reason(%d), daemon_pid(%d), msg(%s)", reason, daemon_pid, err_msg); + __vc_mgr_cb_error(reason, daemon_pid, err_msg); } SLOG(LOG_DEBUG, TAG_VCM, "====="); @@ -552,6 +570,9 @@ int vc_mgr_dbus_close_connection() dbus_connection_close(g_m_conn_sender); dbus_connection_close(g_m_conn_listener); + dbus_connection_unref(g_m_conn_sender); + dbus_connection_unref(g_m_conn_listener); + g_m_conn_sender = NULL; g_m_conn_listener = NULL; @@ -619,8 +640,53 @@ int vc_mgr_dbus_request_hello() return result; } -int vc_mgr_dbus_request_initialize(int pid, int* service_state, int* foreground) +static int __dbus_restore_daemon() { + int ret = -1; + int count = 0; + while (0 != ret) { + ret = vc_mgr_dbus_request_hello(); + if (0 != ret) { + if (VC_ERROR_TIMED_OUT != ret) { + SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Fail to restore daemon"); + break; + } else { + SLOG(LOG_WARN, TAG_VCM, "[WARNING] retry restore daemon"); + usleep(10000); + count++; + if (VC_RETRY_COUNT == count) { + SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Fail to request"); + break; + } + } + } else { + SLOG(LOG_ERROR, TAG_VCM, "[SUCCESS] restore daemon"); + } + } + return ret; +} + +int vc_mgr_dbus_request_initialize(int pid, int* service_state, int* foreground, int* daemon_pid) +{ + DBusError err; + dbus_error_init(&err); + + bool exist = dbus_bus_name_has_owner(g_m_conn_sender, VC_SERVER_SERVICE_NAME, &err); + if (dbus_error_is_set(&err)) { + SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Dbus Error (%s)", err.message); + dbus_error_free(&err); + } + + int ret; + if (false == exist) { + ret = __dbus_restore_daemon(); + if (VC_ERROR_NONE != ret) { + SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Fail to restore daemon"); + return VC_ERROR_TIMED_OUT; + } + return VC_ERROR_OPERATION_FAILED; + } + DBusMessage* msg; msg = dbus_message_new_method_call( @@ -640,9 +706,6 @@ int vc_mgr_dbus_request_initialize(int pid, int* service_state, int* foreground) DBUS_TYPE_INT32, &pid, DBUS_TYPE_INVALID); - DBusError err; - dbus_error_init(&err); - DBusMessage* result_msg; int result = VC_ERROR_OPERATION_FAILED; @@ -657,10 +720,12 @@ int vc_mgr_dbus_request_initialize(int pid, int* service_state, int* foreground) if (NULL != result_msg) { int tmp_service_state = 0; int tmp_foreground = 0; + int tmp_daemon_pid = 0; dbus_message_get_args(result_msg, &err, DBUS_TYPE_INT32, &result, DBUS_TYPE_INT32, &tmp_service_state, DBUS_TYPE_INT32, &tmp_foreground, + DBUS_TYPE_INT32, &tmp_daemon_pid, DBUS_TYPE_INVALID); if (dbus_error_is_set(&err)) { @@ -674,8 +739,9 @@ int vc_mgr_dbus_request_initialize(int pid, int* service_state, int* foreground) if (0 == result) { *service_state = tmp_service_state; *foreground = tmp_foreground; - SLOG(LOG_DEBUG, TAG_VCM, "<<<< vc mgr initialize : result = %d, service state = %d, foreground = %d", - result, *service_state, *foreground); + *daemon_pid = tmp_daemon_pid; + SLOG(LOG_DEBUG, TAG_VCM, "<<<< vc mgr initialize : result = %d, service state = %d, foreground = %d, daemon_pid = %d", + result, *service_state, *foreground, *daemon_pid); } else { SLOG(LOG_ERROR, TAG_VCM, "<<<< vc mgr initialize : result = %d", result); } @@ -690,6 +756,25 @@ int vc_mgr_dbus_request_initialize(int pid, int* service_state, int* foreground) int vc_mgr_dbus_request_finalize(int pid) { + DBusError err; + dbus_error_init(&err); + + bool exist = dbus_bus_name_has_owner(g_m_conn_sender, VC_SERVER_SERVICE_NAME, &err); + if (dbus_error_is_set(&err)) { + SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Dbus Error (%s)", err.message); + dbus_error_free(&err); + } + + int ret; + if (false == exist) { + ret = __dbus_restore_daemon(); + if (VC_ERROR_NONE != ret) { + SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Fail to restore daemon"); + return VC_ERROR_TIMED_OUT; + } + return VC_ERROR_OPERATION_FAILED; + } + DBusMessage* msg; msg = dbus_message_new_method_call( @@ -707,9 +792,6 @@ int vc_mgr_dbus_request_finalize(int pid) dbus_message_append_args(msg, DBUS_TYPE_INT32, &pid, DBUS_TYPE_INVALID); - DBusError err; - dbus_error_init(&err); - DBusMessage* result_msg; int result = VC_ERROR_OPERATION_FAILED; @@ -750,6 +832,25 @@ int vc_mgr_dbus_request_finalize(int pid) int vc_mgr_dbus_request_set_command(int pid) { + DBusError err; + dbus_error_init(&err); + + bool exist = dbus_bus_name_has_owner(g_m_conn_sender, VC_SERVER_SERVICE_NAME, &err); + if (dbus_error_is_set(&err)) { + SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Dbus Error (%s)", err.message); + dbus_error_free(&err); + } + + int ret; + if (false == exist) { + ret = __dbus_restore_daemon(); + if (VC_ERROR_NONE != ret) { + SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Fail to restore daemon"); + return VC_ERROR_TIMED_OUT; + } + return VC_ERROR_OPERATION_FAILED; + } + DBusMessage* msg; msg = dbus_message_new_method_call( @@ -769,9 +870,6 @@ int vc_mgr_dbus_request_set_command(int pid) DBUS_TYPE_INT32, &pid, DBUS_TYPE_INVALID); - DBusError err; - dbus_error_init(&err); - DBusMessage* result_msg; int result = VC_ERROR_OPERATION_FAILED; @@ -811,6 +909,25 @@ int vc_mgr_dbus_request_set_command(int pid) int vc_mgr_dbus_request_unset_command(int pid) { + DBusError err; + dbus_error_init(&err); + + bool exist = dbus_bus_name_has_owner(g_m_conn_sender, VC_SERVER_SERVICE_NAME, &err); + if (dbus_error_is_set(&err)) { + SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Dbus Error (%s)", err.message); + dbus_error_free(&err); + } + + int ret; + if (false == exist) { + ret = __dbus_restore_daemon(); + if (VC_ERROR_NONE != ret) { + SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Fail to restore daemon"); + return VC_ERROR_TIMED_OUT; + } + return VC_ERROR_OPERATION_FAILED; + } + DBusMessage* msg; msg = dbus_message_new_method_call( @@ -830,9 +947,6 @@ int vc_mgr_dbus_request_unset_command(int pid) DBUS_TYPE_INT32, &pid, DBUS_TYPE_INVALID); - DBusError err; - dbus_error_init(&err); - DBusMessage* result_msg; int result = VC_ERROR_OPERATION_FAILED; @@ -872,6 +986,25 @@ int vc_mgr_dbus_request_unset_command(int pid) int vc_mgr_dbus_request_demandable_client(int pid) { + DBusError err; + dbus_error_init(&err); + + bool exist = dbus_bus_name_has_owner(g_m_conn_sender, VC_SERVER_SERVICE_NAME, &err); + if (dbus_error_is_set(&err)) { + SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Dbus Error (%s)", err.message); + dbus_error_free(&err); + } + + int ret; + if (false == exist) { + ret = __dbus_restore_daemon(); + if (VC_ERROR_NONE != ret) { + SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Fail to restore daemon"); + return VC_ERROR_TIMED_OUT; + } + return VC_ERROR_OPERATION_FAILED; + } + DBusMessage* msg; msg = dbus_message_new_method_call( @@ -891,9 +1024,6 @@ int vc_mgr_dbus_request_demandable_client(int pid) DBUS_TYPE_INT32, &pid, DBUS_TYPE_INVALID); - DBusError err; - dbus_error_init(&err); - DBusMessage* result_msg; int result = VC_ERROR_OPERATION_FAILED; @@ -933,6 +1063,25 @@ int vc_mgr_dbus_request_demandable_client(int pid) int vc_mgr_dbus_request_set_audio_type(int pid, const char* audio_type) { + DBusError err; + dbus_error_init(&err); + + bool exist = dbus_bus_name_has_owner(g_m_conn_sender, VC_SERVER_SERVICE_NAME, &err); + if (dbus_error_is_set(&err)) { + SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Dbus Error (%s)", err.message); + dbus_error_free(&err); + } + + int ret; + if (false == exist) { + ret = __dbus_restore_daemon(); + if (VC_ERROR_NONE != ret) { + SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Fail to restore daemon"); + return VC_ERROR_TIMED_OUT; + } + return VC_ERROR_OPERATION_FAILED; + } + DBusMessage* msg; /* create a signal & check for errors */ @@ -954,9 +1103,6 @@ int vc_mgr_dbus_request_set_audio_type(int pid, const char* audio_type) DBUS_TYPE_STRING, &(audio_type), DBUS_TYPE_INVALID); - DBusError err; - dbus_error_init(&err); - DBusMessage* result_msg; int result = VC_ERROR_OPERATION_FAILED; @@ -996,6 +1142,25 @@ int vc_mgr_dbus_request_set_audio_type(int pid, const char* audio_type) int vc_mgr_dbus_request_get_audio_type(int pid, char** audio_type) { + DBusError err; + dbus_error_init(&err); + + bool exist = dbus_bus_name_has_owner(g_m_conn_sender, VC_SERVER_SERVICE_NAME, &err); + if (dbus_error_is_set(&err)) { + SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Dbus Error (%s)", err.message); + dbus_error_free(&err); + } + + int ret; + if (false == exist) { + ret = __dbus_restore_daemon(); + if (VC_ERROR_NONE != ret) { + SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Fail to restore daemon"); + return VC_ERROR_TIMED_OUT; + } + return VC_ERROR_OPERATION_FAILED; + } + DBusMessage* msg; /* create a signal & check for errors */ @@ -1016,8 +1181,6 @@ int vc_mgr_dbus_request_get_audio_type(int pid, char** audio_type) DBUS_TYPE_INT32, &pid, DBUS_TYPE_INVALID); - DBusError err; - dbus_error_init(&err); DBusMessage* result_msg; int result = VC_ERROR_OPERATION_FAILED; @@ -1063,6 +1226,25 @@ int vc_mgr_dbus_request_get_audio_type(int pid, char** audio_type) int vc_mgr_dbus_request_set_client_info(int pid) { + DBusError err; + dbus_error_init(&err); + + bool exist = dbus_bus_name_has_owner(g_m_conn_sender, VC_SERVER_SERVICE_NAME, &err); + if (dbus_error_is_set(&err)) { + SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Dbus Error (%s)", err.message); + dbus_error_free(&err); + } + + int ret; + if (false == exist) { + ret = __dbus_restore_daemon(); + if (VC_ERROR_NONE != ret) { + SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Fail to restore daemon"); + return VC_ERROR_TIMED_OUT; + } + return VC_ERROR_OPERATION_FAILED; + } + DBusMessage* msg; /* create a signal & check for errors */ @@ -1083,9 +1265,6 @@ int vc_mgr_dbus_request_set_client_info(int pid) DBUS_TYPE_INT32, &pid, DBUS_TYPE_INVALID); - DBusError err; - dbus_error_init(&err); - DBusMessage* result_msg; int result = VC_ERROR_OPERATION_FAILED; @@ -1125,6 +1304,25 @@ int vc_mgr_dbus_request_set_client_info(int pid) int vc_mgr_dbus_request_start(int pid, int recognition_mode, bool exclusive_command_option, bool start_by_client) { + DBusError err; + dbus_error_init(&err); + + bool exist = dbus_bus_name_has_owner(g_m_conn_sender, VC_SERVER_SERVICE_NAME, &err); + if (dbus_error_is_set(&err)) { + SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Dbus Error (%s)", err.message); + dbus_error_free(&err); + } + + int ret; + if (false == exist) { + ret = __dbus_restore_daemon(); + if (VC_ERROR_NONE != ret) { + SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Fail to restore daemon"); + return VC_ERROR_TIMED_OUT; + } + return VC_ERROR_OPERATION_FAILED; + } + DBusMessage* msg; /* create a signal & check for errors */ @@ -1152,9 +1350,6 @@ int vc_mgr_dbus_request_start(int pid, int recognition_mode, bool exclusive_comm DBUS_TYPE_INT32, &(by), DBUS_TYPE_INVALID); - DBusError err; - dbus_error_init(&err); - DBusMessage* result_msg; int result = VC_ERROR_OPERATION_FAILED; @@ -1194,6 +1389,25 @@ int vc_mgr_dbus_request_start(int pid, int recognition_mode, bool exclusive_comm int vc_mgr_dbus_request_stop(int pid) { + DBusError err; + dbus_error_init(&err); + + bool exist = dbus_bus_name_has_owner(g_m_conn_sender, VC_SERVER_SERVICE_NAME, &err); + if (dbus_error_is_set(&err)) { + SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Dbus Error (%s)", err.message); + dbus_error_free(&err); + } + + int ret; + if (false == exist) { + ret = __dbus_restore_daemon(); + if (VC_ERROR_NONE != ret) { + SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Fail to restore daemon"); + return VC_ERROR_TIMED_OUT; + } + return VC_ERROR_OPERATION_FAILED; + } + DBusMessage* msg; /* create a signal & check for errors */ @@ -1214,9 +1428,6 @@ int vc_mgr_dbus_request_stop(int pid) DBUS_TYPE_INT32, &pid, DBUS_TYPE_INVALID); - DBusError err; - dbus_error_init(&err); - DBusMessage* result_msg; int result = VC_ERROR_OPERATION_FAILED; @@ -1256,6 +1467,25 @@ int vc_mgr_dbus_request_stop(int pid) int vc_mgr_dbus_request_cancel(int pid) { + DBusError err; + dbus_error_init(&err); + + bool exist = dbus_bus_name_has_owner(g_m_conn_sender, VC_SERVER_SERVICE_NAME, &err); + if (dbus_error_is_set(&err)) { + SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Dbus Error (%s)", err.message); + dbus_error_free(&err); + } + + int ret; + if (false == exist) { + ret = __dbus_restore_daemon(); + if (VC_ERROR_NONE != ret) { + SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Fail to restore daemon"); + return VC_ERROR_TIMED_OUT; + } + return VC_ERROR_OPERATION_FAILED; + } + DBusMessage* msg; /* create a signal & check for errors */ @@ -1276,9 +1506,6 @@ int vc_mgr_dbus_request_cancel(int pid) DBUS_TYPE_INT32, &pid, DBUS_TYPE_INVALID); - DBusError err; - dbus_error_init(&err); - DBusMessage* result_msg; int result = VC_ERROR_OPERATION_FAILED; diff --git a/client/vc_mgr_dbus.h b/client/vc_mgr_dbus.h index 486bd72..bd6215d 100644 --- a/client/vc_mgr_dbus.h +++ b/client/vc_mgr_dbus.h @@ -30,7 +30,7 @@ int vc_mgr_dbus_close_connection(); int vc_mgr_dbus_request_hello(); -int vc_mgr_dbus_request_initialize(int pid, int* service_state, int* foreground); +int vc_mgr_dbus_request_initialize(int pid, int* service_state, int* foreground, int* daemon_pid); int vc_mgr_dbus_request_finalize(int pid); diff --git a/client/vc_widget_dbus.c b/client/vc_widget_dbus.c index 1ad9ff2..2db6f72 100644 --- a/client/vc_widget_dbus.c +++ b/client/vc_widget_dbus.c @@ -339,6 +339,9 @@ int vc_widget_dbus_close_connection() dbus_connection_close(g_w_conn_sender); dbus_connection_close(g_w_conn_listener); + + dbus_connection_unref(g_w_conn_sender); + dbus_connection_unref(g_w_conn_listener); g_w_conn_sender = NULL; g_w_conn_listener = NULL; diff --git a/common/vc_config_mgr.c b/common/vc_config_mgr.c old mode 100755 new mode 100644 index e8d8dc5..b97959a --- a/common/vc_config_mgr.c +++ b/common/vc_config_mgr.c @@ -395,7 +395,7 @@ int __vc_config_set_auto_language() } if (true == __vc_config_mgr_check_lang_is_valid(g_config_info->engine_id, candidate_lang)) { - /* stt default language change */ + /* vc default language change */ char* before_lang = NULL; if (0 != vc_parser_set_language(candidate_lang)) { SLOG(LOG_ERROR, vc_config_tag(), "Fail to save default language"); diff --git a/common/vc_defs.h b/common/vc_defs.h index 3f09203..786b891 100644 --- a/common/vc_defs.h +++ b/common/vc_defs.h @@ -128,6 +128,7 @@ extern "C" { #define VCD_MANAGER_METHOD_HELLO "vcd_manager_method_hello" #define VCD_MANAGER_METHOD_SPEECH_DETECTED "vcd_manager_method_speech_detected" #define VCD_MANAGER_METHOD_ALL_RESULT "vcd_manager_method_all_result" +#define VCD_MANAGER_METHOD_PRE_RESULT "vcd_manager_method_pre_result" #define VCD_MANAGER_METHOD_RESULT "vcd_manager_method_result" #define VCD_MANAGER_METHOD_SET_VOLUME "vcd_manager_method_set_volume" #define VCD_MANAGER_METHOD_SET_SERVICE_STATE "vcd_manager_method_set_service_state" @@ -169,6 +170,8 @@ extern "C" { #define VC_RUNTIME_INFO_CLIENT tzplatform_mkpath(TZ_USER_HOME, "share/.voice/vc/vc-client-info.xml") +#define VC_RUNTIME_INFO_NLP_INFO tzplatform_mkpath(TZ_USER_HOME, "share/.voice/vc/vc-nlp-info.xml") + #define VC_NO_FOREGROUND_PID 0 #define VC_BASE_LANGUAGE "en_US" #define VC_RETRY_COUNT 5 diff --git a/common/vc_info_parser.c b/common/vc_info_parser.c index 321d924..b6e7142 100644 --- a/common/vc_info_parser.c +++ b/common/vc_info_parser.c @@ -1212,6 +1212,94 @@ int vc_info_parser_get_result(char** result_text, int* event, char** result_mess return 0; } +int vc_info_parser_set_nlp_info(const char* nlp_info) +{ + if (NULL == nlp_info) { + SLOG(LOG_ERROR, vc_info_tag(), "[ERROR] nlp info is NULL"); + return -1; + } + + remove(VC_RUNTIME_INFO_NLP_INFO); + + FILE* fp = NULL; + int write_size = -1; + + fp = fopen(VC_RUNTIME_INFO_NLP_INFO, "w+"); + if (NULL == fp) { + SLOG(LOG_ERROR, vc_info_tag(), "[ERROR] Fail to open file %s", VC_RUNTIME_INFO_NLP_INFO); + return -1; + } + + /* Write size */ + fprintf(fp, "size(%d)\n", strlen(nlp_info)); + + write_size = fwrite(nlp_info, 1, strlen(nlp_info), fp); + fclose(fp); + + if (0 >= write_size) { + SLOG(LOG_ERROR, vc_info_tag(), "[ERROR] Fail to write file"); + return -1; + } + + if (0 != __vc_info_parser_set_file_mode(VC_RUNTIME_INFO_NLP_INFO)) { + SLOG(LOG_ERROR, vc_info_tag(), "[ERROR] Fail to set file mode - %s", VC_RUNTIME_INFO_NLP_INFO); + } + + SLOG(LOG_DEBUG, vc_info_tag(), "[SUCCESS] Write file (%s) size (%d)", VC_RUNTIME_INFO_NLP_INFO, strlen(nlp_info)); + + return 0; +} + +int vc_info_parser_get_nlp_info(char** nlp_info) +{ + if (NULL == nlp_info) { + SLOG(LOG_ERROR, vc_info_tag(), "[ERROR] nlp info is NULL"); + return -1; + } + + FILE* fp = NULL; + int readn = 0; + + fp = fopen(VC_RUNTIME_INFO_NLP_INFO, "r"); + if (NULL == fp) { + SLOG(LOG_ERROR, vc_info_tag(), "[ERROR] Fail to open file %s", VC_RUNTIME_INFO_NLP_INFO); + return -1; + } + + int ret; + ret = fscanf(fp, "size(%d)\n", &readn); + if (ret <= 0) { + SLOG(LOG_DEBUG, vc_info_tag(), "[ERROR] Fail to get buffer size"); + fclose(fp); + return -1; + } + + SLOG(LOG_DEBUG, vc_info_tag(), "[DEBUG] buffer size (%d)", readn); + if (10000000 < readn || 0 > readn) { + SLOG(LOG_DEBUG, vc_info_tag(), "[ERROR] Invalid buffer size"); + fclose(fp); + return -1; + } + int tmp_readn = readn + 10; + + *nlp_info = (char*)calloc(tmp_readn, sizeof(char)); + if (NULL == *nlp_info) { + SLOG(LOG_ERROR, vc_info_tag(), "[ERROR] Out of memory"); + fclose(fp); + return -1; + } + + readn = fread(*nlp_info, 1, readn, fp); + fclose(fp); + + SLOG(LOG_DEBUG, vc_info_tag(), "[DEBUG] Read buffer (%d)", readn); + + /* remove(VC_RUNTIME_INFO_NLP_INFO); */ + + return 0; +} + + int vc_info_parser_unset_result(bool exclusive) { if (false == exclusive) { diff --git a/common/vc_info_parser.h b/common/vc_info_parser.h index fbf90cc..910e936 100644 --- a/common/vc_info_parser.h +++ b/common/vc_info_parser.h @@ -62,6 +62,10 @@ int vc_info_parser_set_result(const char* result_text, int event, const char* ms int vc_info_parser_get_result(char** result_text, int* event, char** result_message, int pid, vc_cmd_list_h vc_cmd_list, bool exclusive); +int vc_info_parser_set_nlp_info(const char* nlp_info); + +int vc_info_parser_get_nlp_info(char** nlp_info); + int vc_info_parser_unset_result(bool exclusive); int vc_info_parser_get_result_pid_list(GSList** pid_list); diff --git a/include/voice_control_common.h b/include/voice_control_common.h old mode 100755 new mode 100644 index 5724437..86b07ac --- a/include/voice_control_common.h +++ b/include/voice_control_common.h @@ -49,7 +49,8 @@ typedef enum { VC_ERROR_OPERATION_FAILED = TIZEN_ERROR_VOICE_CONTROL | 0x014, /**< Operation failed */ VC_ERROR_OPERATION_REJECTED = TIZEN_ERROR_VOICE_CONTROL | 0x015, /**< Operation rejected */ VC_ERROR_ITERATION_END = TIZEN_ERROR_VOICE_CONTROL | 0x016, /**< List reached end */ - VC_ERROR_EMPTY = TIZEN_ERROR_VOICE_CONTROL | 0x017 /**< List empty */ + VC_ERROR_EMPTY = TIZEN_ERROR_VOICE_CONTROL | 0x017, /**< List empty */ + VC_ERROR_SERVICE_RESET = TIZEN_ERROR_VOICE_CONTROL | 0x018 /**< Service Damon reset */ } vc_error_e; /** diff --git a/include/voice_control_manager.h b/include/voice_control_manager.h old mode 100755 new mode 100644 index 80476c6..8909b57 --- a/include/voice_control_manager.h +++ b/include/voice_control_manager.h @@ -39,6 +39,11 @@ extern "C" #define VC_AUDIO_TYPE_BLUETOOTH "VC_AUDIO_ID_BLUETOOTH" /**< Bluetooth audio type */ /** + * @brief Defines of audio-in type. +*/ +#define VC_AUDIO_TYPE_MSF "VC_AUDIO_ID_MSF" /**< MSF (wifi) audio type */ + +/** * @brief Definitions for foreground command type. * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif */ @@ -106,7 +111,16 @@ typedef enum { * @see vc_mgr_unset_all_result_cb() */ typedef bool (*vc_mgr_all_result_cb)(vc_result_event_e event, vc_cmd_list_h vc_cmd_list, - const char* result, const char* msg, void *user_data); + const char* result, const char* msg, void *user_data); + +typedef enum { + VC_PRE_RESULT_EVENT_FINAL_RESULT = 0, + VC_PRE_RESULT_EVENT_PARTIAL_RESULT, + VC_PRE_RESULT_EVENT_ERROR +}vc_pre_result_event_e; + +// support pre-result +typedef bool(*vc_mgr_pre_result_cb)(vc_pre_result_event_e event, const char* result, void *user_data); /** * @brief Called when user speaking is detected. @@ -519,6 +533,14 @@ int vc_mgr_get_recording_volume(float* volume); int vc_mgr_set_selected_results(vc_cmd_list_h vc_cmd_list); +int vc_mgr_set_nlp_info(const char* info); + +int vc_mgr_get_nlp_info(char** info); + +int vc_mgr_set_pre_result_cb(vc_mgr_pre_result_cb callback, void* user_data); + +int vc_mgr_unset_pre_result_cb(); + /** * @brief Registers a callback function for getting recognition result. * diff --git a/include/voice_control_plugin_engine.h b/include/voice_control_plugin_engine.h index 1c124c6..3d257a2 100644 --- a/include/voice_control_plugin_engine.h +++ b/include/voice_control_plugin_engine.h @@ -120,8 +120,17 @@ typedef int vcp_cmd_h; * * @see vcpe_stop() */ -typedef void (*vcpe_result_cb)(vcp_result_event_e event, int* result_id, int count, const char* all_result, - const char* non_fixed_result, const char* msg, void *user_data); +typedef void (*vcpe_result_cb)(vcp_result_event_e event, int* result_id, int count, + const char* all_result, const char* non_fixed_result, const char* msg, void *user_data); + +typedef enum { + VCP_PRE_RESULT_EVENT_FINAL_RESULT = 0, + VCP_PRE_RESULT_EVENT_PARTIAL_RESULT, + VCP_PRE_RESULT_EVENT_ERROR +}vcp_pre_result_event_e; + +// Add new +typedef void (*vcpe_pre_result_cb)(vcp_pre_result_event_e event, const char* pre_result, void *user_data); /** * @brief Called to retrieve the supported languages. @@ -181,6 +190,19 @@ typedef void (*vcpe_deinitialize)(void); typedef int (*vcpe_set_result_cb)(vcpe_result_cb callback, void* user_data); /** +* @brief Registers a callback function for getting partial recognition result. +* +* @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 +* +* @see vcpe_pre_result_cb() +*/ +typedef int (*vcpe_set_pre_result_cb)(vcpe_pre_result_cb callback, void* user_data); + + +/** * @brief Gets recording format of the engine. * * @param[in] audio_id The audio device id. @@ -267,6 +289,11 @@ typedef int (*vcpe_set_commands)(vcp_cmd_h vcp_command); */ typedef int (*vcpe_unset_commands)(); +// Add new +typedef int (*vcpe_set_nlp_info)(const char* info); + +typedef int (*vcpe_get_nlp_info)(char** info); + /** * @brief Start recognition. * @@ -422,10 +449,13 @@ typedef struct { vcpe_is_language_supported is_lang_supported; /**< Check language */ /* Set info */ + vcpe_set_pre_result_cb set_pre_result_cb; /**< Set pre result callback */ vcpe_set_result_cb set_result_cb; /**< Set result callback */ vcpe_set_language set_language; /**< Set language */ vcpe_set_commands set_commands; /**< Request to set current commands */ vcpe_unset_commands unset_commands; /**< Request to unset current commands */ + vcpe_set_nlp_info set_nlp_info; /**< Set nlp info */ + vcpe_get_nlp_info get_nlp_info; /**< Get nlp info */ /* Control recognition */ vcpe_start start; /**< Start recognition */ diff --git a/server/vcd_dbus.c b/server/vcd_dbus.c index f24f39f..6dbc6e6 100644 --- a/server/vcd_dbus.c +++ b/server/vcd_dbus.c @@ -253,6 +253,35 @@ int vcdc_send_result(int pid, int cmd_type) return 0; } +int vcdc_send_pre_result_to_manager(int manger_pid, int event, const char* pre_result) +{ + DBusError err; + dbus_error_init(&err); + + DBusMessage* msg = NULL; + + msg = __get_message(manger_pid, VCD_MANAGER_METHOD_PRE_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_INT32, &event, DBUS_TYPE_STRING, &pre_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) { DBusError err; @@ -398,43 +427,126 @@ int vcdc_send_service_state(vcd_state_e state) return 0; } -int vcdc_send_error_signal(int pid, int reason, char *err_msg) +int vcdc_send_error_signal_to_manager(int manager_pid, int reason, char *err_msg) { + SLOG(LOG_ERROR, TAG_VCD, ">>>> Send error signal to manager"); + if (NULL == err_msg) { SLOG(LOG_ERROR, TAG_VCD, "[Dbus ERROR] Input parameter is NULL"); return VCD_ERROR_INVALID_PARAMETER; } - char service_name[64] = {0, }; - snprintf(service_name, 64, "%s%d", VC_CLIENT_SERVICE_NAME, pid); + int daemon_pid; + DBusError err; + dbus_error_init(&err); - DBusMessage* msg; - SLOG(LOG_DEBUG, TAG_VCD, "[Dbus] send error signal : reason(%d), Error Msg(%s)", reason, err_msg); + DBusMessage* msg = NULL; - msg = dbus_message_new_method_call( - service_name, + msg = dbus_message_new_signal( + VC_MANAGER_SERVICE_OBJECT_PATH, + VC_MANAGER_SERVICE_INTERFACE, + VCD_MANAGER_METHOD_ERROR); + + if (NULL == msg) { + SLOG(LOG_ERROR, TAG_VCD, "[Dbus ERROR] Message is NULL"); + return VCD_ERROR_OUT_OF_MEMORY; + } + + daemon_pid = getpid(); + dbus_message_append_args(msg, DBUS_TYPE_INT32, &reason, DBUS_TYPE_INT32, &daemon_pid, DBUS_TYPE_STRING, &err_msg, DBUS_TYPE_INVALID); + + 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, "<<<< Send error signal to manager : reason(%d), Error Msg(%s)", reason, err_msg); + dbus_connection_flush(g_conn_sender); + } + + dbus_message_unref(msg); + + return 0; +} + +int vcdc_send_error_signal(int reason, char *err_msg) +{ + SLOG(LOG_ERROR, TAG_VCD, ">>>> Send error signal"); + + if (NULL == err_msg) { + SLOG(LOG_ERROR, TAG_VCD, "[Dbus ERROR] Input parameter is NULL"); + return VCD_ERROR_INVALID_PARAMETER; + } + + int daemon_pid; + DBusError err; + dbus_error_init(&err); + + DBusMessage* msg = NULL; + + msg = dbus_message_new_signal( + VC_MANAGER_SERVICE_OBJECT_PATH, + VC_MANAGER_SERVICE_INTERFACE, + VCD_MANAGER_METHOD_ERROR); + + if (NULL == msg) { + SLOG(LOG_ERROR, TAG_VCD, "[Dbus ERROR] Message is NULL"); + return VCD_ERROR_OUT_OF_MEMORY; + } + + daemon_pid = getpid(); + dbus_message_append_args(msg, DBUS_TYPE_INT32, &reason, DBUS_TYPE_INT32, &daemon_pid, DBUS_TYPE_STRING, &err_msg, DBUS_TYPE_INVALID); + + 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, "<<<< Send error signal to manager: reason(%d), daemon_pid(%d), Error Msg(%s)", reason, daemon_pid, err_msg); + dbus_connection_flush(g_conn_sender); + } + + dbus_message_unref(msg); + + msg = NULL; + msg = dbus_message_new_signal( VC_CLIENT_SERVICE_OBJECT_PATH, VC_CLIENT_SERVICE_INTERFACE, VCD_METHOD_ERROR); if (NULL == msg) { - SLOG(LOG_ERROR, TAG_VCD, "[Dbus ERROR] Fail to create message"); + SLOG(LOG_ERROR, TAG_VCD, "[Dbus ERROR] Message is NULL"); return VCD_ERROR_OUT_OF_MEMORY; } - dbus_message_append_args(msg, - DBUS_TYPE_INT32, &pid, - DBUS_TYPE_INT32, &reason, - DBUS_TYPE_STRING, &err_msg, - DBUS_TYPE_INVALID); + dbus_message_append_args(msg, DBUS_TYPE_INT32, &reason, DBUS_TYPE_INT32, &daemon_pid, DBUS_TYPE_STRING, &err_msg, 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, "<<<< Send error signal : reason(%d), daemon_pid(%d), Error Msg(%s)", reason, daemon_pid, err_msg); + dbus_connection_flush(g_conn_sender); + } + + dbus_message_unref(msg); + + msg = NULL; + msg = dbus_message_new_signal( + VC_WIDGET_SERVICE_OBJECT_PATH, + VC_WIDGET_SERVICE_INTERFACE, + VCD_WIDGET_METHOD_ERROR); + + 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, &reason, DBUS_TYPE_INT32, &daemon_pid, DBUS_TYPE_STRING, &err_msg, DBUS_TYPE_INVALID); 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"); + SLOG(LOG_DEBUG, TAG_VCD, "<<<< Send error signal to widget : reason(%d), daemon_pid(%d), Error Msg(%s)", reason, daemon_pid, err_msg); dbus_connection_flush(g_conn_sender); } @@ -655,6 +767,9 @@ int vcd_dbus_close_connection() dbus_connection_close(g_conn_listener); dbus_connection_close(g_conn_sender); + dbus_connection_unref(g_conn_listener); + dbus_connection_unref(g_conn_sender); + g_conn_listener = NULL; g_conn_sender = NULL; diff --git a/server/vcd_dbus.h b/server/vcd_dbus.h index f8a4966..f83e97d 100644 --- a/server/vcd_dbus.h +++ b/server/vcd_dbus.h @@ -43,11 +43,15 @@ int vcdc_send_set_volume(int manger_pid, float volume); int vcdc_send_result(int pid, int cmd_type); +int vcdc_send_pre_result_to_manager(int manger_pid, int event, const char* pre_result); + int vcdc_send_result_to_manager(int manger_pid, int result_type); int vcdc_send_speech_detected(int manger_pid); -int vcdc_send_error_signal(int pid, int reason, char *err_msg); +int vcdc_send_error_signal(int reason, char *err_msg); + +int vcdc_send_error_signal_to_manager(int manager_pid, int reason, char *err_msg); int vcdc_send_service_state(vcd_state_e state); diff --git a/server/vcd_dbus_server.c b/server/vcd_dbus_server.c index 3f2741b..2929eb0 100644 --- a/server/vcd_dbus_server.c +++ b/server/vcd_dbus_server.c @@ -90,6 +90,7 @@ int vcd_dbus_server_mgr_initialize(DBusConnection* conn, DBusMessage* msg) int pid; int service_state; int foreground; + int daemon_pid; int ret = VCD_ERROR_OPERATION_FAILED; dbus_message_get_args(msg, &err, @@ -106,8 +107,9 @@ int vcd_dbus_server_mgr_initialize(DBusConnection* conn, DBusMessage* msg) ret = vcd_server_mgr_initialize(pid); service_state = vcd_server_get_service_state(); foreground = vcd_server_get_foreground(); + daemon_pid = getpid(); - SLOG(LOG_DEBUG, TAG_VCD, "[IN] vcd mgr initialize : pid(%d) service state(%d) foreground(%d)", pid, service_state, foreground); + SLOG(LOG_DEBUG, TAG_VCD, "[IN] vcd mgr initialize : pid(%d) service state(%d) foreground(%d) daemon_pid(%d)", pid, service_state, foreground, daemon_pid); } DBusMessage* reply; @@ -118,6 +120,7 @@ int vcd_dbus_server_mgr_initialize(DBusConnection* conn, DBusMessage* msg) DBUS_TYPE_INT32, &ret, DBUS_TYPE_INT32, &service_state, DBUS_TYPE_INT32, &foreground, + DBUS_TYPE_INT32, &daemon_pid, DBUS_TYPE_INVALID); if (0 == ret) { diff --git a/server/vcd_engine_agent.c b/server/vcd_engine_agent.c index cdba7fe..cfa89ad 100644 --- a/server/vcd_engine_agent.c +++ b/server/vcd_engine_agent.c @@ -69,6 +69,7 @@ static vcengine_s g_dynamic_engine; static char* g_default_lang; /** callback functions */ +static pre_result_callback g_pre_result_cb; static result_callback g_result_cb; bool __supported_language_cb(const char* language, void* user_data); @@ -99,9 +100,9 @@ int __log_enginelist(); /* * VCS Engine Agent Interfaces */ -int vcd_engine_agent_init(result_callback result_cb) +int vcd_engine_agent_init(pre_result_callback pre_cb, result_callback result_cb) { - if (NULL == result_cb) { + if (NULL == pre_cb || NULL == result_cb) { SLOG(LOG_ERROR, TAG_VCD, "[Engine Agent ERROR] Input parameter is NULL"); return VCD_ERROR_OPERATION_FAILED; } @@ -120,6 +121,7 @@ int vcd_engine_agent_init(result_callback result_cb) g_agent_init = true; + g_pre_result_cb = pre_cb; g_result_cb = result_cb; if (0 != vcd_config_get_default_language(&g_default_lang)) { @@ -460,12 +462,45 @@ int __get_audio_type(char** audio_type) return vcd_recorder_get(audio_type); } +void __pre_result_cb(vcp_pre_result_event_e event, const char* pre_result, void* user_data) +{ + SLOG(LOG_DEBUG, TAG_VCD, "[Engine agent] Pre result(%s)", pre_result); + + if (NULL != g_pre_result_cb) { + g_pre_result_cb(event, pre_result, user_data); + } else { + SLOG(LOG_DEBUG, TAG_VCD, "[Engine Agent ERROR] Result callback function is NOT valid"); + } + + return; +} + void __result_cb(vcp_result_event_e event, int* result_id, int count, const char* all_result, const char* non_fixed, const char* msg, void *user_data) { SLOG(LOG_DEBUG, TAG_VCD, "[Engine agent] Event(%d), Count(%d) Text(%s) Nonfixed(%s) Msg(%s)", event, count, all_result, non_fixed, msg); + // Need to nlp info handle or true false value + int ret = 0; + char* temp_nlp = NULL; + + if (true == g_dynamic_engine.is_loaded) { + if (NULL != g_dynamic_engine.pefuncs->get_nlp_info) { + ret = g_dynamic_engine.pefuncs->get_nlp_info(&temp_nlp); + if (0 != ret) { + SLOG(LOG_WARN, TAG_VCD, "[Engine Agent ERROR] Fail to get nlp info : error(%d)", ret); + } else { + SLOG(LOG_DEBUG, TAG_VCD, "[Engine Agent SUCCESS] Get nlp info : %s", temp_nlp); + } + } else { + SLOG(LOG_WARN, TAG_VCD, "[Engine Agent ERROR] Not support to get nlp info"); + } + } + + if (NULL == temp_nlp) + temp_nlp = "null"; + if (NULL != g_result_cb) { - g_result_cb(event, result_id, count, all_result, non_fixed, msg, user_data); + g_result_cb(event, result_id, count, all_result, non_fixed, msg, temp_nlp, user_data); } else { SLOG(LOG_DEBUG, TAG_VCD, "[Engine Agent ERROR] Result callback function is NOT valid"); } @@ -553,6 +588,12 @@ int __load_engine(vcengine_s* engine) return VCD_ERROR_OPERATION_FAILED; } + // temp + if (0 != engine->pefuncs->set_pre_result_cb(__pre_result_cb, NULL)) { + SLOG(LOG_ERROR, TAG_VCD, "[Engine Agent ERROR] Fail to set pre result callback of vc-engine"); + return VCD_ERROR_OPERATION_FAILED; + } + /* load engine */ if (true == engine->pefuncs->is_lang_supported(g_default_lang)) { if (0 != engine->pefuncs->set_language(g_default_lang)) { @@ -686,6 +727,9 @@ int vcd_engine_recognize_audio(const void* data, unsigned int length, vcp_speech ret = g_dynamic_engine.pefuncs->set_recording(data, length, speech_detected); if (0 != ret) { SLOG(LOG_ERROR, TAG_VCD, "[Engine Agent ERROR] Fail to set recording dynamic engine error(%d)", ret); + if (VCP_ERROR_OUT_OF_NETWORK == ret) { + return VCD_ERROR_TIMED_OUT; + } return VCD_ERROR_OPERATION_FAILED; } } diff --git a/server/vcd_engine_agent.h b/server/vcd_engine_agent.h index fbbfb71..4bfcaf1 100644 --- a/server/vcd_engine_agent.h +++ b/server/vcd_engine_agent.h @@ -31,15 +31,17 @@ extern "C" { #define ENGINE_PATH_SIZE 256 +typedef void (*pre_result_callback)(vcp_pre_result_event_e event, const char* pre_result, void* user_data); + typedef void (*result_callback)(vcp_result_event_e event, int* result_id, int count, const char* all_result, - const char* non_fixed_result, const char* msg, void *user_data); + const char* non_fixed_result, const char* msg, const char* nlp_info, void *user_data); typedef void (*silence_dectection_callback)(void *user_data); /** Init engine agent */ -int vcd_engine_agent_init(result_callback result_cb); +int vcd_engine_agent_init(pre_result_callback pre_cb, result_callback result_cb); /** Release engine agent */ int vcd_engine_agent_release(); diff --git a/server/vcd_main.c b/server/vcd_main.c index 906f58a..f31ed91 100644 --- a/server/vcd_main.c +++ b/server/vcd_main.c @@ -63,10 +63,10 @@ int main(int argc, char** argv) ecore_timer_del(g_check_client_timer); } - vcd_dbus_close_connection(); - vcd_finalize(); + vcd_dbus_close_connection(); + ecore_shutdown(); SLOG(LOG_DEBUG, TAG_VCD, "====="); diff --git a/server/vcd_main.h b/server/vcd_main.h index b56650c..1f83fb9 100644 --- a/server/vcd_main.h +++ b/server/vcd_main.h @@ -59,7 +59,8 @@ typedef enum { VCD_ERROR_INVALID_LANGUAGE = TIZEN_ERROR_VOICE_CONTROL | 0x012, /**< Invalid language */ VCD_ERROR_ENGINE_NOT_FOUND = TIZEN_ERROR_VOICE_CONTROL | 0x013, /**< No available engine */ VCD_ERROR_OPERATION_FAILED = TIZEN_ERROR_VOICE_CONTROL | 0x014, /**< Operation failed */ - VCD_ERROR_OPERATION_REJECTED = TIZEN_ERROR_VOICE_CONTROL | 0x015 /**< Operation rejected */ + VCD_ERROR_OPERATION_REJECTED = TIZEN_ERROR_VOICE_CONTROL | 0x015, /**< Operation rejected */ + VCD_ERROR_SERVICE_RESET = TIZEN_ERROR_VOICE_CONTROL | 0x018 /**< Daemon Service reset */ } vcd_error_e; typedef enum { diff --git a/server/vcd_server.c b/server/vcd_server.c index cb1dc7d..86be307 100644 --- a/server/vcd_server.c +++ b/server/vcd_server.c @@ -36,6 +36,8 @@ static bool g_is_engine; static GList *g_proc_list = NULL; +static Ecore_Timer *g_restart_timer = NULL; + /* * VC Server Internal Functions */ @@ -65,6 +67,8 @@ static Eina_Bool __restart_engine(void *data) { SLOG(LOG_DEBUG, TAG_VCD, "===== Restart by no result"); + g_restart_timer = NULL; + /* Restart recognition */ int ret = vcd_engine_recognize_start(true); if (0 != ret) { @@ -90,8 +94,8 @@ static int __server_recorder_callback(const void* data, const unsigned int lengt { vcd_state_e state = vcd_config_get_service_state(); if (VCD_STATE_RECORDING != state) { - SLOG(LOG_DEBUG, TAG_VCD, "[Server] Skip by engine processing"); - return 0; + SLOG(LOG_DEBUG, TAG_VCD, "[Server] Not recording state, but recording"); +// return 0; } vcp_speech_detect_e speech_detected = VCP_SPEECH_DETECT_NONE; @@ -103,6 +107,12 @@ static int __server_recorder_callback(const void* data, const unsigned int lengt /* Error */ SLOG(LOG_ERROR, TAG_VCD, "[Server ERROR] Fail to set recording data to engine(%d)", ret); ecore_timer_add(0, __cancel_by_interrupt, NULL); + /* Send error cb to manager */ + if (VCP_ERROR_OUT_OF_NETWORK == ret) { + vcdc_send_error_signal_to_manager(vcd_client_manager_get_pid(), VCD_ERROR_TIMED_OUT, "Engine connection failed"); + } else { + vcdc_send_error_signal_to_manager(vcd_client_manager_get_pid(), VCD_ERROR_OPERATION_FAILED, "Engine recognition failed"); + } return 0; } @@ -257,8 +267,17 @@ static int __convert_type_to_priority(vc_cmd_type_e type) } } +static void __vcd_server_pre_result_cb(vcp_pre_result_event_e event, const char* pre_result, void* user_data) +{ + if (NULL != pre_result) { + vcdc_send_pre_result_to_manager(vcd_client_manager_get_pid(), event, pre_result); + } + + return; +} + static void __vcd_server_result_cb(vcp_result_event_e event, int* result_id, int count, const char* all_result, - const char* non_fixed_result, const char* msg, void *user_data) + const char* non_fixed_result, const char* msg, const char* nlp_info, void *user_data) { if (VCD_STATE_PROCESSING != vcd_config_get_service_state()) { if (VCD_RECOGNITION_MODE_RESTART_CONTINUOUSLY != vcd_client_get_recognition_mode()) { @@ -267,6 +286,13 @@ static void __vcd_server_result_cb(vcp_result_event_e event, int* result_id, int } } + // temp + if (NULL != nlp_info) { + if (0 != vc_info_parser_set_nlp_info(nlp_info)) { + SLOG(LOG_ERROR, TAG_VCD, "[Server ERROR] Fail to save nlp info"); + } + } + vc_info_parser_unset_result(vcd_client_manager_get_exclusive()); SLOG(LOG_DEBUG, TAG_VCD, "[Server] Event(%d), Text(%s) Nonfixed(%s) Msg(%s) Result count(%d)", @@ -283,7 +309,7 @@ static void __vcd_server_result_cb(vcp_result_event_e event, int* result_id, int SLOG(LOG_WARN, TAG_VCD, "[Server WARNING] Fail to send result"); } - ecore_timer_add(0, __restart_engine, NULL); + g_restart_timer = ecore_timer_add(0, __restart_engine, NULL); return; } SLOG(LOG_DEBUG, TAG_VCD, "[Server] Stop recorder due to success"); @@ -291,7 +317,7 @@ static void __vcd_server_result_cb(vcp_result_event_e event, int* result_id, int } else if (VCD_RECOGNITION_MODE_RESTART_CONTINUOUSLY == vcd_client_get_recognition_mode()) { SLOG(LOG_DEBUG, TAG_VCD, "[Server] Restart continuously"); /* Restart option is ON */ - ecore_timer_add(0, __restart_engine, NULL); + g_restart_timer = ecore_timer_add(0, __restart_engine, NULL); if (VCP_RESULT_EVENT_REJECTED == event) { bool temp = vcd_client_manager_get_exclusive(); vc_info_parser_set_result(all_result, event, msg, NULL, temp); @@ -512,6 +538,8 @@ int vcd_initialize() /* Remove old file */ __vcd_file_clean_up(); + /* Send error signal for notifying that daemon is reset*/ + vcdc_send_error_signal(VCD_ERROR_SERVICE_RESET, "Daemon reset"); /* initialize modules */ ret = vcd_config_initialize(__config_lang_changed_cb, __config_foreground_changed_cb, NULL); @@ -521,7 +549,7 @@ int vcd_initialize() vcd_config_set_service_state(VCD_STATE_NONE); - ret = vcd_engine_agent_init(__vcd_server_result_cb); + ret = vcd_engine_agent_init(__vcd_server_pre_result_cb, __vcd_server_result_cb); if (0 != ret) { SLOG(LOG_ERROR, TAG_VCD, "[Server ERROR] Fail to engine agent initialize : result(%d)", ret); return ret; @@ -573,6 +601,11 @@ void vcd_finalize() } } + if (g_restart_timer != NULL) { + ecore_timer_del(g_restart_timer); + g_restart_timer = NULL; + } + vcd_state_e state = vcd_config_get_service_state(); if (VCD_STATE_READY != state) { if (VCD_STATE_RECORDING == state) { @@ -852,8 +885,9 @@ int vcd_server_mgr_initialize(int pid) /* check if pid is valid */ if (false == vcd_client_manager_is_valid(pid)) { - SLOG(LOG_ERROR, TAG_VCD, "[Server ERROR] The pid(%d) is already exist", pid); - return VCD_ERROR_INVALID_PARAMETER; + SLOG(LOG_ERROR, TAG_VCD, "[Server] old manager pid(%d) be removed", vcd_client_manager_get_pid()); + vcd_server_mgr_cancel(); + vcd_client_manager_unset(); } /* Add client information to client manager */ @@ -1147,6 +1181,12 @@ int vcd_server_mgr_cancel() return VCD_ERROR_INVALID_STATE; } + if (g_restart_timer != NULL) { + SLOG(LOG_WARN, TAG_VCD, "[Server WARNING] Delete restart engine timer"); + ecore_timer_del(g_restart_timer); + g_restart_timer = NULL; + } + /* 2. Stop recorder */ vcd_recorder_stop(); /* 3. Cancel engine */ @@ -1481,7 +1521,7 @@ int vcd_server_widget_start_recording(int pid, bool widget_command) SLOG(LOG_DEBUG, TAG_VCD, "[Server] widget command is available"); } else { vcd_client_widget_unset_command(pid); - SLOG(LOG_WARN, TAG_VCD, "[Server] widget command is NOT available"); + SLOG(LOG_DEBUG, TAG_VCD, "[Server] widget command is NOT available"); } int ret = __start_internal_recognition(); -- 2.7.4 From 734e47e0cec14908d6aea3f16c6deab7a3b0f4fe Mon Sep 17 00:00:00 2001 From: Wonnam Jang Date: Mon, 23 May 2016 20:28:17 +0900 Subject: [PATCH 14/16] Add checking privilege Change-Id: I8bc50ddbed2b548f4fa63c23bf8ffa2de293ac69 Signed-off-by: Wonnam Jang --- CMakeLists.txt | 4 +- client/vc.c | 140 ++++++++++++++++++++++++++++++++++ common/vc_command.c | 174 +++++++++++++++++++++++++++++++++++++++++-- common/vc_defs.h | 2 + packaging/voice-control.spec | 2 + 5 files changed, 315 insertions(+), 7 deletions(-) mode change 100755 => 100644 client/vc.c diff --git a/CMakeLists.txt b/CMakeLists.txt index ab6f0bd..ffe62f9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -42,12 +42,12 @@ INCLUDE(FindPkgConfig) IF("${_TV_PRODUCT}" STREQUAL "TRUE") pkg_check_modules(pkgs REQUIRED aul capi-base-common capi-media-audio-io capi-media-sound-manager capi-network-bluetooth capi-system-info - dbus-1 dlog ecore glib-2.0 libtzplatform-config libxml-2.0 vconf #msfapi + cynara-client cynara-session dbus-1 dlog ecore glib-2.0 libtzplatform-config libxml-2.0 vconf #msfapi ) ELSE() pkg_check_modules(pkgs REQUIRED aul capi-base-common capi-media-audio-io capi-media-sound-manager capi-network-bluetooth capi-system-info - dbus-1 dlog ecore glib-2.0 libtzplatform-config libxml-2.0 vconf + cynara-client cynara-session dbus-1 dlog ecore glib-2.0 libtzplatform-config libxml-2.0 vconf ) ENDIF() diff --git a/client/vc.c b/client/vc.c old mode 100755 new mode 100644 index 1ee1350..611352e --- a/client/vc.c +++ b/client/vc.c @@ -15,6 +15,9 @@ */ #include +#include +#include +#include #include #include "vc_client.h" @@ -36,6 +39,9 @@ static vc_h g_vc = NULL; static int g_feature_enabled = -1; +static int g_privilege_allowed = -1; +static cynara *p_cynara = NULL; + #if 0 static Ecore_Event_Handler* g_focus_in_hander = NULL; static Ecore_Event_Handler* g_focus_out_hander = NULL; @@ -74,6 +80,77 @@ static int __vc_get_feature_enabled() return 0; } +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"); + + return ret == CYNARA_API_SUCCESS; +} + +static int __check_privilege(const char* uid, const char * privilege) +{ + FILE *fp = NULL; + char smack_label[1024] = "/proc/self/attr/current"; + + if (!p_cynara) { + return false; + } + + fp = fopen(smack_label, "r"); + if (fp != NULL) { + if (fread(smack_label, 1, sizeof(smack_label), fp) <= 0) + SLOG(LOG_ERROR, TAG_VCC, "[ERROR] fail to fread"); + + fclose(fp); + } + + pid_t pid = getpid(); + char *session = cynara_session_from_pid(pid); + int ret = cynara_check(p_cynara, smack_label, session, uid, privilege); + SLOG(LOG_DEBUG, TAG_VCC, "[Client]cynara_check returned %d(%s)", ret, (CYNARA_API_ACCESS_ALLOWED == ret) ? "Allowed" : "Denied"); + if (session) + free(session); + + if (ret != CYNARA_API_ACCESS_ALLOWED) + return false; + return true; +} + +static void __check_privilege_deinitialize() +{ + if (p_cynara) + cynara_finish(p_cynara); + p_cynara = NULL; +} + +static int __vc_check_privilege() +{ + char uid[16]; + + if (0 == g_privilege_allowed) { + SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Permission is denied"); + return VC_ERROR_PERMISSION_DENIED; + } else if (-1 == g_privilege_allowed) { + if (false == __check_privilege_initialize()){ + SLOG(LOG_ERROR, TAG_VCC, "[ERROR] privilege initialize is failed"); + return VC_ERROR_PERMISSION_DENIED; + } + snprintf(uid, 16, "%d", getuid()); + if (false == __check_privilege(uid, VC_PRIVILEGE)) { + SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Permission is denied"); + g_privilege_allowed = 0; + __check_privilege_deinitialize(); + return VC_ERROR_PERMISSION_DENIED; + } + __check_privilege_deinitialize(); + } + + g_privilege_allowed = 1; + return VC_ERROR_NONE; +} + static const char* __vc_get_error_code(vc_error_e err) { switch (err) { @@ -218,6 +295,9 @@ int vc_initialize(void) if (0 != __vc_get_feature_enabled()) { return VC_ERROR_NOT_SUPPORTED; } + if (0 != __vc_check_privilege()) { + return VC_ERROR_PERMISSION_DENIED; + } SLOG(LOG_DEBUG, TAG_VCC, "===== [Client] Initialize"); @@ -302,6 +382,9 @@ int vc_deinitialize(void) if (0 != __vc_get_feature_enabled()) { return VC_ERROR_NOT_SUPPORTED; } + if (0 != __vc_check_privilege()) { + return VC_ERROR_PERMISSION_DENIED; + } SLOG(LOG_DEBUG, TAG_VCC, "===== [Client] Deinitialize"); @@ -489,6 +572,9 @@ int vc_prepare(void) if (0 != __vc_get_feature_enabled()) { return VC_ERROR_NOT_SUPPORTED; } + if (0 != __vc_check_privilege()) { + return VC_ERROR_PERMISSION_DENIED; + } SLOG(LOG_DEBUG, TAG_VCC, "===== [Client] Prepare"); @@ -521,6 +607,9 @@ int vc_unprepare(void) if (0 != __vc_get_feature_enabled()) { return VC_ERROR_NOT_SUPPORTED; } + if (0 != __vc_check_privilege()) { + return VC_ERROR_PERMISSION_DENIED; + } SLOG(LOG_DEBUG, TAG_VCC, "===== [Client] Unprepare"); @@ -556,6 +645,9 @@ int vc_foreach_supported_languages(vc_supported_language_cb callback, void* user if (0 != __vc_get_feature_enabled()) { return VC_ERROR_NOT_SUPPORTED; } + if (0 != __vc_check_privilege()) { + return VC_ERROR_PERMISSION_DENIED; + } SLOG(LOG_DEBUG, TAG_VCC, "===== [Client] Foreach Supported Language"); @@ -593,6 +685,9 @@ int vc_get_current_language(char** language) if (0 != __vc_get_feature_enabled()) { return VC_ERROR_NOT_SUPPORTED; } + if (0 != __vc_check_privilege()) { + return VC_ERROR_PERMISSION_DENIED; + } SLOG(LOG_DEBUG, TAG_VCC, "===== [Client] Get Current Language"); @@ -629,6 +724,9 @@ int vc_get_state(vc_state_e* state) if (0 != __vc_get_feature_enabled()) { return VC_ERROR_NOT_SUPPORTED; } + if (0 != __vc_check_privilege()) { + return VC_ERROR_PERMISSION_DENIED; + } SLOG(LOG_DEBUG, TAG_VCC, "===== [Client] Get State"); @@ -665,6 +763,9 @@ int vc_get_service_state(vc_service_state_e* state) if (0 != __vc_get_feature_enabled()) { return VC_ERROR_NOT_SUPPORTED; } + if (0 != __vc_check_privilege()) { + return VC_ERROR_PERMISSION_DENIED; + } SLOG(LOG_DEBUG, TAG_VCC, "===== [Client] Get Service State"); @@ -859,6 +960,9 @@ int vc_set_command_list(vc_cmd_list_h vc_cmd_list, int type) if (0 != __vc_get_feature_enabled()) { return VC_ERROR_NOT_SUPPORTED; } + if (0 != __vc_check_privilege()) { + return VC_ERROR_PERMISSION_DENIED; + } SLOG(LOG_DEBUG, TAG_VCC, "===== [Client] Set Command list"); @@ -930,6 +1034,9 @@ int vc_unset_command_list(int type) if (0 != __vc_get_feature_enabled()) { return VC_ERROR_NOT_SUPPORTED; } + if (0 != __vc_check_privilege()) { + return VC_ERROR_PERMISSION_DENIED; + } SLOG(LOG_DEBUG, TAG_VCC, "===== [Client] Unset Command list"); @@ -1021,6 +1128,9 @@ int vc_set_exclusive_command_option(bool value) if (0 != __vc_get_feature_enabled()) { return VC_ERROR_NOT_SUPPORTED; } + if (0 != __vc_check_privilege()) { + return VC_ERROR_PERMISSION_DENIED; + } SLOG(LOG_DEBUG, TAG_VCC, "===== [Client] Set exclusive command"); @@ -1371,6 +1481,9 @@ int vc_set_result_cb(vc_result_cb callback, void* user_data) if (0 != __vc_get_feature_enabled()) { return VC_ERROR_NOT_SUPPORTED; } + if (0 != __vc_check_privilege()) { + return VC_ERROR_PERMISSION_DENIED; + } if (NULL == callback) return VC_ERROR_INVALID_PARAMETER; @@ -1397,6 +1510,9 @@ int vc_unset_result_cb(void) if (0 != __vc_get_feature_enabled()) { return VC_ERROR_NOT_SUPPORTED; } + if (0 != __vc_check_privilege()) { + return VC_ERROR_PERMISSION_DENIED; + } vc_state_e state; if (0 != vc_client_get_client_state(g_vc, &state)) { @@ -1452,6 +1568,9 @@ int vc_set_service_state_changed_cb(vc_service_state_changed_cb callback, void* if (0 != __vc_get_feature_enabled()) { return VC_ERROR_NOT_SUPPORTED; } + if (0 != __vc_check_privilege()) { + return VC_ERROR_PERMISSION_DENIED; + } if (NULL == callback) return VC_ERROR_INVALID_PARAMETER; @@ -1478,6 +1597,9 @@ int vc_unset_service_state_changed_cb(void) if (0 != __vc_get_feature_enabled()) { return VC_ERROR_NOT_SUPPORTED; } + if (0 != __vc_check_privilege()) { + return VC_ERROR_PERMISSION_DENIED; + } vc_state_e state; if (0 != vc_client_get_client_state(g_vc, &state)) { @@ -1501,6 +1623,9 @@ int vc_set_state_changed_cb(vc_state_changed_cb callback, void* user_data) if (0 != __vc_get_feature_enabled()) { return VC_ERROR_NOT_SUPPORTED; } + if (0 != __vc_check_privilege()) { + return VC_ERROR_PERMISSION_DENIED; + } if (callback == NULL) return VC_ERROR_INVALID_PARAMETER; @@ -1527,6 +1652,9 @@ int vc_unset_state_changed_cb(void) if (0 != __vc_get_feature_enabled()) { return VC_ERROR_NOT_SUPPORTED; } + if (0 != __vc_check_privilege()) { + return VC_ERROR_PERMISSION_DENIED; + } vc_state_e state; if (0 != vc_client_get_client_state(g_vc, &state)) { @@ -1550,6 +1678,9 @@ int vc_set_current_language_changed_cb(vc_current_language_changed_cb callback, if (0 != __vc_get_feature_enabled()) { return VC_ERROR_NOT_SUPPORTED; } + if (0 != __vc_check_privilege()) { + return VC_ERROR_PERMISSION_DENIED; + } if (NULL == callback) return VC_ERROR_INVALID_PARAMETER; @@ -1576,6 +1707,9 @@ int vc_unset_current_language_changed_cb(void) if (0 != __vc_get_feature_enabled()) { return VC_ERROR_NOT_SUPPORTED; } + if (0 != __vc_check_privilege()) { + return VC_ERROR_PERMISSION_DENIED; + } vc_state_e state; if (0 != vc_client_get_client_state(g_vc, &state)) { @@ -1599,6 +1733,9 @@ int vc_set_error_cb(vc_error_cb callback, void* user_data) if (0 != __vc_get_feature_enabled()) { return VC_ERROR_NOT_SUPPORTED; } + if (0 != __vc_check_privilege()) { + return VC_ERROR_PERMISSION_DENIED; + } if (NULL == callback) return VC_ERROR_INVALID_PARAMETER; @@ -1625,6 +1762,9 @@ int vc_unset_error_cb(void) if (0 != __vc_get_feature_enabled()) { return VC_ERROR_NOT_SUPPORTED; } + if (0 != __vc_check_privilege()) { + return VC_ERROR_PERMISSION_DENIED; + } vc_state_e state; if (0 != vc_client_get_client_state(g_vc, &state)) { diff --git a/common/vc_command.c b/common/vc_command.c index 293efdb..e93a1e8 100644 --- a/common/vc_command.c +++ b/common/vc_command.c @@ -14,7 +14,9 @@ * limitations under the License. */ - +#include +#include +#include #include #include #include @@ -28,10 +30,13 @@ static int g_feature_enabled = -1; +static int g_privilege_allowed = -1; +static cynara *p_cynara = NULL; + static int __vc_cmd_get_feature_enabled() { if (0 == g_feature_enabled) { - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Voice control feature NOT supported"); + SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Voice control feature NOT supported"); return VC_ERROR_NOT_SUPPORTED; } else if (-1 == g_feature_enabled) { bool vc_supported = false; @@ -39,18 +44,18 @@ static int __vc_cmd_get_feature_enabled() if (0 == system_info_get_platform_bool(VC_FEATURE_PATH, &vc_supported)) { if (0 == system_info_get_platform_bool(VC_MIC_FEATURE_PATH, &mic_supported)) { if (false == vc_supported || false == mic_supported) { - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Voice control feature NOT supported"); + SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Voice control feature NOT supported"); g_feature_enabled = 0; return VC_ERROR_NOT_SUPPORTED; } g_feature_enabled = 1; } else { - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to get feature value"); + SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Fail to get feature value"); return VC_ERROR_NOT_SUPPORTED; } } else { - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to get feature value"); + SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Fail to get feature value"); return VC_ERROR_NOT_SUPPORTED; } } @@ -58,11 +63,86 @@ static int __vc_cmd_get_feature_enabled() return 0; } +static int __check_privilege_initialize() +{ + int ret = cynara_initialize(&p_cynara, NULL); + if (CYNARA_API_SUCCESS != ret) + SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] fail to initialize"); + + return ret == CYNARA_API_SUCCESS; +} + +static int __check_privilege(const char* uid, const char * privilege) +{ + FILE *fp = NULL; + char smack_label[1024] = "/proc/self/attr/current"; + + if (!p_cynara) { + return false; + } + + fp = fopen(smack_label, "r"); + if (fp != NULL) { + if (fread(smack_label, 1, sizeof(smack_label), fp) <= 0) + SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] fail to fread"); + + fclose(fp); + } + + pid_t pid = getpid(); + char *session = cynara_session_from_pid(pid); + int ret = cynara_check(p_cynara, smack_label, session, uid, privilege); + SLOG(LOG_DEBUG, TAG_VCCMD, "[Client]cynara_check returned %d(%s)", ret, (CYNARA_API_ACCESS_ALLOWED == ret) ? "Allowed" : "Denied"); + if (session) + free(session); + + if (ret != CYNARA_API_ACCESS_ALLOWED) + return false; + return true; +} + +static void __check_privilege_deinitialize() +{ + if (p_cynara) + cynara_finish(p_cynara); + p_cynara = NULL; +} + +static int __vc_cmd_check_privilege() +{ + char uid[16]; + int ret = -1; + + if (0 == g_privilege_allowed) { + SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Permission is denied"); + return VC_ERROR_PERMISSION_DENIED; + } else if (-1 == g_privilege_allowed) { + if (false == __check_privilege_initialize()){ + SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] privilege initialize is failed"); + return VC_ERROR_PERMISSION_DENIED; + } + snprintf(uid, 16, "%d", getuid()); + if (false == __check_privilege(uid, VC_PRIVILEGE)) { + SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Permission is denied"); + g_privilege_allowed = 0; + __check_privilege_deinitialize(); + return VC_ERROR_PERMISSION_DENIED; + } + __check_privilege_deinitialize(); + } + + g_privilege_allowed = 1; + return VC_ERROR_NONE; +} + int vc_cmd_list_create(vc_cmd_list_h* vc_cmd_list) { if (0 != __vc_cmd_get_feature_enabled()) { return VC_ERROR_NOT_SUPPORTED; } + if (0 != __vc_cmd_check_privilege()) { + return VC_ERROR_PERMISSION_DENIED; + } if (NULL == vc_cmd_list) { SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Input parameter is NULL"); @@ -91,6 +171,9 @@ int vc_cmd_list_destroy(vc_cmd_list_h vc_cmd_list, bool release_command) if (0 != __vc_cmd_get_feature_enabled()) { return VC_ERROR_NOT_SUPPORTED; } + if (0 != __vc_cmd_check_privilege()) { + return VC_ERROR_PERMISSION_DENIED; + } if (NULL == vc_cmd_list) { SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Input parameter is NULL"); @@ -117,6 +200,9 @@ int vc_cmd_list_get_count(vc_cmd_list_h vc_cmd_list, int* count) if (0 != __vc_cmd_get_feature_enabled()) { return VC_ERROR_NOT_SUPPORTED; } + if (0 != __vc_cmd_check_privilege()) { + return VC_ERROR_PERMISSION_DENIED; + } if (NULL == vc_cmd_list || NULL == count) { SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Get command count : Input parameter is NULL"); @@ -138,6 +224,9 @@ int vc_cmd_list_add(vc_cmd_list_h vc_cmd_list, vc_cmd_h vc_command) if (0 != __vc_cmd_get_feature_enabled()) { return VC_ERROR_NOT_SUPPORTED; } + if (0 != __vc_cmd_check_privilege()) { + return VC_ERROR_PERMISSION_DENIED; + } if (NULL == vc_cmd_list || NULL == vc_command) { SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Input parameter is NULL"); @@ -166,6 +255,9 @@ int vc_cmd_list_remove(vc_cmd_list_h vc_cmd_list, vc_cmd_h vc_command) if (0 != __vc_cmd_get_feature_enabled()) { return VC_ERROR_NOT_SUPPORTED; } + if (0 != __vc_cmd_check_privilege()) { + return VC_ERROR_PERMISSION_DENIED; + } if (NULL == vc_cmd_list || NULL == vc_command) { SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Input parameter is NULL"); @@ -220,6 +312,9 @@ int vc_cmd_list_remove_all(vc_cmd_list_h vc_cmd_list, bool release_command) if (0 != __vc_cmd_get_feature_enabled()) { return VC_ERROR_NOT_SUPPORTED; } + if (0 != __vc_cmd_check_privilege()) { + return VC_ERROR_PERMISSION_DENIED; + } SLOG(LOG_DEBUG, TAG_VCCMD, "===== Destroy all command"); @@ -268,6 +363,9 @@ int vc_cmd_list_foreach_commands(vc_cmd_list_h vc_cmd_list, vc_cmd_list_cb callb if (0 != __vc_cmd_get_feature_enabled()) { return VC_ERROR_NOT_SUPPORTED; } + if (0 != __vc_cmd_check_privilege()) { + return VC_ERROR_PERMISSION_DENIED; + } if (NULL == vc_cmd_list) { SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Input parameter is NULL"); @@ -309,6 +407,9 @@ int vc_cmd_list_filter_by_type(vc_cmd_list_h original, int type, vc_cmd_list_h* if (0 != __vc_cmd_get_feature_enabled()) { return VC_ERROR_NOT_SUPPORTED; } + if (0 != __vc_cmd_check_privilege()) { + return VC_ERROR_PERMISSION_DENIED; + } if (NULL == original) { SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Input parameter is NULL"); @@ -393,6 +494,9 @@ int vc_cmd_list_first(vc_cmd_list_h vc_cmd_list) if (0 != __vc_cmd_get_feature_enabled()) { return VC_ERROR_NOT_SUPPORTED; } + if (0 != __vc_cmd_check_privilege()) { + return VC_ERROR_PERMISSION_DENIED; + } if (NULL == vc_cmd_list) { SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Input parameter is NULL"); @@ -417,6 +521,9 @@ int vc_cmd_list_last(vc_cmd_list_h vc_cmd_list) if (0 != __vc_cmd_get_feature_enabled()) { return VC_ERROR_NOT_SUPPORTED; } + if (0 != __vc_cmd_check_privilege()) { + return VC_ERROR_PERMISSION_DENIED; + } if (NULL == vc_cmd_list) { SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Input parameter is NULL"); @@ -444,6 +551,9 @@ int vc_cmd_list_next(vc_cmd_list_h vc_cmd_list) if (0 != __vc_cmd_get_feature_enabled()) { return VC_ERROR_NOT_SUPPORTED; } + if (0 != __vc_cmd_check_privilege()) { + return VC_ERROR_PERMISSION_DENIED; + } if (NULL == vc_cmd_list) { SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Input parameter is NULL"); @@ -471,6 +581,9 @@ int vc_cmd_list_prev(vc_cmd_list_h vc_cmd_list) if (0 != __vc_cmd_get_feature_enabled()) { return VC_ERROR_NOT_SUPPORTED; } + if (0 != __vc_cmd_check_privilege()) { + return VC_ERROR_PERMISSION_DENIED; + } if (NULL == vc_cmd_list) { SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Input parameter is NULL"); @@ -496,6 +609,9 @@ int vc_cmd_list_get_current(vc_cmd_list_h vc_cmd_list, vc_cmd_h* vc_command) if (0 != __vc_cmd_get_feature_enabled()) { return VC_ERROR_NOT_SUPPORTED; } + if (0 != __vc_cmd_check_privilege()) { + return VC_ERROR_PERMISSION_DENIED; + } if (NULL == vc_cmd_list || NULL == vc_command) { SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Input parameter is NULL"); @@ -529,6 +645,9 @@ int vc_cmd_create(vc_cmd_h* vc_command) if (0 != __vc_cmd_get_feature_enabled()) { return VC_ERROR_NOT_SUPPORTED; } + if (0 != __vc_cmd_check_privilege()) { + return VC_ERROR_PERMISSION_DENIED; + } if (NULL == vc_command) { SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Input parameter is NULL"); @@ -565,6 +684,9 @@ int vc_cmd_destroy(vc_cmd_h vc_command) if (0 != __vc_cmd_get_feature_enabled()) { return VC_ERROR_NOT_SUPPORTED; } + if (0 != __vc_cmd_check_privilege()) { + return VC_ERROR_PERMISSION_DENIED; + } if (NULL == vc_command) { SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Input parameter is NULL"); @@ -591,6 +713,9 @@ int vc_cmd_set_id(vc_cmd_h vc_command, int id) if (0 != __vc_cmd_get_feature_enabled()) { return VC_ERROR_NOT_SUPPORTED; } + if (0 != __vc_cmd_check_privilege()) { + return VC_ERROR_PERMISSION_DENIED; + } if (NULL == vc_command) { SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Invalid parameter "); @@ -613,6 +738,9 @@ int vc_cmd_get_id(vc_cmd_h vc_command, int* id) if (0 != __vc_cmd_get_feature_enabled()) { return VC_ERROR_NOT_SUPPORTED; } + if (0 != __vc_cmd_check_privilege()) { + return VC_ERROR_PERMISSION_DENIED; + } if (NULL == vc_command || NULL == id) { SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Invalid handle "); @@ -635,6 +763,9 @@ int vc_cmd_set_command(vc_cmd_h vc_command, const char* command) if (0 != __vc_cmd_get_feature_enabled()) { return VC_ERROR_NOT_SUPPORTED; } + if (0 != __vc_cmd_check_privilege()) { + return VC_ERROR_PERMISSION_DENIED; + } if (NULL == vc_command) { SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Invalid parameter "); @@ -664,6 +795,9 @@ int vc_cmd_get_command(vc_cmd_h vc_command, char** command) if (0 != __vc_cmd_get_feature_enabled()) { return VC_ERROR_NOT_SUPPORTED; } + if (0 != __vc_cmd_check_privilege()) { + return VC_ERROR_PERMISSION_DENIED; + } if (NULL == vc_command || NULL == command) { SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Invalid handle "); @@ -687,6 +821,9 @@ int vc_cmd_set_unfixed_command(vc_cmd_h vc_command, const char* command) if (0 != __vc_cmd_get_feature_enabled()) { return VC_ERROR_NOT_SUPPORTED; } + if (0 != __vc_cmd_check_privilege()) { + return VC_ERROR_PERMISSION_DENIED; + } if (NULL == vc_command) { SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Invalid parameter "); @@ -715,6 +852,9 @@ int vc_cmd_get_unfixed_command(vc_cmd_h vc_command, char** command) if (0 != __vc_cmd_get_feature_enabled()) { return VC_ERROR_NOT_SUPPORTED; } + if (0 != __vc_cmd_check_privilege()) { + return VC_ERROR_PERMISSION_DENIED; + } if (NULL == vc_command || NULL == command) { SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Invalid handle "); @@ -737,6 +877,9 @@ int vc_cmd_set_type(vc_cmd_h vc_command, int type) if (0 != __vc_cmd_get_feature_enabled()) { return VC_ERROR_NOT_SUPPORTED; } + if (0 != __vc_cmd_check_privilege()) { + return VC_ERROR_PERMISSION_DENIED; + } if (NULL == vc_command) { SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Invalid parameter "); @@ -758,6 +901,9 @@ int vc_cmd_get_type(vc_cmd_h vc_command, int* type) if (0 != __vc_cmd_get_feature_enabled()) { return VC_ERROR_NOT_SUPPORTED; } + if (0 != __vc_cmd_check_privilege()) { + return VC_ERROR_PERMISSION_DENIED; + } if (NULL == vc_command || NULL == type) { SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Invalid parameter "); @@ -779,6 +925,9 @@ int vc_cmd_set_format(vc_cmd_h vc_command, vc_cmd_format_e format) if (0 != __vc_cmd_get_feature_enabled()) { return VC_ERROR_NOT_SUPPORTED; } + if (0 != __vc_cmd_check_privilege()) { + return VC_ERROR_PERMISSION_DENIED; + } if (NULL == vc_command) { SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Invalid parameter "); @@ -800,6 +949,9 @@ int vc_cmd_get_format(vc_cmd_h vc_command, vc_cmd_format_e* format) if (0 != __vc_cmd_get_feature_enabled()) { return VC_ERROR_NOT_SUPPORTED; } + if (0 != __vc_cmd_check_privilege()) { + return VC_ERROR_PERMISSION_DENIED; + } if (NULL == vc_command || NULL == format) { SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Invalid parameter "); @@ -821,6 +973,9 @@ int vc_cmd_set_pid(vc_cmd_h vc_command, int pid) if (0 != __vc_cmd_get_feature_enabled()) { return VC_ERROR_NOT_SUPPORTED; } + if (0 != __vc_cmd_check_privilege()) { + return VC_ERROR_PERMISSION_DENIED; + } if (NULL == vc_command) { SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Invalid parameter "); @@ -842,6 +997,9 @@ int vc_cmd_get_pid(vc_cmd_h vc_command, int* pid) if (0 != __vc_cmd_get_feature_enabled()) { return VC_ERROR_NOT_SUPPORTED; } + if (0 != __vc_cmd_check_privilege()) { + return VC_ERROR_PERMISSION_DENIED; + } if (NULL == vc_command || NULL == pid) { SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Invalid parameter "); @@ -863,6 +1021,9 @@ int vc_cmd_set_domain(vc_cmd_h vc_command, int domain) if (0 != __vc_cmd_get_feature_enabled()) { return VC_ERROR_NOT_SUPPORTED; } + if (0 != __vc_cmd_check_privilege()) { + return VC_ERROR_PERMISSION_DENIED; + } if (NULL == vc_command) { SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Invalid parameter "); @@ -884,6 +1045,9 @@ int vc_cmd_get_domain(vc_cmd_h vc_command, int* domain) if (0 != __vc_cmd_get_feature_enabled()) { return VC_ERROR_NOT_SUPPORTED; } + if (0 != __vc_cmd_check_privilege()) { + return VC_ERROR_PERMISSION_DENIED; + } if (NULL == vc_command || NULL == domain) { SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Invalid parameter "); diff --git a/common/vc_defs.h b/common/vc_defs.h index 786b891..1194fed 100644 --- a/common/vc_defs.h +++ b/common/vc_defs.h @@ -180,6 +180,8 @@ extern "C" { #define VC_FEATURE_PATH "tizen.org/feature/speech.control" #define VC_MIC_FEATURE_PATH "tizen.org/feature/microphone" +#define VC_PRIVILEGE "http://tizen.org/privilege/recorder" + /****************************************************************************************** * Defines for common enum *******************************************************************************************/ diff --git a/packaging/voice-control.spec b/packaging/voice-control.spec index ed54462..8b38128 100644 --- a/packaging/voice-control.spec +++ b/packaging/voice-control.spec @@ -16,6 +16,8 @@ BuildRequires: pkgconfig(capi-media-audio-io) BuildRequires: pkgconfig(capi-media-sound-manager) BuildRequires: pkgconfig(capi-network-bluetooth) BuildRequires: pkgconfig(capi-system-info) +BuildRequires: pkgconfig(cynara-client) +BuildRequires: pkgconfig(cynara-session) BuildRequires: pkgconfig(dbus-1) BuildRequires: pkgconfig(dlog) BuildRequires: pkgconfig(ecore) -- 2.7.4 From 4affad6ac36f36ad0600ca5f6fbb1f823eacf427 Mon Sep 17 00:00:00 2001 From: "ky85.kim" Date: Wed, 25 May 2016 20:20:39 +0900 Subject: [PATCH 15/16] Fix invalid free Change-Id: I34b5f9ff08c2021bf2bcf42ba9431c31b757d0af Signed-off-by: ky85.kim --- server/vcd_server.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/server/vcd_server.c b/server/vcd_server.c index 86be307..2643476 100644 --- a/server/vcd_server.c +++ b/server/vcd_server.c @@ -697,6 +697,10 @@ static void __vcd_cleanup_client(vcd_client_type_e type) mgr_pid = vcd_client_manager_get_pid(); client_list = &mgr_pid; client_count = 1; + if (-1 == mgr_pid) { + SLOG(LOG_WARN, TAG_VCD, "[WARNING] Invalid Manager pid"); + return; + } } if (0 == ret || mgr_pid > 0) { -- 2.7.4 From ca38d0540a472230b7a4b282f02b4d772629113b Mon Sep 17 00:00:00 2001 From: "sooyeon.kim" Date: Fri, 27 May 2016 10:52:08 +0900 Subject: [PATCH 16/16] Remove unnecessary codes Change-Id: I810df16f815356bb5403d3a454d896ee97667d13 Signed-off-by: sooyeon.kim --- client/vc.c | 26 +++++++++++++------------- client/vc_mgr.c | 30 +++++++++++++++--------------- client/vc_widget.c | 22 +++++++++++----------- server/vcd_client_data.c | 2 +- server/vcd_server.c | 16 +++++++--------- 5 files changed, 47 insertions(+), 49 deletions(-) diff --git a/client/vc.c b/client/vc.c index 611352e..5ad3709 100644 --- a/client/vc.c +++ b/client/vc.c @@ -154,17 +154,17 @@ static int __vc_check_privilege() static const char* __vc_get_error_code(vc_error_e err) { switch (err) { - case VC_ERROR_NONE: return "VC_ERROR_NONE"; break; - case VC_ERROR_OUT_OF_MEMORY: return "VC_ERROR_OUT_OF_MEMORY"; break; - case VC_ERROR_IO_ERROR: return "VC_ERROR_IO_ERROR"; break; - case VC_ERROR_INVALID_PARAMETER: return "VC_ERROR_INVALID_PARAMETER"; break; - case VC_ERROR_TIMED_OUT: return "VC_ERROR_TIMED_OUT"; break; - case VC_ERROR_RECORDER_BUSY: return "VC_ERROR_RECORDER_BUSY"; break; - case VC_ERROR_INVALID_STATE: return "VC_ERROR_INVALID_STATE"; break; - case VC_ERROR_INVALID_LANGUAGE: return "VC_ERROR_INVALID_LANGUAGE"; break; - case VC_ERROR_ENGINE_NOT_FOUND: return "VC_ERROR_ENGINE_NOT_FOUND"; break; - case VC_ERROR_OPERATION_FAILED: return "VC_ERROR_OPERATION_FAILED"; break; - default: return "Invalid error code"; break; + case VC_ERROR_NONE: return "VC_ERROR_NONE"; + case VC_ERROR_OUT_OF_MEMORY: return "VC_ERROR_OUT_OF_MEMORY"; + case VC_ERROR_IO_ERROR: return "VC_ERROR_IO_ERROR"; + case VC_ERROR_INVALID_PARAMETER: return "VC_ERROR_INVALID_PARAMETER"; + case VC_ERROR_TIMED_OUT: return "VC_ERROR_TIMED_OUT"; + case VC_ERROR_RECORDER_BUSY: return "VC_ERROR_RECORDER_BUSY"; + case VC_ERROR_INVALID_STATE: return "VC_ERROR_INVALID_STATE"; + case VC_ERROR_INVALID_LANGUAGE: return "VC_ERROR_INVALID_LANGUAGE"; + case VC_ERROR_ENGINE_NOT_FOUND: return "VC_ERROR_ENGINE_NOT_FOUND"; + case VC_ERROR_OPERATION_FAILED: return "VC_ERROR_OPERATION_FAILED"; + default: return "Invalid error code"; } return NULL; } @@ -749,7 +749,7 @@ int vc_get_state(vc_state_e* state) 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"); break; + default: SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Invalid state"); } SLOG(LOG_DEBUG, TAG_VCC, "====="); @@ -803,7 +803,7 @@ int vc_get_service_state(vc_service_state_e* state) 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"); break; + default: SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Invalid state"); } SLOG(LOG_DEBUG, TAG_VCC, "====="); diff --git a/client/vc_mgr.c b/client/vc_mgr.c index 06da0dc..ab70bcb 100644 --- a/client/vc_mgr.c +++ b/client/vc_mgr.c @@ -51,17 +51,17 @@ static Eina_Bool __vc_mgr_notify_result(void *data); static const char* __vc_mgr_get_error_code(vc_error_e err) { switch (err) { - case VC_ERROR_NONE: return "VC_ERROR_NONE"; break; - case VC_ERROR_OUT_OF_MEMORY: return "VC_ERROR_OUT_OF_MEMORY"; break; - case VC_ERROR_IO_ERROR: return "VC_ERROR_IO_ERROR"; break; - case VC_ERROR_INVALID_PARAMETER: return "VC_ERROR_INVALID_PARAMETER"; break; - case VC_ERROR_TIMED_OUT: return "VC_ERROR_TIMED_OUT"; break; - case VC_ERROR_RECORDER_BUSY: return "VC_ERROR_RECORDER_BUSY"; break; - case VC_ERROR_INVALID_STATE: return "VC_ERROR_INVALID_STATE"; break; - case VC_ERROR_INVALID_LANGUAGE: return "VC_ERROR_INVALID_LANGUAGE"; break; - case VC_ERROR_ENGINE_NOT_FOUND: return "VC_ERROR_ENGINE_NOT_FOUND"; break; - case VC_ERROR_OPERATION_FAILED: return "VC_ERROR_OPERATION_FAILED"; break; - default: return "Invalid error code"; break; + case VC_ERROR_NONE: return "VC_ERROR_NONE"; + case VC_ERROR_OUT_OF_MEMORY: return "VC_ERROR_OUT_OF_MEMORY"; + case VC_ERROR_IO_ERROR: return "VC_ERROR_IO_ERROR"; + case VC_ERROR_INVALID_PARAMETER: return "VC_ERROR_INVALID_PARAMETER"; + case VC_ERROR_TIMED_OUT: return "VC_ERROR_TIMED_OUT"; + case VC_ERROR_RECORDER_BUSY: return "VC_ERROR_RECORDER_BUSY"; + case VC_ERROR_INVALID_STATE: return "VC_ERROR_INVALID_STATE"; + case VC_ERROR_INVALID_LANGUAGE: return "VC_ERROR_INVALID_LANGUAGE"; + case VC_ERROR_ENGINE_NOT_FOUND: return "VC_ERROR_ENGINE_NOT_FOUND"; + case VC_ERROR_OPERATION_FAILED: return "VC_ERROR_OPERATION_FAILED"; + default: return "Invalid error code"; } return NULL; } @@ -496,7 +496,7 @@ int vc_mgr_get_state(vc_state_e* state) case VC_STATE_NONE: SLOG(LOG_DEBUG, TAG_VCM, "Current state is 'None'"); break; case VC_STATE_INITIALIZED: SLOG(LOG_DEBUG, TAG_VCM, "Current state is 'Created'"); break; case VC_STATE_READY: SLOG(LOG_DEBUG, TAG_VCM, "Current state is 'Ready'"); break; - default: SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Invalid state"); break; + default: SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Invalid state"); } SLOG(LOG_DEBUG, TAG_VCM, "====="); @@ -540,7 +540,7 @@ int vc_mgr_get_service_state(vc_service_state_e* state) case VC_SERVICE_STATE_READY: SLOG(LOG_DEBUG, TAG_VCM, "Current service state is 'Ready'"); break; case VC_SERVICE_STATE_RECORDING: SLOG(LOG_DEBUG, TAG_VCM, "Current service state is 'Recording'"); break; case VC_SERVICE_STATE_PROCESSING: SLOG(LOG_DEBUG, TAG_VCM, "Current service state is 'Processing'"); break; - default: SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Invalid state"); break; + default: SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Invalid state"); } SLOG(LOG_DEBUG, TAG_VCM, "====="); @@ -665,7 +665,7 @@ int vc_mgr_is_command_format_supported(vc_cmd_format_e format, bool* support) case VC_CMD_FORMAT_FIXED: *support = true; break; case VC_CMD_FORMAT_FIXED_AND_EXTRA: *support = non_fixed_support; break; case VC_CMD_FORMAT_EXTRA_AND_FIXED: *support = non_fixed_support; break; - default: *support = false; break; + default: *support = false; } SLOG(LOG_ERROR, TAG_VCM, "[DEBUG] Format(%d) support(%s)", format, *support ? "true" : "false"); @@ -2401,4 +2401,4 @@ int __vc_mgr_request_auth_cancel(int pid) ecore_timer_add(0, __request_auth_cancel, NULL); return 0; -} \ No newline at end of file +} diff --git a/client/vc_widget.c b/client/vc_widget.c index 7002bda..c342d67 100755 --- a/client/vc_widget.c +++ b/client/vc_widget.c @@ -46,15 +46,15 @@ const char* vc_tag() static const char* __vc_widget_get_error_code(vc_error_e err) { switch (err) { - case VC_ERROR_NONE: return "VC_ERROR_NONE"; break; - case VC_ERROR_OUT_OF_MEMORY: return "VC_ERROR_OUT_OF_MEMORY"; break; - case VC_ERROR_IO_ERROR: return "VC_ERROR_IO_ERROR"; break; - case VC_ERROR_INVALID_PARAMETER:return "VC_ERROR_INVALID_PARAMETER"; break; - case VC_ERROR_TIMED_OUT: return "VC_ERROR_TIMED_OUT"; break; - case VC_ERROR_INVALID_STATE: return "VC_ERROR_INVALID_STATE"; break; - case VC_ERROR_ENGINE_NOT_FOUND: return "VC_ERROR_ENGINE_NOT_FOUND"; break; - case VC_ERROR_OPERATION_FAILED: return "VC_ERROR_OPERATION_FAILED"; break; - default: return "Invalid error code"; break; + case VC_ERROR_NONE: return "VC_ERROR_NONE"; + case VC_ERROR_OUT_OF_MEMORY: return "VC_ERROR_OUT_OF_MEMORY"; + case VC_ERROR_IO_ERROR: return "VC_ERROR_IO_ERROR"; + case VC_ERROR_INVALID_PARAMETER:return "VC_ERROR_INVALID_PARAMETER"; + case VC_ERROR_TIMED_OUT: return "VC_ERROR_TIMED_OUT"; + case VC_ERROR_INVALID_STATE: return "VC_ERROR_INVALID_STATE"; + case VC_ERROR_ENGINE_NOT_FOUND: return "VC_ERROR_ENGINE_NOT_FOUND"; + case VC_ERROR_OPERATION_FAILED: return "VC_ERROR_OPERATION_FAILED"; + default: return "Invalid error code"; } return NULL; } @@ -399,7 +399,7 @@ int vc_widget_get_state(vc_state_e* state) case VC_STATE_NONE: SLOG(LOG_DEBUG, TAG_VCW, "Current state is 'None'"); break; case VC_STATE_INITIALIZED: SLOG(LOG_DEBUG, TAG_VCW, "Current state is 'Created'"); break; case VC_STATE_READY: SLOG(LOG_DEBUG, TAG_VCW, "Current state is 'Ready'"); break; - default: SLOG(LOG_ERROR, TAG_VCW, "Invalid state"); break; + default: SLOG(LOG_ERROR, TAG_VCW, "Invalid state"); } SLOG(LOG_DEBUG, TAG_VCW, "====="); @@ -446,7 +446,7 @@ int vc_widget_get_service_state(vc_service_state_e* state) case VC_SERVICE_STATE_READY: SLOG(LOG_DEBUG, TAG_VCW, "Current service state is 'Ready'"); break; case VC_SERVICE_STATE_RECORDING: SLOG(LOG_DEBUG, TAG_VCW, "Current service state is 'Recording'"); break; case VC_SERVICE_STATE_PROCESSING: SLOG(LOG_DEBUG, TAG_VCW, "Current service state is 'Processing'"); break; - default: SLOG(LOG_ERROR, TAG_VCW, "Invalid service state"); break; + default: SLOG(LOG_ERROR, TAG_VCW, "Invalid service state"); } SLOG(LOG_DEBUG, TAG_VCW, "====="); diff --git a/server/vcd_client_data.c b/server/vcd_client_data.c index 5d5ff34..c922c4d 100644 --- a/server/vcd_client_data.c +++ b/server/vcd_client_data.c @@ -1364,4 +1364,4 @@ int vcd_client_widget_unset_command(int pid) info->widget_cmd = false; return 0; -} \ No newline at end of file +} diff --git a/server/vcd_server.c b/server/vcd_server.c index 2643476..748e548 100644 --- a/server/vcd_server.c +++ b/server/vcd_server.c @@ -257,13 +257,13 @@ static Eina_Bool __vcd_send_selected_result(void *data) static int __convert_type_to_priority(vc_cmd_type_e type) { switch (type) { - case VC_COMMAND_TYPE_NONE: return 0; break; - case VC_COMMAND_TYPE_BACKGROUND: return 1; break; - case VC_COMMAND_TYPE_FOREGROUND: return 2; break; - case VC_COMMAND_TYPE_WIDGET: return 2; break; - case VC_COMMAND_TYPE_SYSTEM: return 3; break; - case VC_COMMAND_TYPE_EXCLUSIVE: return 3; break; - default: return 0; break; + case VC_COMMAND_TYPE_NONE: return 0; + case VC_COMMAND_TYPE_BACKGROUND: return 1; + case VC_COMMAND_TYPE_FOREGROUND: return 2; + case VC_COMMAND_TYPE_WIDGET: return 2; + case VC_COMMAND_TYPE_SYSTEM: return 3; + case VC_COMMAND_TYPE_EXCLUSIVE: return 3; + default: return 0; } } @@ -272,8 +272,6 @@ static void __vcd_server_pre_result_cb(vcp_pre_result_event_e event, const char* if (NULL != pre_result) { vcdc_send_pre_result_to_manager(vcd_client_manager_get_pid(), event, pre_result); } - - return; } static void __vcd_server_result_cb(vcp_result_event_e event, int* result_id, int count, const char* all_result, -- 2.7.4