From 70e7514fc09c6eda33de434c267f63fddd23aeb6 Mon Sep 17 00:00:00 2001 From: Wonnam Jang Date: Mon, 7 Sep 2015 11:06:35 +0900 Subject: [PATCH] updates codes to check model config feature Change-Id: I7ed31729cde6265457422282b436dfa9f3c63200 --- CMakeLists.txt | 4 +- changelog | 4 ++ client/vc.c | 110 ++++++++++++++++++++++++++++++++++ common/vc_command.c | 138 +++++++++++++++++++++++++++++++++++++++++++ common/vc_defs.h | 3 + doc/uix_vc_doc.h | 28 ++++----- packaging/voice-control.spec | 3 +- 7 files changed, 273 insertions(+), 17 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index bb93fa6..d978245 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -26,7 +26,7 @@ PROJECT(vc) SET(PREFIX ${CMAKE_INSTALL_PREFIX}) SET(EXEC_PREFIX "${PREFIX}") -SET(VERSION 0.2.9) +SET(VERSION 0.2.10) # pkg config tool INCLUDE(FindPkgConfig) @@ -38,7 +38,7 @@ INCLUDE_DIRECTORIES("${CMAKE_SOURCE_DIR}/include") ## Dependent packages ## INCLUDE(FindPkgConfig) pkg_check_modules(pkgs REQUIRED - aul capi-base-common capi-media-audio-io capi-media-sound-manager capi-network-bluetooth + 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 libprivilege-control libxml-2.0 vconf ) diff --git a/changelog b/changelog index 9f2aae1..423a38d 100644 --- a/changelog +++ b/changelog @@ -1,3 +1,7 @@ +voice-control (0.2.10) -- Thu, 27 Aug 2015 + + * Add tizen.org/feature/speech.control feature check (Dongyeol Lee ) + voice-control (0.2.9) -- Mon, 6 Jul 2015 * Update daemon start by dbus activation (Dongyeol Lee ) diff --git a/client/vc.c b/client/vc.c index f3bf651..1cad371 100644 --- a/client/vc.c +++ b/client/vc.c @@ -15,6 +15,7 @@ */ #include +#include #include "vc_client.h" #include "vc_command.h" @@ -33,6 +34,8 @@ static Ecore_Timer* g_connect_timer = NULL; static vc_h g_vc = NULL; +static int g_feature_enabled = -1; + #if 0 static Ecore_Event_Handler* g_focus_in_hander = NULL; static Ecore_Event_Handler* g_focus_out_hander = NULL; @@ -41,6 +44,29 @@ static Ecore_Event_Handler* g_focus_out_hander = NULL; Eina_Bool __vc_notify_state_changed(void *data); Eina_Bool __vc_notify_error(void *data); +static int __vc_get_feature_enabled() +{ + if (0 == g_feature_enabled) { + SLOG(LOG_ERROR, TAG_VCC, "[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_VCC, "[ERROR] Voice control feature NOT supported"); + g_feature_enabled = 0; + return VC_ERROR_NOT_SUPPORTED; + } + + g_feature_enabled = 1; + } + } + } + + return 0; +} static const char* __vc_get_error_code(vc_error_e err) { @@ -122,6 +148,10 @@ static Eina_Bool __notify_auth_changed_cb(void *data) int vc_initialize(void) { + if (0 != __vc_get_feature_enabled()) { + return VC_ERROR_NOT_SUPPORTED; + } + SLOG(LOG_DEBUG, TAG_VCC, "===== [Client] Initialize"); /* check handle */ @@ -202,6 +232,10 @@ static void __vc_internal_unprepare(void) int vc_deinitialize(void) { + if (0 != __vc_get_feature_enabled()) { + return VC_ERROR_NOT_SUPPORTED; + } + SLOG(LOG_DEBUG, TAG_VCC, "===== [Client] Deinitialize"); if (false == vc_client_is_valid(g_vc)) { @@ -381,6 +415,10 @@ static Eina_Bool __vc_connect_daemon(void *data) int vc_prepare(void) { + if (0 != __vc_get_feature_enabled()) { + return VC_ERROR_NOT_SUPPORTED; + } + SLOG(LOG_DEBUG, TAG_VCC, "===== [Client] Prepare"); vc_state_e state; @@ -409,6 +447,10 @@ int vc_prepare(void) int vc_unprepare(void) { + if (0 != __vc_get_feature_enabled()) { + return VC_ERROR_NOT_SUPPORTED; + } + SLOG(LOG_DEBUG, TAG_VCC, "===== [Client] Unprepare"); vc_state_e state; @@ -440,6 +482,10 @@ int vc_unprepare(void) int vc_foreach_supported_languages(vc_supported_language_cb callback, void* user_data) { + if (0 != __vc_get_feature_enabled()) { + return VC_ERROR_NOT_SUPPORTED; + } + SLOG(LOG_DEBUG, TAG_VCC, "===== [Client] Foreach Supported Language"); if (NULL == callback) { @@ -473,6 +519,10 @@ int vc_foreach_supported_languages(vc_supported_language_cb callback, void* user int vc_get_current_language(char** language) { + if (0 != __vc_get_feature_enabled()) { + return VC_ERROR_NOT_SUPPORTED; + } + SLOG(LOG_DEBUG, TAG_VCC, "===== [Client] Get Current Language"); if (NULL == language) { @@ -505,6 +555,10 @@ int vc_get_current_language(char** language) int vc_get_state(vc_state_e* state) { + if (0 != __vc_get_feature_enabled()) { + return VC_ERROR_NOT_SUPPORTED; + } + SLOG(LOG_DEBUG, TAG_VCC, "===== [Client] Get State"); if (NULL == state) { @@ -537,6 +591,10 @@ int vc_get_state(vc_state_e* state) int vc_get_service_state(vc_service_state_e* state) { + if (0 != __vc_get_feature_enabled()) { + return VC_ERROR_NOT_SUPPORTED; + } + SLOG(LOG_DEBUG, TAG_VCC, "===== [Client] Get Service State"); if (NULL == state) { @@ -720,6 +778,10 @@ int vc_is_command_format_supported(vc_cmd_format_e format, bool* support) 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; + } + SLOG(LOG_DEBUG, TAG_VCC, "===== [Client] Set Command list"); if (NULL == vc_cmd_list) { @@ -787,6 +849,10 @@ int vc_set_command_list(vc_cmd_list_h vc_cmd_list, int type) int vc_unset_command_list(int type) { + if (0 != __vc_get_feature_enabled()) { + return VC_ERROR_NOT_SUPPORTED; + } + SLOG(LOG_DEBUG, TAG_VCC, "===== [Client] Unset Command list"); vc_state_e state; @@ -874,6 +940,10 @@ int vc_get_exclusive_command_option(bool* value) int vc_set_exclusive_command_option(bool value) { + if (0 != __vc_get_feature_enabled()) { + return VC_ERROR_NOT_SUPPORTED; + } + SLOG(LOG_DEBUG, TAG_VCC, "===== [Client] Set exclusive command"); vc_state_e state; @@ -1225,6 +1295,10 @@ void __vc_cb_result(int pid) int vc_set_result_cb(vc_result_cb callback, void* user_data) { + if (0 != __vc_get_feature_enabled()) { + return VC_ERROR_NOT_SUPPORTED; + } + if (NULL == callback) return VC_ERROR_INVALID_PARAMETER; @@ -1247,6 +1321,10 @@ int vc_set_result_cb(vc_result_cb callback, void* user_data) int vc_unset_result_cb(void) { + if (0 != __vc_get_feature_enabled()) { + return VC_ERROR_NOT_SUPPORTED; + } + vc_state_e state; if (0 != vc_client_get_client_state(g_vc, &state)) { SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Unset result callback : A handle is not available"); @@ -1298,6 +1376,10 @@ int __vc_cb_service_state(int state) int vc_set_service_state_changed_cb(vc_service_state_changed_cb callback, void* user_data) { + if (0 != __vc_get_feature_enabled()) { + return VC_ERROR_NOT_SUPPORTED; + } + if (NULL == callback) return VC_ERROR_INVALID_PARAMETER; @@ -1320,6 +1402,10 @@ int vc_set_service_state_changed_cb(vc_service_state_changed_cb callback, void* int vc_unset_service_state_changed_cb(void) { + if (0 != __vc_get_feature_enabled()) { + return VC_ERROR_NOT_SUPPORTED; + } + vc_state_e state; if (0 != vc_client_get_client_state(g_vc, &state)) { SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Unset result callback : A handle is not available"); @@ -1339,6 +1425,10 @@ int vc_unset_service_state_changed_cb(void) 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 (callback == NULL) return VC_ERROR_INVALID_PARAMETER; @@ -1361,6 +1451,10 @@ int vc_set_state_changed_cb(vc_state_changed_cb callback, void* user_data) int vc_unset_state_changed_cb(void) { + if (0 != __vc_get_feature_enabled()) { + return VC_ERROR_NOT_SUPPORTED; + } + vc_state_e state; if (0 != vc_client_get_client_state(g_vc, &state)) { SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Unset state changed callback : A handle is not available"); @@ -1380,6 +1474,10 @@ int vc_unset_state_changed_cb(void) int vc_set_current_language_changed_cb(vc_current_language_changed_cb callback, void* user_data) { + if (0 != __vc_get_feature_enabled()) { + return VC_ERROR_NOT_SUPPORTED; + } + if (NULL == callback) return VC_ERROR_INVALID_PARAMETER; @@ -1402,6 +1500,10 @@ int vc_set_current_language_changed_cb(vc_current_language_changed_cb callback, int vc_unset_current_language_changed_cb(void) { + if (0 != __vc_get_feature_enabled()) { + return VC_ERROR_NOT_SUPPORTED; + } + vc_state_e state; if (0 != vc_client_get_client_state(g_vc, &state)) { SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Unset current language changed : A handle is not available"); @@ -1421,6 +1523,10 @@ int vc_unset_current_language_changed_cb(void) int vc_set_error_cb(vc_error_cb callback, void* user_data) { + if (0 != __vc_get_feature_enabled()) { + return VC_ERROR_NOT_SUPPORTED; + } + if (NULL == callback) return VC_ERROR_INVALID_PARAMETER; @@ -1443,6 +1549,10 @@ int vc_set_error_cb(vc_error_cb callback, void* user_data) int vc_unset_error_cb(void) { + if (0 != __vc_get_feature_enabled()) { + return VC_ERROR_NOT_SUPPORTED; + } + vc_state_e state; if (0 != vc_client_get_client_state(g_vc, &state)) { SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Unset error callback : A handle is not available"); diff --git a/common/vc_command.c b/common/vc_command.c index c06d828..f4fb2ef 100644 --- a/common/vc_command.c +++ b/common/vc_command.c @@ -17,6 +17,7 @@ #include #include +#include #include "vc_command.h" #include "vc_main.h" @@ -25,9 +26,38 @@ #include "voice_control_common.h" #include "voice_control_key_defines.h" +static int g_feature_enabled = -1; + +static int __vc_cmd_get_feature_enabled() +{ + if (0 == g_feature_enabled) { + SLOG(LOG_ERROR, TAG_VCC, "[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_VCC, "[ERROR] Voice control feature NOT supported"); + g_feature_enabled = 0; + return VC_ERROR_NOT_SUPPORTED; + } + + g_feature_enabled = 1; + } + } + } + + return 0; +} 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 (NULL == vc_cmd_list) { SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Input parameter is NULL"); return VC_ERROR_INVALID_PARAMETER; @@ -52,6 +82,10 @@ int vc_cmd_list_create(vc_cmd_list_h* vc_cmd_list) 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 (NULL == vc_cmd_list) { SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Input parameter is NULL"); return VC_ERROR_INVALID_PARAMETER; @@ -74,6 +108,10 @@ int vc_cmd_list_destroy(vc_cmd_list_h vc_cmd_list, bool release_command) 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 (NULL == vc_cmd_list || NULL == count) { SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Get command count : Input parameter is NULL"); return VC_ERROR_INVALID_PARAMETER; @@ -91,6 +129,10 @@ int vc_cmd_list_get_count(vc_cmd_list_h vc_cmd_list, int* count) 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 (NULL == vc_cmd_list || NULL == vc_command) { SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Input parameter is NULL"); return VC_ERROR_INVALID_PARAMETER; @@ -115,6 +157,10 @@ int vc_cmd_list_add(vc_cmd_list_h vc_cmd_list, vc_cmd_h vc_command) 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 (NULL == vc_cmd_list || NULL == vc_command) { SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Input parameter is NULL"); return VC_ERROR_INVALID_PARAMETER; @@ -165,6 +211,10 @@ int vc_cmd_list_remove(vc_cmd_list_h vc_cmd_list, vc_cmd_h vc_command) 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; + } + SLOG(LOG_DEBUG, TAG_VCCMD, "===== Destroy all command"); if (NULL == vc_cmd_list) { @@ -209,6 +259,10 @@ int vc_cmd_list_remove_all(vc_cmd_list_h vc_cmd_list, bool release_command) int vc_cmd_list_foreach_commands(vc_cmd_list_h vc_cmd_list, vc_cmd_list_cb callback, void* user_data) { + if (0 != __vc_cmd_get_feature_enabled()) { + return VC_ERROR_NOT_SUPPORTED; + } + if (NULL == vc_cmd_list) { SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Input parameter is NULL"); return VC_ERROR_INVALID_PARAMETER; @@ -244,6 +298,10 @@ int vc_cmd_list_foreach_commands(vc_cmd_list_h vc_cmd_list, vc_cmd_list_cb callb 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 (NULL == vc_cmd_list) { SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Input parameter is NULL"); return VC_ERROR_INVALID_PARAMETER; @@ -264,6 +322,10 @@ int vc_cmd_list_first(vc_cmd_list_h vc_cmd_list) 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 (NULL == vc_cmd_list) { SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Input parameter is NULL"); return VC_ERROR_INVALID_PARAMETER; @@ -287,6 +349,10 @@ int vc_cmd_list_last(vc_cmd_list_h vc_cmd_list) 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 (NULL == vc_cmd_list) { SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Input parameter is NULL"); return VC_ERROR_INVALID_PARAMETER; @@ -310,6 +376,10 @@ int vc_cmd_list_next(vc_cmd_list_h vc_cmd_list) 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 (NULL == vc_cmd_list) { SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Input parameter is NULL"); return VC_ERROR_INVALID_PARAMETER; @@ -331,6 +401,10 @@ int vc_cmd_list_prev(vc_cmd_list_h vc_cmd_list) 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 (NULL == vc_cmd_list || NULL == vc_command) { SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Input parameter is NULL"); return VC_ERROR_INVALID_PARAMETER; @@ -360,6 +434,10 @@ int vc_cmd_list_get_current(vc_cmd_list_h vc_cmd_list, vc_cmd_h* vc_command) int vc_cmd_create(vc_cmd_h* vc_command) { + if (0 != __vc_cmd_get_feature_enabled()) { + return VC_ERROR_NOT_SUPPORTED; + } + if (NULL == vc_command) { SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Input parameter is NULL"); return VC_ERROR_INVALID_PARAMETER; @@ -392,6 +470,10 @@ int vc_cmd_create(vc_cmd_h* vc_command) int vc_cmd_destroy(vc_cmd_h vc_command) { + if (0 != __vc_cmd_get_feature_enabled()) { + return VC_ERROR_NOT_SUPPORTED; + } + if (NULL == vc_command) { SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Input parameter is NULL"); return VC_ERROR_INVALID_PARAMETER; @@ -414,6 +496,10 @@ int vc_cmd_destroy(vc_cmd_h vc_command) 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 (NULL == vc_command) { SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Invalid parameter "); return VC_ERROR_INVALID_PARAMETER; @@ -432,6 +518,10 @@ int vc_cmd_set_id(vc_cmd_h vc_command, int id) 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 (NULL == vc_command || NULL == id) { SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Invalid handle "); return VC_ERROR_INVALID_PARAMETER; @@ -450,6 +540,10 @@ int vc_cmd_get_id(vc_cmd_h vc_command, int* id) 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 (NULL == vc_command) { SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Invalid parameter "); return VC_ERROR_INVALID_PARAMETER; @@ -475,6 +569,10 @@ int vc_cmd_set_command(vc_cmd_h vc_command, const char* command) 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 (NULL == vc_command || NULL == command) { SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Invalid handle "); return VC_ERROR_INVALID_PARAMETER; @@ -494,6 +592,10 @@ int vc_cmd_get_command(vc_cmd_h vc_command, char** command) 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 (NULL == vc_command) { SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Invalid parameter "); return VC_ERROR_INVALID_PARAMETER; @@ -518,6 +620,10 @@ int vc_cmd_set_unfixed_command(vc_cmd_h vc_command, const char* command) 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 (NULL == vc_command || NULL == command) { SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Invalid handle "); return VC_ERROR_INVALID_PARAMETER; @@ -536,6 +642,10 @@ int vc_cmd_get_unfixed_command(vc_cmd_h vc_command, char** command) 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 (NULL == vc_command) { SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Invalid parameter "); return VC_ERROR_INVALID_PARAMETER; @@ -553,6 +663,10 @@ int vc_cmd_set_type(vc_cmd_h vc_command, int type) 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 (NULL == vc_command || NULL == type) { SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Invalid parameter "); return VC_ERROR_INVALID_PARAMETER; @@ -570,6 +684,10 @@ int vc_cmd_get_type(vc_cmd_h vc_command, int* type) 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 (NULL == vc_command) { SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Invalid parameter "); return VC_ERROR_INVALID_PARAMETER; @@ -587,6 +705,10 @@ int vc_cmd_set_format(vc_cmd_h vc_command, vc_cmd_format_e format) 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 (NULL == vc_command || NULL == format) { SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Invalid parameter "); return VC_ERROR_INVALID_PARAMETER; @@ -604,6 +726,10 @@ int vc_cmd_get_format(vc_cmd_h vc_command, vc_cmd_format_e* format) 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 (NULL == vc_command) { SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Invalid parameter "); return VC_ERROR_INVALID_PARAMETER; @@ -621,6 +747,10 @@ int vc_cmd_set_pid(vc_cmd_h vc_command, int pid) 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 (NULL == vc_command || NULL == pid) { SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Invalid parameter "); return VC_ERROR_INVALID_PARAMETER; @@ -638,6 +768,10 @@ int vc_cmd_get_pid(vc_cmd_h vc_command, int* pid) 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 (NULL == vc_command) { SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Invalid parameter "); return VC_ERROR_INVALID_PARAMETER; @@ -655,6 +789,10 @@ int vc_cmd_set_domain(vc_cmd_h vc_command, int domain) 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 (NULL == vc_command || NULL == domain) { SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Invalid parameter "); return VC_ERROR_INVALID_PARAMETER; diff --git a/common/vc_defs.h b/common/vc_defs.h index 161c39e..03344ed 100644 --- a/common/vc_defs.h +++ b/common/vc_defs.h @@ -166,6 +166,9 @@ extern "C" { #define VC_RUNTIME_INFO_CLIENT tzplatform_mkpath(TZ_USER_HOME, "share/voice/vc/vc-client-info.xml") +#define VC_FEATURE_PATH "tizen.org/feature/speech.control" +#define VC_MIC_FEATURE_PATH "tizen.org/feature/microphone" + /****************************************************************************************** * Defines for common enum *******************************************************************************************/ diff --git a/doc/uix_vc_doc.h b/doc/uix_vc_doc.h index ba34513..ac100b1 100644 --- a/doc/uix_vc_doc.h +++ b/doc/uix_vc_doc.h @@ -11,7 +11,7 @@ * distributed under the License is distributed on an AS IS BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and - * limitations under the License. + * limitations under the License. */ @@ -22,35 +22,34 @@ * @defgroup CAPI_UIX_VOICE_CONTROL_MODULE Voice control * @ingroup CAPI_UIX_FRAMEWORK * @brief The @ref CAPI_UIX_VOICE_CONTROL_MODULE API provides functions for registering command and getting notification when registered command is recognized. - * + * * @section CAPI_UIX_VOICE_CONTROL_MODULE_HEADER Required Header * \#include
- * + * * @section CAPI_UIX_VOICE_CONTROL_MODULE_OVERVIEW Overview * A main function of Voice Control API register command and gets notification for recognition result. * Applications can add their own commands and be provided result when their command is recognized by user voice input. - * - * To use of Voice Control, use the following steps: + * + * To use of Voice Control, use the following steps:
* 1. Initialize
- * 2. Register callback functions for notifications
+ * 2. Register callback functions for notifications
* 3. Connect to voice control service asynchronously. The state should be changed to Ready
- * 4. Make command list as the following step
+ * 4. Make command list as the following step and Step 4 is called repeatedly for each command which an application wants
* 4-1. Create command list handle
* 4-2. Create command handle
* 4-3. Set command and type for command handle
* 4-4. Add command handle to command list
- * Step 4 is called repeatedly for each command which an application wants
* 5. Set command list for recognition
* 6. If an application wants to finish voice control,
* 6-1. Destroy command and command list handle
* 6-2. Deinitialize
* - * An application can obtain command handle from command list, and also get information from handle. + * An application can obtain command handle from command list, and also get information from handle. * * - * The Voice Control API also notifies you (by callback mechanism) when the states of client and service are changed, + * The Voice Control API also notifies you (by callback mechanism) when the states of client and service are changed, * command is recognized, current language is changed or error occurred. - * An application should register callback functions: vc_state_changed_cb(), vc_service_state_changed_cb(), vc_result_cb(), + * An application should register callback functions: vc_state_changed_cb(), vc_service_state_changed_cb(), vc_result_cb(), * vc_current_language_changed_cb(), vc_error_cb(). * * @section CAPI_UIX_VOICE_CONTROL_MODULE_STATE_DIAGRAM State Diagram @@ -100,7 +99,7 @@ * The following table shows state-dependent function calls. * It is forbidden to call functions listed below in wrong states. * Violation of this rule may result in an unpredictable behavior. - * + * * * * @@ -173,10 +172,11 @@ * * *
FUNCTION All callback function should be registered in Initialized state
- * - * @section CAPI_UIX_STT_MODULE_FEATURE Related Features + * + * @section CAPI_UIX_VOICE_CONTROL_MODULE Related Features * This API is related with the following features:
* - http://tizen.org/feature/microphone
+ * - http://tizen.org/feature/speech.control
* * It is recommended to design feature related codes in your application for reliability.
* You can check if a device supports the related features for this API by using @ref CAPI_SYSTEM_SYSTEM_INFO_MODULE, thereby controlling the procedure of your application.
diff --git a/packaging/voice-control.spec b/packaging/voice-control.spec index e154945..575da96 100644 --- a/packaging/voice-control.spec +++ b/packaging/voice-control.spec @@ -1,6 +1,6 @@ Name: voice-control Summary: Voice control client library and daemon -Version: 0.2.9 +Version: 0.2.10 Release: 1 Group: Graphics & UI Framework/Voice Framework License: Apache-2.0 @@ -15,6 +15,7 @@ BuildRequires: pkgconfig(capi-base-common) BuildRequires: pkgconfig(capi-media-audio-io) BuildRequires: pkgconfig(capi-media-sound-manager) BuildRequires: pkgconfig(capi-network-bluetooth) +BuildRequires: pkgconfig(capi-system-info) BuildRequires: pkgconfig(dbus-1) BuildRequires: pkgconfig(dlog) BuildRequires: pkgconfig(ecore) -- 2.7.4