From: sooyeon.kim Date: Wed, 12 Oct 2016 09:56:53 +0000 (+0900) Subject: Add file name checker and Fix dbus type and bt return X-Git-Tag: accepted/tizen/common/20161028.114815^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;ds=sidebyside;h=63097c8e2256c2f654325b0fb744c9fada50fac9;p=platform%2Fcore%2Fuifw%2Fstt.git Add file name checker and Fix dbus type and bt return Change-Id: I5264a7e658873d3d96c79c6e3efae0952f24dd01 Signed-off-by: sooyeon.kim --- diff --git a/client/stt_dbus.c b/client/stt_dbus.c index 5801649..ec50934 100644 --- a/client/stt_dbus.c +++ b/client/stt_dbus.c @@ -919,12 +919,17 @@ int stt_dbus_request_initialize(int uid, bool* silence_supported, bool* credenti } if (NULL != result_msg) { + int int_silence_supported = 0; + int int_credential_needed = 0; dbus_message_get_args(result_msg, &err, DBUS_TYPE_INT32, &result, - DBUS_TYPE_INT32, silence_supported, - DBUS_TYPE_INT32, credential_needed, + DBUS_TYPE_INT32, &int_silence_supported, + DBUS_TYPE_INT32, &int_credential_needed, DBUS_TYPE_INVALID); + *silence_supported = (bool)(int_silence_supported); + *credential_needed = (bool)(int_credential_needed); + if (dbus_error_is_set(&err)) { SLOG(LOG_ERROR, TAG_STTC, "<<<< Get arguments error (%s)", err.message); dbus_error_free(&err); @@ -1050,12 +1055,18 @@ int stt_dbus_request_set_current_engine(int uid, const char* engine_id, bool* si } if (NULL != result_msg) { + int int_silence_supported = 0; + int int_credential_needed = 0; + dbus_message_get_args(result_msg, &err, DBUS_TYPE_INT32, &result, - DBUS_TYPE_INT32, silence_supported, - DBUS_TYPE_INT32, credential_needed, + DBUS_TYPE_INT32, &int_silence_supported, + DBUS_TYPE_INT32, &int_credential_needed, DBUS_TYPE_INVALID); + *silence_supported = (bool)(int_silence_supported); + *credential_needed = (bool)(int_credential_needed); + if (dbus_error_is_set(&err)) { SLOG(LOG_ERROR, TAG_STTC, "<<<< Get arguments error (%s)", err.message); dbus_error_free(&err); diff --git a/client/stt_file.c b/client/stt_file.c index 0a3e918..11b4a35 100644 --- a/client/stt_file.c +++ b/client/stt_file.c @@ -371,6 +371,9 @@ int stt_file_initialize(void) } if (NULL != dirp) { + if (!strcmp(".", dirp->d_name) || !strcmp("..", dirp->d_name)) + continue; + sttengine_info_s* info = NULL; char* filepath; int filesize; diff --git a/server/sttd_dbus_server.c b/server/sttd_dbus_server.c index 2daf8ee..2428cb0 100644 --- a/server/sttd_dbus_server.c +++ b/server/sttd_dbus_server.c @@ -78,12 +78,16 @@ int sttd_dbus_server_initialize(DBusConnection* conn, DBusMessage* msg) reply = dbus_message_new_method_return(msg); if (NULL != reply) { + int int_silence_supported = (int)silence_supported; + int int_credential_needed = (int)credential_needed; + dbus_message_append_args(reply, DBUS_TYPE_INT32, &ret, - DBUS_TYPE_INT32, &silence_supported, - DBUS_TYPE_INT32, &credential_needed, + DBUS_TYPE_INT32, &int_silence_supported, + DBUS_TYPE_INT32, &int_credential_needed, DBUS_TYPE_INVALID); + if (0 == ret) { SLOG(LOG_DEBUG, TAG_STTD, "[OUT SUCCESS] Result(%d), silence(%d), credential(%d)", ret, silence_supported, credential_needed); @@ -291,10 +295,13 @@ int sttd_dbus_server_set_current_engine(DBusConnection* conn, DBusMessage* msg) reply = dbus_message_new_method_return(msg); if (NULL != reply) { + int int_silence_supported = (int)silence_supported; + int int_credential_needed = (int)credential_needed; + dbus_message_append_args(reply, DBUS_TYPE_INT32, &ret, - DBUS_TYPE_INT32, &silence_supported, - DBUS_TYPE_INT32, &credential_needed, + DBUS_TYPE_INT32, &int_silence_supported, + DBUS_TYPE_INT32, &int_credential_needed, DBUS_TYPE_INVALID); if (0 == ret) { diff --git a/server/sttd_recorder.c b/server/sttd_recorder.c index 387308c..7d0f190 100755 --- a/server/sttd_recorder.c +++ b/server/sttd_recorder.c @@ -595,7 +595,7 @@ int sttd_recorder_stop() g_recorder->uid = -1; - int ret; + int ret = -1; #ifndef TV_BT_MODE ret = audio_in_unprepare(g_recorder->audio_h); if (AUDIO_IO_ERROR_NONE != ret) { @@ -615,12 +615,13 @@ int sttd_recorder_stop() usleep(50000); bt_retry++; } else { + SLOG(LOG_ERROR, TAG_STTD, "[Recorder ERROR] bt_hid_rc_stop_sending_voice(): ret(%d)", ret); break; } } if (false == stopped) { - SLOG(LOG_ERROR, TAG_STTD, "[Recorder ERROR] Fail to stop bt audio"); - return STTD_ERROR_OPERATION_FAILED; + SLOG(LOG_ERROR, TAG_STTD, "[Recorder ERROR] Fail to stop bt audio(%d)", ret); +// return STTD_ERROR_OPERATION_FAILED; } #endif diff --git a/server/sttd_server.c b/server/sttd_server.c index 78f64e6..ea462df 100644 --- a/server/sttd_server.c +++ b/server/sttd_server.c @@ -217,6 +217,9 @@ int __server_recognition_result_callback(stte_result_event_e event, const char* sttd_config_time_save(); sttd_config_time_reset(); + sttd_client_set_state(uid, APP_STATE_READY); + stt_client_unset_current_recognition(); + 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"); @@ -238,8 +241,8 @@ int __server_recognition_result_callback(stte_result_event_e event, const char* } /* change state of uid */ - sttd_client_set_state(uid, APP_STATE_READY); - stt_client_unset_current_recognition(); +// sttd_client_set_state(uid, APP_STATE_READY); +// stt_client_unset_current_recognition(); } else if (STTE_RESULT_EVENT_PARTIAL_RESULT == event) { SLOG(LOG_DEBUG, TAG_STTD, "[Server] The partial result from engine is event[%d] data_count[%d]", event, data_count); @@ -266,6 +269,9 @@ int __server_recognition_result_callback(stte_result_event_e event, const char* } sttd_config_time_reset(); + sttd_client_set_state(uid, APP_STATE_READY); + stt_client_unset_current_recognition(); + if (0 != sttdc_send_result(uid, event, NULL, 0, msg)) { SLOG(LOG_ERROR, TAG_STTD, "[Server ERROR] Fail to send result "); @@ -277,8 +283,8 @@ int __server_recognition_result_callback(stte_result_event_e event, const char* } /* change state of uid */ - sttd_client_set_state(uid, APP_STATE_READY); - stt_client_unset_current_recognition(); +// sttd_client_set_state(uid, APP_STATE_READY); +// stt_client_unset_current_recognition(); } else { /* nothing */ }