From 7f0bf45c064ebda65f89fbf157eee862aaa586db Mon Sep 17 00:00:00 2001 From: "sooyeon.kim" Date: Tue, 31 Jul 2018 19:01:14 +0900 Subject: [PATCH] Add line coverage tags Change-Id: I5877734f71e8212272b1f9fc5a574a3f28207132 Signed-off-by: sooyeon.kim --- client/stt.c | 225 ++++++++++++++++++++++++++++----------------- client/stt_client.c | 14 +-- client/stt_dbus.c | 190 +++++++++++++++++++++++++------------- common/stt_config_mgr.c | 86 +++++++++-------- common/stt_config_parser.c | 115 ++++++++++++++--------- 5 files changed, 395 insertions(+), 235 deletions(-) mode change 100755 => 100644 common/stt_config_mgr.c diff --git a/client/stt.c b/client/stt.c index a08dacc..a3a4763 100644 --- a/client/stt.c +++ b/client/stt.c @@ -51,33 +51,43 @@ static bool g_err_callback_status = false; const char* stt_tag() { + //LCOV_EXCL_START return "sttc"; + //LCOV_EXCL_STOP } static int __stt_get_feature_enabled() { if (0 == g_feature_enabled) { + //LCOV_EXCL_START SLOG(LOG_ERROR, TAG_STTC, "[ERROR] STT NOT supported"); return STT_ERROR_NOT_SUPPORTED; + //LCOV_EXCL_STOP } else if (-1 == g_feature_enabled) { bool stt_supported = false; bool mic_supported = false; if (0 == system_info_get_platform_bool(STT_FEATURE_PATH, &stt_supported)) { if (0 == system_info_get_platform_bool(STT_MIC_FEATURE_PATH, &mic_supported)) { if (false == stt_supported || false == mic_supported) { + //LCOV_EXCL_START SLOG(LOG_ERROR, TAG_STTC, "[ERROR] STT NOT supported"); g_feature_enabled = 0; return STT_ERROR_NOT_SUPPORTED; + //LCOV_EXCL_STOP } g_feature_enabled = 1; } else { + //LCOV_EXCL_START SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Fail to get feature value"); return STT_ERROR_NOT_SUPPORTED; + //LCOV_EXCL_STOP } } else { + //LCOV_EXCL_START SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Fail to get feature value"); return STT_ERROR_NOT_SUPPORTED; + //LCOV_EXCL_STOP } } @@ -88,7 +98,7 @@ static int __check_privilege_initialize() { int ret = cynara_initialize(&p_cynara, NULL); if (CYNARA_API_SUCCESS != ret) - SLOG(LOG_ERROR, TAG_STTC, "[ERROR] fail to initialize"); + SLOG(LOG_ERROR, TAG_STTC, "[ERROR] fail to initialize"); //LCOV_EXCL_LINE return ret == CYNARA_API_SUCCESS; } @@ -106,7 +116,7 @@ static bool __check_privilege(const char* uid, const char * privilege) fp = fopen(label_path, "r"); if (fp != NULL) { if (0 >= fread(smack_label, 1, sizeof(smack_label), fp)) - SLOG(LOG_ERROR, TAG_STTC, "[ERROR] fail to fread"); + SLOG(LOG_ERROR, TAG_STTC, "[ERROR] fail to fread"); //LCOV_EXCL_LINE fclose(fp); } @@ -137,16 +147,16 @@ static int __stt_check_privilege() char uid[16]; if (0 == g_privilege_allowed) { - SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Permission is denied"); + SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Permission is denied"); //LCOV_EXCL_LINE return STT_ERROR_PERMISSION_DENIED; } else if (-1 == g_privilege_allowed) { if (false == __check_privilege_initialize()) { - SLOG(LOG_ERROR, TAG_STTC, "[ERROR] privilege initialize is failed"); + SLOG(LOG_ERROR, TAG_STTC, "[ERROR] privilege initialize is failed"); //LCOV_EXCL_LINE return STT_ERROR_PERMISSION_DENIED; } snprintf(uid, 16, "%d", getuid()); if (false == __check_privilege(uid, STT_PRIVILEGE_RECORDER)) { - SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Permission is denied"); + SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Permission is denied"); //LCOV_EXCL_LINE g_privilege_allowed = 0; __check_privilege_deinitialize(); return STT_ERROR_PERMISSION_DENIED; @@ -163,16 +173,16 @@ static int __stt_check_privilege_for_applaunch() char uid[16]; if (0 == g_privilege_applaunch_allowed) { - SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Permission for applaunch is denied"); + SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Permission for applaunch is denied"); //LCOV_EXCL_LINE return STT_ERROR_PERMISSION_DENIED; } else if (-1 == g_privilege_applaunch_allowed) { if (false == __check_privilege_initialize()) { - SLOG(LOG_ERROR, TAG_STTC, "[ERROR] privilege initialize is failed (applaunch)"); + SLOG(LOG_ERROR, TAG_STTC, "[ERROR] privilege initialize is failed (applaunch)"); //LCOV_EXCL_LINE return STT_ERROR_PERMISSION_DENIED; } snprintf(uid, 16, "%d", getuid()); if (false == __check_privilege(uid, STT_PRIVILEGE_APPLAUNCH)) { - SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Permission is denied : appmanager.launch"); + SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Permission is denied : appmanager.launch"); //LCOV_EXCL_LINE g_privilege_applaunch_allowed = 0; __check_privilege_deinitialize(); return STT_ERROR_PERMISSION_DENIED; @@ -186,6 +196,7 @@ static int __stt_check_privilege_for_applaunch() static const char* __stt_get_error_code(stt_error_e err) { + //LCOV_EXCL_START switch (err) { case STT_ERROR_NONE: return "STT_ERROR_NONE"; case STT_ERROR_OUT_OF_MEMORY: return "STT_ERROR_OUT_OF_MEMORY"; @@ -205,10 +216,12 @@ static const char* __stt_get_error_code(stt_error_e err) default: return "Invalid error code"; } + //LCOV_EXCL_STOP } static int __stt_convert_config_error_code(stt_config_error_e code) { + //LCOV_EXCL_START if (code == STT_CONFIG_ERROR_NONE) return STT_ERROR_NONE; if (code == STT_CONFIG_ERROR_OUT_OF_MEMORY) return STT_ERROR_OUT_OF_MEMORY; if (code == STT_CONFIG_ERROR_IO_ERROR) return STT_ERROR_IO_ERROR; @@ -221,6 +234,7 @@ static int __stt_convert_config_error_code(stt_config_error_e code) if (code == STT_CONFIG_ERROR_OPERATION_FAILED) return STT_ERROR_OPERATION_FAILED; return code; + //LCOV_EXCL_STOP } void __stt_config_lang_changed_cb(const char* before_language, const char* current_language, void* user_data) @@ -370,19 +384,23 @@ int stt_create(stt_h* stt) if (0 == stt_client_get_size()) { if (0 != stt_dbus_open_connection()) { + //LCOV_EXCL_START SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Fail to open connection"); return STT_ERROR_OPERATION_FAILED; + //LCOV_EXCL_STOP } } if (0 != stt_client_new(stt)) { + //LCOV_EXCL_START SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Fail to create client!"); return STT_ERROR_OUT_OF_MEMORY; + //LCOV_EXCL_STOP } stt_client_s* client = stt_client_get(*stt); if (NULL == client) { - SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Fail to create client"); + SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Fail to create client"); //LCOV_EXCL_LINE stt_client_destroy(*stt); return STT_ERROR_OPERATION_FAILED; } @@ -390,7 +408,7 @@ int stt_create(stt_h* stt) int ret = stt_config_mgr_initialize(client->uid); ret = __stt_convert_config_error_code(ret); if (0 != ret) { - SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Fail to init config manager : %s", __stt_get_error_code(ret)); + SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Fail to init config manager : %s", __stt_get_error_code(ret)); //LCOV_EXCL_LINE stt_client_destroy(*stt); return ret; } @@ -398,7 +416,7 @@ int stt_create(stt_h* stt) ret = stt_config_mgr_set_callback(client->uid, __stt_config_engine_changed_cb, __stt_config_lang_changed_cb, NULL, client->stt); ret = __stt_convert_config_error_code(ret); if (0 != ret) { - SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Fail to set config changed : %s", __stt_get_error_code(ret)); + SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Fail to set config changed : %s", __stt_get_error_code(ret)); //LCOV_EXCL_LINE stt_client_destroy(*stt); return ret; } @@ -443,7 +461,7 @@ int stt_destroy(stt_h stt) case STT_STATE_READY: ret = stt_dbus_request_finalize(client->uid); if (0 != ret) { - SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Fail to request finalize : %s", __stt_get_error_code(ret)); + SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Fail to request finalize : %s", __stt_get_error_code(ret)); //LCOV_EXCL_LINE } case STT_STATE_CREATED: if (NULL != g_connect_timer) { @@ -461,7 +479,7 @@ int stt_destroy(stt_h stt) if (0 == stt_client_get_size()) { if (0 != stt_dbus_close_connection()) { - SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Fail to close connection"); + SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Fail to close connection"); //LCOV_EXCL_LINE } } @@ -480,15 +498,17 @@ bool __stt_config_supported_engine_cb(const char* engine_id, const char* engine_ stt_client_s* client = stt_client_get(stt); if (NULL == client) { + //LCOV_EXCL_START SLOG(LOG_ERROR, TAG_STTC, "[WARNING] A handle is not valid"); return false; + //LCOV_EXCL_STOP } /* call callback function */ if (NULL != client->supported_engine_cb) { return client->supported_engine_cb(stt, engine_id, engine_name, client->supported_engine_user_data); } else { - SLOG(LOG_WARN, TAG_STTC, "No registered callback function of supported engine"); + SLOG(LOG_WARN, TAG_STTC, "No registered callback function of supported engine"); //LCOV_EXCL_LINE } return false; @@ -510,7 +530,7 @@ int stt_foreach_supported_engines(stt_h stt, stt_supported_engine_cb callback, v SLOG(LOG_DEBUG, TAG_STTC, "===== Foreach Supported engine"); if (NULL == callback) { - SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Input parameter is NULL"); + SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Input parameter is NULL"); //LCOV_EXCL_LINE return STT_ERROR_INVALID_PARAMETER; } @@ -526,7 +546,7 @@ int stt_foreach_supported_engines(stt_h stt, stt_supported_engine_cb callback, v ret = stt_config_mgr_get_engine_list(__stt_config_supported_engine_cb, client->stt); ret = __stt_convert_config_error_code(ret); if (0 != ret) { - SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Fail to get engines : %s", __stt_get_error_code(ret)); + SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Fail to get engines : %s", __stt_get_error_code(ret)); //LCOV_EXCL_LINE } client->supported_engine_cb = NULL; @@ -554,7 +574,7 @@ int stt_get_engine(stt_h stt, char** engine_id) SLOG(LOG_DEBUG, TAG_STTC, "===== Get current engine"); if (NULL == engine_id) { - SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Input parameter is NULL"); + SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Input parameter is NULL"); //LCOV_EXCL_LINE return STT_ERROR_INVALID_PARAMETER; } @@ -573,7 +593,7 @@ int stt_get_engine(stt_h stt, char** engine_id) ret = stt_config_mgr_get_engine(engine_id); ret = __stt_convert_config_error_code(ret); if (0 != ret) { - SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Fail to request get current engine : %s", __stt_get_error_code(ret)); + SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Fail to request get current engine : %s", __stt_get_error_code(ret)); //LCOV_EXCL_LINE } else { SLOG(LOG_DEBUG, TAG_STTC, "[SUCCESS] Current engine uuid = %s", *engine_id); } @@ -594,29 +614,34 @@ int __stt_set_buxtonkey(const char* engine_id) int ret = buxton_open(&bux_cli, NULL, NULL); if (0 != ret) { - SLOG(LOG_ERROR, stt_tag(), "[DBUS-BUXTON2] Fail to open buxton client"); + SLOG(LOG_ERROR, stt_tag(), "[DBUS-BUXTON2] Fail to open buxton client"); //LCOV_EXCL_LINE return STT_ERROR_OPERATION_FAILED; } SLOG(LOG_DEBUG, stt_tag(), "[DBUS-BUXTON2] buxton_open: %d", ret); bux_layer = buxton_create_layer("system"); if (NULL == bux_layer) { + //LCOV_EXCL_START SLOG(LOG_ERROR, stt_tag(), "[DBUS-BUXTON2] buxton_create_layer FAIL"); buxton_close(bux_cli); bux_cli = NULL; return STT_ERROR_OPERATION_FAILED; + //LCOV_EXCL_STOP } bux_val = buxton_value_create_string(engine_id); if (NULL == bux_val) { + //LCOV_EXCL_START SLOG(LOG_ERROR, stt_tag(), "[DBUS-BUXTON2] buxton_value_create_string FAIL"); buxton_free_layer(bux_layer); buxton_close(bux_cli); bux_layer = NULL; bux_cli = NULL; return STT_ERROR_OPERATION_FAILED; + //LCOV_EXCL_STOP } ret = buxton_set_value_sync(bux_cli, bux_layer, STT_ENGINE_DB_CUSTOM, bux_val); if (0 != ret) { + //LCOV_EXCL_START SLOG(LOG_ERROR, stt_tag(), "[DBUS-BUXTON2] Fail to set value sync"); buxton_value_free(bux_val); buxton_free_layer(bux_layer); @@ -626,6 +651,7 @@ int __stt_set_buxtonkey(const char* engine_id) bux_layer = NULL; bux_val = NULL; return STT_ERROR_OPERATION_FAILED; + //LCOV_EXCL_STOP } SLOG(LOG_DEBUG, stt_tag(), "[DBUS-BUXTON2] buxton_set_value_sync: %d, %s", ret, STT_ENGINE_DB_CUSTOM); @@ -659,7 +685,7 @@ int stt_set_engine(stt_h stt, const char* engine_id) SLOG(LOG_DEBUG, TAG_STTC, "===== Set current engine"); if (NULL == engine_id) { - SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Input parameter is NULL"); + SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Input parameter is NULL"); //LCOV_EXCL_LINE return STT_ERROR_INVALID_PARAMETER; } @@ -681,7 +707,7 @@ int stt_set_engine(stt_h stt, const char* engine_id) /* Set vconfkey */ int ret = __stt_set_buxtonkey(engine_id); if (0 != ret) { - SLOG(LOG_ERROR, TAG_STTC, "[ERROR] set buxtonkey Failed!!!"); + SLOG(LOG_ERROR, TAG_STTC, "[ERROR] set buxtonkey Failed!!!"); //LCOV_EXCL_LINE return ret; } @@ -713,7 +739,7 @@ int stt_set_credential(stt_h stt, const char* credential) /* check state */ if (client->current_state != STT_STATE_CREATED && client->current_state != STT_STATE_READY) { - SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Invalid State: Current state(%d) is not CREATED or READY", client->current_state); + SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Invalid State: Current state(%d) is not CREATED or READY", client->current_state); //LCOV_EXCL_LINE return STT_ERROR_INVALID_STATE; } @@ -756,7 +782,7 @@ int stt_set_private_data(stt_h stt, const char* key, const char* data) } if (true != client->internal && (0 == strcmp(key, "server") || 0 == strcmp(key, "rampcode") || 0 == strcmp(key, "epd"))) { - SLOG(LOG_ERROR, TAG_STTC, "[ERROR] This is not an internal app"); + SLOG(LOG_ERROR, TAG_STTC, "[ERROR] This is not an internal app"); //LCOV_EXCL_LINE return STT_ERROR_INVALID_PARAMETER; } @@ -765,6 +791,7 @@ int stt_set_private_data(stt_h stt, const char* key, const char* data) while (0 != ret) { ret = stt_dbus_request_set_private_data(client->uid, key, data); if (0 != ret) { + //LCOV_EXCL_START if (STT_ERROR_TIMED_OUT != ret) { SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Fail to set private data : %s", __stt_get_error_code(ret)); return ret; @@ -777,6 +804,7 @@ int stt_set_private_data(stt_h stt, const char* key, const char* data) return ret; } } + //LCOV_EXCL_STOP } } @@ -817,6 +845,7 @@ int stt_get_private_data(stt_h stt, const char* key, char** data) while (0 != ret) { ret = stt_dbus_request_get_private_data(client->uid, key, data); if (0 != ret) { + //LCOV_EXCL_START if (STT_ERROR_TIMED_OUT != ret) { SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Fail to get private data : %s", __stt_get_error_code(ret)); return ret; @@ -829,6 +858,7 @@ int stt_get_private_data(stt_h stt, const char* key, char** data) return ret; } } + //LCOV_EXCL_STOP } } @@ -843,6 +873,7 @@ int stt_get_private_data(stt_h stt, const char* key, char** data) return STT_ERROR_NONE; } +//LCOV_EXCL_START int stt_set_server_stt(stt_h stt, const char* key, char* user_data) { int ret = -1; @@ -904,6 +935,7 @@ int stt_set_server_stt(stt_h stt, const char* key, char* user_data) return ret; } +//LCOV_EXCL_STOP static Eina_Bool __stt_connect_daemon(void *data) { @@ -911,13 +943,13 @@ static Eina_Bool __stt_connect_daemon(void *data) int ret = -1; if (NULL == client) { - SLOG(LOG_ERROR, TAG_STTC, "[ERROR] A handle is not available"); + SLOG(LOG_ERROR, TAG_STTC, "[ERROR] A handle is not available"); //LCOV_EXCL_LINE g_connect_timer = NULL; return EINA_FALSE; } if (0 == stt_client_get_size() || NULL == stt_client_get_by_uid(client->uid)) { - SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Client has been already destroyed"); + SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Client has been already destroyed"); //LCOV_EXCL_LINE return EINA_FALSE; } @@ -925,10 +957,12 @@ static Eina_Bool __stt_connect_daemon(void *data) if (1 == g_privilege_applaunch_allowed && NULL != client->current_engine_id) { /* Set vconfkey */ ret = __stt_set_buxtonkey(client->current_engine_id); + //LCOV_EXCL_START if (0 != ret) { SLOG(LOG_DEBUG, TAG_STTC, "[DEBUG] set buxtonkey Failed!!! (inside __stt_connect_daemon)"); return EINA_TRUE; } + //LCOV_EXCL_STOP } /* Send hello */ @@ -952,7 +986,7 @@ static Eina_Bool __stt_connect_daemon(void *data) ret = stt_dbus_request_initialize(client->uid, &silence_supported, &credential_needed); if (STT_ERROR_ENGINE_NOT_FOUND == ret) { - SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Fail to initialize : %s", __stt_get_error_code(ret)); + SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Fail to initialize : %s", __stt_get_error_code(ret)); //LCOV_EXCL_LINE client->reason = STT_ERROR_ENGINE_NOT_FOUND; ecore_main_loop_thread_safe_call_async(__stt_notify_error, (void*)client); @@ -960,7 +994,7 @@ static Eina_Bool __stt_connect_daemon(void *data) return EINA_FALSE; } else if (STT_ERROR_NONE != ret) { - SLOG(LOG_ERROR, TAG_STTC, "[WARNING] Fail to connection. Retry to connect"); + SLOG(LOG_ERROR, TAG_STTC, "[WARNING] Fail to connection. Retry to connect"); //LCOV_EXCL_LINE return EINA_TRUE; } else { /* success to connect stt-service */ @@ -969,6 +1003,7 @@ static Eina_Bool __stt_connect_daemon(void *data) SLOG(LOG_DEBUG, TAG_STTC, "Supported options : silence(%s), credential(%s)", silence_supported ? "support" : "no support", credential_needed ? "need" : "no need"); } +//LCOV_EXCL_START #ifdef __UNUSED_CODES__ if (NULL != client->current_engine_id) { ret = -1; @@ -1002,6 +1037,7 @@ static Eina_Bool __stt_connect_daemon(void *data) } } #endif +//LCOV_EXCL_STOP SLOG(LOG_DEBUG, TAG_STTC, "[SUCCESS] uid(%d)", client->uid); client->before_state = client->current_state; @@ -1078,6 +1114,7 @@ int stt_unprepare(stt_h stt) while (0 != ret) { ret = stt_dbus_request_finalize(client->uid); if (0 != ret) { + //LCOV_EXCL_START if (STT_ERROR_TIMED_OUT != ret) { SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Fail to request finalize : %s", __stt_get_error_code(ret)); break; @@ -1090,6 +1127,7 @@ int stt_unprepare(stt_h stt) break; } } + //LCOV_EXCL_STOP } } @@ -1124,7 +1162,7 @@ bool __stt_config_supported_language_cb(const char* engine_id, const char* langu stt_client_s* client = stt_client_get(stt); if (NULL == client) { - SLOG(LOG_ERROR, TAG_STTC, "[WARNING] A handle is not valid"); + SLOG(LOG_ERROR, TAG_STTC, "[WARNING] A handle is not valid"); //LCOV_EXCL_LINE return false; } @@ -1132,7 +1170,7 @@ bool __stt_config_supported_language_cb(const char* engine_id, const char* langu if (NULL != client->supported_lang_cb) { return client->supported_lang_cb(stt, language, client->supported_lang_user_data); } else { - SLOG(LOG_WARN, TAG_STTC, "No registered callback function of supported languages"); + SLOG(LOG_WARN, TAG_STTC, "No registered callback function of supported languages"); //LCOV_EXCL_LINE } return false; @@ -1154,7 +1192,7 @@ int stt_foreach_supported_languages(stt_h stt, stt_supported_language_cb callbac SLOG(LOG_DEBUG, TAG_STTC, "===== Foreach Supported Language"); if (NULL == callback) { - SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Input parameter is NULL"); + SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Input parameter is NULL"); //LCOV_EXCL_LINE return STT_ERROR_INVALID_PARAMETER; } @@ -1165,15 +1203,17 @@ int stt_foreach_supported_languages(stt_h stt, stt_supported_language_cb callbac ret = stt_config_mgr_get_engine(¤t_engine_id); ret = __stt_convert_config_error_code(ret); if (0 != ret) { - SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Fail to get default engine id : %s", __stt_get_error_code(ret)); + SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Fail to get default engine id : %s", __stt_get_error_code(ret)); //LCOV_EXCL_LINE return ret; } } else { current_engine_id = strdup(client->current_engine_id); + //LCOV_EXCL_START if (NULL == current_engine_id) { SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Fail to allocate memory"); return STT_ERROR_OUT_OF_MEMORY; } + //LCOV_EXCL_STOP } client->supported_lang_cb = callback; @@ -1182,7 +1222,7 @@ int stt_foreach_supported_languages(stt_h stt, stt_supported_language_cb callbac ret = stt_config_mgr_get_language_list(current_engine_id, __stt_config_supported_language_cb, client->stt); ret = __stt_convert_config_error_code(ret); if (0 != ret) { - SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Fail to get languages : %s", __stt_get_error_code(ret)); + SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Fail to get languages : %s", __stt_get_error_code(ret)); //LCOV_EXCL_LINE } if (NULL != current_engine_id) { @@ -1215,7 +1255,7 @@ int stt_get_default_language(stt_h stt, char** language) SLOG(LOG_DEBUG, TAG_STTC, "===== Get Default Language"); if (NULL == language) { - SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Input parameter is NULL"); + SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Input parameter is NULL"); //LCOV_EXCL_LINE return STT_ERROR_INVALID_PARAMETER; } @@ -1223,7 +1263,7 @@ int stt_get_default_language(stt_h stt, char** language) ret = stt_config_mgr_get_default_language(language); ret = __stt_convert_config_error_code(ret); if (0 != ret) { - SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Fail to get default language : %s", __stt_get_error_code(ret)); + SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Fail to get default language : %s", __stt_get_error_code(ret)); //LCOV_EXCL_LINE } else { SLOG(LOG_DEBUG, TAG_STTC, "[SUCCESS] Current language = %s", *language); } @@ -1248,7 +1288,7 @@ int stt_get_state(stt_h stt, stt_state_e* state) } if (NULL == state) { - SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Input parameter is NULL"); + SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Input parameter is NULL"); //LCOV_EXCL_LINE return STT_ERROR_INVALID_PARAMETER; } @@ -1290,13 +1330,13 @@ int stt_get_error_message(stt_h stt, char** err_msg) if (NULL != client->err_msg) { *err_msg = strdup(client->err_msg); - SLOG(LOG_DEBUG, TAG_STTC, "[SUCCESS] Error msg (%s)", *err_msg); + SLOG(LOG_DEBUG, TAG_STTC, "[SUCCESS] Error msg (%s)", *err_msg); //LCOV_EXCL_LINE } else { - SLOG(LOG_DEBUG, TAG_STTC, "[SUCCESS] Error msg (NULL)"); + SLOG(LOG_DEBUG, TAG_STTC, "[SUCCESS] Error msg (NULL)"); //LCOV_EXCL_LINE } - SLOG(LOG_DEBUG, TAG_STTC, "====="); - SLOG(LOG_DEBUG, TAG_STTC, " "); + SLOG(LOG_DEBUG, TAG_STTC, "====="); //LCOV_EXCL_LINE + SLOG(LOG_DEBUG, TAG_STTC, " "); //LCOV_EXCL_LINE return STT_ERROR_NONE; } @@ -1315,7 +1355,7 @@ int stt_is_recognition_type_supported(stt_h stt, const char* type, bool* support } if (NULL == type || NULL == support) { - SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Input parameter is NULL"); + SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Input parameter is NULL"); //LCOV_EXCL_LINE return STT_ERROR_INVALID_PARAMETER; } @@ -1330,6 +1370,7 @@ int stt_is_recognition_type_supported(stt_h stt, const char* type, bool* support while (0 != ret) { ret = stt_dbus_request_is_recognition_type_supported(client->uid, type, support); if (0 != ret) { + //LCOV_EXCL_START if (STT_ERROR_TIMED_OUT != ret) { SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Fail to get recognition type supported : %s", __stt_get_error_code(ret)); return ret; @@ -1342,6 +1383,7 @@ int stt_is_recognition_type_supported(stt_h stt, const char* type, bool* support return ret; } } + //LCOV_EXCL_STOP } else { SLOG(LOG_DEBUG, TAG_STTC, "[SUCCESS] recognition type is %s", *support ? "true " : "false"); break; @@ -1400,18 +1442,18 @@ int stt_set_start_sound(stt_h stt, const char* filename) SLOG(LOG_DEBUG, TAG_STTC, "===== STT SET START SOUND"); if (NULL == filename) { - SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Input parameter is NULL"); + SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Input parameter is NULL"); //LCOV_EXCL_LINE return STT_ERROR_INVALID_PARAMETER; } if (0 != access(filename, F_OK)) { - SLOG(LOG_ERROR, TAG_STTC, "[ERROR] File does not exist"); + SLOG(LOG_ERROR, TAG_STTC, "[ERROR] File does not exist"); //LCOV_EXCL_LINE return STT_ERROR_INVALID_PARAMETER; } /* check state */ if (client->current_state != STT_STATE_READY) { - SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Invalid State: Current state(%d) is not READY", client->current_state); + SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Invalid State: Current state(%d) is not READY", client->current_state); //LCOV_EXCL_LINE return STT_ERROR_INVALID_STATE; } @@ -1420,6 +1462,7 @@ int stt_set_start_sound(stt_h stt, const char* filename) while (0 != ret) { ret = stt_dbus_request_set_start_sound(client->uid, filename); if (0 != ret) { + //LCOV_EXCL_START if (STT_ERROR_TIMED_OUT != ret) { SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Fail to set start sound : %s", __stt_get_error_code(ret)); return ret; @@ -1432,6 +1475,7 @@ int stt_set_start_sound(stt_h stt, const char* filename) return ret; } } + //LCOV_EXCL_STOP } else { SLOG(LOG_DEBUG, TAG_STTC, "[SUCCESS] Set start sound : %s", filename); break; @@ -1467,6 +1511,7 @@ int stt_unset_start_sound(stt_h stt) while (0 != ret) { ret = stt_dbus_request_unset_start_sound(client->uid); if (0 != ret) { + //LCOV_EXCL_START if (STT_ERROR_TIMED_OUT != ret) { SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Fail to unset start sound : %s", __stt_get_error_code(ret)); return ret; @@ -1479,6 +1524,7 @@ int stt_unset_start_sound(stt_h stt) return ret; } } + //LCOV_EXCL_STOP } else { SLOG(LOG_DEBUG, TAG_STTC, "[SUCCESS] Unset start sound"); break; @@ -1504,18 +1550,18 @@ int stt_set_stop_sound(stt_h stt, const char* filename) SLOG(LOG_DEBUG, TAG_STTC, "===== STT SET STOP SOUND"); if (NULL == filename) { - SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Input parameter is NULL"); + SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Input parameter is NULL"); //LCOV_EXCL_LINE return STT_ERROR_INVALID_PARAMETER; } if (0 != access(filename, F_OK)) { - SLOG(LOG_ERROR, TAG_STTC, "[ERROR] File does not exist"); + SLOG(LOG_ERROR, TAG_STTC, "[ERROR] File does not exist"); //LCOV_EXCL_LINE return STT_ERROR_INVALID_PARAMETER; } /* check state */ if (client->current_state != STT_STATE_READY) { - SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Invalid State: Current state(%d) is not READY", client->current_state); + SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Invalid State: Current state(%d) is not READY", client->current_state); //LCOV_EXCL_LINE return STT_ERROR_INVALID_STATE; } @@ -1524,6 +1570,7 @@ int stt_set_stop_sound(stt_h stt, const char* filename) while (0 != ret) { ret = stt_dbus_request_set_stop_sound(client->uid, filename); if (0 != ret) { + //LCOV_EXCL_START if (STT_ERROR_TIMED_OUT != ret) { SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Fail to set stop sound : %s", __stt_get_error_code(ret)); return ret; @@ -1536,6 +1583,7 @@ int stt_set_stop_sound(stt_h stt, const char* filename) return ret; } } + //LCOV_EXCL_STOP } else { SLOG(LOG_DEBUG, TAG_STTC, "[SUCCESS] Set stop sound : %s", filename); break; @@ -1571,6 +1619,7 @@ int stt_unset_stop_sound(stt_h stt) while (0 != ret) { ret = stt_dbus_request_unset_stop_sound(client->uid); if (0 != ret) { + //LCOV_EXCL_START if (STT_ERROR_TIMED_OUT != ret) { SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Fail to unset stop sound : %s", __stt_get_error_code(ret)); return ret; @@ -1583,6 +1632,7 @@ int stt_unset_stop_sound(stt_h stt) return ret; } } + //LCOV_EXCL_STOP } else { SLOG(LOG_DEBUG, TAG_STTC, "[SUCCESS] Unset stop sound"); break; @@ -1614,7 +1664,7 @@ int stt_start(stt_h stt, const char* language, const char* type) } 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); + SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Invalid State : Internal state is NOT none : %d", client->internal_state); //LCOV_EXCL_LINE return STT_ERROR_IN_PROGRESS_TO_RECORDING; } @@ -1623,7 +1673,7 @@ int stt_start(stt_h stt, const char* language, const char* type) ret = aul_app_get_appid_bypid(getpid(), appid, sizeof(appid) - 1); if ((AUL_R_OK != ret) || (0 == strlen(appid))) { - SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Fail to get application ID"); + SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Fail to get application ID"); //LCOV_EXCL_LINE } else { SLOG(LOG_DEBUG, TAG_STTC, "[DEBUG] Current app id is %s", appid); } @@ -1641,7 +1691,7 @@ int stt_start(stt_h stt, const char* language, const char* type) } 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); + SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Do not have app credential for this engine(%s)", client->current_engine_id); //LCOV_EXCL_LINE free(temp); temp = NULL; return STT_ERROR_PERMISSION_DENIED; @@ -1650,7 +1700,7 @@ int stt_start(stt_h stt, const char* language, const char* type) client->internal_state = STT_INTERNAL_STATE_STARTING; ret = stt_dbus_request_start(client->uid, temp, type, client->silence, appid, client->credential); if (0 != ret) { - SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Fail to start : %s", __stt_get_error_code(ret)); + SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Fail to start : %s", __stt_get_error_code(ret)); //LCOV_EXCL_LINE client->internal_state = STT_INTERNAL_STATE_NONE; } else { SLOG(LOG_DEBUG, TAG_STTC, "[SUCCESS] Start is successful but not done"); @@ -1682,25 +1732,25 @@ int stt_stop(stt_h stt) /* check state */ if (client->current_state != STT_STATE_RECORDING) { - SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Invalid State : Current state(%d) is NOT RECORDING", client->current_state); + SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Invalid State : Current state(%d) is NOT RECORDING", client->current_state); //LCOV_EXCL_LINE return STT_ERROR_INVALID_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); + SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Invalid State : Internal state is STARTING : %d", client->internal_state); //LCOV_EXCL_LINE 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); + SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Invalid State : Internal state is CANCELING : %d", client->internal_state); //LCOV_EXCL_LINE 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); + SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Invalid State : Internal state is STOPPING : %d", client->internal_state); //LCOV_EXCL_LINE return STT_ERROR_IN_PROGRESS_TO_PROCESSING; } client->internal_state = STT_INTERNAL_STATE_STOPPING; int ret = stt_dbus_request_stop(client->uid); if (0 != ret) { - SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Fail to stop : %s", __stt_get_error_code(ret)); + SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Fail to stop : %s", __stt_get_error_code(ret)); //LCOV_EXCL_LINE client->internal_state = STT_INTERNAL_STATE_NONE; } else { SLOG(LOG_DEBUG, TAG_STTC, "[SUCCESS] Stop is successful but not done"); @@ -1730,25 +1780,25 @@ int stt_cancel(stt_h stt) /* check state */ if (STT_STATE_RECORDING != client->current_state && STT_STATE_PROCESSING != client->current_state) { - SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Invalid state : Current state(%d) is 'Ready'", client->current_state); + SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Invalid state : Current state(%d) is 'Ready'", client->current_state); //LCOV_EXCL_LINE return STT_ERROR_INVALID_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); + SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Invalid State : Internal state is STARTING : %d", client->internal_state); //LCOV_EXCL_LINE 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); + SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Invalid State : Internal state is STOPPING : %d", client->internal_state); //LCOV_EXCL_LINE 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); + SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Invalid State : Internal state is CANCELING : %d", client->internal_state); //LCOV_EXCL_LINE return STT_ERROR_IN_PROGRESS_TO_READY; } client->internal_state = STT_INTERNAL_STATE_CANCELING; 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_ERROR, TAG_STTC, "[ERROR] Fail to cancel : %s", __stt_get_error_code(ret)); //LCOV_EXCL_LINE client->internal_state = STT_INTERNAL_STATE_NONE; } else { SLOG(LOG_DEBUG, TAG_STTC, "[SUCCESS] Cancel is successful but not done"); @@ -1766,13 +1816,17 @@ int __stt_cb_set_volume(int uid, float volume) client = stt_client_get_by_uid(uid); if (NULL == client) { + //LCOV_EXCL_START SLOG(LOG_ERROR, TAG_STTC, "Handle is NOT valid"); return STT_ERROR_INVALID_PARAMETER; + //LCOV_EXCL_STOP } if (STT_STATE_RECORDING != client->current_state) { + //LCOV_EXCL_START SLOG(LOG_DEBUG, TAG_STTC, "[ERROR] Invalid state : NO 'Recording' state, cur(%d)", client->current_state); return STT_ERROR_INVALID_STATE; + //LCOV_EXCL_STOP } g_volume_db = volume; @@ -1795,12 +1849,12 @@ int stt_get_recording_volume(stt_h stt, float* volume) } if (NULL == volume) { - SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Input parameter is NULL"); + SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Input parameter is NULL"); //LCOV_EXCL_LINE return STT_ERROR_INVALID_PARAMETER; } if (STT_STATE_RECORDING != client->current_state) { - SLOG(LOG_DEBUG, TAG_STTC, "[ERROR] Invalid state : NO 'Recording' state, cur(%d)", client->current_state); + SLOG(LOG_DEBUG, TAG_STTC, "[ERROR] Invalid state : NO 'Recording' state, cur(%d)", client->current_state); //LCOV_EXCL_LINE return STT_ERROR_INVALID_STATE; } @@ -1809,6 +1863,7 @@ int stt_get_recording_volume(stt_h stt, float* volume) return STT_ERROR_NONE; } +//LCOV_EXCL_START bool __stt_result_time_cb(int index, int event, const char* text, long start_time, long end_time, void* user_data) { stt_client_s* client = (stt_client_s*)user_data; @@ -1831,6 +1886,7 @@ bool __stt_result_time_cb(int index, int event, const char* text, long start_tim return true; } +//LCOV_EXCL_STOP int stt_foreach_detailed_result(stt_h stt, stt_result_time_cb callback, void* user_data) { @@ -1848,7 +1904,7 @@ int stt_foreach_detailed_result(stt_h stt, stt_result_time_cb callback, void* us SLOG(LOG_DEBUG, TAG_STTC, "===== STT FOREACH DETAILED RESULT"); if (NULL == callback) { - SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Input parameter is NULL"); + SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Input parameter is NULL"); //LCOV_EXCL_LINE return STT_ERROR_INVALID_PARAMETER; } @@ -1859,7 +1915,7 @@ int stt_foreach_detailed_result(stt_h stt, stt_result_time_cb callback, void* us ret = stt_config_mgr_foreach_time_info(__stt_result_time_cb, client); ret = __stt_convert_config_error_code(ret); if (0 != ret) { - SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Fail to foreach time info : %s", __stt_get_error_code(ret)); + SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Fail to foreach time info : %s", __stt_get_error_code(ret)); //LCOV_EXCL_LINE } client->result_time_cb = NULL; @@ -1879,7 +1935,7 @@ static void __stt_notify_error(void *data) /* check handle */ if (NULL == client) { - SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Fail to notify error : A handle is not valid"); + SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Fail to notify error : A handle is not valid"); //LCOV_EXCL_LINE return; } @@ -1894,7 +1950,7 @@ static void __stt_notify_error(void *data) stt_client_not_use_callback(client); SLOG(LOG_WARN, TAG_STTC, "[WARNING] Error callback is called : reason [%d]", client->reason); } else { - SLOG(LOG_WARN, TAG_STTC, "[WARNING] Error callback is null"); + SLOG(LOG_WARN, TAG_STTC, "[WARNING] Error callback is null"); //LCOV_EXCL_LINE } return; @@ -1902,6 +1958,7 @@ static void __stt_notify_error(void *data) int __stt_cb_error(int uid, int reason, char* err_msg) { + //LCOV_EXCL_START if (-1 == uid) { GList* client_list = NULL; client_list = stt_client_get_client_list(); @@ -1946,10 +2003,11 @@ int __stt_cb_error(int uid, int reason, char* err_msg) iter = g_list_next(iter); } } + //LCOV_EXCL_STOP } else { stt_client_s* client = stt_client_get_by_uid(uid); if (NULL == client) { - SLOG(LOG_ERROR, TAG_STTC, "Handle not found"); + SLOG(LOG_ERROR, TAG_STTC, "Handle not found"); //LCOV_EXCL_LINE return -1; } @@ -1971,11 +2029,11 @@ int __stt_cb_error(int uid, int reason, char* err_msg) } if (STT_ERROR_SERVICE_RESET == reason) { - SLOG(LOG_WARN, TAG_STTC, "[WARNING] Service reset"); + SLOG(LOG_WARN, TAG_STTC, "[WARNING] Service reset"); //LCOV_EXCL_LINE client->current_state = STT_STATE_CREATED; if (0 != stt_prepare(client->stt)) { - SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Fail to prepare"); + SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Fail to prepare"); //LCOV_EXCL_LINE } } } @@ -1989,7 +2047,7 @@ static void __stt_notify_state_changed(void *data) /* check handle */ if (NULL == client) { - SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Fail to notify error : A handle is not valid"); + SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Fail to notify error : A handle is not valid"); //LCOV_EXCL_LINE return; } @@ -2015,7 +2073,7 @@ static void __stt_notify_state_changed(void *data) stt_client_not_use_callback(client); SLOG(LOG_DEBUG, TAG_STTC, "State changed callback is called, State(%d)", client->current_state); } else { - SLOG(LOG_WARN, TAG_STTC, "[WARNING] State changed callback is null, State(%d)", client->current_state); + SLOG(LOG_WARN, TAG_STTC, "[WARNING] State changed callback is null, State(%d)", client->current_state); //LCOV_EXCL_LINE } return; @@ -2027,7 +2085,7 @@ static Eina_Bool __stt_notify_result(void *data) /* check handle */ if (NULL == client) { - SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Fail to notify error : A handle is not valid"); + SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Fail to notify error : A handle is not valid"); //LCOV_EXCL_LINE return EINA_FALSE; } @@ -2060,7 +2118,7 @@ static Eina_Bool __stt_notify_result(void *data) free(temp[i]); temp[i] = NULL; } else { - SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Result data is error"); + SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Result data is error"); //LCOV_EXCL_LINE } } free(client->data_list); @@ -2078,7 +2136,7 @@ static Eina_Bool __stt_notify_result(void *data) 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"); + SLOG(LOG_WARN, TAG_STTC, "[WARNING] State changed callback is null"); //LCOV_EXCL_LINE } } @@ -2091,7 +2149,7 @@ int __stt_cb_result(int uid, int event, char** data, int data_count, const char* client = stt_client_get_by_uid(uid); if (NULL == client) { - SLOG(LOG_ERROR, TAG_STTC, "Handle is NOT valid"); + SLOG(LOG_ERROR, TAG_STTC, "Handle is NOT valid"); //LCOV_EXCL_LINE return STT_ERROR_INVALID_PARAMETER; } @@ -2116,7 +2174,7 @@ int __stt_cb_result(int uid, int event, char** data, int data_count, const char* char **temp = NULL; temp = (char**)calloc(data_count, sizeof(char*)); if (NULL == temp) { - SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Fail to allocate memory"); + SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Fail to allocate memory"); //LCOV_EXCL_LINE return STT_ERROR_OUT_OF_MEMORY; } @@ -2124,7 +2182,7 @@ int __stt_cb_result(int uid, int event, char** data, int data_count, const char* if (NULL != data[i]) temp[i] = strdup(data[i]); else - SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Result data is error"); + SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Result data is error"); //LCOV_EXCL_LINE } client->data_list = temp; @@ -2142,7 +2200,7 @@ int __stt_cb_set_state(int uid, int state) { stt_client_s* client = stt_client_get_by_uid(uid); if (NULL == client) { - SLOG(LOG_ERROR, TAG_STTC, "Handle not found"); + SLOG(LOG_ERROR, TAG_STTC, "Handle not found"); //LCOV_EXCL_LINE return -1; } @@ -2166,7 +2224,7 @@ static void __stt_notify_speech_status(void *data) /* check handle */ if (NULL == client) { - SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Fail to notify speech status : A handle is not valid"); + SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Fail to notify speech status : A handle is not valid"); //LCOV_EXCL_LINE return; } @@ -2178,9 +2236,9 @@ static void __stt_notify_speech_status(void *data) stt_client_use_callback(client); client->speech_status_cb(client->stt, client->speech_status, client->speech_status_user_data); stt_client_not_use_callback(client); - SLOG(LOG_DEBUG, TAG_STTC, "Speech status callback is called"); + SLOG(LOG_DEBUG, TAG_STTC, "Speech status callback is called"); //LCOV_EXCL_LINE } else { - SLOG(LOG_WARN, TAG_STTC, "[WARNING] Speech status callback is null"); + SLOG(LOG_WARN, TAG_STTC, "[WARNING] Speech status callback is null"); //LCOV_EXCL_LINE } return; @@ -2190,7 +2248,7 @@ int __stt_cb_speech_status(int uid, int status) { stt_client_s* client = stt_client_get_by_uid(uid); if (NULL == client) { - SLOG(LOG_ERROR, TAG_STTC, "Handle not found"); + SLOG(LOG_ERROR, TAG_STTC, "Handle not found"); //LCOV_EXCL_LINE return -1; } @@ -2455,6 +2513,7 @@ int stt_unset_engine_changed_cb(stt_h stt) return 0; } +//LCOV_EXCL_START int stt_set_speech_status_cb(stt_h stt, stt_speech_status_cb callback, void* user_data) { stt_client_s* client = NULL; @@ -2629,4 +2688,4 @@ int stt_cancel_file(stt_h stt) return ret; } - +//LCOV_EXCL_STOP diff --git a/client/stt_client.c b/client/stt_client.c index d2d04cf..a9eef07 100644 --- a/client/stt_client.c +++ b/client/stt_client.c @@ -43,13 +43,13 @@ int stt_client_new(stt_h* stt) client = (stt_client_s*)calloc(1, sizeof(stt_client_s)); if (NULL == client) { - SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Fail to allocate memory"); + SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Fail to allocate memory"); //LCOV_EXCL_LINE return STT_ERROR_OUT_OF_MEMORY; } stt_h temp = (stt_h)calloc(1, sizeof(struct stt_s)); if (NULL == temp) { - SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Fail to allocate memory"); + SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Fail to allocate memory"); //LCOV_EXCL_LINE free(client); return STT_ERROR_OUT_OF_MEMORY; } @@ -106,7 +106,7 @@ int stt_client_new(stt_h* stt) int stt_client_destroy(stt_h stt) { if (stt == NULL) { - SLOG(LOG_ERROR, TAG_STTC, "Input parameter is NULL"); + SLOG(LOG_ERROR, TAG_STTC, "Input parameter is NULL"); //LCOV_EXCL_LINE return 0; } @@ -154,7 +154,7 @@ int stt_client_destroy(stt_h stt) } } - SLOG(LOG_ERROR, TAG_STTC, "[ERROR] client Not founded"); + SLOG(LOG_ERROR, TAG_STTC, "[ERROR] client Not founded"); //LCOV_EXCL_LINE return -1; } @@ -163,7 +163,7 @@ int stt_client_destroy(stt_h stt) stt_client_s* stt_client_get(stt_h stt) { if (NULL == stt) { - SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Input parameter is NULL"); + SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Input parameter is NULL"); //LCOV_EXCL_LINE return NULL; } @@ -193,7 +193,7 @@ stt_client_s* stt_client_get(stt_h stt) stt_client_s* stt_client_get_by_uid(const int uid) { if (uid < 0) { - SLOG(LOG_ERROR, TAG_STTC, "[ERROR] out of range : handle"); + SLOG(LOG_ERROR, TAG_STTC, "[ERROR] out of range : handle"); //LCOV_EXCL_LINE return NULL; } @@ -215,7 +215,7 @@ stt_client_s* stt_client_get_by_uid(const int uid) } } - SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Fail to get client by uid"); + SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Fail to get client by uid"); //LCOV_EXCL_LINE return NULL; } diff --git a/client/stt_dbus.c b/client/stt_dbus.c index f589775..4ef5282 100644 --- a/client/stt_dbus.c +++ b/client/stt_dbus.c @@ -45,6 +45,7 @@ extern int __stt_cb_set_volume(int uid, float volume); extern int __stt_cb_speech_status(int uid, int status); +//LCOV_EXCL_START char* __stt_get_service_name(char* engine_id) { char* service_name = NULL; @@ -355,7 +356,7 @@ char* __stt_get_service_interface(char* engine_id) return service_interface; } - +//LCOV_EXCL_STOP static Eina_Bool listener_event_callback(void* data, Ecore_Fd_Handler *fd_handler) { @@ -368,7 +369,7 @@ static Eina_Bool listener_event_callback(void* data, Ecore_Fd_Handler *fd_handle msg = dbus_connection_pop_message(g_conn_listener); if (true != dbus_connection_get_is_connected(g_conn_listener)) { - SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Connection is disconnected"); + SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Connection is disconnected"); //LCOV_EXCL_LINE break; } @@ -442,7 +443,7 @@ static Eina_Bool listener_event_callback(void* data, Ecore_Fd_Handler *fd_handle DBUS_TYPE_INVALID); if (dbus_error_is_set(&err)) { - SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Get arguments error (%s)", err.message); + SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Get arguments error (%s)", err.message); //LCOV_EXCL_LINE dbus_error_free(&err); } @@ -450,7 +451,7 @@ static Eina_Bool listener_event_callback(void* data, Ecore_Fd_Handler *fd_handle SLOG(LOG_DEBUG, TAG_STTC, "<<<< stt set state : uid(%d), state(%d)", uid, state); __stt_cb_set_state(uid, state); } else { - SLOG(LOG_ERROR, TAG_STTC, "<<<< stt set state : invalid uid or state"); + SLOG(LOG_ERROR, TAG_STTC, "<<<< stt set state : invalid uid or state"); //LCOV_EXCL_LINE } SLOG(LOG_DEBUG, TAG_STTC, "====="); @@ -468,7 +469,7 @@ static Eina_Bool listener_event_callback(void* data, Ecore_Fd_Handler *fd_handle DBUS_TYPE_INVALID); if (dbus_error_is_set(&err)) { - SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Get arguments error (%s)", err.message); + SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Get arguments error (%s)", err.message); //LCOV_EXCL_LINE dbus_error_free(&err); } @@ -534,7 +535,7 @@ static Eina_Bool listener_event_callback(void* data, Ecore_Fd_Handler *fd_handle temp_result = (char**)calloc(temp_count, sizeof(char*)); if (NULL == temp_result) { - SLOG(LOG_ERROR, TAG_STTC, "Fail : memory allocation error"); + SLOG(LOG_ERROR, TAG_STTC, "Fail : memory allocation error"); //LCOV_EXCL_LINE } else { int i = 0; for (i = 0; i < temp_count; i++) { @@ -558,7 +559,7 @@ static Eina_Bool listener_event_callback(void* data, Ecore_Fd_Handler *fd_handle } } } else { - SLOG(LOG_ERROR, TAG_STTC, "<<<< stt get result : invalid uid"); + SLOG(LOG_ERROR, TAG_STTC, "<<<< stt get result : invalid uid"); //LCOV_EXCL_LINE } SLOG(LOG_DEBUG, TAG_STTC, "====="); @@ -578,7 +579,7 @@ static Eina_Bool listener_event_callback(void* data, Ecore_Fd_Handler *fd_handle DBUS_TYPE_INVALID); if (dbus_error_is_set(&err)) { - SLOG(LOG_ERROR, TAG_STTC, "<<<< stt Get Error message : Get arguments error (%s)", err.message); + SLOG(LOG_ERROR, TAG_STTC, "<<<< stt Get Error message : Get arguments error (%s)", err.message); //LCOV_EXCL_LINE dbus_error_free(&err); } else { SLOG(LOG_DEBUG, TAG_STTC, "<<<< stt Get Error message : uid(%d), reason(%d), err_msg(%s)", uid, reason, (NULL == err_msg) ? "NULL" : err_msg); @@ -600,7 +601,7 @@ static Eina_Bool listener_event_callback(void* data, Ecore_Fd_Handler *fd_handle DBUS_TYPE_INVALID); if (dbus_error_is_set(&err)) { - SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Get arguments error (%s)", err.message); + SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Get arguments error (%s)", err.message); //LCOV_EXCL_LINE dbus_error_free(&err); } @@ -608,7 +609,7 @@ static Eina_Bool listener_event_callback(void* data, Ecore_Fd_Handler *fd_handle SLOG(LOG_DEBUG, TAG_STTC, "<<<< stt speech status : uid(%d), status(%d)", uid, status); __stt_cb_speech_status(uid, status); } else { - SLOG(LOG_ERROR, TAG_STTC, "<<<< stt set status : invalid uid or status"); + SLOG(LOG_ERROR, TAG_STTC, "<<<< stt set status : invalid uid or status"); //LCOV_EXCL_LINE } SLOG(LOG_DEBUG, TAG_STTC, "====="); @@ -616,6 +617,7 @@ static Eina_Bool listener_event_callback(void* data, Ecore_Fd_Handler *fd_handle } /* STTD_METHOD_SPEECH_STATUS */ else if (dbus_message_is_signal(msg, "org.freedesktop.DBus", "NameOwnerChanged")) { + //LCOV_EXCL_START SLOG(LOG_DEBUG, TAG_STTC, "===== Owner Changed"); DBusError err; dbus_error_init(&err); @@ -633,6 +635,7 @@ static Eina_Bool listener_event_callback(void* data, Ecore_Fd_Handler *fd_handle __stt_cb_error(-1, STT_ERROR_SERVICE_RESET, "Daemon Reset"); SLOG(LOG_DEBUG, TAG_STTC, "====="); SLOG(LOG_DEBUG, TAG_STTC, " "); + //LCOV_EXCL_STOP } /* NameOwnerChanged */ else { @@ -665,7 +668,7 @@ static void __stt_dbus_connection_free() int stt_dbus_open_connection() { if (NULL != g_conn_sender && NULL != g_conn_listener) { - SLOG(LOG_WARN, TAG_STTC, "already existed connection "); + SLOG(LOG_WARN, TAG_STTC, "already existed connection "); //LCOV_EXCL_LINE return 0; } @@ -678,13 +681,15 @@ int stt_dbus_open_connection() if (NULL == g_conn_sender) { g_conn_sender = dbus_bus_get_private(DBUS_BUS_SESSION, &err); if (dbus_error_is_set(&err)) { + //LCOV_EXCL_START SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Dbus Connection Error (%s)", err.message); dbus_error_free(&err); + //LCOV_EXCL_STOP } } if (NULL == g_conn_sender) { - SLOG(LOG_ERROR, TAG_STTC, "[ERROR] fail to get dbus connection"); + SLOG(LOG_ERROR, TAG_STTC, "[ERROR] fail to get dbus connection"); //LCOV_EXCL_LINE return STT_ERROR_OPERATION_FAILED; } @@ -707,8 +712,6 @@ int stt_dbus_open_connection() dbus_connection_set_exit_on_disconnect(g_conn_listener, false); - dbus_connection_set_exit_on_disconnect(g_conn_listener, false); - int pid = getpid(); char service_name[64]; @@ -721,8 +724,10 @@ int stt_dbus_open_connection() dbus_bus_request_name(g_conn_listener, service_name, DBUS_NAME_FLAG_REPLACE_EXISTING , &err); if (dbus_error_is_set(&err)) { + //LCOV_EXCL_START SLOG(LOG_ERROR, TAG_STTC, "Name Error (%s)", err.message); dbus_error_free(&err); + //LCOV_EXCL_STOP } char rule[128] = {0, }; @@ -733,26 +738,32 @@ int stt_dbus_open_connection() dbus_connection_flush(g_conn_listener); if (dbus_error_is_set(&err)) { + //LCOV_EXCL_START SLOG(LOG_ERROR, TAG_STTC, "Match Error (%s)", err.message); dbus_error_free(&err); __stt_dbus_connection_free(); return STT_ERROR_OPERATION_FAILED; + //LCOV_EXCL_STOP } int fd = 0; if (true != dbus_connection_get_unix_fd(g_conn_listener, &fd)) { + //LCOV_EXCL_START SLOG(LOG_ERROR, TAG_STTC, "Fail to get fd from dbus"); __stt_dbus_connection_free(); return STT_ERROR_OPERATION_FAILED; + //LCOV_EXCL_STOP } else { SLOG(LOG_DEBUG, TAG_STTC, "Get fd from dbus : %d", fd); } g_fd_handler = ecore_main_fd_handler_add(fd, ECORE_FD_READ, (Ecore_Fd_Cb)listener_event_callback, g_conn_listener, NULL, NULL); if (NULL == g_fd_handler) { + //LCOV_EXCL_START SLOG(LOG_ERROR, TAG_STTC, "fail to get fd handler from ecore"); __stt_dbus_connection_free(); return STT_ERROR_OPERATION_FAILED; + //LCOV_EXCL_STOP } return 0; @@ -777,8 +788,10 @@ int stt_dbus_close_connection() dbus_bus_release_name(g_conn_listener, service_name, &err); if (dbus_error_is_set(&err)) { + //LCOV_EXCL_START SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Release name Error (%s)", err.message); dbus_error_free(&err); + //LCOV_EXCL_STOP } } @@ -858,7 +871,7 @@ int stt_dbus_request_hello(int uid) /* Default engine */ g_server_service_name = strdup(STT_SERVER_SERVICE_NAME); if (NULL == g_server_service_name) { - SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Fail to allocate memory"); + SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Fail to allocate memory"); //LCOV_EXCL_LINE return STT_ERROR_OUT_OF_MEMORY; } g_server_service_object = strdup(STT_SERVER_SERVICE_OBJECT_PATH); @@ -879,32 +892,32 @@ int stt_dbus_request_hello(int uid) STT_METHOD_HELLO); } else { /* Get service name, object, interface */ - SLOG(LOG_DEBUG, TAG_STTC, "[DBUS] current_engine_id: %s", client->current_engine_id); + SLOG(LOG_DEBUG, TAG_STTC, "[DBUS] current_engine_id: %s", client->current_engine_id); //LCOV_EXCL_LINE g_server_service_name = __stt_get_service_name(client->current_engine_id); g_server_service_object = __stt_get_service_object(client->current_engine_id); g_server_service_interface = __stt_get_service_interface(client->current_engine_id); if (NULL == g_server_service_name || NULL == g_server_service_object || NULL == g_server_service_interface) { - SLOG(LOG_ERROR, TAG_STTC, "[ERROR] dbus service info invalid"); + SLOG(LOG_ERROR, TAG_STTC, "[ERROR] dbus service info invalid"); //LCOV_EXCL_LINE return STT_ERROR_OPERATION_FAILED; } - SLOG(LOG_DEBUG, TAG_STTC, "[DBUS] service name: %s, object path: %s, interface: %s", g_server_service_name, g_server_service_object, g_server_service_interface); + SLOG(LOG_DEBUG, TAG_STTC, "[DBUS] service name: %s, object path: %s, interface: %s", g_server_service_name, g_server_service_object, g_server_service_interface); //LCOV_EXCL_LINE /* Custom engine */ is_exist = dbus_bus_name_has_owner(g_conn_sender, g_server_service_name, &err); - SLOG(LOG_DEBUG, TAG_STTC, "[DBUS] is there dbus name has owner??: %s (g_server_service_name: %s)", (is_exist == TRUE) ? "True" : "False", g_server_service_name); + SLOG(LOG_DEBUG, TAG_STTC, "[DBUS] is there dbus name has owner??: %s (g_server_service_name: %s)", (is_exist == TRUE) ? "True" : "False", g_server_service_name); //LCOV_EXCL_LINE if (TRUE == is_exist) { - SLOG(LOG_DEBUG, TAG_STTC, "[DBUS] dbus: is_exist: True"); + SLOG(LOG_DEBUG, TAG_STTC, "[DBUS] dbus: is_exist: True"); //LCOV_EXCL_LINE msg = dbus_message_new_method_call( g_server_service_name, g_server_service_object, g_server_service_interface, STT_METHOD_HELLO); } else { - SLOG(LOG_DEBUG, TAG_STTC, "[DBUS] dbus: is_exist: False"); + SLOG(LOG_DEBUG, TAG_STTC, "[DBUS] dbus: is_exist: False"); //LCOV_EXCL_LINE msg = dbus_message_new_method_call( STT_SERVER_CUSTOM_SERVICE_NAME, STT_SERVER_CUSTOM_SERVICE_OBJECT_PATH, @@ -934,21 +947,25 @@ int stt_dbus_request_hello(int uid) dbus_message_unref(result_msg); if (dbus_error_is_set(&err)) { + //LCOV_EXCL_START SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Get arguments error (%s)", err.message); dbus_error_free(&err); + //LCOV_EXCL_STOP } SLOG(LOG_DEBUG, TAG_STTC, "<<<< stt hello"); } else { if (dbus_error_is_set(&err)) { + //LCOV_EXCL_START SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Get arguments error (%s)", err.message); dbus_error_free(&err); + //LCOV_EXCL_STOP } result = STT_ERROR_TIMED_OUT; } } else { - SLOG(LOG_WARN, TAG_STTC, "[WARN] dbus connection handle is null (%p)", g_conn_sender); + SLOG(LOG_WARN, TAG_STTC, "[WARN] dbus connection handle is null (%p)", g_conn_sender); //LCOV_EXCL_LINE stt_dbus_reconnect(); result = STT_ERROR_OPERATION_FAILED; } @@ -968,7 +985,7 @@ int stt_dbus_request_initialize(int uid, bool* silence_supported, bool* credenti STT_METHOD_INITIALIZE); if (NULL == msg) { - SLOG(LOG_ERROR, TAG_STTC, ">>>> stt initialize : Fail to make message"); + SLOG(LOG_ERROR, TAG_STTC, ">>>> stt initialize : Fail to make message"); //LCOV_EXCL_LINE return STT_ERROR_OPERATION_FAILED; } else { SLOG(LOG_DEBUG, TAG_STTC, ">>>> stt initialize : uid(%d)", uid); @@ -990,8 +1007,10 @@ int stt_dbus_request_initialize(int uid, bool* silence_supported, bool* credenti result_msg = dbus_connection_send_with_reply_and_block(g_conn_sender, msg, g_waiting_time, &err); dbus_message_unref(msg); if (dbus_error_is_set(&err)) { + //LCOV_EXCL_START SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Send Error (%s)", err.message); dbus_error_free(&err); + //LCOV_EXCL_STOP } if (NULL != result_msg) { @@ -1007,9 +1026,11 @@ int stt_dbus_request_initialize(int uid, bool* silence_supported, bool* credenti *credential_needed = (bool)(int_credential_needed); if (dbus_error_is_set(&err)) { + //LCOV_EXCL_START SLOG(LOG_ERROR, TAG_STTC, "<<<< Get arguments error (%s)", err.message); dbus_error_free(&err); result = STT_ERROR_OPERATION_FAILED; + //LCOV_EXCL_STOP } if (0 == result) { @@ -1037,17 +1058,17 @@ int stt_dbus_request_initialize(int uid, bool* silence_supported, bool* credenti } } } else { - SLOG(LOG_ERROR, TAG_STTC, "<<<< stt initialize : result = %d", result); + SLOG(LOG_ERROR, TAG_STTC, "<<<< stt initialize : result = %d", result); //LCOV_EXCL_LINE } dbus_message_unref(result_msg); } else { - SLOG(LOG_ERROR, TAG_STTC, "<<<< Result message is NULL"); + SLOG(LOG_ERROR, TAG_STTC, "<<<< Result message is NULL"); //LCOV_EXCL_LINE stt_dbus_reconnect(); result = STT_ERROR_TIMED_OUT; } } else { - SLOG(LOG_WARN, TAG_STTC, "[WARN] dbus connection handle is null (%p)", g_conn_sender); + SLOG(LOG_WARN, TAG_STTC, "[WARN] dbus connection handle is null (%p)", g_conn_sender); //LCOV_EXCL_LINE result = STT_ERROR_OPERATION_FAILED; } @@ -1067,8 +1088,10 @@ int stt_dbus_request_finalize(int uid) dbus_bus_remove_match(g_conn_listener, rule_err, &err); dbus_connection_flush(g_conn_listener); if (dbus_error_is_set(&err)) { + //LCOV_EXCL_START SLOG(LOG_ERROR, TAG_STTC, "Match Error (%s)", err.message); dbus_error_free(&err); + //LCOV_EXCL_STOP } SLOG(LOG_DEBUG, TAG_STTC, "[dbus_info] service name: %s, service object: %s, service interface: %s", g_server_service_name, g_server_service_object, g_server_service_interface); @@ -1080,7 +1103,7 @@ int stt_dbus_request_finalize(int uid) STT_METHOD_FINALIZE); if (NULL == msg) { - SLOG(LOG_ERROR, TAG_STTC, ">>>> stt finalize : Fail to make message"); + SLOG(LOG_ERROR, TAG_STTC, ">>>> stt finalize : Fail to make message"); //LCOV_EXCL_LINE return STT_ERROR_OPERATION_FAILED; } else { SLOG(LOG_DEBUG, TAG_STTC, ">>>> stt finalize : uid(%d)", uid); @@ -1094,8 +1117,10 @@ int stt_dbus_request_finalize(int uid) result_msg = dbus_connection_send_with_reply_and_block(g_conn_sender, msg, g_waiting_short_time, &err); dbus_message_unref(msg); if (dbus_error_is_set(&err)) { + //LCOV_EXCL_START SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Send Error (%s)", err.message); dbus_error_free(&err); + //LCOV_EXCL_STOP } if (NULL != result_msg) { @@ -1104,9 +1129,11 @@ int stt_dbus_request_finalize(int uid) DBUS_TYPE_INVALID); if (dbus_error_is_set(&err)) { + //LCOV_EXCL_START SLOG(LOG_ERROR, TAG_STTC, "<<<< Get arguments error (%s)", err.message); dbus_error_free(&err); result = STT_ERROR_OPERATION_FAILED; + //LCOV_EXCL_STOP } dbus_message_unref(result_msg); @@ -1114,10 +1141,10 @@ int stt_dbus_request_finalize(int uid) if (0 == result) { SLOG(LOG_DEBUG, TAG_STTC, "<<<< stt finalize : result = %d", result); } else { - SLOG(LOG_ERROR, TAG_STTC, "<<<< stt finalize : result = %d", result); + SLOG(LOG_ERROR, TAG_STTC, "<<<< stt finalize : result = %d", result); //LCOV_EXCL_LINE } } else { - SLOG(LOG_ERROR, TAG_STTC, "<<<< Result message is NULL"); + SLOG(LOG_ERROR, TAG_STTC, "<<<< Result message is NULL"); //LCOV_EXCL_LINE stt_dbus_reconnect(); result = STT_ERROR_TIMED_OUT; } @@ -1125,6 +1152,7 @@ int stt_dbus_request_finalize(int uid) return result; } +//LCOV_EXCL_START int stt_dbus_request_set_current_engine(int uid, const char* engine_id, bool* silence_supported, bool* credential_needed) { DBusMessage* msg; @@ -1418,11 +1446,12 @@ int stt_dbus_request_get_default_lang(int uid, char** language) return result; } +//LCOV_EXCL_STOP int stt_dbus_request_set_private_data(int uid, const char* key, const char* data) { if (NULL == key || NULL == data) { - SLOG(LOG_ERROR, TAG_STTC, "Input parameter is NULL"); + SLOG(LOG_ERROR, TAG_STTC, "Input parameter is NULL"); //LCOV_EXCL_LINE return STT_ERROR_INVALID_PARAMETER; } @@ -1435,7 +1464,7 @@ int stt_dbus_request_set_private_data(int uid, const char* key, const char* data STT_METHOD_SET_PRIVATE_DATA); if (NULL == msg) { - SLOG(LOG_ERROR, TAG_STTC, ">>>> stt set private data : Fail to make message"); + SLOG(LOG_ERROR, TAG_STTC, ">>>> stt set private data : Fail to make message"); //LCOV_EXCL_LINE return STT_ERROR_OPERATION_FAILED; } else { SLOG(LOG_DEBUG, TAG_STTC, ">>>> stt set private data : uid(%d)", uid); @@ -1446,7 +1475,7 @@ int stt_dbus_request_set_private_data(int uid, const char* key, const char* data DBUS_TYPE_STRING, &key, DBUS_TYPE_STRING, &data, DBUS_TYPE_INVALID)) { - SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Fail to append args"); + SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Fail to append args"); //LCOV_EXCL_LINE return STT_ERROR_OPERATION_FAILED; } @@ -1459,8 +1488,10 @@ int stt_dbus_request_set_private_data(int uid, const char* key, const char* data result_msg = dbus_connection_send_with_reply_and_block(g_conn_sender, msg, g_waiting_time, &err); dbus_message_unref(msg); if (dbus_error_is_set(&err)) { + //LCOV_EXCL_START SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Send Error (%s)", err.message); dbus_error_free(&err); + //LCOV_EXCL_STOP } if (NULL != result_msg) { @@ -1469,19 +1500,21 @@ int stt_dbus_request_set_private_data(int uid, const char* key, const char* data DBUS_TYPE_INVALID); if (dbus_error_is_set(&err)) { + //LCOV_EXCL_START SLOG(LOG_ERROR, TAG_STTC, "<<<< Get arguments error (%s)", err.message); dbus_error_free(&err); result = STT_ERROR_OPERATION_FAILED; + //LCOV_EXCL_STOP } dbus_message_unref(result_msg); if (0 == result) { SLOG(LOG_DEBUG, TAG_STTC, "<<<< stt set private data : result = %d", result); } else { - SLOG(LOG_ERROR, TAG_STTC, "<<<< stt set private data : result = %d", result); + SLOG(LOG_ERROR, TAG_STTC, "<<<< stt set private data : result = %d", result); //LCOV_EXCL_LINE } } else { - SLOG(LOG_ERROR, TAG_STTC, "<<<< Result message is NULL"); + SLOG(LOG_ERROR, TAG_STTC, "<<<< Result message is NULL"); //LCOV_EXCL_LINE stt_dbus_reconnect(); result = STT_ERROR_TIMED_OUT; } @@ -1492,7 +1525,7 @@ int stt_dbus_request_set_private_data(int uid, const char* key, const char* data int stt_dbus_request_get_private_data(int uid, const char* key, char** data) { if (NULL == key || NULL == data) { - SLOG(LOG_ERROR, TAG_STTC, "Input parameter is NULL"); + SLOG(LOG_ERROR, TAG_STTC, "Input parameter is NULL"); //LCOV_EXCL_LINE return STT_ERROR_INVALID_PARAMETER; } @@ -1505,7 +1538,7 @@ int stt_dbus_request_get_private_data(int uid, const char* key, char** data) STT_METHOD_GET_PRIVATE_DATA); if (NULL == msg) { - SLOG(LOG_ERROR, TAG_STTC, ">>>> stt get private data : Fail to make message"); + SLOG(LOG_ERROR, TAG_STTC, ">>>> stt get private data : Fail to make message"); //LCOV_EXCL_LINE return STT_ERROR_OPERATION_FAILED; } else { SLOG(LOG_DEBUG, TAG_STTC, ">>>> stt get private data : uid(%d)", uid); @@ -1515,7 +1548,7 @@ int stt_dbus_request_get_private_data(int uid, const char* key, char** data) DBUS_TYPE_INT32, &uid, DBUS_TYPE_STRING, &key, DBUS_TYPE_INVALID)) { - SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Fail to append args"); + SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Fail to append args"); //LCOV_EXCL_LINE return STT_ERROR_OPERATION_FAILED; } @@ -1528,8 +1561,10 @@ int stt_dbus_request_get_private_data(int uid, const char* key, char** data) result_msg = dbus_connection_send_with_reply_and_block(g_conn_sender, msg, g_waiting_time, &err); dbus_message_unref(msg); if (dbus_error_is_set(&err)) { + //LCOV_EXCL_START SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Send Error (%s)", err.message); dbus_error_free(&err); + //LCOV_EXCL_STOP } char* temp = NULL; @@ -1540,9 +1575,11 @@ int stt_dbus_request_get_private_data(int uid, const char* key, char** data) DBUS_TYPE_INVALID); if (dbus_error_is_set(&err)) { + //LCOV_EXCL_START SLOG(LOG_ERROR, TAG_STTC, "<<<< Get arguments error (%s)", err.message); dbus_error_free(&err); result = STT_ERROR_OPERATION_FAILED; + //LCOV_EXCL_STOP } dbus_message_unref(result_msg); @@ -1552,10 +1589,10 @@ int stt_dbus_request_get_private_data(int uid, const char* key, char** data) *data = strdup(temp); } } else { - SLOG(LOG_ERROR, TAG_STTC, "<<<< stt get private data : result = %d", result); + SLOG(LOG_ERROR, TAG_STTC, "<<<< stt get private data : result = %d", result); //LCOV_EXCL_LINE } } else { - SLOG(LOG_ERROR, TAG_STTC, "<<<< Result message is NULL"); + SLOG(LOG_ERROR, TAG_STTC, "<<<< Result message is NULL"); //LCOV_EXCL_LINE stt_dbus_reconnect(); result = STT_ERROR_TIMED_OUT; } @@ -1568,7 +1605,7 @@ int stt_dbus_request_get_private_data(int uid, const char* key, char** data) int stt_dbus_request_is_recognition_type_supported(int uid, const char* type, bool* support) { if (NULL == support || NULL == type) { - SLOG(LOG_ERROR, TAG_STTC, "Input parameter is NULL"); + SLOG(LOG_ERROR, TAG_STTC, "Input parameter is NULL"); //LCOV_EXCL_LINE return STT_ERROR_INVALID_PARAMETER; } @@ -1581,7 +1618,7 @@ int stt_dbus_request_is_recognition_type_supported(int uid, const char* type, bo STT_METHOD_IS_TYPE_SUPPORTED); if (NULL == msg) { - SLOG(LOG_ERROR, TAG_STTC, ">>>> stt is partial result supported : Fail to make message"); + SLOG(LOG_ERROR, TAG_STTC, ">>>> stt is partial result supported : Fail to make message"); //LCOV_EXCL_LINE return STT_ERROR_OPERATION_FAILED; } else { SLOG(LOG_DEBUG, TAG_STTC, ">>>> stt is recognition type supported : uid(%d) type(%s)", uid, type); @@ -1602,8 +1639,10 @@ int stt_dbus_request_is_recognition_type_supported(int uid, const char* type, bo result_msg = dbus_connection_send_with_reply_and_block(g_conn_sender, msg, g_waiting_time, &err); dbus_message_unref(msg); if (dbus_error_is_set(&err)) { + //LCOV_EXCL_START SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Send Error (%s)", err.message); dbus_error_free(&err); + //LCOV_EXCL_STOP } if (NULL != result_msg) { @@ -1613,9 +1652,11 @@ int stt_dbus_request_is_recognition_type_supported(int uid, const char* type, bo DBUS_TYPE_INVALID); if (dbus_error_is_set(&err)) { + //LCOV_EXCL_START SLOG(LOG_ERROR, TAG_STTC, "<<<< Get arguments error (%s)", err.message); dbus_error_free(&err); result = STT_ERROR_OPERATION_FAILED; + //LCOV_EXCL_STOP } dbus_message_unref(result_msg); @@ -1623,10 +1664,10 @@ int stt_dbus_request_is_recognition_type_supported(int uid, const char* type, bo *support = (bool)result_support; SLOG(LOG_DEBUG, TAG_STTC, "<<<< stt is recognition type supported : result = %d, support = %s", result, *support ? "true" : "false"); } else { - SLOG(LOG_ERROR, TAG_STTC, "<<<< stt is recognition type supported : result = %d", result); + SLOG(LOG_ERROR, TAG_STTC, "<<<< stt is recognition type supported : result = %d", result); //LCOV_EXCL_LINE } } else { - SLOG(LOG_ERROR, TAG_STTC, "<<<< Result message is NULL"); + SLOG(LOG_ERROR, TAG_STTC, "<<<< Result message is NULL"); //LCOV_EXCL_LINE stt_dbus_reconnect(); result = STT_ERROR_TIMED_OUT; } @@ -1637,7 +1678,7 @@ int stt_dbus_request_is_recognition_type_supported(int uid, const char* type, bo int stt_dbus_request_set_start_sound(int uid, const char* file) { if (NULL == file) { - SLOG(LOG_ERROR, TAG_STTC, "Input parameter is NULL"); + SLOG(LOG_ERROR, TAG_STTC, "Input parameter is NULL"); //LCOV_EXCL_LINE return STT_ERROR_INVALID_PARAMETER; } @@ -1650,7 +1691,7 @@ int stt_dbus_request_set_start_sound(int uid, const char* file) STT_METHOD_SET_START_SOUND); if (NULL == msg) { - SLOG(LOG_ERROR, TAG_STTC, ">>>> stt set start sound : Fail to make message"); + SLOG(LOG_ERROR, TAG_STTC, ">>>> stt set start sound : Fail to make message"); //LCOV_EXCL_LINE return STT_ERROR_OPERATION_FAILED; } else { SLOG(LOG_DEBUG, TAG_STTC, ">>>> stt set start sound : uid(%d) file(%s)", uid, file); @@ -1670,8 +1711,10 @@ int stt_dbus_request_set_start_sound(int uid, const char* file) result_msg = dbus_connection_send_with_reply_and_block(g_conn_sender, msg, g_waiting_time, &err); dbus_message_unref(msg); if (dbus_error_is_set(&err)) { + //LCOV_EXCL_START SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Send Error (%s)", err.message); dbus_error_free(&err); + //LCOV_EXCL_STOP } if (NULL != result_msg) { @@ -1680,19 +1723,21 @@ int stt_dbus_request_set_start_sound(int uid, const char* file) DBUS_TYPE_INVALID); if (dbus_error_is_set(&err)) { + //LCOV_EXCL_START SLOG(LOG_ERROR, TAG_STTC, "<<<< Get arguments error (%s)", err.message); dbus_error_free(&err); result = STT_ERROR_OPERATION_FAILED; + //LCOV_EXCL_STOP } dbus_message_unref(result_msg); if (0 == result) { SLOG(LOG_DEBUG, TAG_STTC, "<<<< stt set start sound : result = %d", result); } else { - SLOG(LOG_ERROR, TAG_STTC, "<<<< stt set start sound : result = %d", result); + SLOG(LOG_ERROR, TAG_STTC, "<<<< stt set start sound : result = %d", result); //LCOV_EXCL_LINE } } else { - SLOG(LOG_ERROR, TAG_STTC, "<<<< Result message is NULL"); + SLOG(LOG_ERROR, TAG_STTC, "<<<< Result message is NULL"); //LCOV_EXCL_LINE stt_dbus_reconnect(); result = STT_ERROR_TIMED_OUT; } @@ -1711,7 +1756,7 @@ int stt_dbus_request_unset_start_sound(int uid) STT_METHOD_UNSET_START_SOUND); if (NULL == msg) { - SLOG(LOG_ERROR, TAG_STTC, ">>>> stt unset start sound : Fail to make message"); + SLOG(LOG_ERROR, TAG_STTC, ">>>> stt unset start sound : Fail to make message"); //LCOV_EXCL_LINE return STT_ERROR_OPERATION_FAILED; } else { SLOG(LOG_DEBUG, TAG_STTC, ">>>> stt unset start sound : uid(%d)", uid); @@ -1730,8 +1775,10 @@ int stt_dbus_request_unset_start_sound(int uid) result_msg = dbus_connection_send_with_reply_and_block(g_conn_sender, msg, g_waiting_time, &err); dbus_message_unref(msg); if (dbus_error_is_set(&err)) { + //LCOV_EXCL_START SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Send Error (%s)", err.message); dbus_error_free(&err); + //LCOV_EXCL_STOP } if (NULL != result_msg) { @@ -1740,19 +1787,21 @@ int stt_dbus_request_unset_start_sound(int uid) DBUS_TYPE_INVALID); if (dbus_error_is_set(&err)) { + //LCOV_EXCL_START SLOG(LOG_ERROR, TAG_STTC, "<<<< Get arguments error (%s)", err.message); dbus_error_free(&err); result = STT_ERROR_OPERATION_FAILED; + //LCOV_EXCL_STOP } dbus_message_unref(result_msg); if (0 == result) { SLOG(LOG_DEBUG, TAG_STTC, "<<<< stt unset start sound : result = %d", result); } else { - SLOG(LOG_ERROR, TAG_STTC, "<<<< stt unset start sound : result = %d", result); + SLOG(LOG_ERROR, TAG_STTC, "<<<< stt unset start sound : result = %d", result); //LCOV_EXCL_LINE } } else { - SLOG(LOG_ERROR, TAG_STTC, "<<<< Result message is NULL"); + SLOG(LOG_ERROR, TAG_STTC, "<<<< Result message is NULL"); //LCOV_EXCL_LINE stt_dbus_reconnect(); result = STT_ERROR_TIMED_OUT; } @@ -1763,7 +1812,7 @@ int stt_dbus_request_unset_start_sound(int uid) int stt_dbus_request_set_stop_sound(int uid, const char* file) { if (NULL == file) { - SLOG(LOG_ERROR, TAG_STTC, "Input parameter is NULL"); + SLOG(LOG_ERROR, TAG_STTC, "Input parameter is NULL"); //LCOV_EXCL_LINE return STT_ERROR_INVALID_PARAMETER; } @@ -1776,7 +1825,7 @@ int stt_dbus_request_set_stop_sound(int uid, const char* file) STT_METHOD_SET_STOP_SOUND); if (NULL == msg) { - SLOG(LOG_ERROR, TAG_STTC, ">>>> stt set stop sound : Fail to make message"); + SLOG(LOG_ERROR, TAG_STTC, ">>>> stt set stop sound : Fail to make message"); //LCOV_EXCL_LINE return STT_ERROR_OPERATION_FAILED; } else { SLOG(LOG_DEBUG, TAG_STTC, ">>>> stt set stop sound : uid(%d) file(%s)", uid, file); @@ -1796,8 +1845,10 @@ int stt_dbus_request_set_stop_sound(int uid, const char* file) result_msg = dbus_connection_send_with_reply_and_block(g_conn_sender, msg, g_waiting_time, &err); dbus_message_unref(msg); if (dbus_error_is_set(&err)) { + //LCOV_EXCL_START SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Send Error (%s)", err.message); dbus_error_free(&err); + //LCOV_EXCL_STOP } if (NULL != result_msg) { @@ -1806,19 +1857,21 @@ int stt_dbus_request_set_stop_sound(int uid, const char* file) DBUS_TYPE_INVALID); if (dbus_error_is_set(&err)) { + //LCOV_EXCL_START SLOG(LOG_ERROR, TAG_STTC, "<<<< Get arguments error (%s)", err.message); dbus_error_free(&err); result = STT_ERROR_OPERATION_FAILED; + //LCOV_EXCL_STOP } dbus_message_unref(result_msg); if (0 == result) { SLOG(LOG_DEBUG, TAG_STTC, "<<<< stt set stop sound : result = %d", result); } else { - SLOG(LOG_ERROR, TAG_STTC, "<<<< stt set stop sound : result = %d", result); + SLOG(LOG_ERROR, TAG_STTC, "<<<< stt set stop sound : result = %d", result); //LCOV_EXCL_LINE } } else { - SLOG(LOG_ERROR, TAG_STTC, "<<<< Result message is NULL"); + SLOG(LOG_ERROR, TAG_STTC, "<<<< Result message is NULL"); //LCOV_EXCL_LINE stt_dbus_reconnect(); result = STT_ERROR_TIMED_OUT; } @@ -1837,7 +1890,7 @@ int stt_dbus_request_unset_stop_sound(int uid) STT_METHOD_UNSET_STOP_SOUND); if (NULL == msg) { - SLOG(LOG_ERROR, TAG_STTC, ">>>> stt unset stop sound : Fail to make message"); + SLOG(LOG_ERROR, TAG_STTC, ">>>> stt unset stop sound : Fail to make message"); //LCOV_EXCL_LINE return STT_ERROR_OPERATION_FAILED; } else { SLOG(LOG_DEBUG, TAG_STTC, ">>>> stt unset stop sound : uid(%d)", uid); @@ -1856,8 +1909,10 @@ int stt_dbus_request_unset_stop_sound(int uid) result_msg = dbus_connection_send_with_reply_and_block(g_conn_sender, msg, g_waiting_time, &err); dbus_message_unref(msg); if (dbus_error_is_set(&err)) { + //LCOV_EXCL_START SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Send Error (%s)", err.message); dbus_error_free(&err); + //LCOV_EXCL_STOP } if (NULL != result_msg) { @@ -1866,19 +1921,21 @@ int stt_dbus_request_unset_stop_sound(int uid) DBUS_TYPE_INVALID); if (dbus_error_is_set(&err)) { + //LCOV_EXCL_START SLOG(LOG_ERROR, TAG_STTC, "<<<< Get arguments error (%s)", err.message); dbus_error_free(&err); result = STT_ERROR_OPERATION_FAILED; + //LCOV_EXCL_STOP } dbus_message_unref(result_msg); if (0 == result) { SLOG(LOG_DEBUG, TAG_STTC, "<<<< stt unset stop sound : result = %d", result); } else { - SLOG(LOG_ERROR, TAG_STTC, "<<<< stt unset stop sound : result = %d", result); + SLOG(LOG_ERROR, TAG_STTC, "<<<< stt unset stop sound : result = %d", result); //LCOV_EXCL_LINE } } else { - SLOG(LOG_ERROR, TAG_STTC, "<<<< Result message is NULL"); + SLOG(LOG_ERROR, TAG_STTC, "<<<< Result message is NULL"); //LCOV_EXCL_LINE stt_dbus_reconnect(); result = STT_ERROR_TIMED_OUT; } @@ -1889,7 +1946,7 @@ int stt_dbus_request_unset_stop_sound(int uid) int stt_dbus_request_start(int uid, const char* lang, const char* type, int silence, const char* appid, const char* credential) { if (NULL == lang || NULL == type || NULL == appid) { - SLOG(LOG_ERROR, TAG_STTC, "Input parameter is NULL"); + SLOG(LOG_ERROR, TAG_STTC, "Input parameter is NULL"); //LCOV_EXCL_LINE return STT_ERROR_INVALID_PARAMETER; } @@ -1903,7 +1960,7 @@ int stt_dbus_request_start(int uid, const char* lang, const char* type, int sile STT_METHOD_START); if (NULL == msg) { - SLOG(LOG_ERROR, TAG_STTC, ">>>> stt start : Fail to make message"); + SLOG(LOG_ERROR, TAG_STTC, ">>>> stt start : Fail to make message"); //LCOV_EXCL_LINE return STT_ERROR_OPERATION_FAILED; } else { SLOG(LOG_DEBUG, TAG_STTC, ">>>> stt start : uid(%d), language(%s), type(%s)", uid, lang, type); @@ -1929,12 +1986,14 @@ int stt_dbus_request_start(int uid, const char* lang, const char* type, int sile dbus_message_set_no_reply(msg, TRUE); if (!dbus_connection_send(g_conn_sender, msg, NULL)) { + //LCOV_EXCL_START SLOG(LOG_ERROR, TAG_STTC, "[Dbus ERROR] <<<< stt start message : Out Of Memory !"); if (NULL != temp) { free(temp); temp = NULL; } return STT_ERROR_OUT_OF_MEMORY; + //LCOV_EXCL_STOP } else { dbus_connection_flush(g_conn_sender); } @@ -1942,7 +2001,7 @@ int stt_dbus_request_start(int uid, const char* lang, const char* type, int sile dbus_message_unref(msg); } else { - SLOG(LOG_WARN, TAG_STTC, "[WARN] dbus connection handle is null (%p)", g_conn_sender); + SLOG(LOG_WARN, TAG_STTC, "[WARN] dbus connection handle is null (%p)", g_conn_sender); //LCOV_EXCL_LINE if (NULL != temp) { free(temp); temp = NULL; @@ -2008,7 +2067,7 @@ int stt_dbus_request_stop(int uid) STT_METHOD_STOP); if (NULL == msg) { - SLOG(LOG_ERROR, TAG_STTC, ">>>> stt stop : Fail to make message"); + SLOG(LOG_ERROR, TAG_STTC, ">>>> stt stop : Fail to make message"); //LCOV_EXCL_LINE return STT_ERROR_OPERATION_FAILED; } else { SLOG(LOG_DEBUG, TAG_STTC, ">>>> stt stop : uid(%d)", uid); @@ -2022,8 +2081,10 @@ int stt_dbus_request_stop(int uid) dbus_message_set_no_reply(msg, TRUE); if (!dbus_connection_send(g_conn_sender, msg, NULL)) { + //LCOV_EXCL_START SLOG(LOG_ERROR, TAG_STTC, "[Dbus ERROR] <<<< stt stop message : Out Of Memory !"); return STT_ERROR_OUT_OF_MEMORY; + //LCOV_EXCL_STOP } else { dbus_connection_flush(g_conn_sender); } @@ -2088,7 +2149,7 @@ int stt_dbus_request_cancel(int uid) STT_METHOD_CANCEL); if (NULL == msg) { - SLOG(LOG_ERROR, TAG_STTC, ">>>> stt cancel : Fail to make message"); + SLOG(LOG_ERROR, TAG_STTC, ">>>> stt cancel : Fail to make message"); //LCOV_EXCL_LINE return STT_ERROR_OPERATION_FAILED; } else { SLOG(LOG_DEBUG, TAG_STTC, ">>>> stt cancel : uid(%d)", uid); @@ -2102,8 +2163,10 @@ int stt_dbus_request_cancel(int uid) dbus_message_set_no_reply(msg, TRUE); if (!dbus_connection_send(g_conn_sender, msg, NULL)) { + //LCOV_EXCL_START SLOG(LOG_ERROR, TAG_STTC, "[Dbus ERROR] <<<< stt stop message : Out Of Memory !"); return STT_ERROR_OUT_OF_MEMORY; + //LCOV_EXCL_STOP } else { dbus_connection_flush(g_conn_sender); } @@ -2156,6 +2219,7 @@ int stt_dbus_request_cancel(int uid) #endif } +//LCOV_EXCL_START int stt_dbus_request_start_file(int uid, const char* lang, const char* type, int silence, const char* appid, const char* credential, const char* filepath, stt_audio_type_e audio_type, int sample_rate) { if (NULL == lang || NULL == type || NULL == appid) { @@ -2269,4 +2333,4 @@ int stt_dbus_request_cancel_file(int uid) return 0; } - +//LCOV_EXCL_STOP diff --git a/common/stt_config_mgr.c b/common/stt_config_mgr.c old mode 100755 new mode 100644 index bdd5f9c..4205bad --- a/common/stt_config_mgr.c +++ b/common/stt_config_mgr.c @@ -166,10 +166,10 @@ Eina_Bool stt_config_mgr_inotify_event_cb(void* data, Ecore_Fd_Handler *fd_handl length = read(g_fd_noti, &event, sizeof(struct inotify_event)); if (0 > length) { - SLOG(LOG_ERROR, stt_tag(), "[ERROR] Empty Inotify event"); - SLOG(LOG_DEBUG, stt_tag(), "====="); - SLOG(LOG_DEBUG, stt_tag(), " "); - return ECORE_CALLBACK_PASS_ON; + SLOG(LOG_ERROR, stt_tag(), "[ERROR] Empty Inotify event"); //LCOV_EXCL_LINE + SLOG(LOG_DEBUG, stt_tag(), "====="); //LCOV_EXCL_LINE + SLOG(LOG_DEBUG, stt_tag(), " "); //LCOV_EXCL_LINE + return ECORE_CALLBACK_PASS_ON; //LCOV_EXCL_LINE } if (IN_MODIFY == event.mask) { @@ -283,7 +283,7 @@ Eina_Bool stt_config_mgr_inotify_event_cb(void* data, Ecore_Fd_Handler *fd_handl if (NULL != setting) free(setting); if (NULL != lang) free(lang); } else { - SLOG(LOG_ERROR, stt_tag(), "[ERROR] Undefined event"); + SLOG(LOG_ERROR, stt_tag(), "[ERROR] Undefined event"); //LCOV_EXCL_LINE } SLOG(LOG_DEBUG, stt_tag(), "====="); @@ -300,8 +300,8 @@ int __stt_config_mgr_register_config_event() fd = inotify_init(); if (fd < 0) { - SLOG(LOG_ERROR, stt_tag(), "[ERROR] Fail get inotify fd"); - return -1; + SLOG(LOG_ERROR, stt_tag(), "[ERROR] Fail get inotify fd"); //LCOV_EXCL_LINE + return -1; //LCOV_EXCL_LINE } g_fd_noti = fd; @@ -310,8 +310,8 @@ int __stt_config_mgr_register_config_event() g_fd_handler_noti = ecore_main_fd_handler_add(fd, ECORE_FD_READ, (Ecore_Fd_Cb)stt_config_mgr_inotify_event_cb, NULL, NULL, NULL); if (NULL == g_fd_handler_noti) { - SLOG(LOG_ERROR, stt_tag(), "[ERROR] Fail to get handler_noti"); - return -1; + SLOG(LOG_ERROR, stt_tag(), "[ERROR] Fail to get handler_noti"); //LCOV_EXCL_LINE + return -1; //LCOV_EXCL_LINE } return 0; @@ -334,7 +334,7 @@ int __stt_config_set_auto_language() value = vconf_get_str(VCONFKEY_LANGSET); if (NULL == value) { - SLOG(LOG_ERROR, stt_tag(), "[Config ERROR] Fail to get display language"); + SLOG(LOG_ERROR, stt_tag(), "[Config ERROR] Fail to get display language"); //LCOV_EXCL_LINE return -1; } @@ -343,13 +343,13 @@ int __stt_config_set_auto_language() /* Check current config info */ if (NULL == g_config_info) { - SLOG(LOG_ERROR, stt_tag(), "Current config info is NULL"); + SLOG(LOG_ERROR, stt_tag(), "Current config info is NULL"); //LCOV_EXCL_LINE return STT_CONFIG_ERROR_OPERATION_FAILED; } /* Check current language */ if (NULL == g_config_info->language) { - SLOG(LOG_ERROR, stt_tag(), "Current config language is NULL"); + SLOG(LOG_ERROR, stt_tag(), "Current config language is NULL"); //LCOV_EXCL_LINE return STT_CONFIG_ERROR_OPERATION_FAILED; } @@ -357,7 +357,7 @@ int __stt_config_set_auto_language() SLOG(LOG_DEBUG, stt_tag(), "[Config] Language is auto. STT language(%s) is same with display lang", g_config_info->language); return 0; } else { - SLOG(LOG_DEBUG, stt_tag(), "[Config] Display language : %s", candidate_lang); + SLOG(LOG_DEBUG, stt_tag(), "[Config] Display language : %s", candidate_lang); //LCOV_EXCL_LINE } if (true == __stt_config_mgr_check_lang_is_valid(g_config_info->engine_id, candidate_lang)) { @@ -513,7 +513,7 @@ void __stt_config_release_engine() int __stt_config_mgr_check_engine_is_valid(const char* engine_id) { if (NULL == engine_id) { - SLOG(LOG_ERROR, stt_tag(), "Input parameter is NULL"); + SLOG(LOG_ERROR, stt_tag(), "Input parameter is NULL"); //LCOV_EXCL_LINE return STT_CONFIG_ERROR_INVALID_PARAMETER; } @@ -521,7 +521,7 @@ int __stt_config_mgr_check_engine_is_valid(const char* engine_id) stt_engine_info_s *engine_info = NULL; if (0 >= g_slist_length(g_engine_list)) { - SLOG(LOG_ERROR, stt_tag(), "There is no engine!!"); + SLOG(LOG_ERROR, stt_tag(), "There is no engine!!"); //LCOV_EXCL_LINE return STT_CONFIG_ERROR_ENGINE_NOT_FOUND; } @@ -532,7 +532,7 @@ int __stt_config_mgr_check_engine_is_valid(const char* engine_id) engine_info = iter->data; if (NULL == engine_info) { - SLOG(LOG_ERROR, stt_tag(), "engine info is NULL"); + SLOG(LOG_ERROR, stt_tag(), "engine info is NULL"); //LCOV_EXCL_LINE return STT_CONFIG_ERROR_ENGINE_NOT_FOUND; } @@ -547,13 +547,13 @@ int __stt_config_mgr_check_engine_is_valid(const char* engine_id) /* Change default engine */ iter = g_slist_nth(g_engine_list, 0); if (NULL == iter) { - SLOG(LOG_ERROR, stt_tag(), "Operation failed - false engine"); + SLOG(LOG_ERROR, stt_tag(), "Operation failed - false engine"); //LCOV_EXCL_LINE return STT_CONFIG_ERROR_OPERATION_FAILED; } engine_info = iter->data; if (NULL == engine_info) { - SLOG(LOG_ERROR, stt_tag(), "[ERROR] Engine info is NULL"); + SLOG(LOG_ERROR, stt_tag(), "[ERROR] Engine info is NULL"); //LCOV_EXCL_LINE return STT_CONFIG_ERROR_ENGINE_NOT_FOUND; } @@ -580,7 +580,7 @@ int __stt_config_mgr_check_engine_is_valid(const char* engine_id) bool is_valid_lang = false; if (0 >= g_slist_length(engine_info->languages)) { - SLOG(LOG_ERROR, stt_tag(), "[ERROR] Empty supported language"); + SLOG(LOG_ERROR, stt_tag(), "[ERROR] Empty supported language"); //LCOV_EXCL_LINE return STT_CONFIG_ERROR_ENGINE_NOT_FOUND; } @@ -622,16 +622,18 @@ int __stt_config_mgr_check_engine_is_valid(const char* engine_id) g_config_info->silence_detection = false; } + //LCOV_EXCL_START SLOG(LOG_DEBUG, stt_tag(), "[Config] Engine changed"); SLOG(LOG_DEBUG, stt_tag(), " Engine : %s", g_config_info->engine_id); SLOG(LOG_DEBUG, stt_tag(), " Setting : %s", g_config_info->setting); SLOG(LOG_DEBUG, stt_tag(), " language : %s", g_config_info->language); SLOG(LOG_DEBUG, stt_tag(), " Silence detection : %s", g_config_info->silence_detection ? "on" : "off"); SLOG(LOG_DEBUG, stt_tag(), " Credential : %s", g_config_info->credential ? "true" : "false"); + //LCOV_EXCL_STOP if (0 != stt_parser_set_engine(g_config_info->engine_id, g_config_info->setting, g_config_info->language, g_config_info->silence_detection, g_config_info->credential)) { - SLOG(LOG_ERROR, stt_tag(), "Fail to save config"); + SLOG(LOG_ERROR, stt_tag(), "Fail to save config"); //LCOV_EXCL_LINE return STT_CONFIG_ERROR_OPERATION_FAILED; } @@ -644,7 +646,7 @@ static void __get_engine_list(const char* directory) struct dirent *dirp = NULL; if (NULL == directory) { - SLOG(LOG_ERROR, stt_tag(), "[Directory ERROR] Directory is NULL"); + SLOG(LOG_ERROR, stt_tag(), "[Directory ERROR] Directory is NULL"); //LCOV_EXCL_LINE return; } else { SLOG(LOG_DEBUG, stt_tag(), "[Directory DEBUG] Directory: %s", directory); @@ -669,7 +671,7 @@ static void __get_engine_list(const char* directory) if (NULL != filepath) { snprintf(filepath, filesize, "%s/%s", directory, dirp->d_name); } else { - SLOG(LOG_ERROR, stt_tag(), "[Config ERROR] Memory not enough!!"); + SLOG(LOG_ERROR, stt_tag(), "[Config ERROR] Memory not enough!!"); //LCOV_EXCL_LINE continue; } @@ -852,7 +854,7 @@ int stt_config_mgr_initialize(int uid) temp_client = (stt_config_client_s*)calloc(1, sizeof(stt_config_client_s)); if (NULL == temp_client) { - SLOG(LOG_ERROR, stt_tag(), "[ERROR] Fail to allocate memory"); + SLOG(LOG_ERROR, stt_tag(), "[ERROR] Fail to allocate memory"); //LCOV_EXCL_LINE return STT_CONFIG_ERROR_OUT_OF_MEMORY; } temp_client->uid = uid; @@ -893,7 +895,7 @@ int stt_config_mgr_finalize(int uid) } if (0 < g_slist_length(g_config_client_list)) { - SLOG(LOG_DEBUG, stt_tag(), "Client count (%d)", g_slist_length(g_config_client_list)); + SLOG(LOG_DEBUG, stt_tag(), "Client count (%d)", g_slist_length(g_config_client_list)); //LCOV_EXCL_LINE return STT_CONFIG_ERROR_NONE; } @@ -955,6 +957,7 @@ int stt_config_mgr_set_callback(int uid, stt_config_engine_changed_cb engine_cb, return STT_CONFIG_ERROR_NONE; } +//LCOV_EXCL_START int stt_config_mgr_unset_callback(int uid) { GSList *iter = NULL; @@ -980,6 +983,7 @@ int stt_config_mgr_unset_callback(int uid) return STT_CONFIG_ERROR_NONE; } +//LCOV_EXCL_STOP int stt_config_mgr_get_engine_list(stt_config_supported_engine_cb callback, void* user_data) { @@ -1025,7 +1029,7 @@ int stt_config_mgr_get_engine_list(stt_config_supported_engine_cb callback, void int stt_config_mgr_get_engine(char** engine) { if (0 >= g_slist_length(g_config_client_list)) { - SLOG(LOG_ERROR, stt_tag(), "Not initialized"); + SLOG(LOG_ERROR, stt_tag(), "Not initialized"); //LCOV_EXCL_LINE return STT_CONFIG_ERROR_INVALID_STATE; } @@ -1036,13 +1040,14 @@ int stt_config_mgr_get_engine(char** engine) if (NULL != g_config_info->engine_id) { *engine = strdup(g_config_info->engine_id); } else { - SLOG(LOG_ERROR, stt_tag(), " Engine id is NULL"); + SLOG(LOG_ERROR, stt_tag(), " Engine id is NULL"); //LCOV_EXCL_LINE return STT_CONFIG_ERROR_ENGINE_NOT_FOUND; } return STT_CONFIG_ERROR_NONE; } +//LCOV_EXCL_START int __stt_config_set_buxtonkey(const char* engine) { /* Set vconfkey */ @@ -1308,16 +1313,17 @@ int stt_config_mgr_get_engine_agreement(const char* engine, char** agreement) return STT_CONFIG_ERROR_NONE; } +//LCOV_EXCL_STOP int stt_config_mgr_get_language_list(const char* engine_id, stt_config_supported_langauge_cb callback, void* user_data) { if (0 >= g_slist_length(g_config_client_list)) { - SLOG(LOG_ERROR, stt_tag(), "Not initialized"); + SLOG(LOG_ERROR, stt_tag(), "Not initialized"); //LCOV_EXCL_LINE return STT_CONFIG_ERROR_INVALID_STATE; } if (0 >= g_slist_length(g_engine_list)) { - SLOG(LOG_ERROR, stt_tag(), "There is no engine"); + SLOG(LOG_ERROR, stt_tag(), "There is no engine"); //LCOV_EXCL_LINE return STT_CONFIG_ERROR_ENGINE_NOT_FOUND; } @@ -1331,7 +1337,7 @@ int stt_config_mgr_get_language_list(const char* engine_id, stt_config_supported engine_info = iter->data; if (NULL == engine_info) { - SLOG(LOG_ERROR, stt_tag(), "[ERROR] engine info is NULL"); + SLOG(LOG_ERROR, stt_tag(), "[ERROR] engine info is NULL"); //LCOV_EXCL_LINE return STT_CONFIG_ERROR_OPERATION_FAILED; } @@ -1368,7 +1374,7 @@ int stt_config_mgr_get_language_list(const char* engine_id, stt_config_supported int stt_config_mgr_get_default_language(char** language) { if (0 >= g_slist_length(g_config_client_list)) { - SLOG(LOG_ERROR, stt_tag(), "Not initialized"); + SLOG(LOG_ERROR, stt_tag(), "Not initialized"); //LCOV_EXCL_LINE return STT_CONFIG_ERROR_INVALID_STATE; } @@ -1379,13 +1385,14 @@ int stt_config_mgr_get_default_language(char** language) if (NULL != g_config_info->language) { *language = strdup(g_config_info->language); } else { - SLOG(LOG_ERROR, stt_tag(), " language is NULL"); + SLOG(LOG_ERROR, stt_tag(), " language is NULL"); //LCOV_EXCL_LINE return STT_CONFIG_ERROR_OPERATION_FAILED; } return STT_CONFIG_ERROR_NONE; } +//LCOV_EXCL_START int stt_config_mgr_set_default_language(const char* language) { if (0 >= g_slist_length(g_config_client_list)) { @@ -1577,6 +1584,7 @@ bool stt_config_check_default_language_is_valid(const char* language) return false; } +//LCOV_EXCL_STOP int __stt_config_mgr_print_engine_info() { @@ -1584,9 +1592,9 @@ int __stt_config_mgr_print_engine_info() stt_engine_info_s *engine_info = NULL; if (0 >= g_slist_length(g_engine_list)) { - SLOG(LOG_DEBUG, stt_tag(), "-------------- engine list -----------------"); - SLOG(LOG_DEBUG, stt_tag(), " No Engine in engine directory"); - SLOG(LOG_DEBUG, stt_tag(), "--------------------------------------------"); + SLOG(LOG_DEBUG, stt_tag(), "-------------- engine list -----------------"); //LCOV_EXCL_LINE + SLOG(LOG_DEBUG, stt_tag(), " No Engine in engine directory"); //LCOV_EXCL_LINE + SLOG(LOG_DEBUG, stt_tag(), "--------------------------------------------"); //LCOV_EXCL_LINE return 0; } @@ -1624,7 +1632,7 @@ int __stt_config_mgr_print_engine_info() j++; } } else { - SLOG(LOG_ERROR, stt_tag(), " language is NONE"); + SLOG(LOG_ERROR, stt_tag(), " language is NONE"); //LCOV_EXCL_LINE } SLOG(LOG_DEBUG, stt_tag(), " silence support : %s", engine_info->support_silence_detection ? "true" : "false"); @@ -1643,6 +1651,7 @@ int __stt_config_mgr_print_engine_info() */ static GSList* g_time_list = NULL; +//LCOV_EXCL_START int stt_config_mgr_reset_time_info() { /* Remove time info */ @@ -1700,11 +1709,12 @@ int stt_config_mgr_add_time_info(int index, int event, const char* text, long st return 0; } +//LCOV_EXCL_STOP int stt_config_mgr_foreach_time_info(stt_config_result_time_cb callback, void* user_data) { if (NULL == callback) { - SLOG(LOG_ERROR, stt_tag(), "[ERROR] Input paramter is NULL : callback function"); + SLOG(LOG_ERROR, stt_tag(), "[ERROR] Input paramter is NULL : callback function"); //LCOV_EXCL_LINE return STT_CONFIG_ERROR_INVALID_PARAMETER; } @@ -1712,7 +1722,7 @@ int stt_config_mgr_foreach_time_info(stt_config_result_time_cb callback, void* u int ret; ret = stt_parser_get_time_info(&temp_time); if (0 != ret) { - SLOG(LOG_WARN, stt_tag(), "[WARNING] Fail to get time info : %d", ret); + SLOG(LOG_WARN, stt_tag(), "[WARNING] Fail to get time info : %d", ret); //LCOV_EXCL_LINE return STT_CONFIG_ERROR_NONE; } @@ -1756,6 +1766,7 @@ int stt_config_mgr_foreach_time_info(stt_config_result_time_cb callback, void* u return STT_CONFIG_ERROR_NONE; } +//LCOV_EXCL_START int stt_config_mgr_save_time_info_file() { if (0 == g_slist_length(g_time_list)) { @@ -1779,3 +1790,4 @@ int stt_config_mgr_remove_time_info_file() return STT_CONFIG_ERROR_NONE; } +//LCOV_EXCL_STOP diff --git a/common/stt_config_parser.c b/common/stt_config_parser.c index 77d0c79..1c3180d 100644 --- a/common/stt_config_parser.c +++ b/common/stt_config_parser.c @@ -55,7 +55,7 @@ static xmlDocPtr g_config_doc = NULL; int stt_parser_get_engine_info(const char* path, stt_engine_info_s** engine_info) { if (NULL == path || NULL == engine_info) { - SLOG(LOG_ERROR, stt_tag(), "[ERROR] Input parameter is NULL"); + SLOG(LOG_ERROR, stt_tag(), "[ERROR] Input parameter is NULL"); //LCOV_EXCL_LINE return -1; } @@ -70,31 +70,39 @@ int stt_parser_get_engine_info(const char* path, stt_engine_info_s** engine_info cur = xmlDocGetRootElement(doc); if (cur == NULL) { + //LCOV_EXCL_START SLOG(LOG_ERROR, stt_tag(), "[ERROR] Empty document"); xmlFreeDoc(doc); return -1; + //LCOV_EXCL_STOP } if (xmlStrcmp(cur->name, (const xmlChar *)STT_TAG_ENGINE_BASE_TAG)) { + //LCOV_EXCL_START SLOG(LOG_ERROR, stt_tag(), "[ERROR] The wrong type, root node is NOT 'stt-engine'"); xmlFreeDoc(doc); return -1; + //LCOV_EXCL_STOP } cur = cur->xmlChildrenNode; if (cur == NULL) { + //LCOV_EXCL_START SLOG(LOG_ERROR, stt_tag(), "[ERROR] Empty document"); xmlFreeDoc(doc); return -1; + //LCOV_EXCL_STOP } /* alloc engine info */ stt_engine_info_s* temp; temp = (stt_engine_info_s*)calloc(1, sizeof(stt_engine_info_s)); if (NULL == temp) { + //LCOV_EXCL_START xmlFreeDoc(doc); SLOG(LOG_ERROR, stt_tag(), "[ERROR] Fail to allocate memory"); return -1; + //LCOV_EXCL_STOP } temp->name = NULL; @@ -117,7 +125,7 @@ int stt_parser_get_engine_info(const char* path, stt_engine_info_s** engine_info temp->name = strdup((char*)key); xmlFree(key); } else { - SLOG(LOG_ERROR, stt_tag(), "[ERROR] <%s> has no content", STT_TAG_ENGINE_NAME); + SLOG(LOG_ERROR, stt_tag(), "[ERROR] <%s> has no content", STT_TAG_ENGINE_NAME); //LCOV_EXCL_LINE } } else if (0 == xmlStrcmp(cur->name, (const xmlChar *)STT_TAG_ENGINE_ID)) { key = xmlNodeGetContent(cur); @@ -127,7 +135,7 @@ int stt_parser_get_engine_info(const char* path, stt_engine_info_s** engine_info temp->uuid = strdup((char*)key); xmlFree(key); } else { - SLOG(LOG_ERROR, stt_tag(), "[ERROR] <%s> has no content", STT_TAG_ENGINE_ID); + SLOG(LOG_ERROR, stt_tag(), "[ERROR] <%s> has no content", STT_TAG_ENGINE_ID); //LCOV_EXCL_LINE } } else if (0 == xmlStrcmp(cur->name, (const xmlChar *)STT_TAG_ENGINE_SETTING)) { key = xmlNodeGetContent(cur); @@ -137,7 +145,7 @@ int stt_parser_get_engine_info(const char* path, stt_engine_info_s** engine_info temp->setting = strdup((char*)key); xmlFree(key); } else { - SLOG(LOG_ERROR, stt_tag(), "[ERROR] <%s> has no content", STT_TAG_ENGINE_SETTING); + SLOG(LOG_ERROR, stt_tag(), "[ERROR] <%s> has no content", STT_TAG_ENGINE_SETTING); //LCOV_EXCL_LINE } } else if (0 == xmlStrcmp(cur->name, (const xmlChar *)STT_TAG_ENGINE_AGREEMENT)) { key = xmlNodeGetContent(cur); @@ -147,7 +155,7 @@ int stt_parser_get_engine_info(const char* path, stt_engine_info_s** engine_info temp->agreement = strdup((char*)key); xmlFree(key); } else { - SLOG(LOG_ERROR, stt_tag(), "[ERROR] <%s> has no content", STT_TAG_ENGINE_AGREEMENT); + SLOG(LOG_ERROR, stt_tag(), "[ERROR] <%s> has no content", STT_TAG_ENGINE_AGREEMENT); //LCOV_EXCL_LINE } } else if (0 == xmlStrcmp(cur->name, (const xmlChar *)STT_TAG_ENGINE_DEFAULT)) { key = xmlNodeGetContent(cur); @@ -183,7 +191,7 @@ int stt_parser_get_engine_info(const char* path, stt_engine_info_s** engine_info } xmlFree(key); } else { - SLOG(LOG_ERROR, stt_tag(), "[ERROR] <%s> has no content", STT_TAG_ENGINE_LANGUAGE); + SLOG(LOG_ERROR, stt_tag(), "[ERROR] <%s> has no content", STT_TAG_ENGINE_LANGUAGE); //LCOV_EXCL_LINE } } @@ -201,7 +209,7 @@ int stt_parser_get_engine_info(const char* path, stt_engine_info_s** engine_info xmlFree(key); } else { - SLOG(LOG_ERROR, stt_tag(), "[ERROR] <%s> has no content", STT_TAG_ENGINE_SILENCE_SUPPORT); + SLOG(LOG_ERROR, stt_tag(), "[ERROR] <%s> has no content", STT_TAG_ENGINE_SILENCE_SUPPORT); //LCOV_EXCL_LINE } } else if (0 == xmlStrcmp(cur->name, (const xmlChar *)STT_TAG_ENGINE_CREDENTIAL_NEED)) { key = xmlNodeGetContent(cur); @@ -241,7 +249,7 @@ int stt_parser_get_engine_info(const char* path, stt_engine_info_s** engine_info int stt_parser_free_engine_info(stt_engine_info_s* engine_info) { if (NULL == engine_info) { - SLOG(LOG_ERROR, stt_tag(), "[ERROR] Input parameter is NULL"); + SLOG(LOG_ERROR, stt_tag(), "[ERROR] Input parameter is NULL"); //LCOV_EXCL_LINE return -1; } @@ -271,6 +279,7 @@ int stt_parser_free_engine_info(stt_engine_info_s* engine_info) return 0; } +//LCOV_EXCL_START int stt_parser_print_engine_info(stt_engine_info_s* engine_info) { if (NULL == engine_info) @@ -308,11 +317,12 @@ int stt_parser_print_engine_info(stt_engine_info_s* engine_info) return 0; } +//LCOV_EXCL_STOP int stt_parser_load_config(stt_config_s** config_info) { if (NULL == config_info) { - SLOG(LOG_ERROR, stt_tag(), "[ERROR] Input parameter is NULL"); + SLOG(LOG_ERROR, stt_tag(), "[ERROR] Input parameter is NULL"); //LCOV_EXCL_LINE return -1; } @@ -324,7 +334,7 @@ int stt_parser_load_config(stt_config_s** config_info) if (0 != access(STT_CONFIG, F_OK)) { doc = xmlParseFile(STT_DEFAULT_CONFIG); if (doc == NULL) { - SLOG(LOG_ERROR, stt_tag(), "[ERROR] Fail to parse file error : %s", STT_DEFAULT_CONFIG); + SLOG(LOG_ERROR, stt_tag(), "[ERROR] Fail to parse file error : %s", STT_DEFAULT_CONFIG); //LCOV_EXCL_LINE xmlCleanupParser(); return -1; } @@ -356,20 +366,20 @@ int stt_parser_load_config(stt_config_s** config_info) cur = xmlDocGetRootElement(doc); if (cur == NULL) { - SLOG(LOG_ERROR, stt_tag(), "[ERROR] Empty document"); + SLOG(LOG_ERROR, stt_tag(), "[ERROR] Empty document"); //LCOV_EXCL_LINE xmlFreeDoc(doc); return -1; } if (xmlStrcmp(cur->name, (const xmlChar *) STT_TAG_CONFIG_BASE_TAG)) { - SLOG(LOG_ERROR, stt_tag(), "[ERROR] The wrong type, root node is NOT %s", STT_TAG_CONFIG_BASE_TAG); + SLOG(LOG_ERROR, stt_tag(), "[ERROR] The wrong type, root node is NOT %s", STT_TAG_CONFIG_BASE_TAG); //LCOV_EXCL_LINE xmlFreeDoc(doc); return -1; } cur = cur->xmlChildrenNode; if (cur == NULL) { - SLOG(LOG_ERROR, stt_tag(), "[ERROR] Empty document"); + SLOG(LOG_ERROR, stt_tag(), "[ERROR] Empty document"); //LCOV_EXCL_LINE xmlFreeDoc(doc); return -1; } @@ -379,7 +389,7 @@ int stt_parser_load_config(stt_config_s** config_info) temp = (stt_config_s*)calloc(1, sizeof(stt_config_s)); if (NULL == temp) { xmlFreeDoc(doc); - SLOG(LOG_ERROR, stt_tag(), "[ERROR] Fail to allocate memory"); + SLOG(LOG_ERROR, stt_tag(), "[ERROR] Fail to allocate memory"); //LCOV_EXCL_LINE return -1; } @@ -396,7 +406,7 @@ int stt_parser_load_config(stt_config_s** config_info) temp->engine_id = strdup((char*)key); xmlFree(key); } else { - SLOG(LOG_ERROR, stt_tag(), "[ERROR] engine id is NULL"); + SLOG(LOG_ERROR, stt_tag(), "[ERROR] engine id is NULL"); //LCOV_EXCL_LINE } } else if (0 == xmlStrcmp(cur->name, (const xmlChar *)STT_TAG_CONFIG_ENGINE_SETTING)) { key = xmlNodeGetContent(cur); @@ -406,7 +416,7 @@ int stt_parser_load_config(stt_config_s** config_info) temp->setting = strdup((char*)key); xmlFree(key); } else { - SLOG(LOG_ERROR, stt_tag(), "[ERROR] setting path is NULL"); + SLOG(LOG_ERROR, stt_tag(), "[ERROR] setting path is NULL"); //LCOV_EXCL_LINE } } else if (0 == xmlStrcmp(cur->name, (const xmlChar *)STT_TAG_CONFIG_AUTO_LANGUAGE)) { @@ -419,13 +429,13 @@ int stt_parser_load_config(stt_config_s** config_info) } else if (0 == xmlStrcmp(key, (const xmlChar *)"off")) { temp->auto_lang = false; } else { - SLOG(LOG_ERROR, stt_tag(), "Auto voice is wrong"); + SLOG(LOG_ERROR, stt_tag(), "Auto voice is wrong"); //LCOV_EXCL_LINE temp->auto_lang = true; } xmlFree(key); } else { - SLOG(LOG_ERROR, stt_tag(), "[ERROR] auto langauge is NULL"); + SLOG(LOG_ERROR, stt_tag(), "[ERROR] auto langauge is NULL"); //LCOV_EXCL_LINE } } else if (0 == xmlStrcmp(cur->name, (const xmlChar *)STT_TAG_CONFIG_LANGUAGE)) { key = xmlNodeGetContent(cur); @@ -435,7 +445,7 @@ int stt_parser_load_config(stt_config_s** config_info) temp->language = strdup((char*)key); xmlFree(key); } else { - SLOG(LOG_ERROR, stt_tag(), "[ERROR] language is NULL"); + SLOG(LOG_ERROR, stt_tag(), "[ERROR] language is NULL"); //LCOV_EXCL_LINE } } else if (0 == xmlStrcmp(cur->name, (const xmlChar *)STT_TAG_CONFIG_SILENCE_DETECTION)) { key = xmlNodeGetContent(cur); @@ -449,7 +459,7 @@ int stt_parser_load_config(stt_config_s** config_info) xmlFree(key); } else { - SLOG(LOG_ERROR, stt_tag(), "[ERROR] silence-detection is NULL"); + SLOG(LOG_ERROR, stt_tag(), "[ERROR] silence-detection is NULL"); //LCOV_EXCL_LINE } } else if (0 == xmlStrcmp(cur->name, (const xmlChar *)STT_TAG_CONFIG_CREDENTIAL)) { key = xmlNodeGetContent(cur); @@ -463,7 +473,7 @@ int stt_parser_load_config(stt_config_s** config_info) xmlFree(key); } else { - SLOG(LOG_ERROR, stt_tag(), "[ERROR] credential is NULL"); + SLOG(LOG_ERROR, stt_tag(), "[ERROR] credential is NULL"); //LCOV_EXCL_LINE } } else { @@ -626,6 +636,7 @@ int stt_parser_set_language(const char* language) return 0; } +//LCOV_EXCL_START int stt_parser_set_auto_lang(bool value) { if (NULL == g_config_doc) @@ -709,11 +720,12 @@ int stt_parser_set_silence_detection(bool value) return 0; } +//LCOV_EXCL_STOP int stt_parser_find_config_changed(char** engine, char** setting, int* auto_lang, char** language, int* silence, int* credential) { if (NULL == engine || NULL == language || NULL == silence || NULL == credential) { - SLOG(LOG_ERROR, stt_tag(), "[ERROR] Input parameter is NULL"); + SLOG(LOG_ERROR, stt_tag(), "[ERROR] Input parameter is NULL"); //LCOV_EXCL_LINE return -1; } @@ -733,23 +745,29 @@ int stt_parser_find_config_changed(char** engine, char** setting, int* auto_lang cur_new = xmlDocGetRootElement(doc); cur_old = xmlDocGetRootElement(g_config_doc); if (cur_new == NULL || cur_old == NULL) { + //LCOV_EXCL_START SLOG(LOG_ERROR, stt_tag(), "[ERROR] Empty document"); xmlFreeDoc(doc); return -1; + //LCOV_EXCL_STOP } if (xmlStrcmp(cur_new->name, (const xmlChar*)STT_TAG_CONFIG_BASE_TAG) || xmlStrcmp(cur_old->name, (const xmlChar*)STT_TAG_CONFIG_BASE_TAG)) { + //LCOV_EXCL_START SLOG(LOG_ERROR, stt_tag(), "[ERROR] The wrong type, root node is NOT %s", STT_TAG_CONFIG_BASE_TAG); xmlFreeDoc(doc); return -1; + //LCOV_EXCL_STOP } cur_new = cur_new->xmlChildrenNode; cur_old = cur_old->xmlChildrenNode; if (cur_new == NULL || cur_old == NULL) { + //LCOV_EXCL_START SLOG(LOG_ERROR, stt_tag(), "[ERROR] Empty document"); xmlFreeDoc(doc); return -1; + //LCOV_EXCL_STOP } *engine = NULL; @@ -773,7 +791,7 @@ int stt_parser_find_config_changed(char** engine, char** setting, int* auto_lang xmlFree(key_old); } } else { - SLOG(LOG_ERROR, stt_tag(), "[ERROR] Old config and new config are different"); + SLOG(LOG_ERROR, stt_tag(), "[ERROR] Old config and new config are different"); //LCOV_EXCL_LINE } } else if (0 == xmlStrcmp(cur_new->name, (const xmlChar*)STT_TAG_CONFIG_ENGINE_SETTING)) { if (0 == xmlStrcmp(cur_old->name, (const xmlChar*)STT_TAG_CONFIG_ENGINE_SETTING)) { @@ -782,7 +800,7 @@ int stt_parser_find_config_changed(char** engine, char** setting, int* auto_lang key_new = xmlNodeGetContent(cur_new); if (NULL != key_new) { if (0 != xmlStrcmp(key_old, key_new)) { - SLOG(LOG_DEBUG, stt_tag(), "Old engine setting(%s), New engine setting(%s)", (char*)key_old, (char*)key_new); + SLOG(LOG_DEBUG, stt_tag(), "Old engine setting(%s), New engine setting(%s)", (char*)key_old, (char*)key_new); //LCOV_EXCL_LINE if (NULL != *setting) free(*setting); *setting = strdup((char*)key_new); } @@ -791,7 +809,7 @@ int stt_parser_find_config_changed(char** engine, char** setting, int* auto_lang xmlFree(key_old); } } else { - SLOG(LOG_ERROR, stt_tag(), "[ERROR] Old config and new config are different"); + SLOG(LOG_ERROR, stt_tag(), "[ERROR] Old config and new config are different"); //LCOV_EXCL_LINE } } else if (0 == xmlStrcmp(cur_new->name, (const xmlChar*)STT_TAG_CONFIG_AUTO_LANGUAGE)) { if (0 == xmlStrcmp(cur_old->name, (const xmlChar*)STT_TAG_CONFIG_AUTO_LANGUAGE)) { @@ -800,7 +818,7 @@ int stt_parser_find_config_changed(char** engine, char** setting, int* auto_lang key_new = xmlNodeGetContent(cur_new); if (NULL != key_new) { if (0 != xmlStrcmp(key_old, key_new)) { - SLOG(LOG_DEBUG, stt_tag(), "Old auto lang(%s), New auto lang(%s)", (char*)key_old, (char*)key_new); + SLOG(LOG_DEBUG, stt_tag(), "Old auto lang(%s), New auto lang(%s)", (char*)key_old, (char*)key_new); //LCOV_EXCL_LINE if (0 == xmlStrcmp((const xmlChar*)"on", key_new)) { *auto_lang = (int)true; } else { @@ -813,7 +831,7 @@ int stt_parser_find_config_changed(char** engine, char** setting, int* auto_lang xmlFree(key_old); } } else { - SLOG(LOG_ERROR, stt_tag(), "[ERROR] old config and new config are different"); + SLOG(LOG_ERROR, stt_tag(), "[ERROR] old config and new config are different"); //LCOV_EXCL_LINE } } else if (0 == xmlStrcmp(cur_new->name, (const xmlChar*)STT_TAG_CONFIG_LANGUAGE)) { if (0 == xmlStrcmp(cur_old->name, (const xmlChar*)STT_TAG_CONFIG_LANGUAGE)) { @@ -822,7 +840,7 @@ int stt_parser_find_config_changed(char** engine, char** setting, int* auto_lang key_new = xmlNodeGetContent(cur_new); if (NULL != key_new) { if (0 != xmlStrcmp(key_old, key_new)) { - SLOG(LOG_DEBUG, stt_tag(), "Old language(%s), New language(%s)", (char*)key_old, (char*)key_new); + SLOG(LOG_DEBUG, stt_tag(), "Old language(%s), New language(%s)", (char*)key_old, (char*)key_new); //LCOV_EXCL_LINE if (NULL != *language) free(*language); *language = strdup((char*)key_new); } @@ -831,7 +849,7 @@ int stt_parser_find_config_changed(char** engine, char** setting, int* auto_lang xmlFree(key_old); } } else { - SLOG(LOG_ERROR, stt_tag(), "[ERROR] old config and new config are different"); + SLOG(LOG_ERROR, stt_tag(), "[ERROR] old config and new config are different"); //LCOV_EXCL_LINE } } else if (0 == xmlStrcmp(cur_new->name, (const xmlChar*)STT_TAG_CONFIG_SILENCE_DETECTION)) { if (0 == xmlStrcmp(cur_old->name, (const xmlChar*)STT_TAG_CONFIG_SILENCE_DETECTION)) { @@ -840,7 +858,7 @@ int stt_parser_find_config_changed(char** engine, char** setting, int* auto_lang key_new = xmlNodeGetContent(cur_new); if (NULL != key_new) { if (0 != xmlStrcmp(key_old, key_new)) { - SLOG(LOG_DEBUG, stt_tag(), "Old silence(%s), New silence(%s)", (char*)key_old, (char*)key_new); + SLOG(LOG_DEBUG, stt_tag(), "Old silence(%s), New silence(%s)", (char*)key_old, (char*)key_new); //LCOV_EXCL_LINE if (0 == xmlStrcmp(key_new, (const xmlChar*)"on")) { *silence = 1; } else { @@ -853,7 +871,7 @@ int stt_parser_find_config_changed(char** engine, char** setting, int* auto_lang xmlFree(key_old); } } else { - SLOG(LOG_ERROR, stt_tag(), "[ERROR] old config and new config are different"); + SLOG(LOG_ERROR, stt_tag(), "[ERROR] old config and new config are different"); //LCOV_EXCL_LINE } } else if (0 == xmlStrcmp(cur_new->name, (const xmlChar*)STT_TAG_CONFIG_CREDENTIAL)) { if (0 == xmlStrcmp(cur_old->name, (const xmlChar*)STT_TAG_CONFIG_CREDENTIAL)) { @@ -862,7 +880,7 @@ int stt_parser_find_config_changed(char** engine, char** setting, int* auto_lang key_new = xmlNodeGetContent(cur_new); if (NULL != key_new) { if (0 != xmlStrcmp(key_old, key_new)) { - SLOG(LOG_DEBUG, stt_tag(), "Old credential(%s), New credential(%s)", (char*)key_old, (char*)key_new); + SLOG(LOG_DEBUG, stt_tag(), "Old credential(%s), New credential(%s)", (char*)key_old, (char*)key_new); //LCOV_EXCL_LINE if (0 == xmlStrcmp(key_new, (const xmlChar*)"true")) { *credential = 1; } else { @@ -874,7 +892,7 @@ int stt_parser_find_config_changed(char** engine, char** setting, int* auto_lang xmlFree(key_old); } } else { - SLOG(LOG_ERROR, stt_tag(), "[ERROR] old config and new config are different"); + SLOG(LOG_ERROR, stt_tag(), "[ERROR] old config and new config are different"); //LCOV_EXCL_LINE } } else { @@ -894,7 +912,7 @@ int stt_parser_find_config_changed(char** engine, char** setting, int* auto_lang /** * time function */ - +//LCOV_EXCL_START int stt_parser_set_time_info(GSList* time_list) { if (0 == g_slist_length(time_list)) { @@ -968,6 +986,7 @@ int stt_parser_set_time_info(GSList* time_list) xmlFreeDoc(doc); return 0; } +//LCOV_EXCL_STOP void __stt_parser_time_info_free(void* data) { @@ -986,7 +1005,7 @@ void __stt_parser_time_info_free(void* data) int stt_parser_get_time_info(GSList** time_list) { if (NULL == time_list) { - SLOG(LOG_ERROR, stt_tag(), "Invalid paramter : text is NULL"); + SLOG(LOG_ERROR, stt_tag(), "Invalid paramter : text is NULL"); //LCOV_EXCL_LINE return -1; } @@ -995,28 +1014,34 @@ int stt_parser_get_time_info(GSList** time_list) doc = xmlParseFile(STT_TIME_INFO_PATH); if (doc == NULL) { - SLOG(LOG_WARN, stt_tag(), "[WARNING] File is not exist"); + SLOG(LOG_WARN, stt_tag(), "[WARNING] File is not exist"); //LCOV_EXCL_LINE return -1; } cur = xmlDocGetRootElement(doc); if (cur == NULL) { + //LCOV_EXCL_START SLOG(LOG_ERROR, stt_tag(), "[ERROR] Empty document"); xmlFreeDoc(doc); return -1; + //LCOV_EXCL_STOP } if (xmlStrcmp(cur->name, (const xmlChar *)STT_TAG_TIME_BASE_TAG)) { + //LCOV_EXCL_START SLOG(LOG_ERROR, stt_tag(), "[ERROR] The wrong type, root node is NOT '%s'", STT_TAG_TIME_BASE_TAG); xmlFreeDoc(doc); return -1; + //LCOV_EXCL_STOP } cur = cur->xmlChildrenNode; if (cur == NULL) { + //LCOV_EXCL_START SLOG(LOG_ERROR, stt_tag(), "[ERROR] Empty document"); xmlFreeDoc(doc); return -1; + //LCOV_EXCL_STOP } /* alloc time info */ @@ -1028,7 +1053,7 @@ int stt_parser_get_time_info(GSList** time_list) if (0 == xmlStrcmp(cur->name, (const xmlChar *)STT_TAG_TIME_INDEX)) { key = xmlGetProp(cur, (const xmlChar*)STT_TAG_TIME_COUNT); if (NULL == key) { - SLOG(LOG_ERROR, stt_tag(), "[ERROR] <%s> has no content", STT_TAG_TIME_COUNT); + SLOG(LOG_ERROR, stt_tag(), "[ERROR] <%s> has no content", STT_TAG_TIME_COUNT); //LCOV_EXCL_LINE if (NULL != temp_time_list) { g_slist_free_full(temp_time_list, __stt_parser_time_info_free); @@ -1046,7 +1071,7 @@ int stt_parser_get_time_info(GSList** time_list) xmlFree(key); if (count <= 0) { - SLOG(LOG_ERROR, stt_tag(), "[ERROR] count is invalid : %d", count); + SLOG(LOG_ERROR, stt_tag(), "[ERROR] count is invalid : %d", count); //LCOV_EXCL_LINE break; } @@ -1062,7 +1087,7 @@ int stt_parser_get_time_info(GSList** time_list) temp_info = (stt_result_time_info_s*)calloc(1, sizeof(stt_result_time_info_s)); if (NULL == temp_info) { - SLOG(LOG_ERROR, stt_tag(), "[ERROR] Memory alloc error!!"); + SLOG(LOG_ERROR, stt_tag(), "[ERROR] Memory alloc error!!"); //LCOV_EXCL_LINE if (NULL != temp_time_list) { g_slist_free_full(temp_time_list, __stt_parser_time_info_free); @@ -1082,11 +1107,11 @@ int stt_parser_get_time_info(GSList** time_list) if (0 == xmlStrcmp(time_node->name, (const xmlChar *)STT_TAG_TIME_TEXT)) { key = xmlNodeGetContent(time_node); if (NULL != key) { - SLOG(LOG_DEBUG, stt_tag(), "text : %s", (char *)key); + SLOG(LOG_DEBUG, stt_tag(), "text : %s", (char *)key); //LCOV_EXCL_LINE temp_info->text = strdup((char*)key); xmlFree(key); } else { - SLOG(LOG_ERROR, stt_tag(), "[ERROR] <%s> has no content", STT_TAG_TIME_TEXT); + SLOG(LOG_ERROR, stt_tag(), "[ERROR] <%s> has no content", STT_TAG_TIME_TEXT); //LCOV_EXCL_LINE free(temp_info); break; } @@ -1099,11 +1124,11 @@ int stt_parser_get_time_info(GSList** time_list) if (0 == xmlStrcmp(time_node->name, (const xmlChar *)STT_TAG_TIME_START)) { key = xmlNodeGetContent(time_node); if (NULL != key) { - SLOG(LOG_DEBUG, stt_tag(), "Start time : %s", (char *)key); + SLOG(LOG_DEBUG, stt_tag(), "Start time : %s", (char *)key); //LCOV_EXCL_LINE temp_info->start_time = atoi((char*)key); xmlFree(key); } else { - SLOG(LOG_ERROR, stt_tag(), "[ERROR] <%s> has no content", STT_TAG_TIME_START); + SLOG(LOG_ERROR, stt_tag(), "[ERROR] <%s> has no content", STT_TAG_TIME_START); //LCOV_EXCL_LINE if (NULL != temp_info->text) free(temp_info->text); free(temp_info); break; @@ -1117,11 +1142,11 @@ int stt_parser_get_time_info(GSList** time_list) if (0 == xmlStrcmp(time_node->name, (const xmlChar *)STT_TAG_TIME_END)) { key = xmlNodeGetContent(time_node); if (NULL != key) { - SLOG(LOG_DEBUG, stt_tag(), "End time : %s", (char *)key); + SLOG(LOG_DEBUG, stt_tag(), "End time : %s", (char *)key); //LCOV_EXCL_LINE temp_info->end_time = atoi((char*)key); xmlFree(key); } else { - SLOG(LOG_ERROR, stt_tag(), "[ERROR] <%s> has no content", STT_TAG_TIME_END); + SLOG(LOG_ERROR, stt_tag(), "[ERROR] <%s> has no content", STT_TAG_TIME_END); //LCOV_EXCL_LINE if (NULL != temp_info->text) free(temp_info->text); free(temp_info); break; -- 2.7.4