void* user_data;
} tts_config_client_s;
-extern char* tts_tag();
-
static GSList* g_engine_list = NULL;
static GSList* g_config_client_list = NULL;
int __tts_config_mgr_check_engine_is_valid(const char* engine_id)
{
if (NULL == engine_id) {
- SLOG(LOG_ERROR, tts_tag(), "Input parameter is NULL");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "Input parameter is NULL");
return -1;
}
tts_engine_info_s *engine_info = NULL;
if (0 >= g_slist_length(g_engine_list)) {
- SLOG(LOG_ERROR, tts_tag(), "There is no engine!!");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "There is no engine!!");
return -1;
}
engine_info = iter->data;
if (NULL == engine_info) {
- SLOG(LOG_ERROR, tts_tag(), "engine info is NULL");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "engine info is NULL");
return -1;
}
if (NULL != engine_info->uuid && 0 == strcmp(engine_id, engine_info->uuid)) {
- SLOG(LOG_DEBUG, tts_tag(), "Default engine is valid : %s", engine_id);
+ SLOG(LOG_DEBUG, TAG_TTSCONFIG, "Default engine is valid : %s", engine_id);
return 0;
}
/* Change default engine */
iter = g_slist_nth(g_engine_list, 0);
if (NULL == iter) {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] No engine in list");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] No engine in list");
return TTS_CONFIG_ERROR_OPERATION_FAILED;
}
engine_info = iter->data;
if (NULL == g_config_info) {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] Invalid engine info in list");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Invalid engine info in list");
return TTS_CONFIG_ERROR_OPERATION_FAILED;
}
strncpy(g_config_info->setting, engine_info->setting, sizeof(g_setting) - 1);
}
- SLOG(LOG_DEBUG, tts_tag(), "Default engine is changed : %s", g_config_info->engine_id);
+ SLOG(LOG_DEBUG, TAG_TTSCONFIG, "Default engine is changed : %s", g_config_info->engine_id);
/* Change is default voice */
GSList *iter_voice = NULL;
g_config_info->type = voice->type;
- SLOG(LOG_DEBUG, tts_tag(), "Default voice is changed : lang(%s) type(%d)", voice->language, voice->type);
+ SLOG(LOG_DEBUG, TAG_TTSCONFIG, "Default voice is changed : lang(%s) type(%d)", voice->language, voice->type);
break;
}
}
iter_voice = g_slist_nth(engine_info->voices, 0);
if (NULL == iter_voice) {
- SLOG(LOG_ERROR, tts_tag(), "Fail to get voice list");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "Fail to get voice list");
return TTS_CONFIG_ERROR_OPERATION_FAILED;
}
voice = iter_voice->data;
if (NULL == voice || NULL == voice->language) {
- SLOG(LOG_ERROR, tts_tag(), "Fail to get voice info from list");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "Fail to get voice info from list");
return TTS_CONFIG_ERROR_OPERATION_FAILED;
}
strncpy(g_config_info->language, voice->language, sizeof(g_language) - 1);
g_config_info->type = voice->type;
- SLOG(LOG_DEBUG, tts_tag(), "Default voice is changed : lang(%s) type(%d)", voice->language, voice->type);
+ SLOG(LOG_DEBUG, TAG_TTSCONFIG, "Default voice is changed : lang(%s) type(%d)", voice->language, voice->type);
}
- if (0 != tts_parser_set_engine(g_config_info->engine_id, g_config_info->setting,
- g_config_info->language, g_config_info->type)) {
- SLOG(LOG_ERROR, tts_tag(), " Fail to save config");
+ if (0 != tts_parser_set_engine(g_config_info->engine_id, g_config_info->setting, g_config_info->language, g_config_info->type)) {
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, " Fail to save config");
return TTS_CONFIG_ERROR_OPERATION_FAILED;
}
bool __tts_config_mgr_check_lang_is_valid(const char* engine_id, const char* language, int type)
{
if (NULL == engine_id || NULL == language) {
- SLOG(LOG_ERROR, tts_tag(), "Input parameter is NULL");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "Input parameter is NULL");
return false;
}
tts_engine_info_s *engine_info = NULL;
if (0 >= g_slist_length(g_engine_list)) {
- SLOG(LOG_ERROR, tts_tag(), "There is no engine!!");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "There is no engine!!");
return false;
}
engine_info = iter->data;
if (NULL == engine_info) {
- SLOG(LOG_ERROR, tts_tag(), "engine info is NULL");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "engine info is NULL");
return false;
}
tts_config_voice_s* voice = NULL;
if (g_slist_length(engine_info->voices) <= 0) {
- SLOG(LOG_ERROR, tts_tag(), "There is no voice : %s", engine_info->uuid);
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "There is no voice : %s", engine_info->uuid);
iter = g_slist_next(iter);
return false;
}
int __tts_config_mgr_select_lang(const char* engine_id, char** language, int* type)
{
if (NULL == engine_id || NULL == language) {
- SLOG(LOG_ERROR, tts_tag(), "Input parameter is NULL");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "Input parameter is NULL");
return false;
}
tts_engine_info_s *engine_info = NULL;
if (0 >= g_slist_length(g_engine_list)) {
- SLOG(LOG_ERROR, tts_tag(), "There is no engine!!");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "There is no engine!!");
return false;
}
engine_info = iter->data;
if (NULL == engine_info) {
- SLOG(LOG_ERROR, tts_tag(), "engine info is NULL");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "engine info is NULL");
return false;
}
tts_config_voice_s* voice = NULL;
if (g_slist_length(engine_info->voices) <= 0) {
- SLOG(LOG_ERROR, tts_tag(), "There is no voice : %s", engine_info->uuid);
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "There is no voice : %s", engine_info->uuid);
return -1;
}
*language = strdup(voice->language);
*type = voice->type;
- SECURE_SLOG(LOG_DEBUG, tts_tag(), "Selected language(%s) type(%d)", *language, *type);
+ SECURE_SLOG(LOG_DEBUG, TAG_TTSCONFIG, "Selected language(%s) type(%d)", *language, *type);
return 0;
}
}
*language = strdup(voice->language);
*type = voice->type;
- SECURE_SLOG(LOG_DEBUG, tts_tag(), "Selected language(%s) type(%d)", *language, *type);
+ SECURE_SLOG(LOG_DEBUG, TAG_TTSCONFIG, "Selected language(%s) type(%d)", *language, *type);
return 0;
}
break;
Eina_Bool tts_config_mgr_inotify_event_cb(void* data, Ecore_Fd_Handler *fd_handler)
{
- SLOG(LOG_DEBUG, tts_tag(), "@@@ Config changed callback event");
+ SLOG(LOG_DEBUG, TAG_TTSCONFIG, "@@@ Config changed callback event");
int length;
struct inotify_event event;
length = read(g_config_fd_noti, &event, sizeof(struct inotify_event));
if (0 > length) {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] Empty Inotify event");
- SLOG(LOG_DEBUG, tts_tag(), "@@@");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Empty Inotify event");
+ SLOG(LOG_DEBUG, TAG_TTSCONFIG, "@@@");
return ECORE_CALLBACK_DONE;
}
strncpy(g_config_info->setting, setting, sizeof(g_setting) - 1);
}
- SECURE_SLOG(LOG_DEBUG, tts_tag(), "Engine change(%s)", g_config_info->engine_id);
+ SECURE_SLOG(LOG_DEBUG, TAG_TTSCONFIG, "Engine change(%s)", g_config_info->engine_id);
/* Call all callbacks of client*/
iter = g_slist_nth(g_config_client_list, 0);
if (NULL != temp_client) {
if (NULL != temp_client->engine_cb) {
- SECURE_SLOG(LOG_DEBUG, tts_tag(), "Engine changed callback : uid(%d)", temp_client->uid);
+ SECURE_SLOG(LOG_DEBUG, TAG_TTSCONFIG, "Engine changed callback : uid(%d)", temp_client->uid);
temp_client->engine_cb(g_config_info->engine_id, g_config_info->setting,
g_config_info->language, g_config_info->type,
g_config_info->auto_voice, g_config_info->credential, temp_client->user_data);
g_config_info->type = voice_type;
}
- SECURE_SLOG(LOG_DEBUG, tts_tag(), "Voice change(%s, %d)", g_config_info->language, g_config_info->type);
+ SECURE_SLOG(LOG_DEBUG, TAG_TTSCONFIG, "Voice change(%s, %d)", g_config_info->language, g_config_info->type);
/* Call all callbacks of client*/
iter = g_slist_nth(g_config_client_list, 0);
if (NULL != temp_client) {
if (NULL != temp_client->voice_cb) {
- SECURE_SLOG(LOG_DEBUG, tts_tag(), "Voice changed callback : uid(%d)", temp_client->uid);
+ SECURE_SLOG(LOG_DEBUG, TAG_TTSCONFIG, "Voice changed callback : uid(%d)", temp_client->uid);
temp_client->voice_cb(before_lang, before_type,
g_config_info->language, g_config_info->type,
g_config_info->auto_voice, temp_client->user_data);
if (-1 != speech_rate) {
g_config_info->speech_rate = speech_rate;
- SECURE_SLOG(LOG_DEBUG, tts_tag(), "Speech rate change(%d)", g_config_info->speech_rate);
+ SECURE_SLOG(LOG_DEBUG, TAG_TTSCONFIG, "Speech rate change(%d)", g_config_info->speech_rate);
/* Call all callbacks of client*/
iter = g_slist_nth(g_config_client_list, 0);
if (NULL != temp_client) {
if (NULL != temp_client->speech_cb) {
- SECURE_SLOG(LOG_DEBUG, tts_tag(), "Speech rate changed callback : uid(%d)", temp_client->uid);
+ SECURE_SLOG(LOG_DEBUG, TAG_TTSCONFIG, "Speech rate changed callback : uid(%d)", temp_client->uid);
temp_client->speech_cb(g_config_info->speech_rate, temp_client->user_data);
}
}
if (-1 != pitch) {
g_config_info->pitch = pitch;
- SECURE_SLOG(LOG_DEBUG, tts_tag(), "pitch change(%d)", g_config_info->pitch);
+ SECURE_SLOG(LOG_DEBUG, TAG_TTSCONFIG, "pitch change(%d)", g_config_info->pitch);
/* Call all callbacks of client*/
iter = g_slist_nth(g_config_client_list, 0);
if (NULL != temp_client) {
if (NULL != temp_client->pitch_cb) {
- SECURE_SLOG(LOG_DEBUG, tts_tag(), "Pitch changed callback : uid(%d)", temp_client->uid);
+ SECURE_SLOG(LOG_DEBUG, TAG_TTSCONFIG, "Pitch changed callback : uid(%d)", temp_client->uid);
temp_client->pitch_cb(g_config_info->pitch, temp_client->user_data);
}
}
lang = NULL;
}
} else if (IN_DELETE_SELF == event.mask) {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] IN_DELETE_SELF event");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] IN_DELETE_SELF event");
tts_parser_unload_config(g_config_info);
tts_parser_reset();
tts_parser_load_config(&g_config_info);
} else {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] Undefined event (0x%x)", event.mask);
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Undefined event (0x%x)", event.mask);
}
- SLOG(LOG_DEBUG, tts_tag(), "@@@");
+ SLOG(LOG_DEBUG, TAG_TTSCONFIG, "@@@");
return ECORE_CALLBACK_PASS_ON;
}
fd = inotify_init();
if (fd < 0) {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] Fail get inotify fd");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Fail get inotify fd");
return -1;
}
g_config_fd_noti = fd;
g_config_fd_handler_noti = ecore_main_fd_handler_add(fd, ECORE_FD_READ,
(Ecore_Fd_Cb)tts_config_mgr_inotify_event_cb, NULL, NULL, NULL);
if (NULL == g_config_fd_handler_noti) {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] Fail to get handler_noti");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Fail to get handler_noti");
return -1;
}
value |= O_NONBLOCK;
if (0 > fcntl(fd, F_SETFL, value)) {
- SLOG(LOG_WARN, tts_tag(), "[WARNING] Fail to set non-block mode");
+ SLOG(LOG_WARN, TAG_TTSCONFIG, "[WARNING] Fail to set non-block mode");
}
return 0;
char* value = NULL;
value = vconf_get_str(TTS_LANGSET_KEY);
if (NULL == value) {
- SLOG(LOG_ERROR, tts_tag(), "[Config ERROR] Fail to get display language");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[Config ERROR] Fail to get display language");
return -1;
}
if (true == __tts_config_mgr_check_lang_is_valid(g_config_info->engine_id, temp_lang, g_config_info->type)) {
/* tts default voice change */
if (NULL == g_config_info->language) {
- SLOG(LOG_ERROR, tts_tag(), "Current config language is NULL");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "Current config language is NULL");
return -1;
}
int before_type;
if (0 != tts_parser_set_voice(temp_lang, g_config_info->type)) {
- SLOG(LOG_ERROR, tts_tag(), "Fail to save default voice");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "Fail to save default voice");
return -1;
}
g_config_info->language = g_language;
strncpy(g_config_info->language, temp_lang, sizeof(g_language) - 1);
- SECURE_SLOG(LOG_DEBUG, tts_tag(), "[Config] Default voice : lang(%s) type(%d)",
+ SECURE_SLOG(LOG_DEBUG, TAG_TTSCONFIG, "[Config] Default voice : lang(%s) type(%d)",
g_config_info->language, g_config_info->type);
GSList *iter = NULL;
char* tmp_language = NULL;
int tmp_type = -1;
if (0 != __tts_config_mgr_select_lang(g_config_info->engine_id, &tmp_language, &tmp_type)) {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] Fail to select language");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Fail to select language");
return -1;
}
if (NULL == tmp_language) {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] language is NULL");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] language is NULL");
return -1;
}
if (0 != tts_parser_set_voice(tmp_language, tmp_type)) {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] Fail to save config");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Fail to save config");
return -1;
}
- SECURE_SLOG(LOG_DEBUG, tts_tag(), "[Config] Default voice : lang(%s) type(%d)",
+ SECURE_SLOG(LOG_DEBUG, TAG_TTSCONFIG, "[Config] Default voice : lang(%s) type(%d)",
tmp_language, tmp_type);
GSList *iter = NULL;
void __tts_config_display_language_changed_cb(keynode_t *key, void *data)
{
if (NULL == g_config_info) {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] Current config info is invalid.");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Current config info is invalid.");
return;
}
int screen_reader;
ret = vconf_get_bool(TTS_ACCESSIBILITY_KEY, &screen_reader);
if (0 != ret) {
- SLOG(LOG_ERROR, tts_tag(), "[Config ERROR] Fail to get screen reader");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[Config ERROR] Fail to get screen reader");
return;
}
}
}
- SLOG(LOG_DEBUG, tts_tag(), "Client count (%d)", g_slist_length(g_config_client_list));
+ SLOG(LOG_DEBUG, TAG_TTSCONFIG, "Client count (%d)", g_slist_length(g_config_client_list));
return g_slist_length(g_config_client_list);
}
/* Copy default info directory to download directory */
dp = opendir(TTS_DEFAULT_ENGINE_INFO);
if (NULL == dp) {
- SLOG(LOG_DEBUG, tts_tag(), "[CONFIG] No default directory : %s", TTS_DEFAULT_ENGINE_INFO);
+ SLOG(LOG_DEBUG, TAG_TTSCONFIG, "[CONFIG] No default directory : %s", TTS_DEFAULT_ENGINE_INFO);
} else {
do {
dirp = readdir(dp);
filesize = strlen(TTS_DEFAULT_ENGINE_INFO) + strlen(dirp->d_name) + 2;
if (filesize >= 512) {
- SECURE_SLOG(LOG_ERROR, tts_tag(), "[CONFIG ERROR] File path is too long : %s", dirp->d_name);
+ SECURE_SLOG(LOG_ERROR, TAG_TTSCONFIG, "[CONFIG ERROR] File path is too long : %s", dirp->d_name);
closedir(dp);
return -1;
}
memset(filepath, '\0', 512);
snprintf(filepath, 512, "%s/%s", TTS_DEFAULT_ENGINE_INFO, dirp->d_name);
- SECURE_SLOG(LOG_DEBUG, tts_tag(), "[CONFIG] Filepath(%s)", filepath);
+ SECURE_SLOG(LOG_DEBUG, TAG_TTSCONFIG, "[CONFIG] Filepath(%s)", filepath);
char dest[512] = {'\0',};
snprintf(dest, 512, "%s/%s", TTS_DOWNLOAD_ENGINE_INFO, dirp->d_name);
if (0 != access(dest, F_OK)) {
if (0 != tts_parser_copy_xml(filepath, dest)) {
- SLOG(LOG_ERROR, tts_tag(), "[CONFIG ERROR] Fail to copy engine info");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[CONFIG ERROR] Fail to copy engine info");
}
}
}
/* Get engine info from default engine directory */
dp = opendir(TTS_DOWNLOAD_ENGINE_INFO);
if (NULL == dp) {
- SLOG(LOG_DEBUG, tts_tag(), "[CONFIG] No downloadable directory : %s", TTS_DOWNLOAD_ENGINE_INFO);
+ SLOG(LOG_DEBUG, TAG_TTSCONFIG, "[CONFIG] No downloadable directory : %s", TTS_DOWNLOAD_ENGINE_INFO);
} else {
do {
dirp = readdir(dp);
filesize = strlen(TTS_DOWNLOAD_ENGINE_INFO) + strlen(dirp->d_name) + 2;
if (filesize >= 512) {
- SECURE_SLOG(LOG_ERROR, tts_tag(), "[CONFIG ERROR] File path is too long : %s", dirp->d_name);
+ SECURE_SLOG(LOG_ERROR, TAG_TTSCONFIG, "[CONFIG ERROR] File path is too long : %s", dirp->d_name);
closedir(dp);
return -1;
}
memset(filepath, '\0', 512);
snprintf(filepath, 512, "%s/%s", TTS_DOWNLOAD_ENGINE_INFO, dirp->d_name);
- SECURE_SLOG(LOG_DEBUG, tts_tag(), "[CONFIG] Filepath(%s)", filepath);
+ SECURE_SLOG(LOG_DEBUG, TAG_TTSCONFIG, "[CONFIG] Filepath(%s)", filepath);
if (0 == tts_parser_get_engine_info(filepath, &info)) {
g_engine_list = g_slist_append(g_engine_list, info);
if (0 != __tts_config_mgr_register_engine_config_updated_event(filepath)) {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] Fail to register engine config updated event");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Fail to register engine config updated event");
}
}
}
}
if (0 >= g_slist_length(g_engine_list)) {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] No engine");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] No engine");
return -1;
}
static Eina_Bool __tts_config_mgr_engine_config_inotify_event_callback(void* data, Ecore_Fd_Handler *fd_handler)
{
- SLOG(LOG_DEBUG, tts_tag(), "@@@ Engine config updated callback event");
+ SLOG(LOG_DEBUG, TAG_TTSCONFIG, "@@@ Engine config updated callback event");
tts_engine_inotify_s *ino = (tts_engine_inotify_s *)data;
int dir_fd = ino->dir_fd;
length = read(dir_fd, &event, sizeof(struct inotify_event));
if (0 > length) {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] Empty Inotify event");
- SLOG(LOG_DEBUG, tts_tag(), "@@@");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Empty Inotify event");
+ SLOG(LOG_DEBUG, TAG_TTSCONFIG, "@@@");
return ECORE_CALLBACK_DONE;
}
if (IN_CLOSE_WRITE == event.mask) {
int ret = __tts_config_mgr_get_engine_info();
if (0 != ret) {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] Fail to get engine info when config updated");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Fail to get engine info when config updated");
}
__tts_config_mgr_print_engine_info();
bool support = tts_config_check_default_voice_is_valid(g_config_info->language, g_config_info->type);
if (false == support) {
- SLOG(LOG_DEBUG, tts_tag(), "[ERROR] Default voice is valid");
+ SLOG(LOG_DEBUG, TAG_TTSCONFIG, "[ERROR] Default voice is valid");
char* temp_lang = NULL;
int temp_type;
ret = __tts_config_mgr_select_lang(g_config_info->engine_id, &temp_lang, &temp_type);
if (0 != ret) {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] Fail to get voice");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Fail to get voice");
}
ret = tts_config_mgr_set_voice(temp_lang, temp_type);
if (0 != ret) {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] Fail to set voice");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Fail to set voice");
} else {
- SLOG(LOG_DEBUG, tts_tag(), "[DEBUG] Saved default voice : lang(%s), type(%d)", g_config_info->language, g_config_info->type);
+ SLOG(LOG_DEBUG, TAG_TTSCONFIG, "[DEBUG] Saved default voice : lang(%s), type(%d)", g_config_info->language, g_config_info->type);
}
if (NULL != temp_lang) {
free(temp_lang);
if (NULL != temp_client) {
if (NULL != temp_client->engine_cb) {
- SECURE_SLOG(LOG_DEBUG, tts_tag(), "Engine changed callback : uid(%d)", temp_client->uid);
+ SECURE_SLOG(LOG_DEBUG, TAG_TTSCONFIG, "Engine changed callback : uid(%d)", temp_client->uid);
temp_client->engine_cb(g_config_info->engine_id, g_config_info->setting,
g_config_info->language, g_config_info->type,
g_config_info->auto_voice, g_config_info->credential, temp_client->user_data);
iter = g_slist_next(iter);
}
} else {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] Undefined event");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Undefined event");
}
- SLOG(LOG_DEBUG, tts_tag(), "@@@");
+ SLOG(LOG_DEBUG, TAG_TTSCONFIG, "@@@");
return ECORE_CALLBACK_PASS_ON;
}
static int __tts_config_mgr_register_engine_config_updated_event(const char* path)
{
if (NULL == path) {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] Path is NULL");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Path is NULL");
return -1;
}
/* For engine directory monitoring */
tts_engine_inotify_s *ino = (tts_engine_inotify_s *)calloc(1, sizeof(tts_engine_inotify_s));
if (NULL == ino) {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] Fail to allocate memory");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Fail to allocate memory");
return -1;
}
ino->dir_fd = inotify_init();
if (ino->dir_fd < 0) {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] Fail to init inotify");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Fail to init inotify");
free(ino);
ino = NULL;
}
ino->dir_wd = inotify_add_watch(ino->dir_fd, path, IN_CLOSE_WRITE);
- SLOG(LOG_DEBUG, tts_tag(), "Add inotify watch(%s)", path);
+ SLOG(LOG_DEBUG, TAG_TTSCONFIG, "Add inotify watch(%s)", path);
if (ino->dir_wd < 0) {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] Fail to add watch");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Fail to add watch");
free(ino);
ino = NULL;
return -1;
ino->dir_fd_handler = ecore_main_fd_handler_add(ino->dir_fd, ECORE_FD_READ, (Ecore_Fd_Cb)__tts_config_mgr_engine_config_inotify_event_callback, (void *)ino, NULL, NULL);
if (NULL == ino->dir_fd_handler) {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] Fail to add fd handler");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Fail to add fd handler");
free(ino);
ino = NULL;
return -1;
value |= O_NONBLOCK;
if (0 > fcntl(ino->dir_fd, F_SETFL, value)) {
- SLOG(LOG_WARN, tts_tag(), "[WARNING] Fail to set non-block mode");
+ SLOG(LOG_WARN, TAG_TTSCONFIG, "[WARNING] Fail to set non-block mode");
}
g_ino_list = g_list_append(g_ino_list, ino);
get_uid = iter->data;
if (uid == *get_uid) {
- SECURE_SLOG(LOG_WARN, tts_tag(), "[CONFIG] uid(%d) has already registered", uid);
+ SECURE_SLOG(LOG_WARN, TAG_TTSCONFIG, "[CONFIG] uid(%d) has already registered", uid);
return 0;
}
temp_client = (tts_config_client_s*)calloc(1, sizeof(tts_config_client_s));
if (NULL == temp_client) {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] Fail to allocate memory");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Fail to allocate memory");
return TTS_CONFIG_ERROR_OUT_OF_MEMORY;
}
temp_client->uid = uid;
g_config_client_list = g_slist_append(g_config_client_list, temp_client);
- SECURE_SLOG(LOG_WARN, tts_tag(), "[CONFIG] Add uid(%d) but config has already initialized", uid);
+ SECURE_SLOG(LOG_WARN, TAG_TTSCONFIG, "[CONFIG] Add uid(%d) but config has already initialized", uid);
return 0;
} else {
temp_client = (tts_config_client_s*)calloc(1, sizeof(tts_config_client_s));
if (NULL == temp_client) {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] Fail to allocate memory");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Fail to allocate memory");
return TTS_CONFIG_ERROR_OUT_OF_MEMORY;
}
temp_client->uid = uid;
if (0 != access(TTS_CONFIG_BASE, F_OK)) {
if (0 != mkdir(TTS_CONFIG_BASE, S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)) {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] Fail to make directory : %s", TTS_CONFIG_BASE);
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Fail to make directory : %s", TTS_CONFIG_BASE);
__tts_config_release_client(uid);
return TTS_CONFIG_ERROR_OPERATION_FAILED;
} else {
- SLOG(LOG_DEBUG, tts_tag(), "Success to make directory : %s", TTS_CONFIG_BASE);
+ SLOG(LOG_DEBUG, TAG_TTSCONFIG, "Success to make directory : %s", TTS_CONFIG_BASE);
}
}
if (0 != access(TTS_HOME, F_OK)) {
if (0 != mkdir(TTS_HOME, S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)) {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] Fail to make directory : %s", TTS_HOME);
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Fail to make directory : %s", TTS_HOME);
__tts_config_release_client(uid);
return TTS_CONFIG_ERROR_OPERATION_FAILED;
} else {
- SLOG(LOG_DEBUG, tts_tag(), "Success to make directory : %s", TTS_HOME);
+ SLOG(LOG_DEBUG, TAG_TTSCONFIG, "Success to make directory : %s", TTS_HOME);
}
}
if (0 != access(TTS_DOWNLOAD_BASE, F_OK)) {
if (0 != mkdir(TTS_DOWNLOAD_BASE, S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)) {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] Fail to make directory : %s", TTS_DOWNLOAD_BASE);
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Fail to make directory : %s", TTS_DOWNLOAD_BASE);
__tts_config_release_client(uid);
return TTS_CONFIG_ERROR_OPERATION_FAILED;
} else {
- SLOG(LOG_DEBUG, tts_tag(), "Success to make directory : %s", TTS_DOWNLOAD_BASE);
+ SLOG(LOG_DEBUG, TAG_TTSCONFIG, "Success to make directory : %s", TTS_DOWNLOAD_BASE);
}
}
if (0 != access(TTS_DOWNLOAD_ENGINE_INFO, F_OK)) {
if (0 != mkdir(TTS_DOWNLOAD_ENGINE_INFO, S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)) {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] Fail to make directory : %s", TTS_DOWNLOAD_ENGINE_INFO);
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Fail to make directory : %s", TTS_DOWNLOAD_ENGINE_INFO);
__tts_config_release_client(uid);
return TTS_CONFIG_ERROR_OPERATION_FAILED;
} else {
- SLOG(LOG_DEBUG, tts_tag(), "Success to make directory : %s", TTS_DOWNLOAD_ENGINE_INFO);
+ SLOG(LOG_DEBUG, TAG_TTSCONFIG, "Success to make directory : %s", TTS_DOWNLOAD_ENGINE_INFO);
}
}
if (0 != __tts_config_mgr_get_engine_info()) {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] Fail to get engine info");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Fail to get engine info");
__tts_config_release_client(uid);
__tts_config_release_engine();
return TTS_CONFIG_ERROR_ENGINE_NOT_FOUND;
__tts_config_mgr_print_engine_info();
if (0 != tts_parser_load_config(&g_config_info)) {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] Fail to parse configure information");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Fail to parse configure information");
__tts_config_release_client(uid);
__tts_config_release_engine();
return TTS_CONFIG_ERROR_OPERATION_FAILED;
/* Check whether engine id is valid */
if (0 != __tts_config_mgr_check_engine_is_valid(g_config_info->engine_id)) {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] Fail to get default engine");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Fail to get default engine");
__tts_config_release_client(uid);
__tts_config_release_engine();
tts_parser_unload_config(g_config_info);
char* tmp_language = NULL;
int tmp_type = -1;
if (0 != __tts_config_mgr_select_lang(g_config_info->engine_id, &tmp_language, &tmp_type)) {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] Fail to select language");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Fail to select language");
__tts_config_release_client(uid);
__tts_config_release_engine();
tts_parser_unload_config(g_config_info);
tmp_language = NULL;
if (0 != tts_parser_set_voice(g_config_info->language, g_config_info->type)) {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] Fail to save config");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Fail to save config");
__tts_config_release_client(uid);
__tts_config_release_engine();
tts_parser_unload_config(g_config_info);
}
/* print daemon config */
- SLOG(LOG_DEBUG, tts_tag(), "@@@ TTS config @@@");
- SECURE_SLOG(LOG_DEBUG, tts_tag(), " engine : %s", g_config_info->engine_id);
- SECURE_SLOG(LOG_DEBUG, tts_tag(), " setting : %s", g_config_info->setting);
- SECURE_SLOG(LOG_DEBUG, tts_tag(), " auto voice : %s", g_config_info->auto_voice ? "on" : "off");
- SECURE_SLOG(LOG_DEBUG, tts_tag(), " language : %s", g_config_info->language);
- SECURE_SLOG(LOG_DEBUG, tts_tag(), " voice type : %d", g_config_info->type);
- SECURE_SLOG(LOG_DEBUG, tts_tag(), " speech rate : %d", g_config_info->speech_rate);
- SECURE_SLOG(LOG_DEBUG, tts_tag(), " pitch : %d", g_config_info->pitch);
- SLOG(LOG_DEBUG, tts_tag(), "@@@@@");
+ SLOG(LOG_DEBUG, TAG_TTSCONFIG, "@@@ TTS config @@@");
+ SECURE_SLOG(LOG_DEBUG, TAG_TTSCONFIG, " engine : %s", g_config_info->engine_id);
+ SECURE_SLOG(LOG_DEBUG, TAG_TTSCONFIG, " setting : %s", g_config_info->setting);
+ SECURE_SLOG(LOG_DEBUG, TAG_TTSCONFIG, " auto voice : %s", g_config_info->auto_voice ? "on" : "off");
+ SECURE_SLOG(LOG_DEBUG, TAG_TTSCONFIG, " language : %s", g_config_info->language);
+ SECURE_SLOG(LOG_DEBUG, TAG_TTSCONFIG, " voice type : %d", g_config_info->type);
+ SECURE_SLOG(LOG_DEBUG, TAG_TTSCONFIG, " speech rate : %d", g_config_info->speech_rate);
+ SECURE_SLOG(LOG_DEBUG, TAG_TTSCONFIG, " pitch : %d", g_config_info->pitch);
+ SLOG(LOG_DEBUG, TAG_TTSCONFIG, "@@@@@");
if (0 != __tts_config_mgr_register_config_event()) {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] Fail to register config event");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Fail to register config event");
__tts_config_release_client(uid);
__tts_config_release_engine();
tts_parser_unload_config(g_config_info);
/* For engine directory monitoring */
//if (0 != __tts_config_mgr_register_engine_config_updated_event()) {
- // SLOG(LOG_ERROR, tts_tag(), "[ERROR] Fail to register engine config updated event");
+ // SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Fail to register engine config updated event");
// __tts_config_release_client(uid);
// __tts_config_release_engine();
// tts_parser_unload_config(g_config_info);
int tts_config_set_screen_reader_callback(int uid, tts_config_screen_reader_changed_cb callback)
{
if (NULL == callback) {
- SLOG(LOG_ERROR, tts_tag(), "Input parameter is NULL");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "Input parameter is NULL");
return TTS_CONFIG_ERROR_INVALID_PARAMETER;
}
int tts_config_mgr_get_engine_list(tts_config_supported_engine_cb callback, void* user_data)
{
if (0 >= g_slist_length(g_config_client_list)) {
- SLOG(LOG_ERROR, tts_tag(), "Not initialized");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "Not initialized");
return TTS_CONFIG_ERROR_INVALID_STATE;
}
tts_engine_info_s *engine_info = NULL;
if (0 >= g_slist_length(g_engine_list)) {
- SLOG(LOG_ERROR, tts_tag(), "There is no engine!!");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "There is no engine!!");
return TTS_CONFIG_ERROR_ENGINE_NOT_FOUND;
}
int tts_config_mgr_get_engine(char** engine)
{
if (0 >= g_slist_length(g_config_client_list)) {
- SLOG(LOG_ERROR, tts_tag(), "Not initialized");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "Not initialized");
return TTS_CONFIG_ERROR_INVALID_STATE;
}
if (NULL == engine) {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] Input parameter is NULL");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Input parameter is NULL");
return TTS_CONFIG_ERROR_INVALID_PARAMETER;
}
tts_engine_info_s *engine_info = NULL;
if (0 >= g_slist_length(g_engine_list)) {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] There is no engine!!");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] There is no engine!!");
return TTS_CONFIG_ERROR_ENGINE_NOT_FOUND;
}
iter = g_slist_next(iter);
}
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] Current engine id is not valid");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Current engine id is not valid");
} else {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] Engine id is NULL");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Engine id is NULL");
}
return TTS_CONFIG_ERROR_OPERATION_FAILED;
int ret = buxton_open(&bux_cli, NULL, NULL);
if (0 != ret) {
- SLOG(LOG_ERROR, tts_tag(), "[DBUS-BUXTON2] buxton_open failed!! (%d)", ret);
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[DBUS-BUXTON2] buxton_open failed!! (%d)", ret);
return TTS_CONFIG_ERROR_OPERATION_FAILED;
}
bux_layer = buxton_create_layer("system");
if (NULL == bux_layer) {
- SLOG(LOG_ERROR, tts_tag(), "[DBUS-BUXTON2] buxton_create_layer FAIL");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[DBUS-BUXTON2] buxton_create_layer FAIL");
buxton_close(bux_cli);
return TTS_CONFIG_ERROR_OPERATION_FAILED;
}
bux_val = buxton_value_create_string(engine);
if (NULL == bux_val) {
- SLOG(LOG_ERROR, tts_tag(), "[DBUS-BUXTON2] buxton_value_create_string FAIL");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[DBUS-BUXTON2] buxton_value_create_string FAIL");
buxton_free_layer(bux_layer);
buxton_close(bux_cli);
return TTS_CONFIG_ERROR_OPERATION_FAILED;
} else {
- SLOG(LOG_DEBUG, tts_tag(), "[DBUS-BUXTON2] layer: %s", buxton_layer_get_name(bux_layer));
+ SLOG(LOG_DEBUG, TAG_TTSCONFIG, "[DBUS-BUXTON2] layer: %s", buxton_layer_get_name(bux_layer));
}
ret = buxton_set_value_sync(bux_cli, bux_layer, TTS_ENGINE_DB_DEFAULT, bux_val);
if (0 != ret) {
- SLOG(LOG_ERROR, tts_tag(), "[DBUS-BUXTON2] buxton_set_value_sync failed!! (%d)", ret);
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[DBUS-BUXTON2] buxton_set_value_sync failed!! (%d)", ret);
buxton_value_free(bux_val);
buxton_free_layer(bux_layer);
buxton_close(bux_cli);
return TTS_CONFIG_ERROR_OPERATION_FAILED;
} else {
- SLOG(LOG_DEBUG, tts_tag(), "[DBUS-BUXTON2] buxton_set_value_sync: %d, %s", ret, TTS_ENGINE_DB_DEFAULT);
+ SLOG(LOG_DEBUG, TAG_TTSCONFIG, "[DBUS-BUXTON2] buxton_set_value_sync: %d, %s", ret, TTS_ENGINE_DB_DEFAULT);
}
buxton_value_free(bux_val);
int tts_config_mgr_set_engine(const char* engine)
{
if (0 >= g_slist_length(g_config_client_list)) {
- SLOG(LOG_ERROR, tts_tag(), "Not initialized");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "Not initialized");
return TTS_CONFIG_ERROR_INVALID_STATE;
}
return 0;
if (0 >= g_slist_length(g_engine_list)) {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] There is no engine!!");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] There is no engine!!");
return TTS_CONFIG_ERROR_ENGINE_NOT_FOUND;
}
- SLOG(LOG_DEBUG, tts_tag(), "New engine id : %s", engine);
+ SLOG(LOG_DEBUG, TAG_TTSCONFIG, "New engine id : %s", engine);
int ret = __tts_set_buxtonkey(engine);
if (0 != ret) {
- SLOG(LOG_DEBUG, tts_tag(), "[DEBUG] set_buxtonkey Fail!!");
+ SLOG(LOG_DEBUG, TAG_TTSCONFIG, "[DEBUG] set_buxtonkey Fail!!");
return ret;
}
engine_info = iter->data;
if (NULL == engine_info) {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] Engine info is NULL");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Engine info is NULL");
iter = g_slist_next(iter);
continue;
}
if (NULL != voice) {
if (NULL == voice->language)
continue;
- SLOG(LOG_DEBUG, tts_tag(), " lang(%s) type(%d)", voice->language, voice->type);
+ SLOG(LOG_DEBUG, TAG_TTSCONFIG, " lang(%s) type(%d)", voice->language, voice->type);
if (0 == strcmp(voice->language, g_config_info->language)) {
if (voice->type == g_config_info->type) {
}
if (true == is_valid_engine) {
- SLOG(LOG_DEBUG, tts_tag(), "[Config] Engine changed");
- SECURE_SLOG(LOG_DEBUG, tts_tag(), " Engine : %s", g_config_info->engine_id);
- SECURE_SLOG(LOG_DEBUG, tts_tag(), " Setting : %s", g_config_info->setting);
- SECURE_SLOG(LOG_DEBUG, tts_tag(), " Language : %s", g_config_info->language);
- SECURE_SLOG(LOG_DEBUG, tts_tag(), " Type : %d", g_config_info->type);
+ SLOG(LOG_DEBUG, TAG_TTSCONFIG, "[Config] Engine changed");
+ SECURE_SLOG(LOG_DEBUG, TAG_TTSCONFIG, " Engine : %s", g_config_info->engine_id);
+ SECURE_SLOG(LOG_DEBUG, TAG_TTSCONFIG, " Setting : %s", g_config_info->setting);
+ SECURE_SLOG(LOG_DEBUG, TAG_TTSCONFIG, " Language : %s", g_config_info->language);
+ SECURE_SLOG(LOG_DEBUG, TAG_TTSCONFIG, " Type : %d", g_config_info->type);
if (0 != tts_parser_set_engine(g_config_info->engine_id, g_config_info->setting,
g_config_info->language, g_config_info->type)) {
- SLOG(LOG_ERROR, tts_tag(), " Fail to save config");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, " Fail to save config");
return TTS_CONFIG_ERROR_OPERATION_FAILED;
}
} else {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] Engine id is not valid");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Engine id is not valid");
return TTS_CONFIG_ERROR_OPERATION_FAILED;
}
int tts_config_mgr_get_voice_list(const char* engine_id, tts_config_supported_voice_cb callback, void* user_data)
{
if (0 >= g_slist_length(g_config_client_list)) {
- SLOG(LOG_ERROR, tts_tag(), "Not initialized");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "Not initialized");
return TTS_CONFIG_ERROR_INVALID_STATE;
}
if (0 >= g_slist_length(g_engine_list)) {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] There is no engine");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] There is no engine");
return TTS_CONFIG_ERROR_ENGINE_NOT_FOUND;
}
engine_info = iter->data;
if (NULL == engine_info) {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] engine info is NULL");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] engine info is NULL");
return TTS_CONFIG_ERROR_OPERATION_FAILED;
}
/*Get handle data from list*/
voice = iter_voice->data;
- SLOG(LOG_DEBUG, tts_tag(), " lang(%s) type(%d)", voice->language, voice->type);
+ SLOG(LOG_DEBUG, TAG_TTSCONFIG, " lang(%s) type(%d)", voice->language, voice->type);
if (NULL != voice->language) {
if (false == callback(engine_info->uuid, voice->language, voice->type, user_data))
break;
int tts_config_mgr_get_voice(char** language, int* type)
{
if (0 >= g_slist_length(g_config_client_list)) {
- SLOG(LOG_ERROR, tts_tag(), "Not initialized");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "Not initialized");
return TTS_CONFIG_ERROR_INVALID_PARAMETER;
}
if (0 >= g_slist_length(g_engine_list)) {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] There is no engine");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] There is no engine");
return TTS_CONFIG_ERROR_ENGINE_NOT_FOUND;
}
*language = strdup(g_config_info->language);
*type = g_config_info->type;
} else {
- SLOG(LOG_ERROR, tts_tag(), "language is NULL");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "language is NULL");
return TTS_CONFIG_ERROR_OPERATION_FAILED;
}
int tts_config_mgr_set_voice(const char* language, int type)
{
if (0 >= g_slist_length(g_config_client_list)) {
- SLOG(LOG_ERROR, tts_tag(), "Not initialized");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "Not initialized");
return TTS_CONFIG_ERROR_INVALID_PARAMETER;
}
if (NULL == language) {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] Input parameter is NULL");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Input parameter is NULL");
return TTS_CONFIG_ERROR_INVALID_PARAMETER;
}
if (0 >= g_slist_length(g_engine_list)) {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] There is no engine");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] There is no engine");
return TTS_CONFIG_ERROR_ENGINE_NOT_FOUND;
}
/* Check language is valid */
if (0 != tts_parser_set_voice(language, type)) {
- SLOG(LOG_ERROR, tts_tag(), "Fail to save default voice");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "Fail to save default voice");
return TTS_CONFIG_ERROR_OPERATION_FAILED;
}
memset(g_language, '\0', sizeof(g_language));
int tts_config_mgr_get_auto_voice(bool* value)
{
if (0 >= g_slist_length(g_config_client_list)) {
- SLOG(LOG_ERROR, tts_tag(), "Not initialized");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "Not initialized");
return TTS_CONFIG_ERROR_INVALID_PARAMETER;
}
int tts_config_mgr_set_auto_voice(bool value)
{
if (0 >= g_slist_length(g_config_client_list)) {
- SLOG(LOG_ERROR, tts_tag(), "Not initialized");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "Not initialized");
return TTS_CONFIG_ERROR_INVALID_PARAMETER;
}
if (g_config_info->auto_voice != value) {
/* Check language is valid */
if (0 != tts_parser_set_auto_voice(value)) {
- SLOG(LOG_ERROR, tts_tag(), "Fail to save auto voice option");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "Fail to save auto voice option");
return TTS_CONFIG_ERROR_OPERATION_FAILED;
}
g_config_info->auto_voice = value;
int tts_config_mgr_get_speech_rate(int* value)
{
if (0 >= g_slist_length(g_config_client_list)) {
- SLOG(LOG_ERROR, tts_tag(), "Not initialized");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "Not initialized");
return TTS_CONFIG_ERROR_INVALID_PARAMETER;
}
int tts_config_mgr_set_speech_rate(int value)
{
if (0 >= g_slist_length(g_config_client_list)) {
- SLOG(LOG_ERROR, tts_tag(), "Not initialized");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "Not initialized");
return TTS_CONFIG_ERROR_INVALID_PARAMETER;
}
if (TTS_CONFIG_SPEED_MIN <= value && value <= TTS_CONFIG_SPEED_MAX) {
- SLOG(LOG_DEBUG, tts_tag(), "[Config] Set speech rate : %d", value);
+ SLOG(LOG_DEBUG, TAG_TTSCONFIG, "[Config] Set speech rate : %d", value);
if (0 != tts_parser_set_speech_rate(value)) {
- SLOG(LOG_ERROR, tts_tag(), "Fail to save speech rate");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "Fail to save speech rate");
return TTS_CONFIG_ERROR_OPERATION_FAILED;
}
g_config_info->speech_rate = value;
} else {
- SLOG(LOG_ERROR, tts_tag(), "[Config ERROR] Speech rate is invalid : %d", value);
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[Config ERROR] Speech rate is invalid : %d", value);
}
return 0;
int tts_config_mgr_get_pitch(int* value)
{
if (0 >= g_slist_length(g_config_client_list)) {
- SLOG(LOG_ERROR, tts_tag(), "Not initialized");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "Not initialized");
return TTS_CONFIG_ERROR_INVALID_PARAMETER;
}
tts_engine_info_s *engine_info = NULL;
if (0 >= g_slist_length(g_engine_list)) {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] There is no engine!!");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] There is no engine!!");
return TTS_CONFIG_ERROR_ENGINE_NOT_FOUND;
}
engine_info = iter->data;
if (NULL == engine_info) {
- SLOG(LOG_ERROR, tts_tag(), "engine info is NULL");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "engine info is NULL");
return TTS_CONFIG_ERROR_OPERATION_FAILED;
}
int tts_config_mgr_set_pitch(int value)
{
if (0 >= g_slist_length(g_config_client_list)) {
- SLOG(LOG_ERROR, tts_tag(), "Not initialized");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "Not initialized");
return -1;
}
tts_engine_info_s *engine_info = NULL;
if (0 >= g_slist_length(g_engine_list)) {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] There is no engine!!");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] There is no engine!!");
return TTS_CONFIG_ERROR_ENGINE_NOT_FOUND;
}
engine_info = iter->data;
if (NULL == engine_info) {
- SLOG(LOG_ERROR, tts_tag(), "engine info is NULL");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "engine info is NULL");
return TTS_CONFIG_ERROR_OPERATION_FAILED;
}
}
if (0 != tts_parser_set_pitch(value)) {
- SLOG(LOG_ERROR, tts_tag(), "Fail to save speech rate");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "Fail to save speech rate");
return TTS_CONFIG_ERROR_OPERATION_FAILED;
}
bool tts_config_check_default_engine_is_valid(const char* engine)
{
if (0 >= g_slist_length(g_config_client_list)) {
- SLOG(LOG_ERROR, tts_tag(), "Not initialized");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "Not initialized");
return -1;
}
bool tts_config_check_default_voice_is_valid(const char* language, int type)
{
if (0 >= g_slist_length(g_config_client_list)) {
- SLOG(LOG_ERROR, tts_tag(), "Not initialized");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "Not initialized");
return -1;
}
return false;
if (0 == strlen(g_config_info->engine_id)) {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] Default engine id is NULL");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Default engine id is NULL");
return false;
}
engine_info = iter->data;
if (NULL == engine_info) {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] Engine info is NULL");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Engine info is NULL");
iter = g_slist_next(iter);
continue;
}
tts_engine_info_s *engine_info = NULL;
if (0 >= g_slist_length(g_engine_list)) {
- SLOG(LOG_DEBUG, tts_tag(), "-------------- engine list -----------------");
- SLOG(LOG_DEBUG, tts_tag(), " No Engine in engine directory");
- SLOG(LOG_DEBUG, tts_tag(), "--------------------------------------------");
+ SLOG(LOG_DEBUG, TAG_TTSCONFIG, "-------------- engine list -----------------");
+ SLOG(LOG_DEBUG, TAG_TTSCONFIG, " No Engine in engine directory");
+ SLOG(LOG_DEBUG, TAG_TTSCONFIG, "--------------------------------------------");
return 0;
}
/* Get a first item */
iter = g_slist_nth(g_engine_list, 0);
- SLOG(LOG_DEBUG, tts_tag(), "--------------- engine list -----------------");
+ SLOG(LOG_DEBUG, TAG_TTSCONFIG, "--------------- engine list -----------------");
int i = 1;
while (NULL != iter) {
engine_info = iter->data;
- SLOG(LOG_DEBUG, tts_tag(), "[%dth]", i);
- SLOG(LOG_DEBUG, tts_tag(), " name : %s", engine_info->name);
- SLOG(LOG_DEBUG, tts_tag(), " id : %s", engine_info->uuid);
- SLOG(LOG_DEBUG, tts_tag(), " setting : %s", engine_info->setting);
+ SLOG(LOG_DEBUG, TAG_TTSCONFIG, "[%dth]", i);
+ SLOG(LOG_DEBUG, TAG_TTSCONFIG, " name : %s", engine_info->name);
+ SLOG(LOG_DEBUG, TAG_TTSCONFIG, " id : %s", engine_info->uuid);
+ SLOG(LOG_DEBUG, TAG_TTSCONFIG, " setting : %s", engine_info->setting);
- SLOG(LOG_DEBUG, tts_tag(), " Voices");
+ SLOG(LOG_DEBUG, TAG_TTSCONFIG, " Voices");
GSList *iter_voice = NULL;
tts_config_voice_s* voice = NULL;
/*Get handle data from list*/
voice = iter_voice->data;
- SLOG(LOG_DEBUG, tts_tag(), " [%dth] lang(%s) type(%d)", j, voice->language, voice->type);
+ SLOG(LOG_DEBUG, TAG_TTSCONFIG, " [%dth] lang(%s) type(%d)", j, voice->language, voice->type);
/*Get next item*/
iter_voice = g_slist_next(iter_voice);
j++;
}
} else {
- SLOG(LOG_ERROR, tts_tag(), " Voice is NONE");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, " Voice is NONE");
}
iter = g_slist_next(iter);
i++;
}
- SLOG(LOG_DEBUG, tts_tag(), "--------------------------------------------");
+ SLOG(LOG_DEBUG, TAG_TTSCONFIG, "--------------------------------------------");
return 0;
}
int tts_config_mgr_get_max_text_size(unsigned int* size)
{
if (0 >= g_slist_length(g_config_client_list)) {
- SLOG(LOG_ERROR, tts_tag(), "Not initialized");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "Not initialized");
return TTS_CONFIG_ERROR_INVALID_PARAMETER;
}
tts_engine_info_s *engine_info = NULL;
if (0 >= g_slist_length(g_engine_list)) {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] There is no engine!!");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] There is no engine!!");
return TTS_CONFIG_ERROR_ENGINE_NOT_FOUND;
}
engine_info = iter->data;
if (NULL == engine_info) {
- SLOG(LOG_ERROR, tts_tag(), "engine info is NULL");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "engine info is NULL");
return TTS_CONFIG_ERROR_OPERATION_FAILED;
}
}
if (NULL == engine_info) {
- SLOG(LOG_ERROR, tts_tag(), "engine info is NULL");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "engine info is NULL");
return TTS_CONFIG_ERROR_OPERATION_FAILED;
}
*size = engine_info->text_size;
- SLOG(LOG_DEBUG, tts_tag(), "[DEBUG] Max text size is %d.", *size);
+ SLOG(LOG_DEBUG, TAG_TTSCONFIG, "[DEBUG] Max text size is %d.", *size);
return 0;
}
-
#define TTS_MAX_TEXT_SIZE 2000
-extern char* tts_tag();
-
static xmlDocPtr g_config_doc = NULL;
char g_engine_id[128] = {0,};
char g_setting[128] = {0,};
int tts_parser_get_engine_info(const char* path, tts_engine_info_s** engine_info)
{
if (NULL == path || NULL == engine_info) {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] Input parameter is NULL");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Input parameter is NULL");
return -1;
}
xmlChar *attr = NULL;
if (0 == access(path, F_OK)) {
- SLOG(LOG_DEBUG, tts_tag(), "[DEBUG] Success to access to %s", path);
+ SLOG(LOG_DEBUG, TAG_TTSCONFIG, "[DEBUG] Success to access to %s", path);
doc = xmlParseFile(path);
if (doc == NULL) {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] Fail to parse xml file");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Fail to parse xml file");
return -1;
}
} else {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] Fail to access to %s", path);
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Fail to access to %s", path);
return -1;
}
cur = xmlDocGetRootElement(doc);
if (cur == NULL) {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] Empty document");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Empty document");
xmlFreeDoc(doc);
doc = NULL;
return -1;
}
if (xmlStrcmp(cur->name, (const xmlChar *)TTS_TAG_ENGINE_BASE_TAG)) {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] The wrong type, root node is NOT 'tts-engine'");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] The wrong type, root node is NOT 'tts-engine'");
xmlFreeDoc(doc);
doc = NULL;
return -1;
cur = cur->xmlChildrenNode;
if (cur == NULL) {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] Empty document");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Empty document");
xmlFreeDoc(doc);
doc = NULL;
return -1;
tts_engine_info_s* temp;
temp = (tts_engine_info_s*)calloc(1, sizeof(tts_engine_info_s));
if (NULL == temp) {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] Out of memory");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Out of memory");
xmlFreeDoc(doc);
doc = NULL;
return -1;
xmlFree(key);
key = NULL;
} else {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] <%s> has no content", TTS_TAG_ENGINE_NAME);
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] <%s> has no content", TTS_TAG_ENGINE_NAME);
}
} else if (0 == xmlStrcmp(cur->name, (const xmlChar *)TTS_TAG_ENGINE_ID)) {
key = xmlNodeGetContent(cur);
xmlFree(key);
key = NULL;
} else {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] <%s> has no content", TTS_TAG_ENGINE_ID);
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] <%s> has no content", TTS_TAG_ENGINE_ID);
}
} else if (0 == xmlStrcmp(cur->name, (const xmlChar *)TTS_TAG_ENGINE_SETTING)) {
key = xmlNodeGetContent(cur);
xmlFree(key);
key = NULL;
} else {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] <%s> has no content", TTS_TAG_ENGINE_SETTING);
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] <%s> has no content", TTS_TAG_ENGINE_SETTING);
}
} else if (0 == xmlStrcmp(cur->name, (const xmlChar *)TTS_TAG_ENGINE_VOICE_SET)) {
xmlNodePtr voice_node = NULL;
if (0 == xmlStrcmp(voice_node->name, (const xmlChar *)TTS_TAG_ENGINE_VOICE)) {
tts_config_voice_s* temp_voice = (tts_config_voice_s*)calloc(1, sizeof(tts_config_voice_s));
if (NULL == temp_voice) {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] Out of memory");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Out of memory");
break;
}
xmlFree(attr);
attr = NULL;
} else {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] <%s> has no content", TTS_TAG_ENGINE_VOICE_TYPE);
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] <%s> has no content", TTS_TAG_ENGINE_VOICE_TYPE);
free(temp_voice);
temp_voice = NULL;
continue;
key = NULL;
temp->voices = g_slist_append(temp->voices, temp_voice);
} else {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] <%s> has no content", TTS_TAG_ENGINE_VOICE);
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] <%s> has no content", TTS_TAG_ENGINE_VOICE);
if (NULL != temp_voice) {
free(temp_voice);
temp_voice = NULL;
xmlFree(key);
key = NULL;
} else {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] <%s> has no content", TTS_TAG_ENGINE_PITCH_SUPPORT);
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] <%s> has no content", TTS_TAG_ENGINE_PITCH_SUPPORT);
}
} else if (0 == xmlStrcmp(cur->name, (const xmlChar *)TTS_TAG_ENGINE_TEXT_SIZE)) {
isTextsize = true;
temp->text_size = atoi((char*)key);
xmlFree(key);
} else {
- SLOG(LOG_INFO, tts_tag(), "[INFO] text size is unlimited.");
+ SLOG(LOG_INFO, TAG_TTSCONFIG, "[INFO] text size is unlimited.");
temp->text_size = 0;
}
}
if (NULL == temp->uuid) {
/* Invalid engine */
- SECURE_SLOG(LOG_ERROR, tts_tag(), "[ERROR] Invalid engine : %s", path);
+ SECURE_SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Invalid engine : %s", path);
tts_parser_free_engine_info(temp);
return -1;
}
int tts_parser_free_engine_info(tts_engine_info_s* engine_info)
{
if (NULL == engine_info) {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] Input parameter is NULL");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Input parameter is NULL");
return -1;
}
int tts_parser_print_engine_info(tts_engine_info_s* engine_info)
{
if (NULL == engine_info) {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] Input parameter is NULL");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Input parameter is NULL");
return -1;
}
- SLOG(LOG_DEBUG, tts_tag(), "== get engine info ==");
- SLOG(LOG_DEBUG, tts_tag(), " name : %s", engine_info->name);
- SLOG(LOG_DEBUG, tts_tag(), " id : %s", engine_info->uuid);
+ SLOG(LOG_DEBUG, TAG_TTSCONFIG, "== get engine info ==");
+ SLOG(LOG_DEBUG, TAG_TTSCONFIG, " name : %s", engine_info->name);
+ SLOG(LOG_DEBUG, TAG_TTSCONFIG, " id : %s", engine_info->uuid);
if (NULL != engine_info->setting)
- SLOG(LOG_DEBUG, tts_tag(), " setting : %s", engine_info->setting);
+ SLOG(LOG_DEBUG, TAG_TTSCONFIG, " setting : %s", engine_info->setting);
- SLOG(LOG_DEBUG, tts_tag(), " voices");
+ SLOG(LOG_DEBUG, TAG_TTSCONFIG, " voices");
GSList *iter = NULL;
tts_config_voice_s *temp_voice;
/*Get handle data from list*/
temp_voice = iter->data;
- SLOG(LOG_DEBUG, tts_tag(), " [%dth] type(%d) lang(%s)",
+ SLOG(LOG_DEBUG, TAG_TTSCONFIG, " [%dth] type(%d) lang(%s)",
i, temp_voice->type, temp_voice->language);
/*Get next item*/
i++;
}
} else {
- SLOG(LOG_ERROR, tts_tag(), " Voice is NONE");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, " Voice is NONE");
}
- SLOG(LOG_DEBUG, tts_tag(), "@@@");
+ SLOG(LOG_DEBUG, TAG_TTSCONFIG, "@@@");
return 0;
}
int tts_parser_load_config(tts_config_s** config_info)
{
if (NULL == config_info) {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] Input parameter is NULL");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Input parameter is NULL");
return -1;
}
if (0 != access(TTS_CONFIG, F_OK)) {
doc = xmlParseFile(TTS_DEFAULT_CONFIG);
if (doc == NULL) {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] Fail to parse file error : %s", TTS_DEFAULT_CONFIG);
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Fail to parse file error : %s", TTS_DEFAULT_CONFIG);
xmlCleanupParser();
return -1;
}
usleep(10000);
if (TTS_RETRY_COUNT == retry_count) {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] Fail to parse file error : %s", TTS_CONFIG);
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Fail to parse file error : %s", TTS_CONFIG);
doc = xmlParseFile(TTS_DEFAULT_CONFIG);
if (NULL == doc) {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] Fail to parse file error : %s", TTS_DEFAULT_CONFIG);
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Fail to parse file error : %s", TTS_DEFAULT_CONFIG);
xmlCleanupParser();
return -1;
}
cur = xmlDocGetRootElement(doc);
if (cur == NULL) {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] Empty document");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Empty document");
xmlFreeDoc(doc);
doc = NULL;
xmlCleanupParser();
}
if (xmlStrcmp(cur->name, (const xmlChar *) TTS_TAG_CONFIG_BASE_TAG)) {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] The wrong type, root node is NOT %s", TTS_TAG_CONFIG_BASE_TAG);
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] The wrong type, root node is NOT %s", TTS_TAG_CONFIG_BASE_TAG);
xmlFreeDoc(doc);
doc = NULL;
xmlCleanupParser();
cur = cur->xmlChildrenNode;
if (cur == NULL) {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] Empty document");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Empty document");
xmlFreeDoc(doc);
doc = NULL;
xmlCleanupParser();
tts_config_s* temp;
temp = (tts_config_s*)calloc(1, sizeof(tts_config_s));
if (NULL == temp) {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] Out of memory");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Out of memory");
xmlFreeDoc(doc);
doc = NULL;
xmlCleanupParser();
xmlFree(key);
key = NULL;
} else {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] engine id is NULL");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] engine id is NULL");
}
} else if (0 == xmlStrcmp(cur->name, (const xmlChar *)TTS_TAG_CONFIG_ENGINE_SETTING)) {
key = xmlNodeGetContent(cur);
xmlFree(key);
key = NULL;
} else {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] setting path is NULL");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] setting path is NULL");
}
} else if (0 == xmlStrcmp(cur->name, (const xmlChar *)TTS_TAG_CONFIG_AUTO_VOICE)) {
key = xmlNodeGetContent(cur);
} else if (0 == xmlStrcmp(key, (const xmlChar *)"off")) {
temp->auto_voice = false;
} else {
- SLOG(LOG_ERROR, tts_tag(), "Auto voice is wrong");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "Auto voice is wrong");
temp->auto_voice = true;
}
xmlFree(key);
key = NULL;
} else {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] voice type is NULL");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] voice type is NULL");
}
} else if (0 == xmlStrcmp(cur->name, (const xmlChar *)TTS_TAG_CONFIG_VOICE_TYPE)) {
key = xmlNodeGetContent(cur);
} else if (0 == xmlStrcmp(key, (const xmlChar *)TTS_TAG_VOICE_TYPE_CHILD)) {
temp->type = (int)TTS_CONFIG_VOICE_TYPE_CHILD;
} else {
- SLOG(LOG_WARN, tts_tag(), "Voice type is user defined");
+ SLOG(LOG_WARN, TAG_TTSCONFIG, "Voice type is user defined");
temp->type = (int)TTS_CONFIG_VOICE_TYPE_USER_DEFINED;
}
xmlFree(key);
key = NULL;
} else {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] voice type is NULL");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] voice type is NULL");
}
} else if (0 == xmlStrcmp(cur->name, (const xmlChar *)TTS_TAG_CONFIG_LANGUAGE)) {
key = xmlNodeGetContent(cur);
xmlFree(key);
key = NULL;
} else {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] engine uuid is NULL");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] engine uuid is NULL");
}
} else if (0 == xmlStrcmp(cur->name, (const xmlChar *)TTS_TAG_CONFIG_SPEECH_RATE)) {
temp->speech_rate = atoi((char*)key);
xmlFree(key);
} else {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] speech rate is NULL");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] speech rate is NULL");
}
} else if (0 == xmlStrcmp(cur->name, (const xmlChar *)TTS_TAG_CONFIG_PITCH)) {
key = xmlNodeGetContent(cur);
xmlFree(key);
key = NULL;
} else {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] Pitch is NULL");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Pitch is NULL");
}
} else {
usleep(10000);
if (TTS_RETRY_COUNT == retry_count) {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] Save result : %d", ret);
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Save result : %d", ret);
return -1;
}
} while (0 != ret);
/* Set mode */
if (0 > chmod(TTS_CONFIG, 0600)) {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] Fail to change file mode : %d", ret);
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Fail to change file mode : %d", ret);
}
/* Set owner */
if (0 > chown(TTS_CONFIG, 5000, 5000)) {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] Fail to change file owner : %d", ret);
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Fail to change file owner : %d", ret);
}
- SLOG(LOG_DEBUG, tts_tag(), "Default config is changed : pid(%d)", getpid());
+ SLOG(LOG_DEBUG, TAG_TTSCONFIG, "Default config is changed : pid(%d)", getpid());
}
return 0;
int tts_parser_copy_xml(const char* original, const char* destination)
{
if (NULL == original || NULL == destination) {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] Input parameter is NULL");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Input parameter is NULL");
return -1;
}
xmlDocPtr doc = NULL;
if (0 == access(original, F_OK)) {
- SLOG(LOG_DEBUG, tts_tag(), "[DEBUG] Success to access to %s", original);
+ SLOG(LOG_DEBUG, TAG_TTSCONFIG, "[DEBUG] Success to access to %s", original);
doc = xmlParseFile(original);
if (doc == NULL) {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] Fail to parse file error : %s", original);
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Fail to parse file error : %s", original);
return -1;
}
} else {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] Fail to access to %s", original);
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Fail to access to %s", original);
return -1;
}
int ret = xmlSaveFile(destination, doc);
if (0 > ret) {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] Save result : %d", ret);
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Save result : %d", ret);
} else {
static FILE* pFile;
pFile = fopen(destination, "r");
int fd = -1;
if (NULL == pFile) {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] Fail to open file %s", destination);
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Fail to open file %s", destination);
} else {
fd = fileno(pFile);
fsync(fd);
fclose(pFile);
- SLOG(LOG_INFO, tts_tag(), "[DEBUG] Success to fsync %s", destination);
+ SLOG(LOG_INFO, TAG_TTSCONFIG, "[DEBUG] Success to fsync %s", destination);
}
- SLOG(LOG_ERROR, tts_tag(), "[DEBUG] Success to save %s", destination);
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[DEBUG] Success to save %s", destination);
}
/* Set mode */
if (0 > chmod(destination, 0600)) {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] Fail to change file mode : %d", ret);
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Fail to change file mode : %d", ret);
}
xmlFreeDoc(doc);
doc = NULL;
- SLOG(LOG_DEBUG, tts_tag(), "[SUCCESS] Copying xml");
+ SLOG(LOG_DEBUG, TAG_TTSCONFIG, "[SUCCESS] Copying xml");
return 0;
}
int tts_parser_set_engine(const char* engine_id, const char* setting, const char* language, int type)
{
if (NULL == engine_id) {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] Input parameter is NULL");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Input parameter is NULL");
return -1;
}
xmlNodePtr cur = NULL;
cur = xmlDocGetRootElement(g_config_doc);
if (cur == NULL) {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] Empty document");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Empty document");
return -1;
}
if (xmlStrcmp(cur->name, (const xmlChar *) TTS_TAG_CONFIG_BASE_TAG)) {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] The wrong type, root node is NOT %s", TTS_TAG_CONFIG_BASE_TAG);
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] The wrong type, root node is NOT %s", TTS_TAG_CONFIG_BASE_TAG);
return -1;
}
cur = cur->xmlChildrenNode;
if (cur == NULL) {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] Empty document");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Empty document");
return -1;
}
if (0 == access(TTS_CONFIG, F_OK)) {
int ret = xmlSaveFile(TTS_CONFIG, g_config_doc);
if (0 > ret) {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] Save result : %d", ret);
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Save result : %d", ret);
} else {
static FILE* pFile;
pFile = fopen(TTS_CONFIG, "r");
int fd = -1;
if (NULL == pFile) {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] Fail to open file %s", TTS_CONFIG);
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Fail to open file %s", TTS_CONFIG);
} else {
fd = fileno(pFile);
fsync(fd);
fclose(pFile);
- SLOG(LOG_INFO, tts_tag(), "[DEBUG] Success to fsync %s", TTS_CONFIG);
+ SLOG(LOG_INFO, TAG_TTSCONFIG, "[DEBUG] Success to fsync %s", TTS_CONFIG);
}
- SLOG(LOG_ERROR, tts_tag(), "[DEBUG] Success to save %s", TTS_CONFIG);
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[DEBUG] Success to save %s", TTS_CONFIG);
}
} else {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] Fail to access to %s", TTS_CONFIG);
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Fail to access to %s", TTS_CONFIG);
}
return 0;
int tts_parser_set_voice(const char* language, int type)
{
if (NULL == language) {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] Input parameter is NULL");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Input parameter is NULL");
return -1;
}
xmlNodePtr cur = NULL;
cur = xmlDocGetRootElement(g_config_doc);
if (cur == NULL) {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] Empty document");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Empty document");
return -1;
}
if (xmlStrcmp(cur->name, (const xmlChar *) TTS_TAG_CONFIG_BASE_TAG)) {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] The wrong type, root node is NOT %s", TTS_TAG_CONFIG_BASE_TAG);
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] The wrong type, root node is NOT %s", TTS_TAG_CONFIG_BASE_TAG);
return -1;
}
cur = cur->xmlChildrenNode;
if (cur == NULL) {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] Empty document");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Empty document");
return -1;
}
case TTS_CONFIG_VOICE_TYPE_FEMALE: xmlNodeSetContent(cur, (const xmlChar*)TTS_TAG_VOICE_TYPE_FEMALE); break;
case TTS_CONFIG_VOICE_TYPE_CHILD: xmlNodeSetContent(cur, (const xmlChar*)TTS_TAG_VOICE_TYPE_CHILD); break;
default:
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] Invalid type : %d", type);
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Invalid type : %d", type);
xmlNodeSetContent(cur, (const xmlChar*)TTS_TAG_VOICE_TYPE_FEMALE);
break;
}
if (0 == access(TTS_CONFIG, F_OK)) {
int ret = xmlSaveFile(TTS_CONFIG, g_config_doc);
if (0 > ret) {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] Save result : %d", ret);
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Save result : %d", ret);
} else {
static FILE* pFile;
pFile = fopen(TTS_CONFIG, "r");
int fd = -1;
if (NULL == pFile) {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] Fail to open file %s", TTS_CONFIG);
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Fail to open file %s", TTS_CONFIG);
} else {
fd = fileno(pFile);
fsync(fd);
fclose(pFile);
- SLOG(LOG_INFO, tts_tag(), "[DEBUG] Success to fsync %s", TTS_CONFIG);
+ SLOG(LOG_INFO, TAG_TTSCONFIG, "[DEBUG] Success to fsync %s", TTS_CONFIG);
}
- SLOG(LOG_ERROR, tts_tag(), "[DEBUG] Success to save %s", TTS_CONFIG);
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[DEBUG] Success to save %s", TTS_CONFIG);
}
} else {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] Fail to access to %s", TTS_CONFIG);
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Fail to access to %s", TTS_CONFIG);
}
return 0;
}
xmlNodePtr cur = NULL;
cur = xmlDocGetRootElement(g_config_doc);
if (cur == NULL) {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] Empty document");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Empty document");
return -1;
}
if (xmlStrcmp(cur->name, (const xmlChar *) TTS_TAG_CONFIG_BASE_TAG)) {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] The wrong type, root node is NOT %s", TTS_TAG_CONFIG_BASE_TAG);
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] The wrong type, root node is NOT %s", TTS_TAG_CONFIG_BASE_TAG);
return -1;
}
cur = cur->xmlChildrenNode;
if (cur == NULL) {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] Empty document");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Empty document");
return -1;
}
} else if (false == value) {
xmlNodeSetContent(cur, (const xmlChar *)"off");
} else {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] The wrong value of auto voice");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] The wrong value of auto voice");
return -1;
}
break;
if (0 == access(TTS_CONFIG, F_OK)) {
int ret = xmlSaveFile(TTS_CONFIG, g_config_doc);
if (0 > ret) {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] Save result : %d", ret);
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Save result : %d", ret);
} else {
static FILE* pFile;
pFile = fopen(TTS_CONFIG, "r");
int fd = -1;
if (NULL == pFile) {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] Fail to open file %s", TTS_CONFIG);
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Fail to open file %s", TTS_CONFIG);
} else {
fd = fileno(pFile);
fsync(fd);
fclose(pFile);
- SLOG(LOG_INFO, tts_tag(), "[DEBUG] Success to fsync %s", TTS_CONFIG);
+ SLOG(LOG_INFO, TAG_TTSCONFIG, "[DEBUG] Success to fsync %s", TTS_CONFIG);
}
- SLOG(LOG_ERROR, tts_tag(), "[DEBUG] Success to save %s", TTS_CONFIG);
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[DEBUG] Success to save %s", TTS_CONFIG);
}
} else {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] Fail to access to %s", TTS_CONFIG);
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Fail to access to %s", TTS_CONFIG);
}
return 0;
xmlNodePtr cur = NULL;
cur = xmlDocGetRootElement(g_config_doc);
if (cur == NULL) {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] Empty document");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Empty document");
return -1;
}
if (xmlStrcmp(cur->name, (const xmlChar *) TTS_TAG_CONFIG_BASE_TAG)) {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] The wrong type, root node is NOT %s", TTS_TAG_CONFIG_BASE_TAG);
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] The wrong type, root node is NOT %s", TTS_TAG_CONFIG_BASE_TAG);
return -1;
}
cur = cur->xmlChildrenNode;
if (cur == NULL) {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] Empty document");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Empty document");
return -1;
}
xmlNodeSetContent(cur, (const xmlChar *)temp);
- SLOG(LOG_DEBUG, tts_tag(), "Set speech rate : %s", temp);
+ SLOG(LOG_DEBUG, TAG_TTSCONFIG, "Set speech rate : %s", temp);
break;
}
if (0 == access(TTS_CONFIG, F_OK)) {
int ret = xmlSaveFile(TTS_CONFIG, g_config_doc);
if (0 > ret) {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] Save result : %d", ret);
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Save result : %d", ret);
} else {
static FILE* pFile;
pFile = fopen(TTS_CONFIG, "r");
int fd = -1;
if (NULL == pFile) {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] Fail to open file %s", TTS_CONFIG);
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Fail to open file %s", TTS_CONFIG);
} else {
fd = fileno(pFile);
fsync(fd);
fclose(pFile);
- SLOG(LOG_INFO, tts_tag(), "[DEBUG] Success to fsync %s", TTS_CONFIG);
+ SLOG(LOG_INFO, TAG_TTSCONFIG, "[DEBUG] Success to fsync %s", TTS_CONFIG);
}
- SLOG(LOG_ERROR, tts_tag(), "[DEBUG] Success to save %s", TTS_CONFIG);
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[DEBUG] Success to save %s", TTS_CONFIG);
}
} else {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] Fail to access to %s", TTS_CONFIG);
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Fail to access to %s", TTS_CONFIG);
}
return 0;
xmlNodePtr cur = NULL;
cur = xmlDocGetRootElement(g_config_doc);
if (cur == NULL) {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] Empty document");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Empty document");
return -1;
}
if (xmlStrcmp(cur->name, (const xmlChar *) TTS_TAG_CONFIG_BASE_TAG)) {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] The wrong type, root node is NOT %s", TTS_TAG_CONFIG_BASE_TAG);
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] The wrong type, root node is NOT %s", TTS_TAG_CONFIG_BASE_TAG);
return -1;
}
cur = cur->xmlChildrenNode;
if (cur == NULL) {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] Empty document");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Empty document");
return -1;
}
if (0 == access(TTS_CONFIG, F_OK)) {
int ret = xmlSaveFile(TTS_CONFIG, g_config_doc);
if (0 > ret) {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] Save result : %d", ret);
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Save result : %d", ret);
} else {
static FILE* pFile;
pFile = fopen(TTS_CONFIG, "r");
int fd = -1;
if (NULL == pFile) {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] Fail to open file %s", TTS_CONFIG);
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Fail to open file %s", TTS_CONFIG);
} else {
fd = fileno(pFile);
fsync(fd);
fclose(pFile);
- SLOG(LOG_INFO, tts_tag(), "[DEBUG] Success to fsync %s", TTS_CONFIG);
+ SLOG(LOG_INFO, TAG_TTSCONFIG, "[DEBUG] Success to fsync %s", TTS_CONFIG);
}
- SLOG(LOG_ERROR, tts_tag(), "[DEBUG] Success to save %s", TTS_CONFIG);
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[DEBUG] Success to save %s", TTS_CONFIG);
}
} else {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] Fail to access to %s", TTS_CONFIG);
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Fail to access to %s", TTS_CONFIG);
}
return 0;
int* speech_rate, int* pitch)
{
if (NULL == engine || NULL == setting || NULL == language || NULL == voice_type || NULL == speech_rate) {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] Input parameter is NULL");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Input parameter is NULL");
return -1;
}
int retry_count = 0;
while (NULL == doc) {
if (0 == access(TTS_CONFIG, F_OK)) {
- SLOG(LOG_DEBUG, tts_tag(), "[DEBUG] Success to access to %s", TTS_CONFIG);
+ SLOG(LOG_DEBUG, TAG_TTSCONFIG, "[DEBUG] Success to access to %s", TTS_CONFIG);
doc = xmlParseFile(TTS_CONFIG);
if (NULL != doc) {
break;
usleep(10000);
if (TTS_RETRY_COUNT == retry_count) {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] Fail to parse file error : %s", TTS_CONFIG);
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Fail to parse file error : %s", TTS_CONFIG);
return -1;
}
}
cur_new = xmlDocGetRootElement(doc);
cur_old = xmlDocGetRootElement(g_config_doc);
if (cur_new == NULL || cur_old == NULL) {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] Empty document");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Empty document");
xmlFreeDoc(doc);
doc = NULL;
return -1;
if (xmlStrcmp(cur_new->name, (const xmlChar*)TTS_TAG_CONFIG_BASE_TAG) ||
xmlStrcmp(cur_old->name, (const xmlChar*)TTS_TAG_CONFIG_BASE_TAG)) {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] The wrong type, root node is NOT %s", TTS_TAG_CONFIG_BASE_TAG);
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] The wrong type, root node is NOT %s", TTS_TAG_CONFIG_BASE_TAG);
xmlFreeDoc(doc);
doc = NULL;
return -1;
cur_new = cur_new->xmlChildrenNode;
cur_old = cur_old->xmlChildrenNode;
if (cur_new == NULL || cur_old == NULL) {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] Empty document");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Empty document");
xmlFreeDoc(doc);
doc = NULL;
return -1;
key_new = xmlNodeGetContent(cur_new);
if (NULL != key_new) {
if (0 != xmlStrcmp(key_old, key_new)) {
- SLOG(LOG_DEBUG, tts_tag(), "Old engine id(%s), New engine(%s)",
+ SLOG(LOG_DEBUG, TAG_TTSCONFIG, "Old engine id(%s), New engine(%s)",
(char*)key_old, (char*)key_new);
if (NULL != *engine) {
free(*engine);
key_old = NULL;
}
} else {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] old config and new config are different");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] old config and new config are different");
}
} else if (0 == xmlStrcmp(cur_new->name, (const xmlChar*)TTS_TAG_CONFIG_ENGINE_SETTING)) {
if (0 == xmlStrcmp(cur_old->name, (const xmlChar*)TTS_TAG_CONFIG_ENGINE_SETTING)) {
key_new = xmlNodeGetContent(cur_new);
if (NULL != key_new) {
if (0 != xmlStrcmp(key_old, key_new)) {
- SLOG(LOG_DEBUG, tts_tag(), "Old engine setting(%s), New engine setting(%s)",
+ SLOG(LOG_DEBUG, TAG_TTSCONFIG, "Old engine setting(%s), New engine setting(%s)",
(char*)key_old, (char*)key_new);
if (NULL != *setting) {
free(*setting);
key_old = NULL;
}
} else {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] old config and new config are different");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] old config and new config are different");
}
} else if (0 == xmlStrcmp(cur_new->name, (const xmlChar*)TTS_TAG_CONFIG_AUTO_VOICE)) {
if (0 == xmlStrcmp(cur_old->name, (const xmlChar*)TTS_TAG_CONFIG_AUTO_VOICE)) {
key_new = xmlNodeGetContent(cur_new);
if (NULL != key_new) {
if (0 != xmlStrcmp(key_old, key_new)) {
- SLOG(LOG_DEBUG, tts_tag(), "Old auto voice (%s), New auto voice(%s)",
+ SLOG(LOG_DEBUG, TAG_TTSCONFIG, "Old auto voice (%s), New auto voice(%s)",
(char*)key_old, (char*)key_new);
if (0 == xmlStrcmp((const xmlChar*)"on", key_new)) {
*auto_voice = true;
key_old = NULL;
}
} else {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] old config and new config are different");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] old config and new config are different");
}
} else if (0 == xmlStrcmp(cur_new->name, (const xmlChar*)TTS_TAG_CONFIG_LANGUAGE)) {
if (0 == xmlStrcmp(cur_old->name, (const xmlChar*)TTS_TAG_CONFIG_LANGUAGE)) {
key_new = xmlNodeGetContent(cur_new);
if (NULL != key_new) {
if (0 != xmlStrcmp(key_old, key_new)) {
- SLOG(LOG_DEBUG, tts_tag(), "Old language(%s), New language(%s)",
+ SLOG(LOG_DEBUG, TAG_TTSCONFIG, "Old language(%s), New language(%s)",
(char*)key_old, (char*)key_new);
if (NULL != *language) {
free(*language);
key_old = NULL;
}
} else {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] old config and new config are different");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] old config and new config are different");
}
} else if (0 == xmlStrcmp(cur_new->name, (const xmlChar*)TTS_TAG_CONFIG_VOICE_TYPE)) {
if (0 == xmlStrcmp(cur_old->name, (const xmlChar*)TTS_TAG_CONFIG_VOICE_TYPE)) {
key_new = xmlNodeGetContent(cur_new);
if (NULL != key_new) {
if (0 != xmlStrcmp(key_old, key_new)) {
- SLOG(LOG_DEBUG, tts_tag(), "Old voice type(%s), New voice type(%s)",
+ SLOG(LOG_DEBUG, TAG_TTSCONFIG, "Old voice type(%s), New voice type(%s)",
(char*)key_old, (char*)key_new);
if (0 == xmlStrcmp(key_new, (const xmlChar *)TTS_TAG_VOICE_TYPE_FEMALE)) {
*voice_type = (int)TTS_CONFIG_VOICE_TYPE_FEMALE;
} else if (0 == xmlStrcmp(key_new, (const xmlChar *)TTS_TAG_VOICE_TYPE_CHILD)) {
*voice_type = (int)TTS_CONFIG_VOICE_TYPE_CHILD;
} else {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] New voice type is not valid");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] New voice type is not valid");
}
}
xmlFree(key_new);
key_old = NULL;
}
} else {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] old config and new config are different");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] old config and new config are different");
}
} else if (0 == xmlStrcmp(cur_new->name, (const xmlChar*)TTS_TAG_CONFIG_SPEECH_RATE)) {
if (0 == xmlStrcmp(cur_old->name, (const xmlChar*)TTS_TAG_CONFIG_SPEECH_RATE)) {
key_new = xmlNodeGetContent(cur_new);
if (NULL != key_new) {
if (0 != xmlStrcmp(key_old, key_new)) {
- SLOG(LOG_DEBUG, tts_tag(), "Old speech rate(%s), New speech rate(%s)",
+ SLOG(LOG_DEBUG, TAG_TTSCONFIG, "Old speech rate(%s), New speech rate(%s)",
(char*)key_old, (char*)key_new);
*speech_rate = atoi((char*)key_new);
}
key_old = NULL;
}
} else {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] old config and new config are different");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] old config and new config are different");
}
} else if (0 == xmlStrcmp(cur_new->name, (const xmlChar*)TTS_TAG_CONFIG_PITCH)) {
if (0 == xmlStrcmp(cur_old->name, (const xmlChar*)TTS_TAG_CONFIG_PITCH)) {
key_new = xmlNodeGetContent(cur_new);
if (NULL != key_new) {
if (0 != xmlStrcmp(key_old, key_new)) {
- SLOG(LOG_DEBUG, tts_tag(), "Old pitch(%s), New pitch(%s)",
+ SLOG(LOG_DEBUG, TAG_TTSCONFIG, "Old pitch(%s), New pitch(%s)",
(char*)key_old, (char*)key_new);
*pitch = atoi((char*)key_new);
}
key_old = NULL;
}
} else {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] old config and new config are different");
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] old config and new config are different");
}
} else {
int tts_parser_reset()
{
- SLOG(LOG_DEBUG, tts_tag(), "[DEBUG] Reset g_config_doc as %s", TTS_DEFAULT_CONFIG);
+ SLOG(LOG_DEBUG, TAG_TTSCONFIG, "[DEBUG] Reset g_config_doc as %s", TTS_DEFAULT_CONFIG);
if (NULL != g_config_doc) {
xmlFreeDoc(g_config_doc);
g_config_doc = xmlParseFile(TTS_DEFAULT_CONFIG);
if (NULL == g_config_doc) {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] Fail to parse %s", TTS_DEFAULT_CONFIG);
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Fail to parse %s", TTS_DEFAULT_CONFIG);
return -1;
}
if (0 == access(TTS_CONFIG, F_OK)) {
int ret = xmlSaveFile(TTS_CONFIG, g_config_doc);
if (0 > ret) {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] Fail to save %s", TTS_CONFIG);
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Fail to save %s", TTS_CONFIG);
} else {
static FILE* pFile;
pFile = fopen(TTS_CONFIG, "r");
int fd = -1;
if (NULL == pFile) {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] Fail to open file %s", TTS_CONFIG);
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Fail to open file %s", TTS_CONFIG);
} else {
fd = fileno(pFile);
fsync(fd);
fclose(pFile);
- SLOG(LOG_INFO, tts_tag(), "[DEBUG] Success to fsync %s", TTS_CONFIG);
+ SLOG(LOG_INFO, TAG_TTSCONFIG, "[DEBUG] Success to fsync %s", TTS_CONFIG);
}
- SLOG(LOG_ERROR, tts_tag(), "[DEBUG] Success to save %s", TTS_CONFIG);
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[DEBUG] Success to save %s", TTS_CONFIG);
}
} else {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] Fail to access to %s", TTS_CONFIG);
+ SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Fail to access to %s", TTS_CONFIG);
}
return 0;