From: Suyeon Hwang Date: Tue, 26 Sep 2017 01:16:34 +0000 (+0900) Subject: Add description and retry limitation for vc_prepare_sync X-Git-Tag: accepted/tizen/unified/20180228.071746~38^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=789c792f9a4abb07b7d07e01c560e4e23f5493bf;p=platform%2Fcore%2Fuifw%2Fvoice-control.git Add description and retry limitation for vc_prepare_sync Change-Id: I5dd1448ff1f861d1ac23d4aad2988b789f9376b1 Signed-off-by: Suyeon Hwang --- diff --git a/client/vc.c b/client/vc.c index 7fe220e..78e5193 100644 --- a/client/vc.c +++ b/client/vc.c @@ -597,10 +597,18 @@ int vc_prepare_sync(void) return VC_ERROR_INVALID_STATE; } - while (EINA_TRUE == __vc_connect_daemon(NULL)); + int cnt = 0; + while (EINA_TRUE == __vc_connect_daemon(NULL) && VC_CONNECTION_RETRY_COUNT > cnt) { + cnt++; + } SLOG(LOG_DEBUG, TAG_VCC, "@@@"); + if (VC_CONNECTION_RETRY_COUNT == cnt) { + SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to connect daemon"); + return VC_ERROR_OPERATION_FAILED; + } + return VC_ERROR_NONE; } diff --git a/common/vc_defs.h b/common/vc_defs.h index 31d4725..7947a92 100755 --- a/common/vc_defs.h +++ b/common/vc_defs.h @@ -202,6 +202,7 @@ extern "C" { #define VC_BASE_LANGUAGE "en_US" #define VC_RETRY_COUNT 5 #define VC_RUNTIME_INFO_NO_FOREGROUND -1 +#define VC_CONNECTION_RETRY_COUNT 10 #define VC_FEATURE_PATH "tizen.org/feature/speech.control" #define VC_MIC_FEATURE_PATH "tizen.org/feature/microphone" diff --git a/include/voice_control_internal.h b/include/voice_control_internal.h index d73dcfb..cc5b4ad 100644 --- a/include/voice_control_internal.h +++ b/include/voice_control_internal.h @@ -49,8 +49,8 @@ typedef bool (*vc_asr_result_cb)(vc_result_event_e event, const char* result, vo * @privilege %http://tizen.org/privilege/recorder * * @remarks The command type is valid for #VC_COMMAND_TYPE_FOREGROUND and #VC_COMMAND_TYPE_BACKGROUND. - * Therefore, @a type is either #VC_COMMAND_TYPE_FOREGROUND or #VC_COMMAND_TYPE_BACKGROUND. \n - * In the file corresponding to @a file_path, there must be commands and command types. + * Therefore, @a type is either #VC_COMMAND_TYPE_FOREGROUND or #VC_COMMAND_TYPE_BACKGROUND. + * In the file corresponding to @a file_path, there must be commands and command types. * * @param[in] file_path The command file path (absolute or relative) * @param[in] type Command type @@ -68,6 +68,22 @@ typedef bool (*vc_asr_result_cb)(vc_result_event_e event, const char* result, vo */ int vc_set_command_list_from_file(const char* file_path, int type); +/** + * @brief Connects the voice control service synchronously. + * @since_tizen 4.0 + * @privlevel public + * @privilege %http://tizen.org/privilege/recorder + * @return @c 0 on success, + * otherwise a negative error value + * @retval #VC_ERROR_NONE Successful + * @retval #VC_ERROR_INVALID_STATE Invalid state + * @retval #VC_ERROR_OPERATION_FAILED Operation failure + * @retval #VC_ERROR_PERMISSION_DENIED Permission denied + * @retval #VC_ERROR_NOT_SUPPORTED Not supported + * @pre The state should be #VC_STATE_INITIALIZED. + * @post If this function is called, the state will be #VC_STATE_READY. + * @see vc_unprepare() + */ int vc_prepare_sync(void);