`common` module should not have accessed any other modules like `client` or `server`, but it has
used `log_tag()` function on `client` module by external definition.
This kind of access occurs cyclic depedency.
This patch removes external definition on common modules to remove cyclic depedencies.
Change-Id: I769a0886bdfb150c8943687d230ba85afe7d0ea0
Signed-off-by: Suyeon Hwang <stom.hwang@samsung.com>
} stt_config_client_s;
-extern const char* stt_tag();
-
static GSList* g_engine_list = NULL;
static GSList* g_config_client_list = NULL;
bool __stt_config_mgr_check_lang_is_valid(const char* engine_id, const char* language)
{
if (NULL == engine_id || NULL == language) {
- SLOG(LOG_ERROR, stt_tag(), "[ERROR] Input parameter is NULL");
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "[ERROR] Input parameter is NULL");
return false;
}
stt_engine_info_s *engine_info = NULL;
if (0 >= g_slist_length(g_engine_list)) {
- SLOG(LOG_ERROR, stt_tag(), "[ERROR] There is no engine!!");
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "[ERROR] There is no engine!!");
return false;
}
engine_info = iter->data;
if (NULL == engine_info) {
- SLOG(LOG_ERROR, stt_tag(), "[ERROR] Engine info is NULL");
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "[ERROR] Engine info is NULL");
return false;
}
/*Get handle data from list*/
engine_lang = iter_lang->data;
- SLOG(LOG_DEBUG, stt_tag(), " [%dth] %s", i, engine_lang);
+ SLOG(LOG_DEBUG, TAG_STTCONFIG, " [%dth] %s", i, engine_lang);
if (0 == strcmp(language, engine_lang)) {
return true;
int __stt_config_mgr_select_lang(const char* engine_id, char** language)
{
if (NULL == engine_id || NULL == language) {
- SLOG(LOG_ERROR, stt_tag(), "[ERROR] Input parameter is NULL");
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "[ERROR] Input parameter is NULL");
return STT_CONFIG_ERROR_INVALID_PARAMETER;
}
stt_engine_info_s *engine_info = NULL;
if (0 >= g_slist_length(g_engine_list)) {
- SLOG(LOG_ERROR, stt_tag(), "[ERROR] There is no engine!!");
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "[ERROR] There is no engine!!");
return STT_CONFIG_ERROR_OPERATION_FAILED;
}
engine_info = iter->data;
if (NULL == engine_info) {
- SLOG(LOG_ERROR, stt_tag(), "engine info is NULL");
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "engine info is NULL");
iter = g_slist_next(iter);
continue;
}
}
if (NULL == engine_info->default_lang) {
- SLOG(LOG_ERROR, stt_tag(), "[ERROR] Default language of the engine info is NULL");
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "[ERROR] Default language of the engine info is NULL");
return STT_CONFIG_ERROR_INVALID_LANGUAGE;
}
*language = strdup(engine_info->default_lang);
if (NULL != *language) {
- SLOG(LOG_DEBUG, stt_tag(), "Selected language : %s", *language);
+ SLOG(LOG_DEBUG, TAG_STTCONFIG, "Selected language : %s", *language);
return STT_CONFIG_ERROR_NONE;
}
}
Eina_Bool stt_config_mgr_inotify_event_cb(void* data, Ecore_Fd_Handler *fd_handler)
{
- SLOG(LOG_DEBUG, stt_tag(), "===== Config changed callback event");
+ SLOG(LOG_DEBUG, TAG_STTCONFIG, "===== Config changed callback event");
int length;
struct inotify_event event;
length = read(g_fd_noti, &event, sizeof(struct inotify_event));
if (0 > length) {
- 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
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "[ERROR] Empty Inotify event"); //LCOV_EXCL_LINE
+ SLOG(LOG_DEBUG, TAG_STTCONFIG, "====="); //LCOV_EXCL_LINE
+ SLOG(LOG_DEBUG, TAG_STTCONFIG, " "); //LCOV_EXCL_LINE
return ECORE_CALLBACK_PASS_ON; //LCOV_EXCL_LINE
}
if (NULL != setting) free(setting);
if (NULL != lang) free(lang);
} else {
- SLOG(LOG_ERROR, stt_tag(), "[ERROR] Undefined event"); //LCOV_EXCL_LINE
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "[ERROR] Undefined event"); //LCOV_EXCL_LINE
}
- SLOG(LOG_DEBUG, stt_tag(), "=====");
- SLOG(LOG_DEBUG, stt_tag(), " ");
+ SLOG(LOG_DEBUG, TAG_STTCONFIG, "=====");
+ SLOG(LOG_DEBUG, TAG_STTCONFIG, " ");
return ECORE_CALLBACK_PASS_ON;
}
fd = inotify_init();
if (fd < 0) {
- SLOG(LOG_ERROR, stt_tag(), "[ERROR] Fail get inotify fd"); //LCOV_EXCL_LINE
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "[ERROR] Fail get inotify fd"); //LCOV_EXCL_LINE
return -1; //LCOV_EXCL_LINE
}
g_fd_noti = fd;
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"); //LCOV_EXCL_LINE
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "[ERROR] Fail to get handler_noti"); //LCOV_EXCL_LINE
return -1; //LCOV_EXCL_LINE
}
value = vconf_get_str(VCONFKEY_LANGSET);
if (NULL == value) {
- SLOG(LOG_ERROR, stt_tag(), "[Config ERROR] Fail to get display language"); //LCOV_EXCL_LINE
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "[Config ERROR] Fail to get display language"); //LCOV_EXCL_LINE
return -1;
}
/* Check current config info */
if (NULL == g_config_info) {
- SLOG(LOG_ERROR, stt_tag(), "Current config info is NULL"); //LCOV_EXCL_LINE
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "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"); //LCOV_EXCL_LINE
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "Current config language is NULL"); //LCOV_EXCL_LINE
return STT_CONFIG_ERROR_OPERATION_FAILED;
}
if (0 == strncmp(g_config_info->language, candidate_lang, 5)) {
- SLOG(LOG_DEBUG, stt_tag(), "[Config] Language is auto. STT language(%s) is same with display lang", g_config_info->language);
+ SLOG(LOG_DEBUG, TAG_STTCONFIG, "[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); //LCOV_EXCL_LINE
+ SLOG(LOG_DEBUG, TAG_STTCONFIG, "[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)) {
char* before_lang = NULL;
if (0 != stt_parser_set_language(candidate_lang)) {
- SLOG(LOG_ERROR, stt_tag(), "Fail to save default language");
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "Fail to save default language");
return -1;
}
free(g_config_info->language);
g_config_info->language = strdup(candidate_lang);
- SLOG(LOG_DEBUG, stt_tag(), "[Config] Language is auto. Set default language(%s)", g_config_info->language);
+ SLOG(LOG_DEBUG, TAG_STTCONFIG, "[Config] Language is auto. Set default language(%s)", g_config_info->language);
/* Call all callbacks of client*/
GSList *iter = NULL;
/* Candidate language is not valid */
char* tmp_language = NULL;
if (0 != __stt_config_mgr_select_lang(g_config_info->engine_id, &tmp_language)) {
- SLOG(LOG_ERROR, stt_tag(), "[ERROR] Fail to select language");
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "[ERROR] Fail to select language");
return -1;
}
if (NULL == tmp_language) {
- SLOG(LOG_ERROR, stt_tag(), "[ERROR] Selected language is NULL");
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "[ERROR] Selected language is NULL");
return -1;
}
if (0 != stt_parser_set_language(tmp_language)) {
free(tmp_language);
tmp_language = NULL;
- SLOG(LOG_ERROR, stt_tag(), "[ERROR] Fail to save config");
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "[ERROR] Fail to save config");
return -1;
}
- SLOG(LOG_DEBUG, stt_tag(), "[Config] Language is auto but display lang is not supported. Default language change(%s)", tmp_language);
+ SLOG(LOG_DEBUG, TAG_STTCONFIG, "[Config] Language is auto but display lang is not supported. Default language change(%s)", tmp_language);
/* Call all callbacks of client*/
GSList *iter = NULL;
}
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, TAG_STTCONFIG, "Client count (%d)", g_slist_length(g_config_client_list));
}
return;
}
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"); //LCOV_EXCL_LINE
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "Input parameter is NULL"); //LCOV_EXCL_LINE
return STT_CONFIG_ERROR_INVALID_PARAMETER;
}
stt_engine_info_s *engine_info = NULL;
if (0 >= g_slist_length(g_engine_list)) {
- SLOG(LOG_ERROR, stt_tag(), "There is no engine!!"); //LCOV_EXCL_LINE
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "There is no engine!!"); //LCOV_EXCL_LINE
return STT_CONFIG_ERROR_ENGINE_NOT_FOUND;
}
engine_info = iter->data;
if (NULL == engine_info) {
- SLOG(LOG_ERROR, stt_tag(), "engine info is NULL"); //LCOV_EXCL_LINE
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "engine info is NULL"); //LCOV_EXCL_LINE
return STT_CONFIG_ERROR_ENGINE_NOT_FOUND;
}
if (0 == strcmp(engine_id, engine_info->uuid)) {
- SLOG(LOG_DEBUG, stt_tag(), "Default engine is valid : %s", engine_id);
+ SLOG(LOG_DEBUG, TAG_STTCONFIG, "Default engine is valid : %s", engine_id);
return STT_CONFIG_ERROR_NONE;
}
/* Change default engine */
iter = g_slist_nth(g_engine_list, 0);
if (NULL == iter) {
- SLOG(LOG_ERROR, stt_tag(), "Operation failed - false engine"); //LCOV_EXCL_LINE
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "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"); //LCOV_EXCL_LINE
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "[ERROR] Engine info is NULL"); //LCOV_EXCL_LINE
return STT_CONFIG_ERROR_ENGINE_NOT_FOUND;
}
bool is_valid_lang = false;
if (0 >= g_slist_length(engine_info->languages)) {
- SLOG(LOG_ERROR, stt_tag(), "[ERROR] Empty supported language"); //LCOV_EXCL_LINE
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "[ERROR] Empty supported language"); //LCOV_EXCL_LINE
return STT_CONFIG_ERROR_ENGINE_NOT_FOUND;
}
/*Get handle data from list*/
lang = iter_lang->data;
- SLOG(LOG_DEBUG, stt_tag(), " %s", lang);
+ SLOG(LOG_DEBUG, TAG_STTCONFIG, " %s", lang);
if (NULL != lang) {
if (0 == strcmp(lang, g_config_info->language)) {
/* language is valid */
}
//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");
+ SLOG(LOG_DEBUG, TAG_STTCONFIG, "[Config] Engine changed");
+ SLOG(LOG_DEBUG, TAG_STTCONFIG, " Engine : %s", g_config_info->engine_id);
+ SLOG(LOG_DEBUG, TAG_STTCONFIG, " Setting : %s", g_config_info->setting);
+ SLOG(LOG_DEBUG, TAG_STTCONFIG, " language : %s", g_config_info->language);
+ SLOG(LOG_DEBUG, TAG_STTCONFIG, " Silence detection : %s", g_config_info->silence_detection ? "on" : "off");
+ SLOG(LOG_DEBUG, TAG_STTCONFIG, " 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"); //LCOV_EXCL_LINE
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "Fail to save config"); //LCOV_EXCL_LINE
return STT_CONFIG_ERROR_OPERATION_FAILED;
}
struct dirent *dirp = NULL;
if (NULL == directory) {
- SLOG(LOG_ERROR, stt_tag(), "[Directory ERROR] Directory is NULL"); //LCOV_EXCL_LINE
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "[Directory ERROR] Directory is NULL"); //LCOV_EXCL_LINE
return;
} else {
- SLOG(LOG_DEBUG, stt_tag(), "[Directory DEBUG] Directory: %s", directory);
+ SLOG(LOG_DEBUG, TAG_STTCONFIG, "[Directory DEBUG] Directory: %s", directory);
}
dp = opendir(directory);
if (NULL != filepath) {
snprintf(filepath, filesize, "%s/%s", directory, dirp->d_name);
} else {
- SLOG(LOG_ERROR, stt_tag(), "[Config ERROR] Memory not enough!!"); //LCOV_EXCL_LINE
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "[Config ERROR] Memory not enough!!"); //LCOV_EXCL_LINE
continue;
}
- SLOG(LOG_DEBUG, stt_tag(), "[File DEBUG] File path: %s", filepath);
+ SLOG(LOG_DEBUG, TAG_STTCONFIG, "[File DEBUG] File path: %s", filepath);
if (0 == stt_parser_get_engine_info(filepath, &info)) {
g_engine_list = g_slist_append(g_engine_list, info);
closedir(dp);
} else {
- SLOG(LOG_WARN, stt_tag(), "[Config WARNING] Fail to open directory");
+ SLOG(LOG_WARN, TAG_STTCONFIG, "[Config WARNING] Fail to open directory");
}
return;
get_uid = iter->data;
if (uid == *get_uid) {
- SLOG(LOG_WARN, stt_tag(), "[CONFIG] uid(%d) has already registered", uid);
+ SLOG(LOG_WARN, TAG_STTCONFIG, "[CONFIG] uid(%d) has already registered", uid);
return 0;
}
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, TAG_STTCONFIG, "[ERROR] Fail to allocate memory");
return STT_CONFIG_ERROR_OUT_OF_MEMORY;
}
temp_client->uid = uid;
/* Add uid */
g_config_client_list = g_slist_append(g_config_client_list, temp_client);
- SLOG(LOG_WARN, stt_tag(), "[CONFIG] Add uid(%d) but config has already initialized", uid);
+ SLOG(LOG_WARN, TAG_STTCONFIG, "[CONFIG] Add uid(%d) but config has already initialized", uid);
return STT_CONFIG_ERROR_NONE;
}
/* Make directories */
if (0 != access(STT_CONFIG_BASE, F_OK)) {
if (0 != mkdir(STT_CONFIG_BASE, S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)) {
- SLOG(LOG_ERROR, stt_tag(), "[ERROR] Fail to make directory : %s", STT_CONFIG_BASE);
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "[ERROR] Fail to make directory : %s", STT_CONFIG_BASE);
__stt_config_release_client(uid);
return STT_CONFIG_ERROR_OPERATION_FAILED;
} else {
- SLOG(LOG_DEBUG, stt_tag(), "Success to make directory : %s", STT_CONFIG_BASE);
+ SLOG(LOG_DEBUG, TAG_STTCONFIG, "Success to make directory : %s", STT_CONFIG_BASE);
}
}
if (0 != access(STT_HOME, F_OK)) {
if (0 != mkdir(STT_HOME, S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)) {
- SLOG(LOG_ERROR, stt_tag(), "[ERROR] Fail to make directory : %s", STT_HOME);
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "[ERROR] Fail to make directory : %s", STT_HOME);
__stt_config_release_client(uid);
return STT_CONFIG_ERROR_OPERATION_FAILED;
} else {
- SLOG(LOG_DEBUG, stt_tag(), "Success to make directory : %s", STT_HOME);
+ SLOG(LOG_DEBUG, TAG_STTCONFIG, "Success to make directory : %s", STT_HOME);
}
}
if (0 != access(STT_DOWNLOAD_BASE, F_OK)) {
if (0 != mkdir(STT_DOWNLOAD_BASE, S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)) {
- SLOG(LOG_ERROR, stt_tag(), "[ERROR] Fail to make directory : %s", STT_DOWNLOAD_BASE);
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "[ERROR] Fail to make directory : %s", STT_DOWNLOAD_BASE);
__stt_config_release_client(uid);
return STT_CONFIG_ERROR_OPERATION_FAILED;
} else {
- SLOG(LOG_DEBUG, stt_tag(), "Success to make directory : %s", STT_DOWNLOAD_BASE);
+ SLOG(LOG_DEBUG, TAG_STTCONFIG, "Success to make directory : %s", STT_DOWNLOAD_BASE);
}
}
if (0 != access(STT_DOWNLOAD_ENGINE_INFO, F_OK)) {
if (0 != mkdir(STT_DOWNLOAD_ENGINE_INFO, S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)) {
- SLOG(LOG_ERROR, stt_tag(), "[ERROR] Fail to make directory : %s", STT_DOWNLOAD_ENGINE_INFO);
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "[ERROR] Fail to make directory : %s", STT_DOWNLOAD_ENGINE_INFO);
__stt_config_release_client(uid);
return STT_CONFIG_ERROR_OPERATION_FAILED;
} else {
- SLOG(LOG_DEBUG, stt_tag(), "Success to make directory : %s", STT_DOWNLOAD_ENGINE_INFO);
+ SLOG(LOG_DEBUG, TAG_STTCONFIG, "Success to make directory : %s", STT_DOWNLOAD_ENGINE_INFO);
}
}
/* Get file name from default engine directory */
g_engine_list = NULL;
- SLOG(LOG_WARN, stt_tag(), "[CONFIG] default engine info(%s)", STT_DEFAULT_ENGINE_INFO);
+ SLOG(LOG_WARN, TAG_STTCONFIG, "[CONFIG] default engine info(%s)", STT_DEFAULT_ENGINE_INFO);
- SLOG(LOG_DEBUG, stt_tag(), "[CONFIG] Get default engine list");
+ SLOG(LOG_DEBUG, TAG_STTCONFIG, "[CONFIG] Get default engine list");
__get_engine_list(STT_DEFAULT_ENGINE_INFO);
- SLOG(LOG_DEBUG, stt_tag(), "[CONFIG] Get download engine list");
+ SLOG(LOG_DEBUG, TAG_STTCONFIG, "[CONFIG] Get download engine list");
__get_engine_list(STT_DOWNLOAD_ENGINE_INFO);
__stt_config_mgr_print_engine_info();
if (0 != stt_parser_load_config(&g_config_info)) {
- SLOG(LOG_ERROR, stt_tag(), "[ERROR] Fail to parse configure information");
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "[ERROR] Fail to parse configure information");
__stt_config_release_client(uid);
__stt_config_release_engine();
return STT_CONFIG_ERROR_OPERATION_FAILED;
/* Check whether engine id is valid */
if (0 != __stt_config_mgr_check_engine_is_valid(g_config_info->engine_id)) {
- SLOG(LOG_ERROR, stt_tag(), "[ERROR] Fail to get default engine");
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "[ERROR] Fail to get default engine");
__stt_config_release_client(uid);
__stt_config_release_engine();
stt_parser_unload_config(g_config_info);
/* Default language is not valid */
char* tmp_language;
if (0 != __stt_config_mgr_select_lang(g_config_info->engine_id, &tmp_language)) {
- SLOG(LOG_ERROR, stt_tag(), "[ERROR] Fail to select language");
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "[ERROR] Fail to select language");
__stt_config_release_client(uid);
__stt_config_release_engine();
stt_parser_unload_config(g_config_info);
}
/* print stt-service config */
- SLOG(LOG_DEBUG, stt_tag(), "== STT service config ==");
- 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(), " auto language : %s", g_config_info->auto_lang ? "on" : "off");
- 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");
- SLOG(LOG_DEBUG, stt_tag(), "===================");
+ SLOG(LOG_DEBUG, TAG_STTCONFIG, "== STT service config ==");
+ SLOG(LOG_DEBUG, TAG_STTCONFIG, " engine : %s", g_config_info->engine_id);
+ SLOG(LOG_DEBUG, TAG_STTCONFIG, " setting : %s", g_config_info->setting);
+ SLOG(LOG_DEBUG, TAG_STTCONFIG, " auto language : %s", g_config_info->auto_lang ? "on" : "off");
+ SLOG(LOG_DEBUG, TAG_STTCONFIG, " language : %s", g_config_info->language);
+ SLOG(LOG_DEBUG, TAG_STTCONFIG, " silence detection : %s", g_config_info->silence_detection ? "on" : "off");
+ SLOG(LOG_DEBUG, TAG_STTCONFIG, " credential : %s", g_config_info->credential ? "true" : "false");
+ SLOG(LOG_DEBUG, TAG_STTCONFIG, "===================");
if (0 != __stt_config_mgr_register_config_event()) {
- SLOG(LOG_ERROR, stt_tag(), "[ERROR] Fail to register config event");
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "[ERROR] Fail to register config event");
__stt_config_release_client(uid);
__stt_config_release_engine();
stt_parser_unload_config(g_config_info);
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"); //LCOV_EXCL_LINE
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "[ERROR] Fail to allocate memory"); //LCOV_EXCL_LINE
return STT_CONFIG_ERROR_OUT_OF_MEMORY;
}
temp_client->uid = 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)); //LCOV_EXCL_LINE
+ SLOG(LOG_DEBUG, TAG_STTCONFIG, "Client count (%d)", g_slist_length(g_config_client_list)); //LCOV_EXCL_LINE
return STT_CONFIG_ERROR_NONE;
}
int stt_config_mgr_get_engine_list(stt_config_supported_engine_cb callback, void* user_data)
{
if (0 >= g_slist_length(g_config_client_list)) {
- SLOG(LOG_ERROR, stt_tag(), "Not initialized");
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "Not initialized");
return STT_CONFIG_ERROR_INVALID_STATE;
}
stt_engine_info_s *engine_info = NULL;
if (0 >= g_slist_length(g_engine_list)) {
- SLOG(LOG_WARN, stt_tag(), "[ERROR] Engine list is NULL");
+ SLOG(LOG_WARN, TAG_STTCONFIG, "[ERROR] Engine list is NULL");
return STT_CONFIG_ERROR_ENGINE_NOT_FOUND;
}
engine_info = iter->data;
if (NULL == engine_info) {
- SLOG(LOG_ERROR, stt_tag(), " Engine info is NULL");
+ SLOG(LOG_ERROR, TAG_STTCONFIG, " Engine info is NULL");
return STT_CONFIG_ERROR_OPERATION_FAILED;
}
- if (false == callback(engine_info->uuid, engine_info->name,
+ if (false == callback(engine_info->uuid, engine_info->name,
engine_info->setting, engine_info->support_silence_detection, user_data)) {
break;
}
int stt_config_mgr_get_engine(char** engine)
{
if (0 >= g_slist_length(g_config_client_list)) {
- SLOG(LOG_ERROR, stt_tag(), "Not initialized"); //LCOV_EXCL_LINE
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "Not initialized"); //LCOV_EXCL_LINE
return STT_CONFIG_ERROR_INVALID_STATE;
}
if (NULL != g_config_info->engine_id) {
*engine = strdup(g_config_info->engine_id);
} else {
- SLOG(LOG_ERROR, stt_tag(), " Engine id is NULL"); //LCOV_EXCL_LINE
+ SLOG(LOG_ERROR, TAG_STTCONFIG, " Engine id is NULL"); //LCOV_EXCL_LINE
*engine = NULL;
return STT_CONFIG_ERROR_ENGINE_NOT_FOUND;
}
int ret = buxton_open(&bux_cli, NULL, NULL);
if (0 != ret) {
- SLOG(LOG_ERROR, stt_tag(), "[DBUS-BUXTON2] Fail to open buxton client, ret(%d)", ret);
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "[DBUS-BUXTON2] Fail to open buxton client, ret(%d)", ret);
return STT_CONFIG_ERROR_OPERATION_FAILED;
}
bux_layer = buxton_create_layer("system");
if (NULL == bux_layer) {
- SLOG(LOG_ERROR, stt_tag(), "[DBUS-BUXTON2] buxton_create_layer FAIL");
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "[DBUS-BUXTON2] buxton_create_layer FAIL");
buxton_close(bux_cli);
bux_cli = NULL;
return STT_CONFIG_ERROR_OPERATION_FAILED;
}
bux_val = buxton_value_create_string(engine);
if (NULL == bux_val) {
- SLOG(LOG_ERROR, stt_tag(), "[DBUS-BUXTON2] buxton_value_create_string FAIL");
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "[DBUS-BUXTON2] buxton_value_create_string FAIL");
buxton_free_layer(bux_layer);
buxton_close(bux_cli);
bux_layer = NULL;
bux_cli = NULL;
return STT_CONFIG_ERROR_OPERATION_FAILED;
} else {
- SLOG(LOG_DEBUG, stt_tag(), "[DBUS-BUXTON2] layer: %s", buxton_layer_get_name(bux_layer));
+ SLOG(LOG_DEBUG, TAG_STTCONFIG, "[DBUS-BUXTON2] layer: %s", buxton_layer_get_name(bux_layer));
}
ret = buxton_set_value_sync(bux_cli, bux_layer, STT_ENGINE_DB_DEFAULT, bux_val);
if (0 != ret) {
- SLOG(LOG_ERROR, stt_tag(), "[DBUS-BUXTON2] Fail to set value sync, ret(%d)", ret);
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "[DBUS-BUXTON2] Fail to set value sync, ret(%d)", ret);
buxton_value_free(bux_val);
buxton_free_layer(bux_layer);
buxton_close(bux_cli);
bux_val = NULL;
return STT_CONFIG_ERROR_OPERATION_FAILED;
}
- SLOG(LOG_DEBUG, stt_tag(), "[DBUS-BUXTON2] buxton_set_value_sync: %s", STT_ENGINE_DB_DEFAULT);
+ SLOG(LOG_DEBUG, TAG_STTCONFIG, "[DBUS-BUXTON2] buxton_set_value_sync: %s", STT_ENGINE_DB_DEFAULT);
buxton_value_free(bux_val);
buxton_free_layer(bux_layer);
int stt_config_mgr_set_engine(const char* engine)
{
if (0 >= g_slist_length(g_config_client_list)) {
- SLOG(LOG_ERROR, stt_tag(), "Not initialized");
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "Not initialized");
return STT_CONFIG_ERROR_INVALID_STATE;
}
return 0;
}
- SLOG(LOG_DEBUG, stt_tag(), "New engine id : %s", engine);
+ SLOG(LOG_DEBUG, TAG_STTCONFIG, "New engine id : %s", engine);
int ret = __stt_config_set_buxtonkey(engine);
if (0 != ret) {
- SLOG(LOG_ERROR, stt_tag(), "[ERROR] set buxtonkey Failed!!!");
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "[ERROR] set buxtonkey Failed!!!");
return ret;
}
engine_info = iter->data;
if (NULL == engine_info) {
- SLOG(LOG_ERROR, stt_tag(), "[ERROR] Engine info is NULL");
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "[ERROR] Engine info is NULL");
iter = g_slist_next(iter);
continue;
}
/*Get handle data from list*/
lang = iter_lang->data;
- SLOG(LOG_DEBUG, stt_tag(), " %s", lang);
+ SLOG(LOG_DEBUG, TAG_STTCONFIG, " %s", lang);
if (NULL != lang && NULL != g_config_info->language) {
if (0 == strcmp(lang, g_config_info->language)) {
/* language is valid */
iter_lang = g_slist_nth(engine_info->languages, 0);
if (NULL == iter_lang) {
- SLOG(LOG_ERROR, stt_tag(), "Fail to get default language");
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "Fail to get default language");
break;
}
}
if (true == is_valid_engine) {
- 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");
+ SLOG(LOG_DEBUG, TAG_STTCONFIG, "[Config] Engine changed");
+ SLOG(LOG_DEBUG, TAG_STTCONFIG, " Engine : %s", g_config_info->engine_id);
+ SLOG(LOG_DEBUG, TAG_STTCONFIG, " Setting : %s", g_config_info->setting);
+ SLOG(LOG_DEBUG, TAG_STTCONFIG, " language : %s", g_config_info->language);
+ SLOG(LOG_DEBUG, TAG_STTCONFIG, " Silence detection : %s", g_config_info->silence_detection ? "on" : "off");
+ SLOG(LOG_DEBUG, TAG_STTCONFIG, " Credential : %s", g_config_info->credential ? "true" : "false");
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, TAG_STTCONFIG, " Fail to save config");
return STT_CONFIG_ERROR_OPERATION_FAILED;
}
} else {
- SLOG(LOG_ERROR, stt_tag(), "[ERROR] Engine id is not valid");
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "[ERROR] Engine id is not valid");
return STT_CONFIG_ERROR_INVALID_PARAMETER;
}
int stt_config_mgr_get_engine_agreement(const char* engine, char** agreement)
{
if (0 >= g_slist_length(g_engine_list)) {
- SLOG(LOG_ERROR, stt_tag(), "There is no engine");
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "There is no engine");
return STT_CONFIG_ERROR_INVALID_STATE;
}
if (NULL == agreement) {
- SLOG(LOG_ERROR, stt_tag(), "Input parameter is NULL");
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "Input parameter is NULL");
return STT_CONFIG_ERROR_INVALID_PARAMETER;
}
if (NULL == engine) {
current_engine = strdup(g_config_info->engine_id);
if (NULL == current_engine) {
- SLOG(LOG_ERROR, stt_tag(), "[ERROR] Fail to allocate memory");
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "[ERROR] Fail to allocate memory");
return STT_CONFIG_ERROR_OUT_OF_MEMORY;;
}
} else {
current_engine = strdup(engine);
if (NULL == current_engine) {
- SLOG(LOG_ERROR, stt_tag(), "[ERROR] Fail to allocate memory");
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "[ERROR] Fail to allocate memory");
return STT_CONFIG_ERROR_OUT_OF_MEMORY;;
}
}
engine_info = iter->data;
if (NULL == engine_info) {
- SLOG(LOG_ERROR, stt_tag(), "[ERROR] engine info is NULL");
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "[ERROR] engine info is NULL");
if (NULL != current_engine) free(current_engine);
return STT_CONFIG_ERROR_OPERATION_FAILED;
}
if (NULL != engine_info->agreement) {
*agreement = strdup(engine_info->agreement);
} else {
- SLOG(LOG_WARN, stt_tag(), "[WARNING] engine agreement is not support");
+ SLOG(LOG_WARN, TAG_STTCONFIG, "[WARNING] engine agreement is not support");
}
break;
}
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"); //LCOV_EXCL_LINE
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "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"); //LCOV_EXCL_LINE
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "There is no engine"); //LCOV_EXCL_LINE
return STT_CONFIG_ERROR_ENGINE_NOT_FOUND;
}
engine_info = iter->data;
if (NULL == engine_info) {
- SLOG(LOG_ERROR, stt_tag(), "[ERROR] engine info is NULL"); //LCOV_EXCL_LINE
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "[ERROR] engine info is NULL"); //LCOV_EXCL_LINE
return STT_CONFIG_ERROR_OPERATION_FAILED;
}
lang = iter_lang->data;
if (NULL != lang) {
- SLOG(LOG_DEBUG, stt_tag(), " %s", lang);
+ SLOG(LOG_DEBUG, TAG_STTCONFIG, " %s", lang);
if (false == callback(engine_info->uuid, lang, user_data))
break;
}
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"); //LCOV_EXCL_LINE
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "Not initialized"); //LCOV_EXCL_LINE
return STT_CONFIG_ERROR_INVALID_STATE;
}
if (NULL != g_config_info->language) {
*language = strdup(g_config_info->language);
} else {
- SLOG(LOG_ERROR, stt_tag(), " language is NULL"); //LCOV_EXCL_LINE
+ SLOG(LOG_ERROR, TAG_STTCONFIG, " language is NULL"); //LCOV_EXCL_LINE
return STT_CONFIG_ERROR_OPERATION_FAILED;
}
int stt_config_mgr_set_default_language(const char* language)
{
if (0 >= g_slist_length(g_config_client_list)) {
- SLOG(LOG_ERROR, stt_tag(), "Not initialized");
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "Not initialized");
return STT_CONFIG_ERROR_INVALID_STATE;
}
/* Check language is valid */
if (NULL != g_config_info->language) {
if (0 != stt_parser_set_language(language)) {
- SLOG(LOG_ERROR, stt_tag(), "Fail to save engine id");
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "Fail to save engine id");
return STT_CONFIG_ERROR_OPERATION_FAILED;
}
free(g_config_info->language);
g_config_info->language = strdup(language);
} else {
- SLOG(LOG_ERROR, stt_tag(), " language is NULL");
+ SLOG(LOG_ERROR, TAG_STTCONFIG, " language is NULL");
return STT_CONFIG_ERROR_OPERATION_FAILED;
}
int stt_config_mgr_get_auto_language(bool* value)
{
if (0 >= g_slist_length(g_config_client_list)) {
- SLOG(LOG_ERROR, stt_tag(), "Not initialized");
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "Not initialized");
return STT_CONFIG_ERROR_INVALID_STATE;
}
int stt_config_mgr_set_auto_language(bool value)
{
if (0 >= g_slist_length(g_config_client_list)) {
- SLOG(LOG_ERROR, stt_tag(), "Not initialized");
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "Not initialized");
return STT_CONFIG_ERROR_INVALID_STATE;
}
if (g_config_info->auto_lang != value) {
/* Check language is valid */
if (0 != stt_parser_set_auto_lang(value)) {
- SLOG(LOG_ERROR, stt_tag(), "Fail to save engine id");
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "Fail to save engine id");
return STT_CONFIG_ERROR_OPERATION_FAILED;
}
g_config_info->auto_lang = value;
int stt_config_mgr_get_silence_detection(bool* value)
{
if (0 >= g_slist_length(g_config_client_list)) {
- SLOG(LOG_ERROR, stt_tag(), "Not initialized");
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "Not initialized");
return STT_CONFIG_ERROR_INVALID_STATE;
}
int stt_config_mgr_set_silence_detection(bool value)
{
if (0 >= g_slist_length(g_config_client_list)) {
- SLOG(LOG_ERROR, stt_tag(), "Not initialized");
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "Not initialized");
return STT_CONFIG_ERROR_INVALID_STATE;
}
if (0 != stt_parser_set_silence_detection(value)) {
- SLOG(LOG_ERROR, stt_tag(), "Fail to save engine id");
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "Fail to save engine id");
return STT_CONFIG_ERROR_OPERATION_FAILED;
}
bool stt_config_check_default_engine_is_valid(const char* engine)
{
if (0 >= g_slist_length(g_config_client_list)) {
- SLOG(LOG_ERROR, stt_tag(), "Not initialized");
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "Not initialized");
return false;
}
bool stt_config_check_default_language_is_valid(const char* language)
{
if (0 >= g_slist_length(g_config_client_list)) {
- SLOG(LOG_ERROR, stt_tag(), "Not initialized");
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "Not initialized");
return false;
}
}
if (NULL == g_config_info->engine_id) {
- SLOG(LOG_ERROR, stt_tag(), "[ERROR] Default engine id is NULL");
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "[ERROR] Default engine id is NULL");
return false;
}
engine_info = iter->data;
if (NULL == engine_info) {
- SLOG(LOG_ERROR, stt_tag(), "[ERROR] Engine info is NULL");
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "[ERROR] Engine info is NULL");
iter = g_slist_next(iter);
continue;
}
stt_engine_info_s *engine_info = NULL;
if (0 >= g_slist_length(g_engine_list)) {
- 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
+ SLOG(LOG_DEBUG, TAG_STTCONFIG, "-------------- engine list -----------------"); //LCOV_EXCL_LINE
+ SLOG(LOG_DEBUG, TAG_STTCONFIG, " No Engine in engine directory"); //LCOV_EXCL_LINE
+ SLOG(LOG_DEBUG, TAG_STTCONFIG, "--------------------------------------------"); //LCOV_EXCL_LINE
return 0;
}
/* Get a first item */
iter = g_slist_nth(g_engine_list, 0);
- SLOG(LOG_DEBUG, stt_tag(), "--------------- engine list -----------------");
+ SLOG(LOG_DEBUG, TAG_STTCONFIG, "--------------- engine list -----------------");
int i = 1;
while (NULL != iter) {
engine_info = iter->data;
- SLOG(LOG_DEBUG, stt_tag(), "[%dth]", i);
- SLOG(LOG_DEBUG, stt_tag(), " name : %s", engine_info->name);
- SLOG(LOG_DEBUG, stt_tag(), " id : %s", engine_info->uuid);
- SLOG(LOG_DEBUG, stt_tag(), " setting : %s", engine_info->setting);
- SLOG(LOG_DEBUG, stt_tag(), " agreement : %s", engine_info->agreement);
+ SLOG(LOG_DEBUG, TAG_STTCONFIG, "[%dth]", i);
+ SLOG(LOG_DEBUG, TAG_STTCONFIG, " name : %s", engine_info->name);
+ SLOG(LOG_DEBUG, TAG_STTCONFIG, " id : %s", engine_info->uuid);
+ SLOG(LOG_DEBUG, TAG_STTCONFIG, " setting : %s", engine_info->setting);
+ SLOG(LOG_DEBUG, TAG_STTCONFIG, " agreement : %s", engine_info->agreement);
- SLOG(LOG_DEBUG, stt_tag(), " languages");
+ SLOG(LOG_DEBUG, TAG_STTCONFIG, " languages");
GSList *iter_lang = NULL;
char* lang;
if (g_slist_length(engine_info->languages) > 0) {
/*Get handle data from list*/
lang = iter_lang->data;
- SLOG(LOG_DEBUG, stt_tag(), " [%dth] %s", j, lang);
+ SLOG(LOG_DEBUG, TAG_STTCONFIG, " [%dth] %s", j, lang);
/*Get next item*/
iter_lang = g_slist_next(iter_lang);
j++;
}
} else {
- SLOG(LOG_ERROR, stt_tag(), " language is NONE"); //LCOV_EXCL_LINE
+ SLOG(LOG_ERROR, TAG_STTCONFIG, " language is NONE"); //LCOV_EXCL_LINE
}
- SLOG(LOG_DEBUG, stt_tag(), " silence support : %s",
+ SLOG(LOG_DEBUG, TAG_STTCONFIG, " silence support : %s",
engine_info->support_silence_detection ? "true" : "false");
iter = g_slist_next(iter);
i++;
}
- SLOG(LOG_DEBUG, stt_tag(), "--------------------------------------------");
+ SLOG(LOG_DEBUG, TAG_STTCONFIG, "--------------------------------------------");
return 0;
}
int stt_config_mgr_add_time_info(int index, int event, const char* text, long start_time, long end_time)
{
if (NULL == text) {
- SLOG(LOG_ERROR, stt_tag(), "Invalid parameter : text is NULL");
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "Invalid parameter : text is NULL");
return -1;
}
stt_result_time_info_s *info = (stt_result_time_info_s*)calloc(1, sizeof(stt_result_time_info_s));
if (NULL == info) {
- SLOG(LOG_ERROR, stt_tag(), "[ERROR] Fail to allocate memory");
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "[ERROR] Fail to allocate memory");
return STT_CONFIG_ERROR_OUT_OF_MEMORY;
}
info->index = index;
info->start_time = start_time;
info->end_time = end_time;
- SECURE_SLOG(LOG_DEBUG, stt_tag(), "[DEBUG] inside stt_config_mgr_add_time_info: index(%d), text(%s), start time(%ld), end_time(%ld)", info->index, (NULL == info->text) ? "NULL" : info->text, info->start_time, info->end_time);
+ SECURE_SLOG(LOG_DEBUG, TAG_STTCONFIG, "[DEBUG] inside stt_config_mgr_add_time_info: index(%d), text(%s), start time(%ld), end_time(%ld)", info->index, (NULL == info->text) ? "NULL" : info->text, info->start_time, info->end_time);
/* Add item to global list */
g_time_list = g_slist_append(g_time_list, info);
- SLOG(LOG_DEBUG, stt_tag(), "[DEBUG] inside stt_config_mgr_add_time_info: g_time_list length(%d)", g_slist_length(g_time_list));
+ SLOG(LOG_DEBUG, TAG_STTCONFIG, "[DEBUG] inside stt_config_mgr_add_time_info: g_time_list length(%d)", g_slist_length(g_time_list));
return 0;
}
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 parameter is NULL : callback function"); //LCOV_EXCL_LINE
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "[ERROR] Input parameter is NULL : callback function"); //LCOV_EXCL_LINE
return STT_CONFIG_ERROR_INVALID_PARAMETER;
}
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); //LCOV_EXCL_LINE
+ SLOG(LOG_WARN, TAG_STTCONFIG, "[WARNING] Fail to get time info : %d", ret); //LCOV_EXCL_LINE
return STT_CONFIG_ERROR_NONE;
}
while (NULL != iter) {
data = iter->data;
- if (false == callback(data->index, data->event, data->text,
+ if (false == callback(data->index, data->event, data->text,
data->start_time, data->end_time, user_data)) {
break;
}
int stt_config_mgr_save_time_info_file()
{
if (0 == g_slist_length(g_time_list)) {
- SLOG(LOG_WARN, stt_tag(), "[WARNING] There is no time info to save");
+ SLOG(LOG_WARN, TAG_STTCONFIG, "[WARNING] There is no time info to save");
return STT_CONFIG_ERROR_OPERATION_FAILED;
}
int ret = 0;
ret = stt_parser_set_time_info(g_time_list);
if (0 != ret) {
- SLOG(LOG_ERROR, stt_tag(), "[ERROR] Fail to save time info : %d", ret);
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "[ERROR] Fail to save time info : %d", ret);
return STT_CONFIG_ERROR_OPERATION_FAILED;
}
#define STT_TAG_TIME_START "start"
#define STT_TAG_TIME_END "end"
-extern const char* stt_tag();
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"); //LCOV_EXCL_LINE
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "[ERROR] Input parameter is NULL"); //LCOV_EXCL_LINE
return -1;
}
cur = xmlDocGetRootElement(doc);
if (cur == NULL) {
//LCOV_EXCL_START
- SLOG(LOG_ERROR, stt_tag(), "[ERROR] Empty document");
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "[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'");
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "[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");
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "[ERROR] Empty document");
xmlFreeDoc(doc);
return -1;
//LCOV_EXCL_STOP
if (NULL == temp) {
//LCOV_EXCL_START
xmlFreeDoc(doc);
- SLOG(LOG_ERROR, stt_tag(), "[ERROR] Fail to allocate memory");
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "[ERROR] Fail to allocate memory");
return -1;
//LCOV_EXCL_STOP
}
if (0 == xmlStrcmp(cur->name, (const xmlChar *)STT_TAG_ENGINE_NAME)) {
key = xmlNodeGetContent(cur);
if (NULL != key) {
- /* SLOG(LOG_DEBUG, stt_tag(), "Engine name : %s", (char *)key); */
+ /* SLOG(LOG_DEBUG, TAG_STTCONFIG, "Engine name : %s", (char *)key); */
if (NULL != temp->name) free(temp->name);
temp->name = strdup((char*)key);
xmlFree(key);
} else {
- SLOG(LOG_ERROR, stt_tag(), "[ERROR] <%s> has no content", STT_TAG_ENGINE_NAME); //LCOV_EXCL_LINE
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "[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);
if (NULL != key) {
- /* SLOG(LOG_DEBUG, stt_tag(), "Engine uuid : %s", (char *)key); */
+ /* SLOG(LOG_DEBUG, TAG_STTCONFIG, "Engine uuid : %s", (char *)key); */
if (NULL != temp->uuid) free(temp->uuid);
temp->uuid = strdup((char*)key);
xmlFree(key);
} else {
- SLOG(LOG_ERROR, stt_tag(), "[ERROR] <%s> has no content", STT_TAG_ENGINE_ID); //LCOV_EXCL_LINE
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "[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);
if (NULL != key) {
- SLOG(LOG_DEBUG, stt_tag(), "Engine setting : %s", (char *)key);
+ SLOG(LOG_DEBUG, TAG_STTCONFIG, "Engine setting : %s", (char *)key);
if (NULL != temp->setting) free(temp->setting);
temp->setting = strdup((char*)key);
xmlFree(key);
} else {
- SLOG(LOG_ERROR, stt_tag(), "[ERROR] <%s> has no content", STT_TAG_ENGINE_SETTING); //LCOV_EXCL_LINE
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "[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);
if (NULL != key) {
- SLOG(LOG_DEBUG, stt_tag(), "Engine agreement : %s", (char *)key);
+ SLOG(LOG_DEBUG, TAG_STTCONFIG, "Engine agreement : %s", (char *)key);
if (NULL != temp->agreement) free(temp->agreement);
temp->agreement = strdup((char*)key);
xmlFree(key);
} else {
- SLOG(LOG_ERROR, stt_tag(), "[ERROR] <%s> has no content", STT_TAG_ENGINE_AGREEMENT); //LCOV_EXCL_LINE
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "[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);
if (NULL != key) {
- SLOG(LOG_DEBUG, stt_tag(), "Engine agreement : %s", (char *)key);
+ SLOG(LOG_DEBUG, TAG_STTCONFIG, "Engine agreement : %s", (char *)key);
if (NULL != temp->default_lang) free(temp->default_lang);
temp->default_lang = strdup((char*)key);
is_default_lang_set = true;
xmlFree(key);
} else {
- SLOG(LOG_ERROR, stt_tag(), "[ERROR] <%s> has no content", STT_TAG_ENGINE_DEFAULT);
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "[ERROR] <%s> has no content", STT_TAG_ENGINE_DEFAULT);
}
} else if (0 == xmlStrcmp(cur->name, (const xmlChar *)STT_TAG_ENGINE_LANGUAGE_SET)) {
xmlNodePtr lang_node = NULL;
if (0 == xmlStrcmp(lang_node->name, (const xmlChar *)STT_TAG_ENGINE_LANGUAGE)) {
key = xmlNodeGetContent(lang_node);
if (NULL != key) {
- /* SLOG(LOG_DEBUG, stt_tag(), "language : %s", (char *)key); */
+ /* SLOG(LOG_DEBUG, TAG_STTCONFIG, "language : %s", (char *)key); */
temp_lang = strdup((char*)key);
temp->languages = g_slist_append(temp->languages, temp_lang);
}
xmlFree(key);
} else {
- SLOG(LOG_ERROR, stt_tag(), "[ERROR] <%s> has no content", STT_TAG_ENGINE_LANGUAGE); //LCOV_EXCL_LINE
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "[ERROR] <%s> has no content", STT_TAG_ENGINE_LANGUAGE); //LCOV_EXCL_LINE
}
}
} else if (0 == xmlStrcmp(cur->name, (const xmlChar *)STT_TAG_ENGINE_SILENCE_SUPPORT)) {
key = xmlNodeGetContent(cur);
if (NULL != key) {
- /*SLOG(LOG_DEBUG, stt_tag(), "silence-detection-support : %s", (char *)key); */
+ /*SLOG(LOG_DEBUG, TAG_STTCONFIG, "silence-detection-support : %s", (char *)key); */
if (0 == xmlStrcmp(key, (const xmlChar *)"true"))
temp->support_silence_detection = true;
xmlFree(key);
} else {
- SLOG(LOG_ERROR, stt_tag(), "[ERROR] <%s> has no content", STT_TAG_ENGINE_SILENCE_SUPPORT); //LCOV_EXCL_LINE
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "[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);
if (NULL != key) {
- //SLOG(LOG_DEBUG, stt_tag(), "app-credential-need : %s", (char *)key);
+ //SLOG(LOG_DEBUG, TAG_STTCONFIG, "app-credential-need : %s", (char *)key);
if (0 == xmlStrcmp(key, (const xmlChar *)"true"))
temp->need_credential = true;
xmlFree(key);
} else {
- SLOG(LOG_ERROR, stt_tag(), "[ERROR] <%s> has no content", STT_TAG_ENGINE_CREDENTIAL_NEED);
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "[ERROR] <%s> has no content", STT_TAG_ENGINE_CREDENTIAL_NEED);
}
} else {
if (NULL == temp->name || NULL == temp->uuid) {
/* Invalid engine */
- SLOG(LOG_ERROR, stt_tag(), "[ERROR] Invalid engine : %s", path);
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "[ERROR] Invalid engine : %s", path);
stt_parser_free_engine_info(temp);
return -1;
}
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"); //LCOV_EXCL_LINE
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "[ERROR] Input parameter is NULL"); //LCOV_EXCL_LINE
return -1;
}
if (NULL == engine_info)
return -1;
- SLOG(LOG_DEBUG, stt_tag(), "== get engine info ==");
- SLOG(LOG_DEBUG, stt_tag(), " name : %s", engine_info->name);
- SLOG(LOG_DEBUG, stt_tag(), " id : %s", engine_info->uuid);
- if (NULL != engine_info->setting) SLOG(LOG_DEBUG, stt_tag(), " setting : %s", engine_info->setting);
+ SLOG(LOG_DEBUG, TAG_STTCONFIG, "== get engine info ==");
+ SLOG(LOG_DEBUG, TAG_STTCONFIG, " name : %s", engine_info->name);
+ SLOG(LOG_DEBUG, TAG_STTCONFIG, " id : %s", engine_info->uuid);
+ if (NULL != engine_info->setting) SLOG(LOG_DEBUG, TAG_STTCONFIG, " setting : %s", engine_info->setting);
- SLOG(LOG_DEBUG, stt_tag(), " languages");
+ SLOG(LOG_DEBUG, TAG_STTCONFIG, " languages");
GSList *iter = NULL;
char* lang;
if (g_slist_length(engine_info->languages) > 0) {
/*Get handle data from list*/
lang = iter->data;
- SLOG(LOG_DEBUG, stt_tag(), " [%dth] %s", i, lang);
+ SLOG(LOG_DEBUG, TAG_STTCONFIG, " [%dth] %s", i, lang);
/*Get next item*/
iter = g_slist_next(iter);
i++;
}
} else {
- SLOG(LOG_ERROR, stt_tag(), " language is NONE");
+ SLOG(LOG_ERROR, TAG_STTCONFIG, " language is NONE");
}
- SLOG(LOG_DEBUG, stt_tag(), " silence support : %s", engine_info->support_silence_detection ? "true" : "false");
- SLOG(LOG_DEBUG, stt_tag(), " credential need : %s", engine_info->need_credential ? "true" : "false");
- SLOG(LOG_DEBUG, stt_tag(), "=====================");
+ SLOG(LOG_DEBUG, TAG_STTCONFIG, " silence support : %s", engine_info->support_silence_detection ? "true" : "false");
+ SLOG(LOG_DEBUG, TAG_STTCONFIG, " credential need : %s", engine_info->need_credential ? "true" : "false");
+ SLOG(LOG_DEBUG, TAG_STTCONFIG, "=====================");
return 0;
}
int stt_parser_load_config(stt_config_s** config_info)
{
if (NULL == config_info) {
- SLOG(LOG_ERROR, stt_tag(), "[ERROR] Input parameter is NULL"); //LCOV_EXCL_LINE
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "[ERROR] Input parameter is NULL"); //LCOV_EXCL_LINE
return -1;
}
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); //LCOV_EXCL_LINE
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "[ERROR] Fail to parse file error : %s", STT_DEFAULT_CONFIG); //LCOV_EXCL_LINE
xmlCleanupParser();
return -1;
}
usleep(10000);
if (STT_RETRY_COUNT == retry_count) {
- SLOG(LOG_ERROR, stt_tag(), "[ERROR] Fail to parse file error : %s", STT_CONFIG);
- SLOG(LOG_ERROR, stt_tag(), "[ERROR] Remove the file");
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "[ERROR] Fail to parse file error : %s", STT_CONFIG);
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "[ERROR] Remove the file");
remove(STT_CONFIG);
doc = xmlParseFile(STT_DEFAULT_CONFIG);
if (NULL == doc) {
- SLOG(LOG_ERROR, stt_tag(), "[ERROR] Fail to parse file error : %s", STT_DEFAULT_CONFIG);
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "[ERROR] Fail to parse file error : %s", STT_DEFAULT_CONFIG);
xmlCleanupParser();
return -1;
}
cur = xmlDocGetRootElement(doc);
if (cur == NULL) {
- SLOG(LOG_ERROR, stt_tag(), "[ERROR] Empty document"); //LCOV_EXCL_LINE
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "[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); //LCOV_EXCL_LINE
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "[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"); //LCOV_EXCL_LINE
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "[ERROR] Empty document"); //LCOV_EXCL_LINE
xmlFreeDoc(doc);
return -1;
}
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"); //LCOV_EXCL_LINE
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "[ERROR] Fail to allocate memory"); //LCOV_EXCL_LINE
return -1;
}
if (0 == xmlStrcmp(cur->name, (const xmlChar *)STT_TAG_CONFIG_ENGINE_ID)) {
key = xmlNodeGetContent(cur);
if (NULL != key) {
- /*SLOG(LOG_DEBUG, stt_tag(), "Engine id : %s", (char *)key); */
+ /*SLOG(LOG_DEBUG, TAG_STTCONFIG, "Engine id : %s", (char *)key); */
if (NULL != temp->engine_id) free(temp->engine_id);
temp->engine_id = strdup((char*)key);
xmlFree(key);
} else {
- SLOG(LOG_ERROR, stt_tag(), "[ERROR] engine id is NULL"); //LCOV_EXCL_LINE
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "[ERROR] engine id is NULL"); //LCOV_EXCL_LINE
}
} else if (0 == xmlStrcmp(cur->name, (const xmlChar *)STT_TAG_CONFIG_ENGINE_SETTING)) {
key = xmlNodeGetContent(cur);
if (NULL != key) {
- /*SLOG(LOG_DEBUG, stt_tag(), "Setting path : %s", (char *)key); */
+ /*SLOG(LOG_DEBUG, TAG_STTCONFIG, "Setting path : %s", (char *)key); */
if (NULL != temp->setting) free(temp->setting);
temp->setting = strdup((char*)key);
xmlFree(key);
} else {
- SLOG(LOG_ERROR, stt_tag(), "[ERROR] setting path is NULL"); //LCOV_EXCL_LINE
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "[ERROR] setting path is NULL"); //LCOV_EXCL_LINE
}
} else if (0 == xmlStrcmp(cur->name, (const xmlChar *)STT_TAG_CONFIG_AUTO_LANGUAGE)) {
key = xmlNodeGetContent(cur);
if (NULL != key) {
- /*SLOG(LOG_DEBUG, stt_tag(), "Auto language : %s", (char *)key); */
+ /*SLOG(LOG_DEBUG, TAG_STTCONFIG, "Auto language : %s", (char *)key); */
if (0 == xmlStrcmp(key, (const xmlChar *)"on")) {
temp->auto_lang = true;
} else if (0 == xmlStrcmp(key, (const xmlChar *)"off")) {
temp->auto_lang = false;
} else {
- SLOG(LOG_ERROR, stt_tag(), "Auto voice is wrong"); //LCOV_EXCL_LINE
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "Auto voice is wrong"); //LCOV_EXCL_LINE
temp->auto_lang = true;
}
xmlFree(key);
} else {
- SLOG(LOG_ERROR, stt_tag(), "[ERROR] auto language is NULL"); //LCOV_EXCL_LINE
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "[ERROR] auto language is NULL"); //LCOV_EXCL_LINE
}
} else if (0 == xmlStrcmp(cur->name, (const xmlChar *)STT_TAG_CONFIG_LANGUAGE)) {
key = xmlNodeGetContent(cur);
if (NULL != key) {
- /*SLOG(LOG_DEBUG, stt_tag(), "language : %s", (char *)key); */
+ /*SLOG(LOG_DEBUG, TAG_STTCONFIG, "language : %s", (char *)key); */
if (NULL != temp->language) free(temp->language);
temp->language = strdup((char*)key);
xmlFree(key);
} else {
- SLOG(LOG_ERROR, stt_tag(), "[ERROR] language is NULL"); //LCOV_EXCL_LINE
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "[ERROR] language is NULL"); //LCOV_EXCL_LINE
}
} else if (0 == xmlStrcmp(cur->name, (const xmlChar *)STT_TAG_CONFIG_SILENCE_DETECTION)) {
key = xmlNodeGetContent(cur);
if (NULL != key) {
- /*SLOG(LOG_DEBUG, stt_tag(), "silence-detection : %s", (char *)key); */
+ /*SLOG(LOG_DEBUG, TAG_STTCONFIG, "silence-detection : %s", (char *)key); */
if (0 == xmlStrcmp(key, (const xmlChar *)"on"))
temp->silence_detection = true;
xmlFree(key);
} else {
- SLOG(LOG_ERROR, stt_tag(), "[ERROR] silence-detection is NULL"); //LCOV_EXCL_LINE
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "[ERROR] silence-detection is NULL"); //LCOV_EXCL_LINE
}
} else if (0 == xmlStrcmp(cur->name, (const xmlChar *)STT_TAG_CONFIG_CREDENTIAL)) {
key = xmlNodeGetContent(cur);
if (NULL != key) {
- //SLOG(LOG_DEBUG, stt_tag(), "credential : %s", (char *)key);
+ //SLOG(LOG_DEBUG, TAG_STTCONFIG, "credential : %s", (char *)key);
if (0 == xmlStrcmp(key, (const xmlChar *)"true"))
temp->credential = true;
xmlFree(key);
} else {
- SLOG(LOG_ERROR, stt_tag(), "[ERROR] credential is NULL"); //LCOV_EXCL_LINE
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "[ERROR] credential is NULL"); //LCOV_EXCL_LINE
}
} else {
usleep(10000);
if (STT_RETRY_COUNT == retry_count) {
- SLOG(LOG_ERROR, stt_tag(), "[ERROR] Save result : %d", ret);
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "[ERROR] Save result : %d", ret);
return -1;
}
} while (0 != ret);
/* Set mode */
if (0 > chmod(STT_CONFIG, 0600)) {
- SLOG(LOG_ERROR, stt_tag(), "[ERROR] Fail to change file mode : %d", ret);
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "[ERROR] Fail to change file mode : %d", ret);
}
/* Set owner */
if (0 > chown(STT_CONFIG, 5000, 5000)) {
- SLOG(LOG_ERROR, stt_tag(), "[ERROR] Fail to change file owner : %d", ret);
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "[ERROR] Fail to change file owner : %d", ret);
}
- SLOG(LOG_DEBUG, stt_tag(), "Default config is changed : pid(%d)", getpid());
+ SLOG(LOG_DEBUG, TAG_STTCONFIG, "Default config is changed : pid(%d)", getpid());
}
return 0;
xmlNodePtr cur = NULL;
cur = xmlDocGetRootElement(g_config_doc);
if (cur == NULL) {
- SLOG(LOG_ERROR, stt_tag(), "[ERROR] Empty document");
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "[ERROR] Empty document");
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, TAG_STTCONFIG, "[ERROR] The wrong type, root node is NOT %s", STT_TAG_CONFIG_BASE_TAG);
return -1;
}
cur = cur->xmlChildrenNode;
if (cur == NULL) {
- SLOG(LOG_ERROR, stt_tag(), "[ERROR] Empty document");
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "[ERROR] Empty document");
return -1;
}
}
int ret = xmlSaveFile(STT_CONFIG, g_config_doc);
- SLOG(LOG_DEBUG, stt_tag(), "Save result : %d", ret);
+ SLOG(LOG_DEBUG, TAG_STTCONFIG, "Save result : %d", ret);
return 0;
}
xmlNodePtr cur = NULL;
cur = xmlDocGetRootElement(g_config_doc);
if (cur == NULL) {
- SLOG(LOG_ERROR, stt_tag(), "[ERROR] Empty document");
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "[ERROR] Empty document");
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, TAG_STTCONFIG, "[ERROR] The wrong type, root node is NOT %s", STT_TAG_CONFIG_BASE_TAG);
return -1;
}
cur = cur->xmlChildrenNode;
if (cur == NULL) {
- SLOG(LOG_ERROR, stt_tag(), "[ERROR] Empty document");
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "[ERROR] Empty document");
return -1;
}
}
int ret = xmlSaveFile(STT_CONFIG, g_config_doc);
- SLOG(LOG_DEBUG, stt_tag(), "Save result : %d", ret);
+ SLOG(LOG_DEBUG, TAG_STTCONFIG, "Save result : %d", ret);
return 0;
xmlNodePtr cur = NULL;
cur = xmlDocGetRootElement(g_config_doc);
if (cur == NULL) {
- SLOG(LOG_ERROR, stt_tag(), "[ERROR] Empty document");
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "[ERROR] Empty document");
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, TAG_STTCONFIG, "[ERROR] The wrong type, root node is NOT %s", STT_TAG_CONFIG_BASE_TAG);
return -1;
}
cur = cur->xmlChildrenNode;
if (cur == NULL) {
- SLOG(LOG_ERROR, stt_tag(), "[ERROR] Empty document");
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "[ERROR] Empty document");
return -1;
}
} else if (false == value) {
xmlNodeSetContent(cur, (const xmlChar *)"off");
} else {
- SLOG(LOG_ERROR, stt_tag(), "[ERROR] The wrong value of auto voice");
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "[ERROR] The wrong value of auto voice");
return -1;
}
break;
}
int ret = xmlSaveFile(STT_CONFIG, g_config_doc);
- SLOG(LOG_DEBUG, stt_tag(), "Save result : %d", ret);
+ SLOG(LOG_DEBUG, TAG_STTCONFIG, "Save result : %d", ret);
return 0;
}
xmlNodePtr cur = NULL;
cur = xmlDocGetRootElement(g_config_doc);
if (cur == NULL) {
- SLOG(LOG_ERROR, stt_tag(), "[ERROR] Empty document");
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "[ERROR] Empty document");
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, TAG_STTCONFIG, "[ERROR] The wrong type, root node is NOT %s", STT_TAG_CONFIG_BASE_TAG);
return -1;
}
cur = cur->xmlChildrenNode;
if (cur == NULL) {
- SLOG(LOG_ERROR, stt_tag(), "[ERROR] Empty document");
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "[ERROR] Empty document");
return -1;
}
}
int ret = xmlSaveFile(STT_CONFIG, g_config_doc);
- SLOG(LOG_DEBUG, stt_tag(), "Save result : %d", ret);
+ SLOG(LOG_DEBUG, TAG_STTCONFIG, "Save result : %d", ret);
return 0;
}
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"); //LCOV_EXCL_LINE
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "[ERROR] Input parameter is NULL"); //LCOV_EXCL_LINE
return -1;
}
doc = xmlParseFile(STT_CONFIG);
if (doc == NULL) {
- SLOG(LOG_ERROR, stt_tag(), "[ERROR] Fail to parse file error : %s", STT_CONFIG);
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "[ERROR] Fail to parse file error : %s", STT_CONFIG);
return -1;
}
cur_old = xmlDocGetRootElement(g_config_doc);
if (cur_new == NULL || cur_old == NULL) {
//LCOV_EXCL_START
- SLOG(LOG_ERROR, stt_tag(), "[ERROR] Empty document");
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "[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);
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "[ERROR] The wrong type, root node is NOT %s", STT_TAG_CONFIG_BASE_TAG);
xmlFreeDoc(doc);
return -1;
//LCOV_EXCL_STOP
cur_old = cur_old->xmlChildrenNode;
if (cur_new == NULL || cur_old == NULL) {
//LCOV_EXCL_START
- SLOG(LOG_ERROR, stt_tag(), "[ERROR] Empty document");
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "[ERROR] Empty document");
xmlFreeDoc(doc);
return -1;
//LCOV_EXCL_STOP
key_new = xmlNodeGetContent(cur_new);
if (NULL != key_new) {
if (0 != xmlStrcmp(key_old, key_new)) {
- SLOG(LOG_DEBUG, stt_tag(), "Old engine id(%s), New engine(%s)", (char*)key_old, (char*)key_new);
+ SLOG(LOG_DEBUG, TAG_STTCONFIG, "Old engine id(%s), New engine(%s)", (char*)key_old, (char*)key_new);
if (NULL != *engine) free(*engine);
*engine = strdup((char*)key_new);
}
xmlFree(key_old);
}
} else {
- SLOG(LOG_ERROR, stt_tag(), "[ERROR] Old config and new config are different"); //LCOV_EXCL_LINE
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "[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)) {
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); //LCOV_EXCL_LINE
+ SLOG(LOG_DEBUG, TAG_STTCONFIG, "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);
}
xmlFree(key_old);
}
} else {
- SLOG(LOG_ERROR, stt_tag(), "[ERROR] Old config and new config are different"); //LCOV_EXCL_LINE
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "[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)) {
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); //LCOV_EXCL_LINE
+ SLOG(LOG_DEBUG, TAG_STTCONFIG, "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 {
xmlFree(key_old);
}
} else {
- SLOG(LOG_ERROR, stt_tag(), "[ERROR] old config and new config are different"); //LCOV_EXCL_LINE
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "[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)) {
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); //LCOV_EXCL_LINE
+ SLOG(LOG_DEBUG, TAG_STTCONFIG, "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);
}
xmlFree(key_old);
}
} else {
- SLOG(LOG_ERROR, stt_tag(), "[ERROR] old config and new config are different"); //LCOV_EXCL_LINE
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "[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)) {
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); //LCOV_EXCL_LINE
+ SLOG(LOG_DEBUG, TAG_STTCONFIG, "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 {
xmlFree(key_old);
}
} else {
- SLOG(LOG_ERROR, stt_tag(), "[ERROR] old config and new config are different"); //LCOV_EXCL_LINE
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "[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)) {
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); //LCOV_EXCL_LINE
+ SLOG(LOG_DEBUG, TAG_STTCONFIG, "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 {
xmlFree(key_old);
}
} else {
- SLOG(LOG_ERROR, stt_tag(), "[ERROR] old config and new config are different"); //LCOV_EXCL_LINE
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "[ERROR] old config and new config are different"); //LCOV_EXCL_LINE
}
} else {
int stt_parser_set_time_info(GSList* time_list)
{
if (0 == g_slist_length(time_list)) {
- SLOG(LOG_WARN, stt_tag(), "[WARNING] There is no time info to save");
+ SLOG(LOG_WARN, TAG_STTCONFIG, "[WARNING] There is no time info to save");
return -1;
}
if (-1 == remove(STT_TIME_INFO_PATH)) {
- SLOG(LOG_WARN, stt_tag(), "[PLAYER WARNING] Fail to remove file(%s)", STT_TIME_INFO_PATH);
+ SLOG(LOG_WARN, TAG_STTCONFIG, "[PLAYER WARNING] Fail to remove file(%s)", STT_TIME_INFO_PATH);
}
xmlDocPtr doc = NULL;
doc = xmlNewDoc((const xmlChar*)"1.0");
if (doc == NULL) {
- SLOG(LOG_ERROR, stt_tag(), "[ERROR] Fail to make new doc");
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "[ERROR] Fail to make new doc");
return -1;
}
data = iter->data;
if (NULL == data) {
- SLOG(LOG_DEBUG, stt_tag(), "data is NULL");
+ SLOG(LOG_DEBUG, TAG_STTCONFIG, "data is NULL");
continue;
}
xmlNodePtr temp_node = NULL;
- SECURE_SLOG(LOG_DEBUG, stt_tag(), "[%d] i(%d) t(%s) s(%ld) e(%ld)",
+ SECURE_SLOG(LOG_DEBUG, TAG_STTCONFIG, "[%d] i(%d) t(%s) s(%ld) e(%ld)",
data->index, data->event, data->text, data->start_time, data->end_time);
temp_node = xmlNewNode(NULL, (const xmlChar*)STT_TAG_TIME_TEXT);
}
int ret = xmlSaveFormatFile(STT_TIME_INFO_PATH, doc, 1);
- SLOG(LOG_DEBUG, stt_tag(), "Save result : %d", ret);
+ SLOG(LOG_DEBUG, TAG_STTCONFIG, "Save result : %d", ret);
xmlFreeDoc(doc);
return 0;
int stt_parser_get_time_info(GSList** time_list)
{
if (NULL == time_list) {
- SLOG(LOG_ERROR, stt_tag(), "Invalid parameter : text is NULL"); //LCOV_EXCL_LINE
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "Invalid parameter : text is NULL"); //LCOV_EXCL_LINE
return -1;
}
doc = xmlParseFile(STT_TIME_INFO_PATH);
if (doc == NULL) {
- SLOG(LOG_WARN, stt_tag(), "[WARNING] File is not exist"); //LCOV_EXCL_LINE
+ SLOG(LOG_WARN, TAG_STTCONFIG, "[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");
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "[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);
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "[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");
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "[ERROR] Empty document");
xmlFreeDoc(doc);
return -1;
//LCOV_EXCL_STOP
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); //LCOV_EXCL_LINE
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "[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);
return -1;
}
- SLOG(LOG_DEBUG, stt_tag(), "Count : %s", (char *)key);
+ SLOG(LOG_DEBUG, TAG_STTCONFIG, "Count : %s", (char *)key);
/* Get time count */
int count = 0;
xmlFree(key);
if (count <= 0) {
- SLOG(LOG_ERROR, stt_tag(), "[ERROR] count is invalid : %d", count); //LCOV_EXCL_LINE
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "[ERROR] count is invalid : %d", count); //LCOV_EXCL_LINE
break;
}
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!!"); //LCOV_EXCL_LINE
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "[ERROR] Memory alloc error!!"); //LCOV_EXCL_LINE
if (NULL != temp_time_list) {
g_slist_free_full(temp_time_list, __stt_parser_time_info_free);
}
temp_info->index = index;
- SLOG(LOG_DEBUG, stt_tag(), "index : %d", temp_info->index);
+ SLOG(LOG_DEBUG, TAG_STTCONFIG, "index : %d", temp_info->index);
if (0 == i) temp_info->event = 0;
else if (count -1 == i) temp_info->event = 2;
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); //LCOV_EXCL_LINE
+ SLOG(LOG_DEBUG, TAG_STTCONFIG, "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); //LCOV_EXCL_LINE
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "[ERROR] <%s> has no content", STT_TAG_TIME_TEXT); //LCOV_EXCL_LINE
free(temp_info);
break;
}
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); //LCOV_EXCL_LINE
+ SLOG(LOG_DEBUG, TAG_STTCONFIG, "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); //LCOV_EXCL_LINE
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "[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;
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); //LCOV_EXCL_LINE
+ SLOG(LOG_DEBUG, TAG_STTCONFIG, "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); //LCOV_EXCL_LINE
+ SLOG(LOG_ERROR, TAG_STTCONFIG, "[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;
int stt_parser_clear_time_info()
{
if (-1 == remove(STT_TIME_INFO_PATH)) {
- /* SLOG(LOG_WARN, stt_tag(), "[PLAYER WARNING] Fail to remove file(%s)", STT_TIME_INFO_PATH); */
+ /* SLOG(LOG_WARN, TAG_STTCONFIG, "[PLAYER WARNING] Fail to remove file(%s)", STT_TIME_INFO_PATH); */
}
return 0;
#define STT_PRIVILEGE_RECORDER "http://tizen.org/privilege/recorder"
#define STT_PRIVILEGE_APPLAUNCH "http://tizen.org/privilege/appmanager.launch"
+/******************************************************************************************
+* Defines for log tag
+*******************************************************************************************/
+#define TAG_STTE "stte"
+#define TAG_STTCONFIG "sttconfig"
+
#ifdef __cplusplus
}
#endif
#include "stt_engine.h"
#include "sttd_engine_agent.h"
+#include "stt_defs.h"
-/*
-* Internal data structure
-*/
+/** Internal data structure **/
typedef struct {
char* engine_path;
stte_request_callback_s *callback;
} sttengine_s;
-extern const char* stt_tag();
-/** stt engine */
+/** Static variables **/
+/* Stt engine */
static sttengine_s *g_engine = NULL;
-
static bool g_is_from_lib = false;
-/** callback functions */
+/* Callback functions */
static stt_engine_result_cb g_result_cb = NULL;
static stte_private_data_set_cb g_set_private_data_cb = NULL;
static stte_private_data_requested_cb g_get_private_data_cb = NULL;
static void* g_set_audio_type_user_data = NULL;
+/** Static function **/
static int __stt_set_engine_from(bool is_from_lib)
{
g_is_from_lib = is_from_lib;
}
}
+
+/** Public function **/
/* Register engine id */
int stt_engine_load(const char* filepath, stte_request_callback_s *callback)
{
if (NULL == callback || NULL == filepath) {
- SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Invalid Parameter");
+ SLOG(LOG_ERROR, TAG_STTE, "[Engine ERROR] Invalid Parameter");
return STTE_ERROR_INVALID_PARAMETER;
}
/* allocation memory */
if (NULL != g_engine) {
- SLOG(LOG_WARN, stt_tag(), "[Engine WARNING] engine is already loaded");
+ SLOG(LOG_WARN, TAG_STTE, "[Engine WARNING] engine is already loaded");
} else {
g_engine = (sttengine_s*)calloc(1, sizeof(sttengine_s));
if (NULL == g_engine) {
- SLOG(LOG_ERROR, stt_tag(), "[ERROR] Fail to allocate memory");
+ SLOG(LOG_ERROR, TAG_STTE, "[ERROR] Fail to allocate memory");
return STTE_ERROR_OUT_OF_MEMORY;
}
g_engine->engine_path = strdup(filepath);
}
- SLOG(LOG_DEBUG, stt_tag(), "[Engine Success] Load engine : version(%d)", g_engine->callback->version);
+ SLOG(LOG_DEBUG, TAG_STTE, "[Engine Success] Load engine : version(%d)", g_engine->callback->version);
return 0;
}
int stt_engine_unload()
{
if (NULL == g_engine) {
- SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] No engine");
+ SLOG(LOG_ERROR, TAG_STTE, "[Engine ERROR] No engine");
return STTE_ERROR_OPERATION_FAILED;
}
int stt_engine_initialize(bool is_from_lib)
{
if (NULL == g_engine) {
- SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] No engine");
+ SLOG(LOG_ERROR, TAG_STTE, "[Engine ERROR] No engine");
return STTE_ERROR_OPERATION_FAILED;
}
if (NULL == g_engine->callback) {
- SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Invalid engine");
+ SLOG(LOG_ERROR, TAG_STTE, "[Engine ERROR] Invalid engine");
return STTE_ERROR_OPERATION_FAILED;
}
if (NULL == g_engine->callback->initialize) {
- SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Invalid engine");
+ SLOG(LOG_ERROR, TAG_STTE, "[Engine ERROR] Invalid engine");
return STTE_ERROR_OPERATION_FAILED;
}
int ret;
ret = __stt_set_engine_from(is_from_lib);
if (0 != ret) {
- SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Fail to set engine : %s", __stt_get_engine_error_code(ret));
+ SLOG(LOG_ERROR, TAG_STTE, "[Engine ERROR] Fail to set engine : %s", __stt_get_engine_error_code(ret));
return STTE_ERROR_OPERATION_FAILED;
}
- SLOG(LOG_INFO, stt_tag(), "[Engine Info] request to initialize");
+ SLOG(LOG_INFO, TAG_STTE, "[Engine Info] request to initialize");
ret = g_engine->callback->initialize();
if (0 != ret) {
- SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Fail to initialize : %s", __stt_get_engine_error_code(ret));
+ SLOG(LOG_ERROR, TAG_STTE, "[Engine ERROR] Fail to initialize : %s", __stt_get_engine_error_code(ret));
}
return ret;
int stt_engine_deinitialize()
{
if (NULL == g_engine) {
- SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] No engine");
+ SLOG(LOG_ERROR, TAG_STTE, "[Engine ERROR] No engine");
return STTE_ERROR_OPERATION_FAILED;
}
if (NULL == g_engine->callback) {
- SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Invalid engine");
+ SLOG(LOG_ERROR, TAG_STTE, "[Engine ERROR] Invalid engine");
return STTE_ERROR_OPERATION_FAILED;
}
if (NULL == g_engine->callback->deinitialize) {
- SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Invalid engine");
+ SLOG(LOG_ERROR, TAG_STTE, "[Engine ERROR] Invalid engine");
return STTE_ERROR_OPERATION_FAILED;
}
- SLOG(LOG_INFO, stt_tag(), "[Engine Info] request to deinitialize");
+ SLOG(LOG_INFO, TAG_STTE, "[Engine Info] request to deinitialize");
int ret;
ret = g_engine->callback->deinitialize();
if (0 != ret) {
- SLOG(LOG_WARN, stt_tag(), "[Engine WARNING] Fail to deinitialize : %s", __stt_get_engine_error_code(ret));
+ SLOG(LOG_WARN, TAG_STTE, "[Engine WARNING] Fail to deinitialize : %s", __stt_get_engine_error_code(ret));
}
return ret;
GSList** lang_list = (GSList**)user_data;
if (NULL == language || NULL == lang_list) {
- SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Input parameter is NULL in callback!!!!");
+ SLOG(LOG_ERROR, TAG_STTE, "[Engine ERROR] Input parameter is NULL in callback!!!!");
return false;
}
int stt_engine_get_supported_langs(GSList** lang_list)
{
if (NULL == lang_list) {
- SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Invalid Parameter");
+ SLOG(LOG_ERROR, TAG_STTE, "[Engine ERROR] Invalid Parameter");
return STTE_ERROR_INVALID_PARAMETER;
}
if (NULL == g_engine) {
- SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] No engine");
+ SLOG(LOG_ERROR, TAG_STTE, "[Engine ERROR] No engine");
return STTE_ERROR_OPERATION_FAILED;
}
if (NULL == g_engine->callback) {
- SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Invalid engine");
+ SLOG(LOG_ERROR, TAG_STTE, "[Engine ERROR] Invalid engine");
return STTE_ERROR_OPERATION_FAILED;
}
if (NULL == g_engine->callback->foreach_langs) {
- SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Invalid engine");
+ SLOG(LOG_ERROR, TAG_STTE, "[Engine ERROR] Invalid engine");
return STTE_ERROR_OPERATION_FAILED;
}
int ret;
ret = g_engine->callback->foreach_langs(__supported_language_cb, (void*)lang_list);
if (0 != ret) {
- SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] get language list error : %s", __stt_get_engine_error_code(ret));
+ SLOG(LOG_ERROR, TAG_STTE, "[Engine ERROR] get language list error : %s", __stt_get_engine_error_code(ret));
}
return ret;
int stt_engine_is_valid_language(const char* language, bool *is_valid)
{
if (NULL == language || NULL == is_valid) {
- SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Invalid Parameter");
+ SLOG(LOG_ERROR, TAG_STTE, "[Engine ERROR] Invalid Parameter");
return STTE_ERROR_INVALID_PARAMETER;
}
if (NULL == g_engine) {
- SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] No engine");
+ SLOG(LOG_ERROR, TAG_STTE, "[Engine ERROR] No engine");
return STTE_ERROR_OPERATION_FAILED;
}
if (NULL == g_engine->callback) {
- SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Invalid engine");
+ SLOG(LOG_ERROR, TAG_STTE, "[Engine ERROR] Invalid engine");
return STTE_ERROR_OPERATION_FAILED;
}
if (NULL == g_engine->callback->is_valid_lang) {
- SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Invalid engine");
+ SLOG(LOG_ERROR, TAG_STTE, "[Engine ERROR] Invalid engine");
return STTE_ERROR_OPERATION_FAILED;
}
int ret = STTE_ERROR_NONE;
ret = g_engine->callback->is_valid_lang(language, is_valid);
if (0 != ret) {
- SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Fail to check valid language(%d)", ret);
+ SLOG(LOG_ERROR, TAG_STTE, "[Engine ERROR] Fail to check valid language(%d)", ret);
}
return ret;
}
int stt_engine_set_private_data(const char* key, const char* data)
{
if (NULL == key || NULL == data) {
- SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Invalid Parameter");
+ SLOG(LOG_ERROR, TAG_STTE, "[Engine ERROR] Invalid Parameter");
return STTE_ERROR_INVALID_PARAMETER;
}
if (NULL != g_set_private_data_cb) {
ret = g_set_private_data_cb(key, data);
if (0 != ret) {
- SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Fail to set private data(%d)", ret);
+ SLOG(LOG_ERROR, TAG_STTE, "[Engine ERROR] Fail to set private data(%d)", ret);
}
}
int stt_engine_get_private_data(const char* key, char** data)
{
if (NULL == key || NULL == data) {
- SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Invalid Parameter");
+ SLOG(LOG_ERROR, TAG_STTE, "[Engine ERROR] Invalid Parameter");
return STTE_ERROR_INVALID_PARAMETER;
}
if (NULL != g_get_private_data_cb) {
ret = g_get_private_data_cb(key, &temp);
if (0 != ret) {
- SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Fail to get private data(%d)", ret);
+ SLOG(LOG_ERROR, TAG_STTE, "[Engine ERROR] Fail to get private data(%d)", ret);
return ret;
}
} else {
- SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] There's no private data function)");
+ SLOG(LOG_ERROR, TAG_STTE, "[Engine ERROR] There's no private data function)");
}
if (NULL == temp)
int stt_engine_get_first_language(char** language)
{
if (NULL == language) {
- SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Invalid Parameter");
+ SLOG(LOG_ERROR, TAG_STTE, "[Engine ERROR] Invalid Parameter");
return STTE_ERROR_INVALID_PARAMETER;
}
if (NULL == g_engine) {
- SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] No engine");
+ SLOG(LOG_ERROR, TAG_STTE, "[Engine ERROR] No engine");
return STTE_ERROR_OPERATION_FAILED;
}
if (NULL == g_engine->callback) {
- SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Invalid engine");
+ SLOG(LOG_ERROR, TAG_STTE, "[Engine ERROR] Invalid engine");
return STTE_ERROR_OPERATION_FAILED;
}
if (NULL == g_engine->callback->foreach_langs || NULL == g_engine->callback->is_valid_lang) {
- SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Invalid engine");
+ SLOG(LOG_ERROR, TAG_STTE, "[Engine ERROR] Invalid engine");
return STTE_ERROR_OPERATION_FAILED;
}
int ret;
ret = g_engine->callback->foreach_langs(__supported_language_cb, &lang_list);
if (0 != ret) {
- SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] get language list error : %s", __stt_get_engine_error_code(ret));
+ SLOG(LOG_ERROR, TAG_STTE, "[Engine ERROR] get language list error : %s", __stt_get_engine_error_code(ret));
return ret;
}
int stt_engine_support_silence(bool* support)
{
if (NULL == support) {
- SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Invalid Parameter");
+ SLOG(LOG_ERROR, TAG_STTE, "[Engine ERROR] Invalid Parameter");
return STTE_ERROR_INVALID_PARAMETER;
}
if (NULL == g_engine) {
- SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] No engine");
+ SLOG(LOG_ERROR, TAG_STTE, "[Engine ERROR] No engine");
return STTE_ERROR_OPERATION_FAILED;
}
if (NULL == g_engine->callback) {
- SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Invalid engine");
+ SLOG(LOG_ERROR, TAG_STTE, "[Engine ERROR] Invalid engine");
return STTE_ERROR_OPERATION_FAILED;
}
- SLOG(LOG_INFO, stt_tag(), "[Engine Info] request to support silence");
+ SLOG(LOG_INFO, TAG_STTE, "[Engine Info] request to support silence");
if (NULL == g_engine->callback->support_silence) {
- SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Invalid engine");
+ SLOG(LOG_ERROR, TAG_STTE, "[Engine ERROR] Invalid engine");
return STTE_ERROR_OPERATION_FAILED;
}
int stt_engine_need_app_credential(bool* need)
{
if (NULL == need) {
- SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Invalid Parameter");
+ SLOG(LOG_ERROR, TAG_STTE, "[Engine ERROR] Invalid Parameter");
return STTE_ERROR_INVALID_PARAMETER;
}
if (NULL == g_engine) {
- SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] No engine");
+ SLOG(LOG_ERROR, TAG_STTE, "[Engine ERROR] No engine");
return STTE_ERROR_OPERATION_FAILED;
}
if (NULL == g_engine->callback) {
- SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Invalid engine");
+ SLOG(LOG_ERROR, TAG_STTE, "[Engine ERROR] Invalid engine");
return STTE_ERROR_OPERATION_FAILED;
}
- SLOG(LOG_INFO, stt_tag(), "[Engine Info] request to need app credential");
+ SLOG(LOG_INFO, TAG_STTE, "[Engine Info] request to need app credential");
if (NULL == g_engine->callback->need_app_credential) {
- SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Invalid engine");
+ SLOG(LOG_ERROR, TAG_STTE, "[Engine ERROR] Invalid engine");
return STTE_ERROR_OPERATION_FAILED;
}
int stt_engine_support_recognition_type(const char* type, bool* support)
{
if (NULL == type || NULL == support) {
- SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Invalid Parameter");
+ SLOG(LOG_ERROR, TAG_STTE, "[Engine ERROR] Invalid Parameter");
return STTE_ERROR_INVALID_PARAMETER;
}
if (NULL == g_engine) {
- SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] No engine");
+ SLOG(LOG_ERROR, TAG_STTE, "[Engine ERROR] No engine");
return STTE_ERROR_OPERATION_FAILED;
}
if (NULL == g_engine->callback) {
- SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Invalid engine");
+ SLOG(LOG_ERROR, TAG_STTE, "[Engine ERROR] Invalid engine");
return STTE_ERROR_OPERATION_FAILED;
}
if (NULL == g_engine->callback->support_recognition_type) {
- SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR} Invalid engine");
+ SLOG(LOG_ERROR, TAG_STTE, "[Engine ERROR} Invalid engine");
return STTE_ERROR_OPERATION_FAILED;
}
- SLOG(LOG_INFO, stt_tag(), "[Engine Info] request to support recognition type, type(%s)", type);
+ SLOG(LOG_INFO, TAG_STTE, "[Engine Info] request to support recognition type, type(%s)", type);
int ret = STTE_ERROR_NONE;
ret = g_engine->callback->support_recognition_type(type, support);
if (0 != ret) {
- SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Fail to get supporting recognition type(%d)", ret);
+ SLOG(LOG_ERROR, TAG_STTE, "[Engine ERROR] Fail to get supporting recognition type(%d)", ret);
}
return ret;
}
int stt_engine_get_audio_format(stte_audio_type_e* types, int* rate, int* channels)
{
if (NULL == types || NULL == rate || NULL == channels) {
- SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Invalid Parameter");
+ SLOG(LOG_ERROR, TAG_STTE, "[Engine ERROR] Invalid Parameter");
return STTE_ERROR_INVALID_PARAMETER;
}
if (NULL == g_engine) {
- SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] No engine");
+ SLOG(LOG_ERROR, TAG_STTE, "[Engine ERROR] No engine");
return STTE_ERROR_OPERATION_FAILED;
}
if (NULL == g_engine->callback) {
- SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Invalid engine");
+ SLOG(LOG_ERROR, TAG_STTE, "[Engine ERROR] Invalid engine");
return STTE_ERROR_OPERATION_FAILED;
}
if (NULL == g_engine->callback->get_audio_format) {
- SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Invalid engine");
+ SLOG(LOG_ERROR, TAG_STTE, "[Engine ERROR] Invalid engine");
return STTE_ERROR_OPERATION_FAILED;
}
- SLOG(LOG_INFO, stt_tag(), "[Engine Info] request to get audio format");
+ SLOG(LOG_INFO, TAG_STTE, "[Engine Info] request to get audio format");
int ret;
ret = g_engine->callback->get_audio_format(types, rate, channels);
if (0 != ret) {
- SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Fail to get audio format : %s", __stt_get_engine_error_code(ret));
+ SLOG(LOG_ERROR, TAG_STTE, "[Engine ERROR] Fail to get audio format : %s", __stt_get_engine_error_code(ret));
}
return ret;
int stt_engine_set_silence_detection(bool value)
{
if (NULL == g_engine) {
- SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] No engine");
+ SLOG(LOG_ERROR, TAG_STTE, "[Engine ERROR] No engine");
return STTE_ERROR_OPERATION_FAILED;
}
if (NULL == g_engine->callback) {
- SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Invalid engine");
+ SLOG(LOG_ERROR, TAG_STTE, "[Engine ERROR] Invalid engine");
return STTE_ERROR_OPERATION_FAILED;
}
if (NULL == g_engine->callback->set_silence_detection) {
- SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Invalid engine");
+ SLOG(LOG_ERROR, TAG_STTE, "[Engine ERROR] Invalid engine");
return STTE_ERROR_OPERATION_FAILED;
}
- SLOG(LOG_INFO, stt_tag(), "[Engine Info] request to set silence detection(%d)", value);
+ SLOG(LOG_INFO, TAG_STTE, "[Engine Info] request to set silence detection(%d)", value);
int ret = g_engine->callback->set_silence_detection(value);
if (STTE_ERROR_NOT_SUPPORTED_FEATURE == ret) {
- SLOG(LOG_WARN, stt_tag(), "[Engine WARNING] Not support silence detection");
+ SLOG(LOG_WARN, TAG_STTE, "[Engine WARNING] Not support silence detection");
} else if (0 != ret) {
- SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Fail to set silence detection : %d", ret);
+ SLOG(LOG_ERROR, TAG_STTE, "[Engine ERROR] Fail to set silence detection : %d", ret);
}
return ret;
}
int stt_engine_check_app_agreed(const char* appid, bool* is_agreed)
{
if (NULL == is_agreed) {
- SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Invalid parameter");
+ SLOG(LOG_ERROR, TAG_STTE, "[Engine ERROR] Invalid parameter");
return STTE_ERROR_INVALID_PARAMETER;
}
if (NULL == g_engine) {
- SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] No engine");
+ SLOG(LOG_ERROR, TAG_STTE, "[Engine ERROR] No engine");
return STTE_ERROR_OPERATION_FAILED;
}
if (NULL == g_engine->callback) {
- SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Invalid engine");
+ SLOG(LOG_ERROR, TAG_STTE, "[Engine ERROR] Invalid engine");
return STTE_ERROR_OPERATION_FAILED;
}
if (NULL == g_engine->callback->check_app_agreed) {
- SLOG(LOG_WARN, stt_tag(), "[Engine WARNING] Not support app agreement. All app is available");
+ SLOG(LOG_WARN, TAG_STTE, "[Engine WARNING] Not support app agreement. All app is available");
*is_agreed = true;
return 0;
}
- SLOG(LOG_INFO, stt_tag(), "[Engine Info] request to app agreed, appid(%s), is_agreed(%d)", appid, *is_agreed);
+ SLOG(LOG_INFO, TAG_STTE, "[Engine Info] request to app agreed, appid(%s), is_agreed(%d)", appid, *is_agreed);
int ret = g_engine->callback->check_app_agreed(appid, is_agreed);
if (0 != ret) {
- SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Fail to get app agreement : %s", __stt_get_engine_error_code(ret));
+ SLOG(LOG_ERROR, TAG_STTE, "[Engine ERROR] Fail to get app agreement : %s", __stt_get_engine_error_code(ret));
*is_agreed = false;
}
int stt_engine_recognize_start(const char* lang, const char* recognition_type, const char* appid, const char* credential, void* user_param)
{
if (NULL == lang || NULL == recognition_type) {
- SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Invalid Parameter");
+ SLOG(LOG_ERROR, TAG_STTE, "[Engine ERROR] Invalid Parameter");
return STTE_ERROR_INVALID_PARAMETER;
}
if (NULL == g_engine) {
- SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] No engine");
+ SLOG(LOG_ERROR, TAG_STTE, "[Engine ERROR] No engine");
return STTE_ERROR_OPERATION_FAILED;
}
if (NULL == g_engine->callback) {
- SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Invalid engine");
+ SLOG(LOG_ERROR, TAG_STTE, "[Engine ERROR] Invalid engine");
return STTE_ERROR_OPERATION_FAILED;
}
if (NULL == g_engine->callback->start) {
- SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Invalid engine");
+ SLOG(LOG_ERROR, TAG_STTE, "[Engine ERROR] Invalid engine");
return STTE_ERROR_OPERATION_FAILED;
}
- SLOG(LOG_INFO, stt_tag(), "[Engine Info] request to start, lang(%s), recognition_type(%s), credential(%s)", lang, recognition_type, credential);
+ SLOG(LOG_INFO, TAG_STTE, "[Engine Info] request to start, lang(%s), recognition_type(%s), credential(%s)", lang, recognition_type, credential);
int ret = g_engine->callback->start(lang, recognition_type, appid, credential, user_param);
if (0 != ret) {
- SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Fail to start recognition : %s", __stt_get_engine_error_code(ret));
- SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Fail to start recognition : lang(%s), recognition_type(%s), credential(%s)", lang, recognition_type, credential);
+ SLOG(LOG_ERROR, TAG_STTE, "[Engine ERROR] Fail to start recognition : %s", __stt_get_engine_error_code(ret));
+ SLOG(LOG_ERROR, TAG_STTE, "[Engine ERROR] Fail to start recognition : lang(%s), recognition_type(%s), credential(%s)", lang, recognition_type, credential);
}
return ret;
int stt_engine_set_recording_data(const void* data, unsigned int length)
{
if (NULL == data) {
- SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Invalid Parameter");
+ SLOG(LOG_ERROR, TAG_STTE, "[Engine ERROR] Invalid Parameter");
return STTE_ERROR_INVALID_PARAMETER;
}
if (NULL == g_engine) {
- SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] No engine");
+ SLOG(LOG_ERROR, TAG_STTE, "[Engine ERROR] No engine");
return STTE_ERROR_OPERATION_FAILED;
}
if (NULL == g_engine->callback) {
- SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Invalid engine");
+ SLOG(LOG_ERROR, TAG_STTE, "[Engine ERROR] Invalid engine");
return STTE_ERROR_OPERATION_FAILED;
}
if (NULL == g_engine->callback->set_recording) {
- SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Invalid engine");
+ SLOG(LOG_ERROR, TAG_STTE, "[Engine ERROR] Invalid engine");
return STTE_ERROR_OPERATION_FAILED;
}
int ret = g_engine->callback->set_recording(data, length);
if (0 != ret) {
- SLOG(LOG_WARN, stt_tag(), "[Engine WARNING] Fail to set recording : %s", __stt_get_engine_error_code(ret));
+ SLOG(LOG_WARN, TAG_STTE, "[Engine WARNING] Fail to set recording : %s", __stt_get_engine_error_code(ret));
}
return ret;
int stt_engine_recognize_stop()
{
if (NULL == g_engine) {
- SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] No engine");
+ SLOG(LOG_ERROR, TAG_STTE, "[Engine ERROR] No engine");
return STTE_ERROR_OPERATION_FAILED;
}
if (NULL == g_engine->callback) {
- SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Invalid engine");
+ SLOG(LOG_ERROR, TAG_STTE, "[Engine ERROR] Invalid engine");
return STTE_ERROR_OPERATION_FAILED;
}
if (NULL == g_engine->callback->stop) {
- SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Invalid engine");
+ SLOG(LOG_ERROR, TAG_STTE, "[Engine ERROR] Invalid engine");
return STTE_ERROR_OPERATION_FAILED;
}
- SLOG(LOG_INFO, stt_tag(), "[Engine Info] request to stop");
+ SLOG(LOG_INFO, TAG_STTE, "[Engine Info] request to stop");
int ret = g_engine->callback->stop();
if (0 != ret) {
- SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Fail to stop : %s", __stt_get_engine_error_code(ret));
+ SLOG(LOG_ERROR, TAG_STTE, "[Engine ERROR] Fail to stop : %s", __stt_get_engine_error_code(ret));
}
return ret;
int stt_engine_recognize_cancel()
{
if (NULL == g_engine) {
- SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] No engine");
+ SLOG(LOG_ERROR, TAG_STTE, "[Engine ERROR] No engine");
return STTE_ERROR_OPERATION_FAILED;
}
if (NULL == g_engine->callback) {
- SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Invalid engine");
+ SLOG(LOG_ERROR, TAG_STTE, "[Engine ERROR] Invalid engine");
return STTE_ERROR_OPERATION_FAILED;
}
if (NULL == g_engine->callback->cancel) {
- SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Invalid engine");
+ SLOG(LOG_ERROR, TAG_STTE, "[Engine ERROR] Invalid engine");
return STTE_ERROR_OPERATION_FAILED;
}
- SLOG(LOG_INFO, stt_tag(), "[Engine Info] request to cancel");
+ SLOG(LOG_INFO, TAG_STTE, "[Engine Info] request to cancel");
int ret = g_engine->callback->cancel();
if (0 != ret) {
- SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Fail to cancel : %s", __stt_get_engine_error_code(ret));
+ SLOG(LOG_ERROR, TAG_STTE, "[Engine ERROR] Fail to cancel : %s", __stt_get_engine_error_code(ret));
}
return ret;
int stt_engine_foreach_result_time(void* time_info, stte_result_time_cb callback, void* user_data)
{
if (NULL == g_engine) {
- SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] No engine");
+ SLOG(LOG_ERROR, TAG_STTE, "[Engine ERROR] No engine");
return STTE_ERROR_OPERATION_FAILED;
}
if (NULL == g_engine->callback) {
- SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Invalid engine");
+ SLOG(LOG_ERROR, TAG_STTE, "[Engine ERROR] Invalid engine");
return STTE_ERROR_OPERATION_FAILED;
}
if (NULL == g_engine->callback->foreach_result_time) {
- SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Invalid engine");
+ SLOG(LOG_ERROR, TAG_STTE, "[Engine ERROR] Invalid engine");
return STTE_ERROR_OPERATION_FAILED;
}
int ret = g_engine->callback->foreach_result_time(time_info, callback, user_data);
if (0 != ret) {
- SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Fail to foreach result time : %s", __stt_get_engine_error_code(ret));
+ SLOG(LOG_ERROR, TAG_STTE, "[Engine ERROR] Fail to foreach result time : %s", __stt_get_engine_error_code(ret));
}
return ret;
}
-int stt_engine_recognize_start_file(const char* lang, const char* recognition_type,
+int stt_engine_recognize_start_file(const char* lang, const char* recognition_type,
const char* filepath, stte_audio_type_e audio_type, int sample_rate, void* user_param)
{
if (NULL == filepath || NULL == lang || NULL == recognition_type) {
- SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Invalid Parameter");
+ SLOG(LOG_ERROR, TAG_STTE, "[Engine ERROR] Invalid Parameter");
return STTE_ERROR_INVALID_PARAMETER;
}
if (NULL == g_engine) {
- SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] No engine");
+ SLOG(LOG_ERROR, TAG_STTE, "[Engine ERROR] No engine");
return STTE_ERROR_OPERATION_FAILED;
}
if (NULL == g_engine->callback) {
- SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Invalid engine");
+ SLOG(LOG_ERROR, TAG_STTE, "[Engine ERROR] Invalid engine");
return STTE_ERROR_OPERATION_FAILED;
}
#ifdef __UNUSED_CODES__
if (NULL == g_engine->callback->start_file) {
- SLOG(LOG_WARN, stt_tag(), "[Engine WARNING] engine API is invalid");
+ SLOG(LOG_WARN, TAG_STTE, "[Engine WARNING] engine API is invalid");
return STTE_ERROR_NOT_SUPPORTED_FEATURE;
}
int ret = g_engine->callback->start_file(lang, recognition_type, filepath, audio_type, sample_rate, user_param);
if (0 != ret) {
- SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Fail to start file recognition : %s", __stt_get_engine_error_code(ret));
+ SLOG(LOG_ERROR, TAG_STTE, "[Engine ERROR] Fail to start file recognition : %s", __stt_get_engine_error_code(ret));
}
#endif
return 0;
int stt_engine_recognize_cancel_file()
{
if (NULL == g_engine) {
- SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] No engine");
+ SLOG(LOG_ERROR, TAG_STTE, "[Engine ERROR] No engine");
return STTE_ERROR_OPERATION_FAILED;
}
if (NULL == g_engine->callback) {
- SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Invalid engine");
+ SLOG(LOG_ERROR, TAG_STTE, "[Engine ERROR] Invalid engine");
return STTE_ERROR_OPERATION_FAILED;
}
#ifdef __UNUSED_CODES__
if (NULL == g_engine->callback->cancel_file) {
- SLOG(LOG_WARN, stt_tag(), "[Engine WARNING] engine API is invalid");
+ SLOG(LOG_WARN, TAG_STTE, "[Engine WARNING] engine API is invalid");
return STTE_ERROR_NOT_SUPPORTED_FEATURE;
}
int ret = g_engine->callback->cancel_file();
if (0 != ret) {
- SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Fail to start file recognition : %s", __stt_get_engine_error_code(ret));
+ SLOG(LOG_ERROR, TAG_STTE, "[Engine ERROR] Fail to start file recognition : %s", __stt_get_engine_error_code(ret));
}
#endif
return 0;
int stt_engine_set_recognition_result_cb(stt_engine_result_cb result_cb, void* user_data)
{
if (NULL == result_cb) {
- SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Invalid parameter");
+ SLOG(LOG_ERROR, TAG_STTE, "[Engine ERROR] Invalid parameter");
return STTE_ERROR_INVALID_PARAMETER;
}
const char* msg, void* time_info, void* user_data)
{
if (NULL == type || NULL == result) {
- SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Invalid parameter");
+ SLOG(LOG_ERROR, TAG_STTE, "[Engine ERROR] Invalid parameter");
}
int ret = STTE_ERROR_NONE;
if (false == __stt_get_engine_from()) {
ret = sttd_engine_agent_send_result(event, type, result, result_count, msg, time_info, user_data);
if (0 != ret) {
- SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Fail to send result");
+ SLOG(LOG_ERROR, TAG_STTE, "[Engine ERROR] Fail to send result");
}
} else {
ret = g_result_cb(event, type, result, result_count, msg, time_info, user_data);
int ret = STTE_ERROR_NONE;
ret = sttd_engine_agent_send_error(error, msg);
if (0 != ret) {
- SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Fail to send error info");
+ SLOG(LOG_ERROR, TAG_STTE, "[Engine ERROR] Fail to send error info");
}
return ret;
}
int ret = STTE_ERROR_NONE;
ret = sttd_engine_agent_send_speech_status(status, user_data);
if (0 != ret) {
- SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Fail to send speech status");
+ SLOG(LOG_ERROR, TAG_STTE, "[Engine ERROR] Fail to send speech status");
}
return ret;
}
int stt_engine_set_private_data_set_cb(stte_private_data_set_cb private_data_set_cb, void* user_data)
{
if (NULL == private_data_set_cb) {
- SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Invalid parameter");
+ SLOG(LOG_ERROR, TAG_STTE, "[Engine ERROR] Invalid parameter");
return STTE_ERROR_INVALID_PARAMETER;
}
int stt_engine_set_private_data_requested_cb(stte_private_data_requested_cb private_data_requested_cb, void* user_data)
{
if (NULL == private_data_requested_cb) {
- SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Invalid parameter");
+ SLOG(LOG_ERROR, TAG_STTE, "[Engine ERROR] Invalid parameter");
return STTE_ERROR_INVALID_PARAMETER;
}
int stt_engine_set_audio_type(const char* audio_type)
{
if (NULL == audio_type) {
- SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Invalid parameter");
+ SLOG(LOG_ERROR, TAG_STTE, "[Engine ERROR] Invalid parameter");
return STTE_ERROR_INVALID_PARAMETER;
}
- SLOG(LOG_INFO, stt_tag(), "[Engine Info] set audio type (%s)", audio_type);
+ SLOG(LOG_INFO, TAG_STTE, "[Engine Info] set audio type (%s)", audio_type);
int ret = STTE_ERROR_NONE;
if (NULL != g_set_audio_type_cb) {
ret = g_set_audio_type_cb(audio_type, g_set_audio_type_user_data);
if (0 != ret) {
- SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Fail to set audio type, ret(%d)", ret);
+ SLOG(LOG_ERROR, TAG_STTE, "[Engine ERROR] Fail to set audio type, ret(%d)", ret);
}
} else {
- SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] There's no set audio function)");
+ SLOG(LOG_ERROR, TAG_STTE, "[Engine ERROR] There's no set audio function)");
}
return ret;
int stt_engine_set_audio_type_set_cb(stte_audio_type_cb audio_type_set_cb, void* user_data)
{
if (NULL == audio_type_set_cb) {
- SLOG(LOG_ERROR, stt_tag(), "[Engine ERROR] Invalid parameter");
+ SLOG(LOG_ERROR, TAG_STTE, "[Engine ERROR] Invalid parameter");
return STTE_ERROR_INVALID_PARAMETER;
}
#include <vconf.h>
#include "stt_network.h"
+#include "stt_defs.h"
-extern const char* stt_tag();
int stt_network_initialize()
{
int network_status = 0;
int ret = vconf_get_int(VCONFKEY_NETWORK_STATUS, &network_status);
if (0 != ret) {
- SLOG(LOG_WARN, stt_tag(), "[Network] Fail to get network status, ret(%d)", ret);
+ SLOG(LOG_WARN, TAG_STTCONFIG, "[Network] Fail to get network status, ret(%d)", ret);
return false;
}
if (network_status == VCONFKEY_NETWORK_OFF) {
- SLOG(LOG_WARN, stt_tag(), "[Network] Current network connection is OFF.");
+ SLOG(LOG_WARN, TAG_STTCONFIG, "[Network] Current network connection is OFF.");
return false;
}
- SLOG(LOG_DEBUG, stt_tag(), "[Network] Network status is %d", network_status);
+ SLOG(LOG_DEBUG, TAG_STTCONFIG, "[Network] Network status is %d", network_status);
return true;
}