From 9f0d6944789b66589ea71c0a6209eb0bb16fd758 Mon Sep 17 00:00:00 2001 From: Wonnam Jang Date: Thu, 9 Jun 2016 14:44:46 +0900 Subject: [PATCH 1/1] Fix bugs Change-Id: I368b9088435a6a44a450a97e1eec25e6bea51d08 Signed-off-by: Wonnam Jang --- CMakeLists.txt | 2 +- client/stt.c | 28 ++++++++++++++++++++-------- client/stt_client.c | 2 +- client/stt_client.h | 4 ++-- client/stt_dbus.c | 40 ++++++++++++++++++++++------------------ client/stt_dbus.h | 2 +- client/stt_file.c | 2 +- client/stt_file_client.c | 2 +- client/stt_file_client.h | 2 +- client/stt_main.h | 2 +- client/stt_setting.c | 2 +- common/stt_config_mgr.c | 8 ++++---- common/stt_config_mgr.h | 2 +- common/stt_config_parser.c | 2 +- common/stt_config_parser.h | 2 +- common/stt_defs.h | 2 +- common/stt_engine.c | 45 +++++++++++++++++---------------------------- common/stt_engine.h | 2 +- common/stt_network.c | 2 +- common/stt_network.h | 2 +- doc/uix_stt_doc.h | 2 +- include/stt.h | 9 +++++++-- include/stt_file.h | 2 +- include/stt_setting.h | 2 +- server/sttd_client_data.c | 2 +- server/sttd_client_data.h | 2 +- server/sttd_config.c | 2 +- server/sttd_config.h | 2 +- server/sttd_dbus.c | 5 ++++- server/sttd_dbus.h | 2 +- server/sttd_dbus_server.c | 6 +++--- server/sttd_dbus_server.h | 2 +- server/sttd_engine_agent.c | 14 +++++--------- server/sttd_engine_agent.h | 2 +- server/sttd_main.c | 2 +- server/sttd_main.h | 5 +++-- server/sttd_recorder.c | 2 +- server/sttd_recorder.h | 2 +- server/sttd_server.c | 2 +- server/sttd_server.h | 2 +- server/sttp.h | 6 ++++-- test/test_main.c | 2 +- 42 files changed, 122 insertions(+), 110 deletions(-) mode change 100755 => 100644 client/stt_file.c mode change 100755 => 100644 client/stt_file_client.h mode change 100755 => 100644 client/stt_main.h mode change 100755 => 100644 include/stt_file.h mode change 100755 => 100644 include/stt_setting.h mode change 100755 => 100644 server/sttd_client_data.h mode change 100755 => 100644 test/test_main.c diff --git a/CMakeLists.txt b/CMakeLists.txt index 5bf936a..42a1c7d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved +# Copyright (c) 2011-2016 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. diff --git a/client/stt.c b/client/stt.c index d69e7f0..fa4dd9c 100644 --- a/client/stt.c +++ b/client/stt.c @@ -1,5 +1,5 @@ /* -* Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved +* Copyright (c) 2011-2016 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 @@ -555,7 +555,7 @@ int stt_set_credential(stt_h stt, const char* credential) SLOG(LOG_DEBUG, TAG_STTC, "===== Set credential"); if (NULL == credential) { - SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Input parameter is NULL, stt(%s), credential(%a)", stt, credential); + SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Input parameter is NULL"); return STT_ERROR_INVALID_PARAMETER; } @@ -1427,8 +1427,14 @@ int stt_stop(stt_h stt) return STT_ERROR_INVALID_STATE; } - 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); + if (STT_INTERNAL_STATE_STARTING == client->internal_state) { + SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Invalid State : Internal state is STARTING : %d", client->internal_state); + return STT_ERROR_IN_PROGRESS_TO_RECORDING; + } else if (STT_INTERNAL_STATE_CANCELING == client->internal_state) { + SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Invalid State : Internal state is CANCELING : %d", client->internal_state); + return STT_ERROR_IN_PROGRESS_TO_READY; + } else if (STT_INTERNAL_STATE_STOPPING == client->internal_state) { + SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Invalid State : Internal state is STOPPING : %d", client->internal_state); return STT_ERROR_IN_PROGRESS_TO_PROCESSING; } @@ -1438,7 +1444,7 @@ int stt_stop(stt_h stt) SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Fail to stop : %s", __stt_get_error_code(ret)); } else { SLOG(LOG_DEBUG, TAG_STTC, "[SUCCESS] Stop is successful but not done"); - client->internal_state = STT_INTERNAL_STATE_STOPING; + client->internal_state = STT_INTERNAL_STATE_STOPPING; } SLOG(LOG_DEBUG, TAG_STTC, "====="); @@ -1469,8 +1475,14 @@ int stt_cancel(stt_h stt) return STT_ERROR_INVALID_STATE; } - 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); + if (STT_INTERNAL_STATE_STARTING == client->internal_state) { + SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Invalid State : Internal state is STARTING : %d", client->internal_state); + return STT_ERROR_IN_PROGRESS_TO_RECORDING; + } else if (STT_INTERNAL_STATE_STOPPING == client->internal_state) { + SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Invalid State : Internal state is STOPPING : %d", client->internal_state); + return STT_ERROR_IN_PROGRESS_TO_PROCESSING; + } else if (STT_INTERNAL_STATE_CANCELING == client->internal_state) { + SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Invalid State : Internal state is CANCELING : %d", client->internal_state); return STT_ERROR_IN_PROGRESS_TO_READY; } @@ -1672,7 +1684,7 @@ static void __stt_notify_state_changed(void *data) if (STT_INTERNAL_STATE_STARTING == client->internal_state && STT_STATE_RECORDING == client->current_state) { client->internal_state = STT_INTERNAL_STATE_NONE; SLOG(LOG_DEBUG, TAG_STTC, "Internal state change to NONE"); - } else if (STT_INTERNAL_STATE_STOPING == client->internal_state && STT_STATE_PROCESSING == client->current_state) { + } else if (STT_INTERNAL_STATE_STOPPING == client->internal_state && STT_STATE_PROCESSING == client->current_state) { client->internal_state = STT_INTERNAL_STATE_NONE; SLOG(LOG_DEBUG, TAG_STTC, "Internal state change to NONE"); } else if (STT_INTERNAL_STATE_CANCELING == client->internal_state && STT_STATE_READY == client->current_state) { diff --git a/client/stt_client.c b/client/stt_client.c index d5a45b4..c925151 100644 --- a/client/stt_client.c +++ b/client/stt_client.c @@ -1,5 +1,5 @@ /* -* Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved +* Copyright (c) 2011-2016 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 diff --git a/client/stt_client.h b/client/stt_client.h index ed9803d..43cf60e 100644 --- a/client/stt_client.h +++ b/client/stt_client.h @@ -1,5 +1,5 @@ /* -* Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved +* Copyright (c) 2011-2016 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 @@ -26,7 +26,7 @@ extern "C" { typedef enum { STT_INTERNAL_STATE_NONE = 0, STT_INTERNAL_STATE_STARTING = 1, - STT_INTERNAL_STATE_STOPING = 2, + STT_INTERNAL_STATE_STOPPING = 2, STT_INTERNAL_STATE_CANCELING = 3 } stt_internal_state_e; diff --git a/client/stt_dbus.c b/client/stt_dbus.c index ee14cd8..1c5682b 100644 --- a/client/stt_dbus.c +++ b/client/stt_dbus.c @@ -1,5 +1,5 @@ /* -* Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved +* Copyright (c) 2011-2016 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 @@ -293,10 +293,12 @@ int stt_dbus_open_connection() dbus_error_init(&err); /* connect to the DBUS system bus, and check for errors */ - g_conn_sender = dbus_bus_get_private(DBUS_BUS_SESSION, &err); - if (dbus_error_is_set(&err)) { - SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Dbus Connection Error (%s)", err.message); - dbus_error_free(&err); + if (NULL == g_conn_sender) { + g_conn_sender = dbus_bus_get_private(DBUS_BUS_SESSION, &err); + if (dbus_error_is_set(&err)) { + SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Dbus Connection Error (%s)", err.message); + dbus_error_free(&err); + } } if (NULL == g_conn_sender) { @@ -307,11 +309,12 @@ int stt_dbus_open_connection() dbus_connection_set_exit_on_disconnect(g_conn_sender, false); /* connect to the DBUS system bus, and check for errors */ - g_conn_listener = dbus_bus_get_private(DBUS_BUS_SESSION, &err); - - if (dbus_error_is_set(&err)) { - SLOG(LOG_ERROR, TAG_STTC, "Dbus Connection Error (%s)", err.message); - dbus_error_free(&err); + if (NULL == g_conn_listener) { + g_conn_listener = dbus_bus_get_private(DBUS_BUS_SESSION, &err); + if (dbus_error_is_set(&err)) { + SLOG(LOG_ERROR, TAG_STTC, "Dbus Connection Error (%s)", err.message); + dbus_error_free(&err); + } } if (NULL == g_conn_listener) { @@ -390,6 +393,9 @@ int stt_dbus_close_connection() dbus_connection_close(g_conn_sender); dbus_connection_close(g_conn_listener); + dbus_connection_unref(g_conn_sender); + dbus_connection_unref(g_conn_listener); + g_conn_sender = NULL; g_conn_listener = NULL; @@ -899,9 +905,9 @@ int stt_dbus_request_set_private_data(int uid, const char* key, const char* data DBusMessage* msg; msg = dbus_message_new_method_call( - STT_SERVER_SERVICE_NAME, - STT_SERVER_SERVICE_OBJECT_PATH, - STT_SERVER_SERVICE_INTERFACE, + STT_SERVER_SERVICE_NAME, + STT_SERVER_SERVICE_OBJECT_PATH, + STT_SERVER_SERVICE_INTERFACE, STT_METHOD_SET_PRIVATE_DATA); if (NULL == msg) { @@ -969,9 +975,9 @@ int stt_dbus_request_get_private_data(int uid, const char* key, char** data) DBusMessage* msg; msg = dbus_message_new_method_call( - STT_SERVER_SERVICE_NAME, - STT_SERVER_SERVICE_OBJECT_PATH, - STT_SERVER_SERVICE_INTERFACE, + STT_SERVER_SERVICE_NAME, + STT_SERVER_SERVICE_OBJECT_PATH, + STT_SERVER_SERVICE_INTERFACE, STT_METHOD_GET_PRIVATE_DATA); if (NULL == msg) { @@ -1020,8 +1026,6 @@ int stt_dbus_request_get_private_data(int uid, const char* key, char** data) SLOG(LOG_DEBUG, TAG_STTC, "<<<< stt get private data : result = %d", result); if (NULL != temp) { *data = strdup(temp); - free(temp); - temp = NULL; } } else { SLOG(LOG_ERROR, TAG_STTC, "<<<< stt get private data : result = %d", result); diff --git a/client/stt_dbus.h b/client/stt_dbus.h index 8485e95..5330b99 100644 --- a/client/stt_dbus.h +++ b/client/stt_dbus.h @@ -1,5 +1,5 @@ /* -* Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved +* Copyright (c) 2011-2016 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 diff --git a/client/stt_file.c b/client/stt_file.c old mode 100755 new mode 100644 index 423eaaa..fcfb863 --- a/client/stt_file.c +++ b/client/stt_file.c @@ -1,5 +1,5 @@ /* -* Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved +* Copyright (c) 2011-2016 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 diff --git a/client/stt_file_client.c b/client/stt_file_client.c index 893c920..c194bd8 100644 --- a/client/stt_file_client.c +++ b/client/stt_file_client.c @@ -1,5 +1,5 @@ /* -* Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved +* Copyright (c) 2011-2016 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 diff --git a/client/stt_file_client.h b/client/stt_file_client.h old mode 100755 new mode 100644 index 2991e4f..fb1ed34 --- a/client/stt_file_client.h +++ b/client/stt_file_client.h @@ -1,5 +1,5 @@ /* -* Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved +* Copyright (c) 2011-2016 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 diff --git a/client/stt_main.h b/client/stt_main.h old mode 100755 new mode 100644 index 564c3f6..79044bf --- a/client/stt_main.h +++ b/client/stt_main.h @@ -1,5 +1,5 @@ /* -* Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved +* Copyright (c) 2011-2016 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 diff --git a/client/stt_setting.c b/client/stt_setting.c index 118b74a..9609c72 100644 --- a/client/stt_setting.c +++ b/client/stt_setting.c @@ -1,5 +1,5 @@ /* -* Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved +* Copyright (c) 2011-2016 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 diff --git a/common/stt_config_mgr.c b/common/stt_config_mgr.c index 1cf7c50..a44f27e 100644 --- a/common/stt_config_mgr.c +++ b/common/stt_config_mgr.c @@ -1,5 +1,5 @@ /* -* Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved +* Copyright (c) 2011-2016 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 @@ -150,7 +150,7 @@ int __stt_config_mgr_select_lang(const char* engine_id, char** language) /* Default language is STT_BASE_LANGUAGE */ if (0 == strcmp(STT_BASE_LANGUAGE, engine_lang)) { *language = strdup(engine_lang); - SLOG(LOG_DEBUG, stt_tag(), "Selected language : %s", *language); + SLOG(LOG_DEBUG, stt_tag(), "Selected language : %s", (NULL == *language) ? "NULL" : *language); return 0; } } @@ -161,7 +161,7 @@ int __stt_config_mgr_select_lang(const char* engine_id, char** language) /* Not support STT_BASE_LANGUAGE */ if (NULL != engine_lang) { *language = strdup(engine_lang); - SLOG(LOG_DEBUG, stt_tag(), "Selected language : %s", *language); + SLOG(LOG_DEBUG, stt_tag(), "Selected language : %s", (NULL == *language) ? "NULL" : *language); return 0; } } @@ -1230,8 +1230,8 @@ int stt_config_mgr_get_language_list(const char* engine_id, stt_config_supported /*Get handle data from list*/ lang = iter_lang->data; - SLOG(LOG_DEBUG, stt_tag(), " %s", lang); if (NULL != lang) { + SLOG(LOG_DEBUG, stt_tag(), " %s", lang); if (false == callback(engine_info->uuid, lang, user_data)) break; } diff --git a/common/stt_config_mgr.h b/common/stt_config_mgr.h index 758662b..9f43044 100644 --- a/common/stt_config_mgr.h +++ b/common/stt_config_mgr.h @@ -1,5 +1,5 @@ /* -* Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved +* Copyright (c) 2011-2016 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 diff --git a/common/stt_config_parser.c b/common/stt_config_parser.c index 8116ba4..a881174 100644 --- a/common/stt_config_parser.c +++ b/common/stt_config_parser.c @@ -1,5 +1,5 @@ /* -* Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved +* Copyright (c) 2011-2016 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 diff --git a/common/stt_config_parser.h b/common/stt_config_parser.h index edd7b23..2987661 100644 --- a/common/stt_config_parser.h +++ b/common/stt_config_parser.h @@ -1,5 +1,5 @@ /* -* Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved +* Copyright (c) 2011-2016 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 diff --git a/common/stt_defs.h b/common/stt_defs.h index d37769c..6ea59f3 100644 --- a/common/stt_defs.h +++ b/common/stt_defs.h @@ -1,5 +1,5 @@ /* -* Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved +* Copyright (c) 2011-2016 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 diff --git a/common/stt_engine.c b/common/stt_engine.c index e644512..0311c51 100644 --- a/common/stt_engine.c +++ b/common/stt_engine.c @@ -1,5 +1,5 @@ /* -* Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved +* Copyright (c) 2011-2016 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 @@ -263,10 +263,9 @@ int stt_engine_initialize(int engine_id, sttpe_result_cb result_cb, sttpe_silenc ret = engine->pefuncs->initialize(result_cb, silence_cb); if (0 != ret) { SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Fail to initialize : %s", __stt_get_engine_error_code(ret)); - return ret; } - return 0; + return ret; } int stt_engine_deinitialize(int engine_id) @@ -284,7 +283,7 @@ int stt_engine_deinitialize(int engine_id) SLOG(LOG_WARN, stt_tag(), "[Engine WARNING] Fail to deinitialize : %s", __stt_get_engine_error_code(ret)); } - return 0; + return ret; } static bool __supported_language_cb(const char* language, void* user_data) @@ -322,10 +321,9 @@ int stt_engine_get_supported_langs(int engine_id, GSList** lang_list) ret = engine->pefuncs->foreach_langs(__supported_language_cb, (void*)lang_list); if (0 != ret) { SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] get language list error : %s", __stt_get_engine_error_code(ret)); - return ret; } - return 0; + return ret; } int stt_engine_is_valid_language(int engine_id, const char* language, bool *is_valid) @@ -368,7 +366,7 @@ int stt_engine_set_private_data(int engine_id, const char* key, const char* data if (0 != ret) { SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Fail to set private data(%d)", ret); } - return STTP_ERROR_NONE; + return ret; } int stt_engine_get_private_data(int engine_id, const char* key, char** data) @@ -388,7 +386,8 @@ int stt_engine_get_private_data(int engine_id, const char* key, char** data) char* temp = NULL; int ret = engine->pefuncs->get_private_data(key, &temp); if (0 != ret) { - SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Fail to set private data(%d)", ret); + SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Fail to get private data(%d)", ret); + return ret; } *data = strdup(temp); @@ -540,10 +539,9 @@ int stt_engine_get_audio_type(int engine_id, sttp_audio_type_e* types, int* rate ret = engine->pefuncs->get_audio_format(types, rate, channels); if (0 != ret) { SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Fail to get audio format : %s", __stt_get_engine_error_code(ret)); - return ret; } - return 0; + return ret; } /* Set option */ @@ -562,10 +560,9 @@ int stt_engine_set_silence_detection(int engine_id, bool value) return STTP_ERROR_NOT_SUPPORTED_FEATURE; } else if (0 != ret) { SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Fail to set silence detection : %d", ret); - return ret; } - return 0; + return ret; } int stt_engine_check_app_agreed(int engine_id, const char* appid, bool* value) @@ -587,10 +584,9 @@ int stt_engine_check_app_agreed(int engine_id, const char* appid, bool* value) if (0 != ret) { SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Fail to get app agreement : %s", __stt_get_engine_error_code(ret)); *value = false; - return ret; } - return 0; + return ret; } /* Recognition */ @@ -612,10 +608,9 @@ int stt_engine_recognize_start(int engine_id, const char* lang, const char* reco if (0 != ret) { SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Fail to start recognition : %s", __stt_get_engine_error_code(ret)); SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Fail to start recognition : lang(%s), recognition_type(%s), credential(%s)", lang, recognition_type, credential); - return ret; } - return 0; + return ret; } int stt_engine_set_recording_data(int engine_id, const void* data, unsigned int length) @@ -635,10 +630,9 @@ int stt_engine_set_recording_data(int engine_id, const void* data, unsigned int int ret = engine->pefuncs->set_recording(data, length); if (0 != ret) { SLOG(LOG_WARN, stt_tag(), "[Engine WARNING] Fail to set recording : %s", __stt_get_engine_error_code(ret)); - return ret; } - return 0; + return ret; } int stt_engine_recognize_stop(int engine_id) @@ -653,10 +647,9 @@ int stt_engine_recognize_stop(int engine_id) int ret = engine->pefuncs->stop(); if (0 != ret) { SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Fail to stop : %s", __stt_get_engine_error_code(ret)); - return ret; } - return 0; + return ret; } int stt_engine_recognize_cancel(int engine_id) @@ -671,10 +664,9 @@ int stt_engine_recognize_cancel(int engine_id) int ret = engine->pefuncs->cancel(); if (0 != ret) { SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Fail to cancel : %s", __stt_get_engine_error_code(ret)); - return ret; } - return 0; + return ret; } int stt_engine_foreach_result_time(int engine_id, void* time_info, sttpe_result_time_cb callback, void* user_data) @@ -689,10 +681,9 @@ int stt_engine_foreach_result_time(int engine_id, void* time_info, sttpe_result_ int ret = engine->pefuncs->foreach_result_time(time_info, callback, user_data); if (0 != ret) { SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Fail to foreach result time : %s", __stt_get_engine_error_code(ret)); - return ret; } - return 0; + return ret; } int stt_engine_recognize_start_file(int engine_id, const char* lang, const char* recognition_type, @@ -718,10 +709,9 @@ int stt_engine_recognize_start_file(int engine_id, const char* lang, const char* int ret = engine->pefuncs->start_file(lang, recognition_type, filepath, audio_type, sample_rate, user_param); if (0 != ret) { SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Fail to start file recognition : %s", __stt_get_engine_error_code(ret)); - return ret; } - return 0; + return ret; } int stt_engine_recognize_cancel_file(int engine_id) @@ -741,8 +731,7 @@ int stt_engine_recognize_cancel_file(int engine_id) int ret = engine->pefuncs->cancel_file(); if (0 != ret) { SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Fail to start file recognition : %s", __stt_get_engine_error_code(ret)); - return ret; } - return 0; + return ret; } diff --git a/common/stt_engine.h b/common/stt_engine.h index 3b47936..a2c9e74 100644 --- a/common/stt_engine.h +++ b/common/stt_engine.h @@ -1,5 +1,5 @@ /* -* Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved +* Copyright (c) 2011-2016 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 diff --git a/common/stt_network.c b/common/stt_network.c index dcecd94..8538e80 100644 --- a/common/stt_network.c +++ b/common/stt_network.c @@ -1,5 +1,5 @@ /* -* Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved +* Copyright (c) 2011-2016 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 diff --git a/common/stt_network.h b/common/stt_network.h index fbda52d..612ff38 100644 --- a/common/stt_network.h +++ b/common/stt_network.h @@ -1,5 +1,5 @@ /* -* Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved +* Copyright (c) 2011-2016 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 diff --git a/doc/uix_stt_doc.h b/doc/uix_stt_doc.h index 25bc85b..6c5b97c 100644 --- a/doc/uix_stt_doc.h +++ b/doc/uix_stt_doc.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved + * Copyright (c) 2011-2016 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. diff --git a/include/stt.h b/include/stt.h index 113cb1c..9fecdaa 100644 --- a/include/stt.h +++ b/include/stt.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved + * Copyright (c) 2011-2016 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. @@ -55,7 +55,8 @@ typedef enum { 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_IN_PROGRESS_TO_PROCESSING = TIZEN_ERROR_STT | 0x09, /**< Progress to processing is not finished */ + STT_ERROR_RECORDING_TIMED_OUT = TIZEN_ERROR_STT | 0x10 /**< Recording timed out */ } stt_error_e; /** @@ -794,6 +795,8 @@ int stt_start(stt_h stt, const char* language, const char* type); * @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 + * @retval #STT_ERROR_IN_PROGRESS_TO_RECORDING Progress to recording is not finished * @retval #STT_ERROR_IN_PROGRESS_TO_PROCESSING Progress to processing is not finished * * @pre The state should be #STT_STATE_RECORDING. @@ -826,6 +829,8 @@ int stt_stop(stt_h stt); * @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 + * @retval #STT_ERROR_IN_PROGRESS_TO_RECORDING Progress to recording is not finished + * @retval #STT_ERROR_IN_PROGRESS_TO_PROCESSING Progress to processing 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 diff --git a/include/stt_file.h b/include/stt_file.h old mode 100755 new mode 100644 index eb06246..01a6a73 --- a/include/stt_file.h +++ b/include/stt_file.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved + * Copyright (c) 2011-2016 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. diff --git a/include/stt_setting.h b/include/stt_setting.h old mode 100755 new mode 100644 index 352a43a..13f90f0 --- a/include/stt_setting.h +++ b/include/stt_setting.h @@ -1,5 +1,5 @@ /* -* Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved +* Copyright (c) 2011-2016 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 diff --git a/server/sttd_client_data.c b/server/sttd_client_data.c index 8da0df2..fafb50d 100644 --- a/server/sttd_client_data.c +++ b/server/sttd_client_data.c @@ -1,5 +1,5 @@ /* -* Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved +* Copyright (c) 2011-2016 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 diff --git a/server/sttd_client_data.h b/server/sttd_client_data.h old mode 100755 new mode 100644 index c5115d9..a1bc732 --- a/server/sttd_client_data.h +++ b/server/sttd_client_data.h @@ -1,5 +1,5 @@ /* -* Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved +* Copyright (c) 2011-2016 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 diff --git a/server/sttd_config.c b/server/sttd_config.c index 71af39d..cedd5d7 100644 --- a/server/sttd_config.c +++ b/server/sttd_config.c @@ -1,5 +1,5 @@ /* -* Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved +* Copyright (c) 2011-2016 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 diff --git a/server/sttd_config.h b/server/sttd_config.h index 1f58534..f6d4c99 100644 --- a/server/sttd_config.h +++ b/server/sttd_config.h @@ -1,5 +1,5 @@ /* -* Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved +* Copyright (c) 2011-2016 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 diff --git a/server/sttd_dbus.c b/server/sttd_dbus.c index 73646d8..b30a35a 100644 --- a/server/sttd_dbus.c +++ b/server/sttd_dbus.c @@ -1,5 +1,5 @@ /* -* Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved +* Copyright (c) 2011-2016 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 @@ -515,6 +515,9 @@ int sttd_dbus_close_connection() dbus_connection_close(g_conn_listener); dbus_connection_close(g_conn_sender); + dbus_connection_unref(g_conn_sender); + dbus_connection_unref(g_conn_listener); + g_conn_listener = NULL; g_conn_sender = NULL; diff --git a/server/sttd_dbus.h b/server/sttd_dbus.h index 9311eca..91d81af 100644 --- a/server/sttd_dbus.h +++ b/server/sttd_dbus.h @@ -1,5 +1,5 @@ /* -* Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved +* Copyright (c) 2011-2016 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 diff --git a/server/sttd_dbus_server.c b/server/sttd_dbus_server.c index 47aa97b..e2266b8 100644 --- a/server/sttd_dbus_server.c +++ b/server/sttd_dbus_server.c @@ -1,5 +1,5 @@ /* -* Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved +* Copyright (c) 2011-2016 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 @@ -640,7 +640,7 @@ int sttd_dbus_server_get_private_data(DBusConnection* conn, DBusMessage* msg) dbus_error_free(&err); ret = STTD_ERROR_OPERATION_FAILED; } else { - SLOG(LOG_DEBUG, TAG_STTD, "[IN] stt get private data : uid(%d)", uid); + SLOG(LOG_DEBUG, TAG_STTD, "[IN] stt get private data : uid(%d), key(%s)", uid, (NULL == key) ? "NULL" : key); ret = sttd_server_get_private_data(uid, key, &data); } @@ -655,7 +655,7 @@ int sttd_dbus_server_get_private_data(DBusConnection* conn, DBusMessage* msg) DBUS_TYPE_INVALID); if (0 == ret) { - SLOG(LOG_DEBUG, TAG_STTD, "[OUT SUCCESS] Result(%d)", ret); + SLOG(LOG_DEBUG, TAG_STTD, "[OUT SUCCESS] Result(%d), data(%s)", ret, (NULL == data) ? "NULL" : data); } else { SLOG(LOG_ERROR, TAG_STTD, "[OUT ERROR] Result(%d)", ret); } diff --git a/server/sttd_dbus_server.h b/server/sttd_dbus_server.h index 34210f7..bb629c1 100644 --- a/server/sttd_dbus_server.h +++ b/server/sttd_dbus_server.h @@ -1,5 +1,5 @@ /* -* Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved +* Copyright (c) 2011-2016 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 diff --git a/server/sttd_engine_agent.c b/server/sttd_engine_agent.c index b316993..a00e33e 100644 --- a/server/sttd_engine_agent.c +++ b/server/sttd_engine_agent.c @@ -1,5 +1,5 @@ /* -* Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved +* Copyright (c) 2011-2016 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 @@ -875,10 +875,9 @@ int sttd_engine_agent_supported_langs(int uid, GSList** lang_list) int ret = stt_engine_get_supported_langs(engine->engine_id, lang_list); if (0 != ret) { SLOG(LOG_ERROR, TAG_STTD, "[Engine Agent ERROR] get language list error(%d)", ret); - return ret; } - return 0; + return ret; } int sttd_engine_agent_get_default_lang(int uid, char** lang) @@ -953,10 +952,9 @@ int sttd_engine_agent_set_private_data(int uid, const char* key, const char* dat ret = stt_engine_set_private_data(engine->engine_id, key, data); if (0 != ret) { SLOG(LOG_ERROR, TAG_STTD, "[Engine Agent ERROR] Fail to set private data"); - return ret; } - return 0; + return ret; } int sttd_engine_agent_get_private_data(int uid, const char* key, char** data) @@ -989,10 +987,9 @@ int sttd_engine_agent_get_private_data(int uid, const char* key, char** data) ret = stt_engine_get_private_data(engine->engine_id, key, data); if (0 != ret) { SLOG(LOG_ERROR, TAG_STTD, "[Engine Agent ERROR] Fail to get private data"); - return ret; } - return 0; + return ret; } int sttd_engine_agent_get_option_supported(int uid, bool* silence) @@ -1299,10 +1296,9 @@ int sttd_engine_agent_set_recording_data(int uid, const void* data, unsigned int int ret = stt_engine_set_recording_data(engine->engine_id, data, length); if (0 != ret) { SLOG(LOG_WARN, TAG_STTD, "[Engine Agent WARNING] set recording error(%d)", ret); - return ret; } - return 0; + return ret; } int sttd_engine_agent_recognize_stop_recorder(int uid) diff --git a/server/sttd_engine_agent.h b/server/sttd_engine_agent.h index 35e93cc..e0ba814 100644 --- a/server/sttd_engine_agent.h +++ b/server/sttd_engine_agent.h @@ -1,5 +1,5 @@ /* -* Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved +* Copyright (c) 2011-2016 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 diff --git a/server/sttd_main.c b/server/sttd_main.c index 7fd2cd2..1d64720 100644 --- a/server/sttd_main.c +++ b/server/sttd_main.c @@ -1,5 +1,5 @@ /* -* Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved +* Copyright (c) 2011-2016 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 diff --git a/server/sttd_main.h b/server/sttd_main.h index b75ade7..31655dc 100644 --- a/server/sttd_main.h +++ b/server/sttd_main.h @@ -1,5 +1,5 @@ /* -* Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved +* Copyright (c) 2011-2016 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 @@ -53,7 +53,8 @@ typedef enum { STTD_ERROR_ENGINE_NOT_FOUND = TIZEN_ERROR_STT | 0x03, /**< No available engine */ STTD_ERROR_OPERATION_FAILED = TIZEN_ERROR_STT | 0x04, /**< Operation failed */ STTD_ERROR_NOT_SUPPORTED_FEATURE = TIZEN_ERROR_STT | 0x05, /**< Not supported feature of current engine */ - STTD_ERROR_NO_SPEECH = TIZEN_ERROR_STT | 0x06 /**< No speech while recording */ + STTD_ERROR_NO_SPEECH = TIZEN_ERROR_STT | 0x06, /**< No speech while recording */ + STTD_ERROR_RECORDING_TIMED_OUT = TIZEN_ERROR_STT | 0x10 /**< Recording timed out */ } stt_error_e; typedef enum { diff --git a/server/sttd_recorder.c b/server/sttd_recorder.c index 629fb35..a1136c9 100644 --- a/server/sttd_recorder.c +++ b/server/sttd_recorder.c @@ -1,5 +1,5 @@ /* -* Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved +* Copyright (c) 2011-2016 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 diff --git a/server/sttd_recorder.h b/server/sttd_recorder.h index 38cc0c4..7cf6946 100644 --- a/server/sttd_recorder.h +++ b/server/sttd_recorder.h @@ -1,5 +1,5 @@ /* -* Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved +* Copyright (c) 2011-2016 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 diff --git a/server/sttd_server.c b/server/sttd_server.c index 8ea0fd2..47bea93 100644 --- a/server/sttd_server.c +++ b/server/sttd_server.c @@ -1,5 +1,5 @@ /* -* Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved +* Copyright (c) 2011-2016 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 diff --git a/server/sttd_server.h b/server/sttd_server.h index 91a3899..ec77117 100644 --- a/server/sttd_server.h +++ b/server/sttd_server.h @@ -1,5 +1,5 @@ /* -* Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved +* Copyright (c) 2011-2016 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 diff --git a/server/sttp.h b/server/sttp.h index e1f7032..72366b1 100644 --- a/server/sttp.h +++ b/server/sttp.h @@ -1,5 +1,5 @@ /* -* Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved +* Copyright (c) 2011-2016 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 @@ -44,7 +44,8 @@ typedef enum { STTP_ERROR_ENGINE_NOT_FOUND = TIZEN_ERROR_STT | 0x03, /**< No available engine */ STTP_ERROR_OPERATION_FAILED = TIZEN_ERROR_STT | 0x04, /**< Operation failed */ STTP_ERROR_NOT_SUPPORTED_FEATURE = TIZEN_ERROR_STT | 0x05, /**< Not supported feature of current engine */ - STTP_ERROR_NO_SPEECH = TIZEN_ERROR_STT | 0x06 /**< No speech while recording */ + STTP_ERROR_NO_SPEECH = TIZEN_ERROR_STT | 0x06, /**< No speech while recording */ + STTP_ERROR_RECORDING_TIMED_OUT = TIZEN_ERROR_STT | 0x10 /**< Recording timed out */ }sttp_error_e; /** @@ -357,6 +358,7 @@ typedef int (*sttpe_foreach_result_time)(void* time_info, sttpe_result_time_cb c * @retval #STTP_ERROR_INVALID_LANGUAGE Invalid language * @retval #STTP_ERROR_OPERATION_FAILED Operation failed * @retval #STTP_ERROR_OUT_OF_NETWORK Out of network +* @retval #STTP_ERROR_PERMISSION_DENIED Permission denied * * @pre The engine is not in recognition processing. * diff --git a/test/test_main.c b/test/test_main.c old mode 100755 new mode 100644 index 03a99c8..5d98a06 --- a/test/test_main.c +++ b/test/test_main.c @@ -1,5 +1,5 @@ /* -* Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved +* Copyright (c) 2011-2016 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 -- 2.7.4