Add description and retry limitation for vc_prepare_sync 65/152465/2
authorSuyeon Hwang <stom.hwang@samsung.com>
Tue, 26 Sep 2017 01:16:34 +0000 (10:16 +0900)
committerSuyeon Hwang <stom.hwang@samsung.com>
Thu, 28 Sep 2017 00:22:52 +0000 (09:22 +0900)
Change-Id: I5dd1448ff1f861d1ac23d4aad2988b789f9376b1
Signed-off-by: Suyeon Hwang <stom.hwang@samsung.com>
client/vc.c
common/vc_defs.h
include/voice_control_internal.h

index 7fe220e..78e5193 100644 (file)
@@ -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;
 }
 
index 31d4725..7947a92 100755 (executable)
@@ -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"
index d73dcfb..cc5b4ad 100644 (file)
@@ -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);