/*
-* Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved
+* Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
int ret;
if (0 != uid) {
- ret = sttd_server_stop(uid);
+ ret = sttd_server_stop(uid);
if (0 > ret) {
return EINA_FALSE;
}
-
+
if (STTD_RESULT_STATE_DONE == ret) {
ret = sttdc_send_set_state(uid, (int)APP_STATE_PROCESSING);
if (0 != ret) {
if (0 != uid) {
ret = sttd_engine_agent_set_recording_data(uid, data, length);
if (ret < 0) {
- ecore_timer_add(0, __cancel_by_error, NULL);
- return -1;
+ ecore_timer_add(0, __cancel_by_error, NULL);
+ return -1;
}
g_recording_log_count++;
if (200 <= g_recording_log_count) {
SLOG(LOG_DEBUG, TAG_STTD, "=====");
SLOG(LOG_DEBUG, TAG_STTD, " ");
-
+
return EINA_FALSE;
}
/* send result to client */
if (STTP_RESULT_EVENT_FINAL_RESULT == event) {
- if (APP_STATE_PROCESSING != state ) {
+ if (APP_STATE_PROCESSING != state) {
SLOG(LOG_WARN, TAG_STTD, "[Server WARNING] Current state is NOT 'Processing'.");
}
SECURE_SLOG(LOG_DEBUG, TAG_STTD, "[Server] the size of result from engine is '%d'", data_count);
if (NULL == data || 0 == data_count) {
if (0 != sttdc_send_result(uid, event, NULL, 0, msg)) {
- SLOG(LOG_ERROR, TAG_STTD, "[Server ERROR] Fail to send result");
+ SLOG(LOG_ERROR, TAG_STTD, "[Server ERROR] Fail to send result");
int reason = (int)STTD_ERROR_OPERATION_FAILED;
if (0 != sttdc_send_error_signal(uid, reason, "Fail to send recognition result")) {
}
} else {
if (0 != sttdc_send_result(uid, event, data, data_count, msg)) {
- SLOG(LOG_ERROR, TAG_STTD, "[Server ERROR] Fail to send result");
+ SLOG(LOG_ERROR, TAG_STTD, "[Server ERROR] Fail to send result");
int reason = (int)STTD_ERROR_OPERATION_FAILED;
if (0 != sttdc_send_error_signal(uid, reason, "Fail to send recognition result")) {
SLOG(LOG_ERROR, TAG_STTD, "[Server ERROR] Fail to send result ");
/* send error msg */
- int reason = (int)STTD_ERROR_INVALID_STATE;
+ int reason = (int)STTD_ERROR_INVALID_STATE;
if (0 != sttdc_send_error_signal(uid, reason, "[ERROR] Fail to send recognition result")) {
SLOG(LOG_ERROR, TAG_STTD, "[Server ERROR] Fail to send error info ");
}
bool __server_result_time_callback(int index, sttp_result_time_event_e event, const char* text, long start_time, long end_time, void* user_data)
{
- SLOG(LOG_DEBUG, TAG_STTD, "[Server] index(%d) event(%d) text(%s) start(%ld) end(%ld)",
- index, event, text, start_time, end_time);
+ SLOG(LOG_DEBUG, TAG_STTD, "[Server] index(%d) event(%d) text(%s) start(%ld) end(%ld)",
+ index, event, text, start_time, end_time);
if (0 == index) {
int ret;
if (0 != ret)
SLOG(LOG_ERROR, TAG_STTD, "[Server ERROR] Fail to set default lang : result(%d)", ret);
}
-
+
ret = sttd_engine_agent_set_silence_detection(support_silence);
if (0 != ret)
SLOG(LOG_ERROR, TAG_STTD, "[Server ERROR] Fail to Result(%d)", ret);
SLOG(LOG_ERROR, TAG_STTD, "[Server ERROR] Fail to engine agent initialize : result(%d)", ret);
return ret;
}
-
+
/* Update engine list */
ret = sttd_engine_agent_initialize_engine_list();
if (0 != ret) {
if (NULL != client_list) {
SLOG(LOG_DEBUG, TAG_STTD, "===== Clean up client ");
- for (i = 0;i < client_count;i++) {
+ for (i = 0; i < client_count; i++) {
result = sttdc_send_hello(client_list[i]);
if (0 == result) {
if (false == sttd_engine_agent_is_default_engine()) {
/* Update installed engine */
sttd_engine_agent_initialize_engine_list();
-
+
if (false == sttd_engine_agent_is_default_engine()) {
SLOG(LOG_WARN, TAG_STTD, "[Server WARNING] No stt-engine");
return STTD_ERROR_ENGINE_NOT_FOUND;
stt_client_unset_current_recognition();
}
-
+
if (0 != sttd_engine_agent_unload_current_engine(uid)) {
SLOG(LOG_ERROR, TAG_STTD, "[Server ERROR] Fail to unload engine");
}
sttd_dbus_close_connection();
ecore_timer_add(0, __quit_ecore_loop, NULL);
}
-
+
return STTD_ERROR_NONE;
}
SECURE_SLOG(LOG_ERROR, TAG_STTD, "[Server ERROR] The state of uid(%d) is not Ready", uid);
return STTD_ERROR_INVALID_STATE;
}
-
+
int ret;
ret = sttd_engine_agent_get_current_engine(uid, engine_id);
if (0 != ret) {
/* Check if uid is valid */
app_state_e state;
if (0 != sttd_client_get_state(uid, &state)) {
- SLOG(LOG_ERROR, TAG_STTD, "[Server ERROR] uid is NOT valid ");
+ SLOG(LOG_ERROR, TAG_STTD, "[Server ERROR] uid is NOT valid ");
return STTD_ERROR_INVALID_PARAMETER;
}
/*get current language from engine */
int ret = sttd_engine_agent_get_default_lang(uid, current_lang);
- if (0 != ret) {
+ if (0 != ret) {
SLOG(LOG_ERROR, TAG_STTD, "[Server ERROR] Fail to get default language :result(%d)", ret);
return STTD_ERROR_OPERATION_FAILED;
}
bool temp;
int ret = sttd_engine_agent_is_recognition_type_supported(uid, type, &temp);
- if (0 != ret) {
+ if (0 != ret) {
SLOG(LOG_ERROR, TAG_STTD, "[Server ERROR] Fail to get recognition type supported : result(%d)", ret);
return STTD_ERROR_OPERATION_FAILED;
}
-
+
*support = (int)temp;
SECURE_SLOG(LOG_DEBUG, TAG_STTD, "[Server SUCCESS] recognition type supporting is %s", *support ? "true" : "false");
}
int ret = sttd_client_set_start_sound(uid, file);
- if (0 != ret) {
+ if (0 != ret) {
SLOG(LOG_ERROR, TAG_STTD, "[Server ERROR] Fail to set start sound file : result(%d)", ret);
return STTD_ERROR_OPERATION_FAILED;
}
}
int ret = sttd_client_set_stop_sound(uid, file);
- if (0 != ret) {
+ if (0 != ret) {
SLOG(LOG_ERROR, TAG_STTD, "[Server ERROR] Fail to set start sound file : result(%d)", ret);
return STTD_ERROR_OPERATION_FAILED;
}
}
Eina_Bool __check_recording_state(void *data)
-{
+{
/* current uid */
int uid = stt_client_get_current_recognition();
if (0 == uid)
}
/* engine start recognition */
- SECURE_SLOG(LOG_DEBUG, TAG_STTD, "[Server] start : uid(%d), lang(%s), recog_type(%s)",
- uid, lang, recognition_type);
+ SECURE_SLOG(LOG_DEBUG, TAG_STTD, "[Server] start : uid(%d), lang(%s), recog_type(%s)",
+ uid, lang, recognition_type);
if (NULL != sound)
SECURE_SLOG(LOG_DEBUG, TAG_STTD, "[Server] start sound : %s", sound);
SLOG(LOG_ERROR, TAG_STTD, "[Server ERROR] Fail to send result ");
/* send error msg */
- int reason = (int)STTD_ERROR_TIMED_OUT;
+ int reason = (int)STTD_ERROR_TIMED_OUT;
if (0 != sttdc_send_error_signal(uid, reason, "[ERROR] Fail to send recognition result")) {
SLOG(LOG_ERROR, TAG_STTD, "[Server ERROR] Fail to send error info ");
}
char* sound = NULL;
if (0 != sttd_client_get_stop_sound(uid, &sound)) {
- SLOG(LOG_ERROR, TAG_STTD, "[Server ERROR] Fail to get start beep sound");
+ SLOG(LOG_ERROR, TAG_STTD, "[Server ERROR] Fail to get start beep sound");
return STTD_ERROR_OPERATION_FAILED;
}
if (0 != ret) {
SLOG(LOG_ERROR, TAG_STTD, "[Server ERROR] Fail to stop recorder : result(%d)", ret);
if (0 != sttd_engine_agent_recognize_cancel(uid)) {
- SLOG(LOG_ERROR, TAG_STTD, "[Server ERROR] Fail to cancel recognize");
+ SLOG(LOG_ERROR, TAG_STTD, "[Server ERROR] Fail to cancel recognize");
}
if (NULL != sound) free(sound);
return STTD_ERROR_OPERATION_FAILED;
sttd_client_set_state(uid, APP_STATE_PROCESSING);
SLOG(LOG_DEBUG, TAG_STTD, "[Server SUCCESS] Stop recognition");
-
+
g_processing_timer = ecore_timer_add(g_processing_timeout, __time_out_for_processing, NULL);
return STTD_RESULT_STATE_DONE;
return STTD_ERROR_INVALID_PARAMETER;
}
- /* check uid state */
+ /* check uid state */
if (APP_STATE_READY == state) {
SLOG(LOG_WARN, TAG_STTD, "[Server WARNING] Current state is ready");
return STTD_ERROR_NONE;
if (0 != ret) {
SLOG(LOG_ERROR, TAG_STTD, "[Server ERROR] Fail to unset session : %d", ret);
return STTD_ERROR_OPERATION_FAILED;
- }
+ }
}
/* change uid state */