if (STT_INTERNAL_STATE_NONE != client->internal_state) {
SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Invalid State : Internal state is NOT none : %d", client->internal_state);
- return STT_ERROR_INVALID_STATE;
+ return STT_ERROR_IN_PROGRESS_TO_RECORDING;
}
int ret = -1;
temp = strdup(language);
}
-#if 0
- ret = -1;
- /* do request */
- int count = 0;
- while (0 != ret) {
- ret = stt_dbus_request_start(client->uid, temp, type, client->silence, appid);
- if (0 > ret) {
- /* Failure */
- if (STT_ERROR_TIMED_OUT != ret) {
- SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Fail to start : %s", __stt_get_error_code(ret));
- if (NULL != temp) free(temp);
- return ret;
- } else {
- SLOG(LOG_WARN, TAG_STTC, "[WARNING] retry to start");
- usleep(10000);
- count++;
- if (STT_RETRY_COUNT == count) {
- SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Fail to request");
- if (NULL != temp) free(temp);
- return ret;
- }
- }
- } else {
- /* Success */
- if (NULL != temp) free(temp);
-
- if (STT_RESULT_STATE_DONE == ret) {
- SLOG(LOG_DEBUG, TAG_STTC, "[SUCCESS] Start is done : %d", ret);
- client->before_state = client->current_state;
- client->current_state = STT_STATE_RECORDING;
-
- if (NULL != client->state_changed_cb) {
- ecore_main_loop_thread_safe_call_async(__stt_notify_state_changed, client);
- } else {
- SLOG(LOG_WARN, TAG_STTC, "[WARNING] State changed callback is null");
- }
- } else if (STT_RESULT_STATE_NOT_DONE == ret) {
- SLOG(LOG_DEBUG, TAG_STTC, "[SUCCESS] Start is not done : %d", ret);
- client->internal_state = STT_INTERNAL_STATE_STARTING;
- } else {
- SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Invalid result : %d", ret);
- }
-
- ret = STT_ERROR_NONE;
- break;
- }
- }
-#else
if (true == client->credential_needed && NULL == client->credential) {
SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Do not have app credential for this engine(%s)", client->current_engine_id);
return STT_ERROR_PERMISSION_DENIED;
}
if (NULL != temp) free(temp);
-#endif
+
SLOG(LOG_DEBUG, TAG_STTC, "=====");
SLOG(LOG_DEBUG, TAG_STTC, " ");
if (STT_INTERNAL_STATE_NONE != client->internal_state) {
SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Invalid State : Internal state is NOT none : %d", client->internal_state);
- return STT_ERROR_INVALID_STATE;
+ return STT_ERROR_IN_PROGRESS_TO_PROCESSING;
}
-#if 0
- int ret = -1;
- /* do request */
- int count = 0;
- while (0 != ret) {
- ret = stt_dbus_request_stop(client->uid);
- if (0 > ret) {
- /* Failure */
- if (STT_ERROR_TIMED_OUT != ret) {
- SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Fail to stop : %s", __stt_get_error_code(ret));
- return ret;
- } else {
- SLOG(LOG_WARN, TAG_STTC, "[WARNING] retry stop");
- usleep(10000);
- count++;
- if (STT_RETRY_COUNT == count) {
- SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Fail to request");
- return ret;
- }
- }
- } else {
- if (STT_RESULT_STATE_DONE == ret) {
- SLOG(LOG_DEBUG, TAG_STTC, "[SUCCESS] Stop is done : %d", ret);
- client->before_state = client->current_state;
- client->current_state = STT_STATE_PROCESSING;
-
- if (NULL != client->state_changed_cb) {
- ecore_main_loop_thread_safe_call_async(__stt_notify_state_changed, client);
- SLOG(LOG_DEBUG, TAG_STTC, "State changed callback is called");
- } else {
- SLOG(LOG_WARN, TAG_STTC, "[WARNING] State changed callback is null");
- }
- } else if (STT_RESULT_STATE_NOT_DONE == ret) {
- SLOG(LOG_DEBUG, TAG_STTC, "[SUCCESS] Stop is not done : %d", ret);
- client->internal_state = STT_INTERNAL_STATE_STOPING;
- } else {
- SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Invalid result : %d", ret);
- }
- ret = STT_ERROR_NONE;
- break;
- }
- }
-#else
+
int ret = stt_dbus_request_stop(client->uid);
if (0 != ret) {
SLOG(LOG_DEBUG, TAG_STTC, "[SUCCESS] Stop is successful but not done");
client->internal_state = STT_INTERNAL_STATE_STOPING;
}
-#endif
+
SLOG(LOG_DEBUG, TAG_STTC, "=====");
SLOG(LOG_DEBUG, TAG_STTC, " ");
if (STT_INTERNAL_STATE_NONE != client->internal_state) {
SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Invalid State : Internal state is NOT none : %d", client->internal_state);
- return STT_ERROR_INVALID_STATE;
+ return STT_ERROR_IN_PROGRESS_TO_READY;
}
-#if 0
- int ret = -1;
- /* do request */
- int count = 0;
- while (0 != ret) {
- ret = stt_dbus_request_cancel(client->uid);
- if (0 != ret) {
- /* Failure */
- if (STT_ERROR_TIMED_OUT != ret) {
- SLOG(LOG_DEBUG, TAG_STTC, "[ERROR] Fail to cancel : %s", __stt_get_error_code(ret));
- return ret;
- } else {
- SLOG(LOG_WARN, TAG_STTC, "[WARNING] retry");
- usleep(10000);
- count++;
- if (STT_RETRY_COUNT == count) {
- SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Fail to request");
- return ret;
- }
- }
- } else {
- SLOG(LOG_DEBUG, TAG_STTC, "[SUCCESS]");
-
- client->before_state = client->current_state;
- client->current_state = STT_STATE_READY;
- if (NULL != client->state_changed_cb) {
- ecore_main_loop_thread_safe_call_async(__stt_notify_state_changed, client);
- SLOG(LOG_DEBUG, TAG_STTC, "State changed callback is called");
- } else {
- SLOG(LOG_WARN, TAG_STTC, "[WARNING] State changed callback is null");
- }
- ret = STT_ERROR_NONE;
- break;
- }
- }
-#else
int ret = stt_dbus_request_cancel(client->uid);
if (0 != ret) {
SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Fail to cancel : %s", __stt_get_error_code(ret));
SLOG(LOG_DEBUG, TAG_STTC, "[SUCCESS] Cancel is successful but not done");
client->internal_state = STT_INTERNAL_STATE_CANCELING;
}
-#endif
+
SLOG(LOG_DEBUG, TAG_STTC, "=====");
SLOG(LOG_DEBUG, TAG_STTC, " ");
STT_ERROR_ENGINE_NOT_FOUND = TIZEN_ERROR_STT | 0x03, /**< No available engine */
STT_ERROR_OPERATION_FAILED = TIZEN_ERROR_STT | 0x04, /**< Operation failed */
STT_ERROR_NOT_SUPPORTED_FEATURE = TIZEN_ERROR_STT | 0x05, /**< Not supported feature of current engine */
- STT_ERROR_NO_SPEECH = TIZEN_ERROR_STT | 0x06 /**< No speech while recording */
+ STT_ERROR_NO_SPEECH = TIZEN_ERROR_STT | 0x06, /**< No speech while recording */
+ STT_ERROR_IN_PROGRESS_TO_READY = TIZEN_ERROR_STT | 0x07, /**< Progress to ready is not finished */
+ STT_ERROR_IN_PROGRESS_TO_RECORDING = TIZEN_ERROR_STT | 0x08, /**< Progress to recording is not finished */
+ STT_ERROR_IN_PROGRESS_TO_PROCESSING = TIZEN_ERROR_STT | 0x09 /**< Progress to processing is not finished */
} stt_error_e;
/**
* @retval #STT_ERROR_RECORDER_BUSY Recorder busy
* @retval #STT_ERROR_INVALID_LANGUAGE Invalid language
* @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
+ * @retval #STT_ERROR_IN_PROGRESS_TO_RECORDING Progress to recording is not finished
*
* @pre The state should be #STT_STATE_READY.
* @post It will invoke stt_state_changed_cb(), if you register a callback with stt_state_changed_cb(). \n
* If this function succeeds, the STT state will be #STT_STATE_RECORDING.
+ * If you call this function again before state changes, you will receive STT_ERROR_IN_PROGRESS_TO_RECORDING.
*
* @see stt_stop()
* @see stt_cancel()
* @retval #STT_ERROR_INVALID_STATE Invalid state
* @retval #STT_ERROR_OPERATION_FAILED Operation failure
* @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
+ * @retval #STT_ERROR_IN_PROGRESS_TO_PROCESSING Progress to processing is not finished
*
* @pre The state should be #STT_STATE_RECORDING.
* @post It will invoke stt_state_changed_cb(), if you register a callback with stt_state_changed_cb(). \n
* If this function succeeds, the STT state will be #STT_STATE_PROCESSING. \n
+ * If you call this function again before state changes, you will receive STT_ERROR_IN_PROGRESS_TO_PROCESSING.
* After processing of engine, stt_result_cb() is called.
*
* @see stt_start()
* @retval #STT_ERROR_INVALID_STATE Invalid state
* @retval #STT_ERROR_OPERATION_FAILED Operation failure
* @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
+ * @retval #STT_ERROR_IN_PROGRESS_TO_READY Progress to ready is not finished
*
* @pre The state should be #STT_STATE_RECORDING or #STT_STATE_PROCESSING.
* @post It will invoke stt_state_changed_cb(), if you register a callback with stt_state_changed_cb(). \n
* If this function succeeds, the STT state will be #STT_STATE_READY.
+ * If you call this function again before state changes, you will receive STT_ERROR_IN_PROGRESS_TO_READY.
*
* @see stt_start()
* @see stt_stop()