From: sooyeon.kim Date: Tue, 20 Sep 2016 07:18:06 +0000 (+0900) Subject: Fix return types X-Git-Tag: accepted/tizen/common/20160921.162716^0 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fstt.git;a=commitdiff_plain;h=e6a2fa55dcb95dac33c2a46ce78347727fa8687e Fix return types Change-Id: Ic266189e631c5c090fc2b81a02db41a7a0453781 Signed-off-by: sooyeon.kim --- diff --git a/client/stt_file.c b/client/stt_file.c index e95b3c3..0a3e918 100644 --- a/client/stt_file.c +++ b/client/stt_file.c @@ -250,7 +250,7 @@ static sttengine_info_s* __stt_file_get_engine_by_id(int engine_id) return NULL; } -void __stt_file_result_cb(stte_result_event_e event, const char* type, const char** data, int data_count, +int __stt_file_result_cb(stte_result_event_e event, const char* type, const char** data, int data_count, const char* msg, void* time_info, void *user_data) { @@ -270,7 +270,7 @@ void __stt_file_result_cb(stte_result_event_e event, const char* type, const cha /* check handle */ if (NULL == client) { SLOG(LOG_ERROR, TAG_STTFC, "[ERROR] Fail to notify error : A handle is not valid"); - return; + return STT_FILE_ERROR_OPERATION_FAILED; } if (NULL != time_info) { @@ -304,7 +304,7 @@ void __stt_file_result_cb(stte_result_event_e event, const char* type, const cha } } - return; + return STT_FILE_ERROR_NONE; } void __stt_file_speech_status_cb(stte_speech_status_e status, void *user_data) diff --git a/common/stt_engine.c b/common/stt_engine.c index 6e3498f..ab6a4bc 100644 --- a/common/stt_engine.c +++ b/common/stt_engine.c @@ -774,7 +774,7 @@ int stt_engine_send_result(stte_result_event_e event, const char* type, const ch SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Fail to send result"); } } else { - g_result_cb(event, type, result, result_count, msg, time_info, user_data); + ret = g_result_cb(event, type, result, result_count, msg, time_info, user_data); } return ret; } diff --git a/common/stt_engine.h b/common/stt_engine.h index d47f804..f8b1a08 100644 --- a/common/stt_engine.h +++ b/common/stt_engine.h @@ -24,7 +24,7 @@ extern "C" { #endif -typedef void (*stt_engine_result_cb)(stte_result_event_e event, const char* type, const char** data, int data_count, +typedef int (*stt_engine_result_cb)(stte_result_event_e event, const char* type, const char** data, int data_count, const char* msg, void* time_info, void* user_data); /* diff --git a/org.tizen.voice.sttserver.tv.service b/org.tizen.voice.sttserver.tv.service new file mode 100644 index 0000000..4dc7fb0 --- /dev/null +++ b/org.tizen.voice.sttserver.tv.service @@ -0,0 +1,5 @@ +[D-BUS Service] +Name=org.tizen.voice.sttserver +#Exec=/bin/sh -c "launch_app org.tizen.stt-engine-default" +Exec=/bin/sh -c "launch_app org.tizen.voice-service-vd-stt" + diff --git a/packaging/stt.spec b/packaging/stt.spec index d93e409..b0a4b47 100644 --- a/packaging/stt.spec +++ b/packaging/stt.spec @@ -94,6 +94,10 @@ rm -rf %{buildroot} mkdir -p %{buildroot}%{TZ_SYS_RO_SHARE}/license install LICENSE.APLv2 %{buildroot}%{TZ_SYS_RO_SHARE}/license/%{name} +%if "%{PRODUCT_TYPE}" == "TV" +mv -f org.tizen.voice.sttserver.tv.service org.tizen.voice.sttserver.service +%endif + %make_install %post @@ -114,7 +118,7 @@ mkdir -p %{TZ_SYS_RO_SHARE}/voice/test /etc/dbus-1/session.d/stt-server.conf %{TZ_SYS_RO_SHARE}/upgrade/scripts/500.stt_upgrade_24to30.sh %{TZ_SYS_RO_SHARE}/voice/stt/1.0/stt-config.xml -%{TZ_SYS_RO_SHARE}/dbus-1/services/org.tizen.voice* +%{TZ_SYS_RO_SHARE}/dbus-1/services/org.tizen.voice.sttserver.service %{TZ_SYS_RO_SHARE}/voice/test/stt-test %{TZ_SYS_RO_SHARE}/license/%{name} diff --git a/server/sttd_engine_agent.c b/server/sttd_engine_agent.c index 3bf7095..5e39973 100644 --- a/server/sttd_engine_agent.c +++ b/server/sttd_engine_agent.c @@ -1080,6 +1080,8 @@ static void __recorder_destroy_by_error_result(void *data) int sttd_engine_agent_send_result(stte_result_event_e event, const char* type, const char** result, int result_count, const char* msg, void* time_info, void *user_data) { + int ret = -1; + if (false == g_agent_init) { SLOG(LOG_ERROR, TAG_STTD, "[Engine Agent ERROR] Result Callback : Not Initialized"); return STTD_ERROR_OPERATION_FAILED; @@ -1089,7 +1091,7 @@ int sttd_engine_agent_send_result(stte_result_event_e event, const char* type, c if (NULL != time_info) { /* Get the time info */ - int ret = stt_engine_foreach_result_time(time_info, __result_time_cb, NULL); + ret = stt_engine_foreach_result_time(time_info, __result_time_cb, NULL); if (0 != ret) { SLOG(LOG_ERROR, TAG_STTD, "[Engine Agent ERROR] Fail to get time info : %d", ret); return ret; @@ -1098,7 +1100,7 @@ int sttd_engine_agent_send_result(stte_result_event_e event, const char* type, c SLOG(LOG_DEBUG, TAG_STTD, "[Server] ============================"); - g_result_cb(event, type, result, result_count, msg, user_data); + ret = g_result_cb(event, type, result, result_count, msg, user_data); #ifdef AUDIO_CREATE_ON_START if (event == STTE_RESULT_EVENT_ERROR) { @@ -1106,7 +1108,7 @@ int sttd_engine_agent_send_result(stte_result_event_e event, const char* type, c } #endif - return STTD_ERROR_NONE; + return ret; } int sttd_engine_agent_send_error(stte_error_e error, const char* msg) @@ -1114,12 +1116,23 @@ int sttd_engine_agent_send_error(stte_error_e error, const char* msg) /* check uid */ int uid = stt_client_get_current_recognition(); - char* err_msg = strdup(msg); - int ret = STTE_ERROR_NONE; + char* err_msg = NULL; + int ret = STTD_ERROR_NONE; + + if (NULL != msg) { + err_msg = strdup(msg); + } ret = sttdc_send_error_signal(uid, error, err_msg); if (0 != ret) { SLOG(LOG_ERROR, TAG_STTD, "[Server ERROR] Fail to send error info."); + + if (NULL != err_msg) { + free(err_msg); + err_msg = NULL; + } + + return ret; } if (NULL != err_msg) { @@ -1127,20 +1140,21 @@ int sttd_engine_agent_send_error(stte_error_e error, const char* msg) err_msg = NULL; } - g_error_cb(error, msg); + ret = g_error_cb(error, msg); return ret; } int sttd_engine_agent_send_speech_status(stte_speech_status_e status, void* user_data) { + int ret = STTD_ERROR_NONE; if (false == g_agent_init) { SLOG(LOG_ERROR, TAG_STTD, "[Engine Agent ERROR] Silence Callback : Not Initialized"); return STTD_ERROR_OPERATION_FAILED; } - g_speech_status_cb(status, user_data); - return STTD_ERROR_NONE; + ret = g_speech_status_cb(status, user_data); + return ret; } bool __result_time_cb(int index, stte_result_time_event_e event, const char* text, long start_time, long end_time, void* user_data) diff --git a/server/sttd_engine_agent.h b/server/sttd_engine_agent.h index 2175f35..f44723d 100644 --- a/server/sttd_engine_agent.h +++ b/server/sttd_engine_agent.h @@ -29,15 +29,15 @@ extern "C" { #define ENGINE_PATH_SIZE 256 -typedef void (*result_callback)(stte_result_event_e event, const char* type, +typedef int (*result_callback)(stte_result_event_e event, const char* type, const char** data, int data_count, const char* msg, void *user_data); typedef bool (*result_time_callback)(int index, stte_result_time_event_e event, const char* text, long start_time, long end_time, void *user_data); -typedef void (*speech_status_callback)(stte_speech_status_e status, void *user_data); +typedef int (*speech_status_callback)(stte_speech_status_e status, void *user_data); -typedef void (*error_callback)(stte_error_e error, const char* msg); +typedef int (*error_callback)(stte_error_e error, const char* msg); /* diff --git a/server/sttd_server.c b/server/sttd_server.c index aaee986..78f64e6 100644 --- a/server/sttd_server.c +++ b/server/sttd_server.c @@ -179,7 +179,7 @@ void __cancel_by_no_record(void *data) return; } -void __server_recognition_result_callback(stte_result_event_e event, const char* type, +int __server_recognition_result_callback(stte_result_event_e event, const char* type, const char** data, int data_count, const char* msg, void *user_data) { // critical section @@ -196,7 +196,7 @@ void __server_recognition_result_callback(stte_result_event_e event, const char* SLOG(LOG_DEBUG, TAG_STTD, "====="); SLOG(LOG_DEBUG, TAG_STTD, " "); pthread_mutex_unlock(&stte_result_mutex); - return; + return STTD_ERROR_OPERATION_FAILED; } SLOG(LOG_DEBUG, TAG_STTD, "[Server] uid (%d), event(%d)", uid, event); @@ -287,7 +287,7 @@ void __server_recognition_result_callback(stte_result_event_e event, const char* SLOG(LOG_DEBUG, TAG_STTD, " "); pthread_mutex_unlock(&stte_result_mutex); - return; + return STTD_ERROR_NONE; } bool __server_result_time_callback(int index, stte_result_time_event_e event, const char* text, long start_time, long end_time, void* user_data) @@ -310,7 +310,7 @@ bool __server_result_time_callback(int index, stte_result_time_event_e event, co return true; } -void __server_speech_status_callback(stte_speech_status_e status, void *user_param) +int __server_speech_status_callback(stte_speech_status_e status, void *user_param) { SLOG(LOG_DEBUG, TAG_STTD, "===== Speech status detected Callback"); @@ -319,12 +319,12 @@ void __server_speech_status_callback(stte_speech_status_e status, void *user_par app_state_e state; if (0 != sttd_client_get_state(uid, &state)) { SLOG(LOG_ERROR, TAG_STTD, "[Server ERROR] uid is not valid "); - return; + return STTD_ERROR_OPERATION_FAILED; } if (APP_STATE_RECORDING != state) { SLOG(LOG_ERROR, TAG_STTD, "[Server ERROR] Current state is not recording"); - return; + return STTD_ERROR_INVALID_STATE; } if (STTE_SPEECH_STATUS_BEGINNING_POINT_DETECTED == status) { @@ -340,13 +340,13 @@ void __server_speech_status_callback(stte_speech_status_e status, void *user_par SLOG(LOG_DEBUG, TAG_STTD, "====="); SLOG(LOG_DEBUG, TAG_STTD, " "); - return; + return STTD_ERROR_NONE; } -void __server_error_callback(stte_error_e error, const char* msg) +int __server_error_callback(stte_error_e error, const char* msg) { SLOG(LOG_DEBUG, TAG_STTD, "[Server] Error Callback is called"); - return; + return STTD_ERROR_NONE; } void __sttd_server_engine_changed_cb(const char* engine_id, const char* language, bool support_silence, bool need_credential, void* user_data)