## Dependent packages ##
INCLUDE(FindPkgConfig)
pkg_check_modules(pkgs REQUIRED
- mm-player vconf dlog ecore ecore-file dbus-1
+ mm-player vconf dlog ecore ecore-file dbus-1 mm-session capi-system-runtime-info
)
## Client library ##
+tts (0.1.1-49)
+
+ * Add TTS mode(notification and screen reader)
+ * Update smack rule
+
+ --Kwangyoun Kim <ky85.kim@samsung.com> Thu, 07 Feb 2013
+
tts (0.1.1-48)
* Update smack rule
static bool g_is_daemon_started = false;
+static bool g_is_noti_daemon_started = false;
+
+static bool g_is_sr_daemon_started = false;
+
static Ecore_Timer* g_connect_timer = NULL;
/* Function definition */
-static int __tts_check_tts_daemon();
+static int __tts_check_tts_daemon(tts_mode_e mode);
static Eina_Bool __tts_notify_state_changed(void *data);
static Eina_Bool __tts_notify_error(void *data);
return TTS_ERROR_OUT_OF_MEMORY;
}
+ g_is_daemon_started = false;
+ g_is_noti_daemon_started = false;
+ g_is_sr_daemon_started = false;
+
SLOG(LOG_DEBUG, TAG_TTSC, "=====");
SLOG(LOG_DEBUG, TAG_TTSC, " ");
case TTS_STATE_READY:
/* Request Finalize */
ret = tts_dbus_request_finalize(client->uid);
- if (0 != ret) {
+ if (0 != ret)
SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to request finalize");
- }
- g_is_daemon_started = false;
+
+ if (TTS_MODE_SCREEN_READER == client->mode)
+ g_is_sr_daemon_started = false;
+ else if (TTS_MODE_NOTIFICATION == client->mode)
+ g_is_noti_daemon_started = false;
+ else
+ g_is_daemon_started = false;
+
case TTS_STATE_CREATED:
if (NULL != g_connect_timer) {
SLOG(LOG_DEBUG, TAG_TTSC, "Connect Timer is deleted");
if (0 != tts_dbus_close_connection()) {
SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to close connection");
}
- }
+ }
SLOG(LOG_DEBUG, TAG_TTSC, "=====");
SLOG(LOG_DEBUG, TAG_TTSC, " ");
}
/* Send hello */
- if (0 != tts_dbus_request_hello()) {
- if (false == g_is_daemon_started) {
- g_is_daemon_started = true;
- __tts_check_tts_daemon();
+ if (0 != tts_dbus_request_hello(client->uid)) {
+ if (TTS_MODE_SCREEN_READER == client->mode) {
+ if (false == g_is_sr_daemon_started) {
+ g_is_sr_daemon_started = true;
+ __tts_check_tts_daemon(client->mode);
+ }
+ } else if (TTS_MODE_NOTIFICATION == client->mode) {
+ if (false == g_is_noti_daemon_started) {
+ g_is_noti_daemon_started = true;
+ __tts_check_tts_daemon(client->mode);
+ }
+ } else {
+ if (false == g_is_daemon_started) {
+ g_is_daemon_started = true;
+ __tts_check_tts_daemon(client->mode);
+ }
}
+
return EINA_TRUE;
}
SLOG(LOG_DEBUG, TAG_TTSC, "===== Connect daemon");
-
+
/* do request initialize */
int ret = -1;
if (0 != ret) {
SLOG(LOG_WARN, TAG_TTSC, "[ERROR] Fail to request finalize");
}
- g_is_daemon_started = false;
+
+ if (TTS_MODE_SCREEN_READER == client->mode)
+ g_is_sr_daemon_started = false;
+ else if (TTS_MODE_NOTIFICATION == client->mode)
+ g_is_noti_daemon_started = false;
+ else
+ g_is_daemon_started = false;
+
client->before_state = client->current_state;
client->current_state = TTS_STATE_CREATED;
return TTS_ERROR_INVALID_STATE;
}
+ if (MAX_TEXT_COUNT < strlen(text)) {
+ SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Input text size is too big.");
+ SLOG(LOG_DEBUG, TAG_TTSC, "=====");
+ SLOG(LOG_DEBUG, TAG_TTSC, " ");
+ return TTS_ERROR_INVALID_PARAMETER;
+ }
+
/* change default language value */
char* temp = NULL;
ret = tts_dbus_request_add_text(client->uid, text, temp, voice_type, speed, client->current_utt_id);
if (0 != ret) {
SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] result : %d", ret);
+ } else {
+ *utt_id = client->current_utt_id;
}
- *utt_id = client->current_utt_id;
-
if (NULL != temp)
free(temp);
return 0;
}
-int __get_cmd_line(char *file, char *buf)
+static int __get_cmd_line(char *file, char *buf)
{
FILE *fp = NULL;
return -1;
}
fclose(fp);
+
return 0;
}
-static bool _tts_is_alive()
+static bool __tts_is_alive(char* daemon_path)
{
DIR *dir;
struct dirent *entry;
struct stat filestat;
int pid;
- char cmdLine[256];
- char tempPath[256];
+ char cmdLine[256] = {'\0',};
+ char tempPath[256] = {'\0',};
dir = opendir("/proc");
if (NULL == dir) {
}
while ((entry = readdir(dir)) != NULL) {
- if (0 != lstat(entry->d_name, &filestat))
+ if (0 != lstat(entry->d_name, &filestat)) {
continue;
+ }
- if (!S_ISDIR(filestat.st_mode))
+ if (!S_ISDIR(filestat.st_mode)) {
continue;
+ }
pid = atoi(entry->d_name);
if (pid <= 0) continue;
continue;
}
- if ( 0 == strncmp(cmdLine, "[tts-daemon]", strlen("[tts-daemon]")) ||
- 0 == strncmp(cmdLine, "tts-daemon", strlen("tts-daemon")) ||
- 0 == strncmp(cmdLine, "/usr/bin/tts-daemon", strlen("/usr/bin/tts-daemon"))) {
- SLOG(LOG_DEBUG, TAG_TTSC, "tts-daemon is ALIVE !!");
- closedir(dir);
- return TRUE;
+ if (0 == strncmp(cmdLine, daemon_path, strlen(daemon_path))) {
+ SLOG(LOG_DEBUG, TAG_TTSC, "%s is ALIVE !!", daemon_path);
+ closedir(dir);
+ return TRUE;
}
}
- SLOG(LOG_DEBUG, TAG_TTSC, "THERE IS NO tts-daemon !!");
+ SLOG(LOG_DEBUG, TAG_TTSC, "THERE IS NO %s !!", daemon_path);
closedir(dir);
return FALSE;
}
-static int __tts_check_tts_daemon()
+static int __tts_check_tts_daemon(tts_mode_e mode)
{
- if (TRUE == _tts_is_alive()) {
+ char daemon_path[64] = {'\0',};
+ int pid, i;
+
+ if (TTS_MODE_DEFAULT == mode) {
+ strcpy(daemon_path, "/usr/bin/tts-daemon");
+ } else if (TTS_MODE_NOTIFICATION == mode) {
+ strcpy(daemon_path, "/usr/bin/tts-daemon-noti");
+ } else if (TTS_MODE_SCREEN_READER == mode) {
+ strcpy(daemon_path, "/usr/bin/tts-daemon-sr");
+ } else {
+ SLOG(LOG_ERROR, TAG_TTSC, "mode is not valid");
+ return -1;
+ }
+
+ if (TRUE == __tts_is_alive(daemon_path)) {
return 0;
}
- /* fork-exec tts-daemom */
- int pid, i;
-
+ /* fork-exec daemom */
pid = fork();
switch(pid) {
case -1:
- SLOG(LOG_ERROR, TAG_TTSC, "Fail to create tts-daemon");
+ SLOG(LOG_ERROR, TAG_TTSC, "Fail to create daemon");
break;
case 0:
for (i = 0;i < _NSIG;i++)
signal(i, SIG_DFL);
- execl("/usr/bin/tts-daemon", "/usr/bin/tts-daemon", NULL);
+ execl(daemon_path, daemon_path, NULL);
break;
default:
return 0;
}
+DBusMessage* __tts_dbus_make_message(int uid, const char* method)
+{
+ if (NULL == method) {
+ SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Input method is NULL");
+ return NULL;
+ }
+
+ tts_client_s* client = tts_client_get_by_uid(uid);
+
+ /* check handle */
+ if (NULL == client) {
+ SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] uid is not available");
+ return NULL;
+ }
+
+ DBusMessage* msg;
+
+ if (TTS_MODE_DEFAULT == client->mode) {
+ msg = dbus_message_new_method_call(
+ TTS_SERVER_SERVICE_NAME,
+ TTS_SERVER_SERVICE_OBJECT_PATH,
+ TTS_SERVER_SERVICE_INTERFACE,
+ method);
+ } else if (TTS_MODE_NOTIFICATION == client->mode) {
+ msg = dbus_message_new_method_call(
+ TTS_NOTI_SERVER_SERVICE_NAME,
+ TTS_NOTI_SERVER_SERVICE_OBJECT_PATH,
+ TTS_NOTI_SERVER_SERVICE_INTERFACE,
+ method);
+ } else if (TTS_MODE_SCREEN_READER == client->mode) {
+ msg = dbus_message_new_method_call(
+ TTS_SR_SERVER_SERVICE_NAME,
+ TTS_SR_SERVER_SERVICE_OBJECT_PATH,
+ TTS_SR_SERVER_SERVICE_INTERFACE,
+ method);
+ } else {
+ SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Input mode is not available");
+ return NULL;
+ }
+
+ return msg;
+}
-int tts_dbus_request_hello()
+int tts_dbus_request_hello(int uid)
{
DBusMessage* msg;
- msg = dbus_message_new_method_call(
- TTS_SERVER_SERVICE_NAME,
- TTS_SERVER_SERVICE_OBJECT_PATH,
- TTS_SERVER_SERVICE_INTERFACE,
- TTS_METHOD_HELLO);
+ msg = __tts_dbus_make_message(uid, TTS_METHOD_HELLO);
if (NULL == msg) {
SLOG(LOG_ERROR, TAG_TTSC, ">>>> Request tts hello : Fail to make message \n");
DBusError err;
dbus_error_init(&err);
- msg = dbus_message_new_method_call(
- TTS_SERVER_SERVICE_NAME,
- TTS_SERVER_SERVICE_OBJECT_PATH,
- TTS_SERVER_SERVICE_INTERFACE,
- TTS_METHOD_INITIALIZE);
+ msg = __tts_dbus_make_message(uid, TTS_METHOD_INITIALIZE);
if (NULL == msg) {
SLOG(LOG_ERROR, TAG_TTSC, ">>>> Request tts initialize : Fail to make message \n");
DBusError err;
dbus_error_init(&err);
- msg = dbus_message_new_method_call(
- TTS_SERVER_SERVICE_NAME,
- TTS_SERVER_SERVICE_OBJECT_PATH,
- TTS_SERVER_SERVICE_INTERFACE,
- TTS_METHOD_FINALIZE);
+ msg = __tts_dbus_make_message(uid, TTS_METHOD_FINALIZE);
if (NULL == msg) {
SLOG(LOG_ERROR, TAG_TTSC, ">>>> Request tts finalize : Fail to make message");
DBusError err;
dbus_error_init(&err);
- msg = dbus_message_new_method_call(
- TTS_SERVER_SERVICE_NAME,
- TTS_SERVER_SERVICE_OBJECT_PATH,
- TTS_SERVER_SERVICE_INTERFACE,
- TTS_METHOD_GET_SUPPORT_VOICES);
+ msg = __tts_dbus_make_message(uid, TTS_METHOD_GET_SUPPORT_VOICES);
if (NULL == msg) {
SLOG(LOG_ERROR, TAG_TTSC, ">>>> Request tts get supported voices : Fail to make message");
DBusError err;
dbus_error_init(&err);
- msg = dbus_message_new_method_call(
- TTS_SERVER_SERVICE_NAME,
- TTS_SERVER_SERVICE_OBJECT_PATH,
- TTS_SERVER_SERVICE_INTERFACE,
- TTS_METHOD_GET_CURRENT_VOICE);
+ msg = __tts_dbus_make_message(uid, TTS_METHOD_GET_CURRENT_VOICE);
if (NULL == msg) {
SLOG(LOG_ERROR, TAG_TTSC, ">>>> Request tts get default voice : Fail to make message");
DBusError err;
dbus_error_init(&err);
- msg = dbus_message_new_method_call(
- TTS_SERVER_SERVICE_NAME,
- TTS_SERVER_SERVICE_OBJECT_PATH,
- TTS_SERVER_SERVICE_INTERFACE,
- TTS_METHOD_ADD_QUEUE);
+ msg = __tts_dbus_make_message(uid, TTS_METHOD_ADD_QUEUE);
if (NULL == msg) {
SLOG(LOG_ERROR, TAG_TTSC, ">>>> Request tts add text : Fail to make message");
DBusError err;
dbus_error_init(&err);
- msg = dbus_message_new_method_call(
- TTS_SERVER_SERVICE_NAME,
- TTS_SERVER_SERVICE_OBJECT_PATH,
- TTS_SERVER_SERVICE_INTERFACE,
- TTS_METHOD_PLAY );
+ msg = __tts_dbus_make_message(uid, TTS_METHOD_PLAY);
if (NULL == msg) {
SLOG(LOG_ERROR, TAG_TTSC, ">>>> Request tts play : Fail to make message");
DBusError err;
dbus_error_init(&err);
- msg = dbus_message_new_method_call(
- TTS_SERVER_SERVICE_NAME,
- TTS_SERVER_SERVICE_OBJECT_PATH,
- TTS_SERVER_SERVICE_INTERFACE,
- TTS_METHOD_STOP);
+ msg = __tts_dbus_make_message(uid, TTS_METHOD_STOP);
if (NULL == msg) {
SLOG(LOG_ERROR, TAG_TTSC, ">>>> Request tts stop : Fail to make message");
DBusError err;
dbus_error_init(&err);
- msg = dbus_message_new_method_call(
- TTS_SERVER_SERVICE_NAME,
- TTS_SERVER_SERVICE_OBJECT_PATH,
- TTS_SERVER_SERVICE_INTERFACE,
- TTS_METHOD_PAUSE);
+ msg = __tts_dbus_make_message(uid, TTS_METHOD_PAUSE);
if (NULL == msg) {
SLOG(LOG_ERROR, TAG_TTSC, ">>>> Request tts pause : Fail to make message");
int tts_dbus_close_connection();
-
-int tts_dbus_request_hello();
+int tts_dbus_request_hello(int uid);
int tts_dbus_request_initialize(int uid);
SLOG(LOG_DEBUG, TAG_TTSC, "===== Initialize TTS Setting");
if (TTS_SETTING_STATE_READY == g_state) {
- SLOG(LOG_WARN, TAG_TTSC, "[WARNING] TTS Setting has already been initialized. \n");
+ SLOG(LOG_WARN, TAG_TTSC, "[WARNING] TTS Setting has already been initialized.");
SLOG(LOG_DEBUG, TAG_TTSC, "=====");
SLOG(LOG_DEBUG, TAG_TTSC, " ");
return TTS_SETTING_ERROR_NONE;
}
if( 0 != tts_setting_dbus_open_connection() ) {
- SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to open connection\n ");
+ SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to open connection");
SLOG(LOG_DEBUG, TAG_TTSC, "=====");
SLOG(LOG_DEBUG, TAG_TTSC, " ");
return TTS_SETTING_ERROR_OPERATION_FAILED;
SLOG(LOG_DEBUG, TAG_TTSC, "===== Initialize TTS Setting");
if (TTS_SETTING_STATE_READY == g_state) {
- SLOG(LOG_WARN, TAG_TTSC, "[WARNING] TTS Setting has already been initialized. \n");
+ SLOG(LOG_WARN, TAG_TTSC, "[WARNING] TTS Setting has already been initialized.");
SLOG(LOG_DEBUG, TAG_TTSC, "=====");
SLOG(LOG_DEBUG, TAG_TTSC, " ");
return TTS_SETTING_ERROR_NONE;
}
if( 0 != tts_setting_dbus_open_connection() ) {
- SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to open connection\n ");
+ SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to open connection");
SLOG(LOG_DEBUG, TAG_TTSC, "=====");
SLOG(LOG_DEBUG, TAG_TTSC, " ");
return TTS_SETTING_ERROR_OPERATION_FAILED;
g_is_daemon_started = false;
if (0 != tts_setting_dbus_close_connection()) {
- SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to close connection\n ");
+ SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to close connection");
} else {
SLOG(LOG_DEBUG, TAG_TTSC, "[SUCCESS] Finalize");
}
if (0 == strncmp(cmdLine, "[tts-daemon]", strlen("[tts-daemon]")) ||
0 == strncmp(cmdLine, "tts-daemon", strlen("tts-daemon")) ||
0 == strncmp(cmdLine, "/usr/bin/tts-daemon", strlen("/usr/bin/tts-daemon"))) {
- SLOG(LOG_DEBUG, TAG_TTSC, "tts-daemon is ALIVE !! \n");
+ SLOG(LOG_DEBUG, TAG_TTSC, "tts-daemon is ALIVE !!");
closedir(dir);
return TRUE;
}
}
- SLOG(LOG_DEBUG, TAG_TTSC, "THERE IS NO tts-daemon !! \n");
+ SLOG(LOG_DEBUG, TAG_TTSC, "THERE IS NO tts-daemon !!");
closedir(dir);
return FALSE;
/*
-* Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd All Rights Reserved
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
#define TTS_SERVER_SERVICE_OBJECT_PATH "/com/samsung/voice/ttsserver"
#define TTS_SERVER_SERVICE_INTERFACE "com.samsung.voice.ttsserver"
+#define TTS_NOTI_SERVER_SERVICE_NAME "service.connect.ttsnotiserver"
+#define TTS_NOTI_SERVER_SERVICE_OBJECT_PATH "/com/samsung/voice/ttsnotiserver"
+#define TTS_NOTI_SERVER_SERVICE_INTERFACE "com.samsung.voice.ttsnotiserver"
+
+#define TTS_SR_SERVER_SERVICE_NAME "service.connect.ttssrserver"
+#define TTS_SR_SERVER_SERVICE_OBJECT_PATH "/com/samsung/voice/ttssrserver"
+#define TTS_SR_SERVER_SERVICE_INTERFACE "com.samsung.voice.ttssrserver"
/******************************************************************************************
* Message Definition for APIs
BuildRequires: pkgconfig(dbus-1)
BuildRequires: pkgconfig(mm-player)
BuildRequires: pkgconfig(mm-common)
+BuildRequires: pkgconfig(mm-session)
BuildRequires: pkgconfig(dlog)
BuildRequires: pkgconfig(vconf)
BuildRequires: pkgconfig(ecore)
BuildRequires: pkgconfig(ecore-file)
+BuildRequires: pkgconfig(capi-system-runtime-info)
BuildRequires: cmake
%defattr(-,root,root,-)
%{_libdir}/lib*.so
%{_libdir}/voice/tts/1.0/ttsd.conf
-%{_bindir}/tts-daemon
+%{_bindir}/tts-daemon*
/usr/share/license/*
%files devel
SET(SRCS
ttsd_data.cpp
- ttsd_player.cpp
+ ttsd_player.c
ttsd_engine_agent.c
ttsd_config.c
- ttsd_server.cpp
+ ttsd_server.c
ttsd_network.c
ttsd_dbus.c
ttsd_dbus_server.c
ttsd_main.c
)
+SET(NOTI_SRCS
+ ttsd_data.cpp
+ ttsd_player.c
+ ttsd_engine_agent.c
+ ttsd_config.c
+ ttsd_server.c
+ ttsd_network.c
+ ttsd_dbus.c
+ ttsd_dbus_server.c
+ ttsd_main_noti.c
+)
+
+SET(SR_SRCS
+ ttsd_data.cpp
+ ttsd_player.c
+ ttsd_engine_agent.c
+ ttsd_config.c
+ ttsd_server.c
+ ttsd_network.c
+ ttsd_dbus.c
+ ttsd_dbus_server.c
+ ttsd_main_sr.c
+)
+
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR})
INCLUDE_DIRECTORIES(${INCLUDEDIR})
INCLUDE_DIRECTORIES("${CMAKE_SOURCE_DIR}/../common")
-
-## Dependent packages ##
-#INCLUDE(FindPkgConfig)
-#pkg_check_modules(pkgs REQUIRED
-# mm-player vconf mm-common dbus-1 dlog
-#)
-
FOREACH(flag ${pkgs_CFLAGS})
SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
ENDFOREACH(flag)
ADD_EXECUTABLE(${PROJECT_NAME} ${SRCS})
TARGET_LINK_LIBRARIES(${PROJECT_NAME} -ldl ${pkgs_LDFLAGS})
+ADD_EXECUTABLE("${PROJECT_NAME}-noti" ${NOTI_SRCS})
+TARGET_LINK_LIBRARIES("${PROJECT_NAME}-noti" -ldl ${pkgs_LDFLAGS})
+
+ADD_EXECUTABLE("${PROJECT_NAME}-sr" ${SR_SRCS})
+TARGET_LINK_LIBRARIES("${PROJECT_NAME}-sr" -ldl ${pkgs_LDFLAGS})
+
+
## Install ##
INSTALL(TARGETS ${PROJECT_NAME} DESTINATION bin)
+INSTALL(TARGETS "${PROJECT_NAME}-noti" DESTINATION bin)
+INSTALL(TARGETS "${PROJECT_NAME}-sr" DESTINATION bin)
+
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/ttsp.h DESTINATION include)
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/ttsd.conf DESTINATION lib/voice/tts/1.0)
*/
#include <Ecore_File.h>
+#include <runtime_info.h>
#include "ttsd_main.h"
#include "ttsd_config.h"
+#include "ttsd_engine_agent.h"
+#include "ttsd_data.h"
-#define CONFIG_FILE_PATH CONFIG_DIRECTORY"/ttsd.conf"
-#define CONFIG_DEFAULT BASE_DIRECTORY_DEFAULT"/ttsd.conf"
+#define CONFIG_DEFAULT BASE_DIRECTORY_DEFAULT"/ttsd.conf"
+
+#define DEFAULT_CONFIG_FILE_NAME "/ttsd_default.conf"
+#define NOTI_CONFIG_FILE_NAME "/ttsd_noti.conf"
+#define SR_CONFIG_FILE_NAME "/ttsd_sr.conf"
+
+#define DEFAULT_ERROR_FILE_NAME "/ttsd_default.err"
+#define NOTI_ERROR_FILE_NAME "/ttsd_noti.err"
+#define SR_ERROR_FILE_NAME "/ttsd_sr.err"
#define ENGINE_ID "ENGINE_ID"
#define VOICE "VOICE"
#define SPEED "SPEED"
-
static char* g_engine_id;
static char* g_language;
static int g_vc_type;
static int g_speed;
+static char* g_config_file;
+
+static ttsd_config_lang_changed_cb g_callback;
+
+void __system_language_changed_cb(runtime_info_key_e key, void *user_data)
+{
+ if (RUNTIME_INFO_KEY_LANGUAGE == key) {
+ if (TTSD_MODE_NOTIFICATION == ttsd_get_mode() || TTSD_MODE_SCREEN_READER == ttsd_get_mode()) {
+ int ret = -1;
+ char *value;
+
+ ret = runtime_info_get_value_string(RUNTIME_INFO_KEY_LANGUAGE, &value);
+ if (0 != ret) {
+ SLOG(LOG_ERROR, get_tag(), "[Config ERROR] Fail to get system language : %d", ret);
+ return;
+ } else {
+ SLOG(LOG_DEBUG, get_tag(), "[Config] System language changed : %s", value);
+ if (NULL != g_callback)
+ g_callback(value, g_vc_type);
+
+ if (NULL != value)
+ free(value);
+ }
+ }
+ }
+
+ return;
+}
+
int __ttsd_config_save()
{
- if (0 != access(CONFIG_FILE_PATH, R_OK|W_OK)) {
+ if (0 != access(g_config_file, R_OK|W_OK)) {
if (0 == ecore_file_mkpath(CONFIG_DIRECTORY)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Config ERROR ] Fail to create directory (%s)", CONFIG_DIRECTORY);
+ SLOG(LOG_ERROR, get_tag(), "[Config ERROR ] Fail to create directory (%s)", CONFIG_DIRECTORY);
return -1;
}
- SLOG(LOG_WARN, TAG_TTSD, "[Config] Create directory (%s)", CONFIG_DIRECTORY);
+ SLOG(LOG_WARN, get_tag(), "[Config] Create directory (%s)", CONFIG_DIRECTORY);
}
FILE* config_fp;
- config_fp = fopen(CONFIG_FILE_PATH, "w+");
+ config_fp = fopen(g_config_file, "w+");
if (NULL == config_fp) {
/* make file and file default */
- SLOG(LOG_WARN, TAG_TTSD, "[Config WARNING] Fail to open config (%s)", CONFIG_FILE_PATH);
+ SLOG(LOG_WARN, get_tag(), "[Config WARNING] Fail to open config (%s)", g_config_file);
return -1;
}
- SLOG(LOG_DEBUG, TAG_TTSD, "[Config] Rewrite config file");
+ SLOG(LOG_DEBUG, get_tag(), "[Config] Rewrite config file");
/* Write engine id */
fprintf(config_fp, "%s %s\n", ENGINE_ID, g_engine_id);
return 0;
}
-
int __ttsd_config_load()
{
FILE* config_fp;
int int_param = 0;
bool is_default_open = false;
- config_fp = fopen(CONFIG_FILE_PATH, "r");
+ config_fp = fopen(g_config_file, "r");
if (NULL == config_fp) {
- SLOG(LOG_WARN, TAG_TTSD, "[Config WARNING] Not open file(%s)", CONFIG_FILE_PATH);
+ SLOG(LOG_WARN, get_tag(), "[Config WARNING] Not open file(%s)", g_config_file);
config_fp = fopen(CONFIG_DEFAULT, "r");
if (NULL == config_fp) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Config WARNING] Not open original config file(%s)", CONFIG_FILE_PATH);
+ SLOG(LOG_ERROR, get_tag(), "[Config WARNING] Not open original config file(%s)", CONFIG_DEFAULT);
return -1;
}
is_default_open = true;
/* Read engine id */
if (EOF == fscanf(config_fp, "%s %s", buf_id, buf_param)) {
fclose(config_fp);
- SLOG(LOG_WARN, TAG_TTSD, "[Config WARNING] Fail to read config (engine id)");
+ SLOG(LOG_WARN, get_tag(), "[Config WARNING] Fail to read config (engine id)");
__ttsd_config_save();
return -1;
} else {
g_engine_id = strdup(buf_param);
} else {
fclose(config_fp);
- SLOG(LOG_WARN, TAG_TTSD, "[Config WARNING] Fail to load config (engine id)");
+ SLOG(LOG_WARN, get_tag(), "[Config WARNING] Fail to load config (engine id)");
__ttsd_config_save();
return -1;
}
}
-
-
/* Read voice */
if (EOF == fscanf(config_fp, "%s %s %d", buf_id, buf_param, &int_param)) {
fclose(config_fp);
- SLOG(LOG_WARN, TAG_TTSD, "[Config WARNING] Fail to read config (voice)");
+ SLOG(LOG_WARN, get_tag(), "[Config WARNING] Fail to read config (voice)");
__ttsd_config_save();
return -1;
} else {
g_vc_type = int_param;
} else {
fclose(config_fp);
- SLOG(LOG_WARN, TAG_TTSD, "[Config WARNING] Fail to load config (voice)");
+ SLOG(LOG_WARN, get_tag(), "[Config WARNING] Fail to load config (voice)");
__ttsd_config_save();
return -1;
}
/* Read speed */
if (EOF == fscanf(config_fp, "%s %d", buf_id, &int_param)) {
fclose(config_fp);
- SLOG(LOG_WARN, TAG_TTSD, "[Config WARNING] Fail to read config (speed)");
+ SLOG(LOG_WARN, get_tag(), "[Config WARNING] Fail to read config (speed)");
__ttsd_config_save();
return -1;
} else {
g_speed = int_param;
} else {
fclose(config_fp);
- SLOG(LOG_WARN, TAG_TTSD, "[Config WARNING] Fail to load config (speed)");
+ SLOG(LOG_WARN, get_tag(), "[Config WARNING] Fail to load config (speed)");
__ttsd_config_save();
return -1;
}
fclose(config_fp);
- SLOG(LOG_DEBUG, TAG_TTSD, "[Config] Load config : engine(%s), voice(%s,%d), speed(%d)",
+ SLOG(LOG_DEBUG, get_tag(), "[Config] Load config : engine(%s), voice(%s,%d), speed(%d)",
g_engine_id, g_language, g_vc_type, g_speed);
if (true == is_default_open) {
if(0 == __ttsd_config_save()) {
- SLOG(LOG_DEBUG, TAG_TTSD, "[Config] Create config(%s)", CONFIG_FILE_PATH);
+ SLOG(LOG_DEBUG, get_tag(), "[Config] Create config(%s)", g_config_file);
}
}
return 0;
}
-int ttsd_config_initialize()
+int ttsd_config_initialize(ttsd_config_lang_changed_cb callback)
{
g_engine_id = NULL;
g_language = NULL;
g_vc_type = 1;
g_speed = 3;
+ g_callback = callback;
+
+ if (TTSD_MODE_NOTIFICATION == ttsd_get_mode()) {
+ g_config_file = (char*)malloc(strlen(CONFIG_DIRECTORY) + strlen(NOTI_CONFIG_FILE_NAME) + 1);
+ strcpy(g_config_file, CONFIG_DIRECTORY);
+ strcat(g_config_file, NOTI_CONFIG_FILE_NAME);
+ } else if (TTSD_MODE_SCREEN_READER == ttsd_get_mode()) {
+ g_config_file = (char*)malloc(strlen(CONFIG_DIRECTORY) + strlen(SR_CONFIG_FILE_NAME) + 1);
+ strcpy(g_config_file, CONFIG_DIRECTORY);
+ strcat(g_config_file, SR_CONFIG_FILE_NAME);
+ } else {
+ g_config_file = (char*)malloc(strlen(CONFIG_DIRECTORY) + strlen(DEFAULT_CONFIG_FILE_NAME) + 1);
+ strcpy(g_config_file, CONFIG_DIRECTORY);
+ strcat(g_config_file, DEFAULT_CONFIG_FILE_NAME);
+ }
+
__ttsd_config_load();
+ /* Register system language changed callback */
+ int ret = runtime_info_set_changed_cb(RUNTIME_INFO_KEY_LANGUAGE, __system_language_changed_cb, NULL);\r
+ if (0 != ret) {
+ SLOG(LOG_ERROR, get_tag(), "[Config ERROR] Fail to register callback : %d", ret);
+ return TTSD_ERROR_OPERATION_FAILED;
+ }
+
return 0;
}
int ttsd_config_finalize()
{
__ttsd_config_save();
+
+ if (NULL != g_config_file) {
+ free(g_config_file);
+ }
+
+ return 0;
+}
+
+int ttsd_config_update_language()
+{
+ if (TTSD_MODE_NOTIFICATION == ttsd_get_mode() || TTSD_MODE_SCREEN_READER == ttsd_get_mode()) {
+ int ret = -1;
+ char *value;
+
+ ret = runtime_info_get_value_string(RUNTIME_INFO_KEY_LANGUAGE, &value);
+ if (0 != ret) {
+ SLOG(LOG_ERROR, get_tag(), "[Config ERROR] Fail to get system language : %d", ret);
+ return -1;
+ } else {
+ SLOG(LOG_DEBUG, get_tag(), "[Config] System language : %s", value);
+
+ if (0 != strcmp(value, g_language)) {
+ if (NULL != g_callback)
+ g_callback(value, g_vc_type);
+ }
+
+ if (NULL != value)
+ free(value);
+ }
+ }
+
return 0;
}
__ttsd_config_save();
return 0;
}
+
+int ttsd_config_save_error(int uid, int uttid, const char* lang, int vctype, const char* text,
+ const char* func, int line, const char* message)
+{
+ char* err_file;
+
+ if (TTSD_MODE_NOTIFICATION == ttsd_get_mode()) {
+ err_file = (char*)malloc(strlen(CONFIG_DIRECTORY) + strlen(NOTI_ERROR_FILE_NAME) + 1);
+ strcpy(err_file, CONFIG_DIRECTORY);
+ strcat(err_file, NOTI_ERROR_FILE_NAME);
+ } else if (TTSD_MODE_SCREEN_READER == ttsd_get_mode()) {
+ err_file = (char*)malloc(strlen(CONFIG_DIRECTORY) + strlen(SR_ERROR_FILE_NAME) + 1);
+ strcpy(err_file, CONFIG_DIRECTORY);
+ strcat(err_file, SR_ERROR_FILE_NAME);
+ } else {
+ err_file = (char*)malloc(strlen(CONFIG_DIRECTORY) + strlen(DEFAULT_ERROR_FILE_NAME) + 1);
+ strcpy(err_file, CONFIG_DIRECTORY);
+ strcat(err_file, DEFAULT_ERROR_FILE_NAME);
+ }
+
+ FILE* err_fp;
+ err_fp = fopen(err_file, "w+");
+ if (NULL == err_fp) {
+ SLOG(LOG_WARN, get_tag(), "[WARNING] Fail to open error file (%s)", err_file);
+ return -1;
+ }
+ SLOG(LOG_DEBUG, get_tag(), "Save Error File (%s)", err_file);
+
+ /* func */
+ if (NULL != func) {
+ fprintf(err_fp, "function - %s\n", func);
+ }
+
+ /* line */
+ fprintf(err_fp, "line - %d\n", line);
+
+ /* message */
+ if (NULL != message) {
+ fprintf(err_fp, "message - %s\n", message);
+ }
+
+ int ret;
+ /* uid */
+ fprintf(err_fp, "uid - %d\n", uid);
+
+ /* uttid */
+ fprintf(err_fp, "uttid - %d\n", uttid);
+
+ /* lang */
+ if (NULL != lang) {
+ fprintf(err_fp, "language - %s\n", lang);
+ }
+
+ /* vctype */
+ fprintf(err_fp, "vctype - %d\n", vctype);
+
+ /* text */
+ if (NULL != text) {
+ fprintf(err_fp, "text - %s\n", text);
+ }
+
+ /* get current engine */
+ char *engine_id = NULL;
+
+ ret = ttsd_engine_setting_get_engine(&engine_id);
+ if (0 != ret) {
+ SLOG(LOG_ERROR, get_tag(), "[ERROR] Fail to get current engine");
+ } else {
+ fprintf(err_fp, "current engine - %s", engine_id);
+ }
+
+ /* get data */
+ ttsd_data_save_error_log(uid, err_fp);
+
+ fclose(err_fp);
+
+ return 0;
+}
\ No newline at end of file
extern "C" {
#endif
-int ttsd_config_initialize();
+typedef void (*ttsd_config_lang_changed_cb)(const char* langauge, int type);
+
+int ttsd_config_initialize(ttsd_config_lang_changed_cb callback);
int ttsd_config_finalize();
+int ttsd_config_update_language();
+
int ttsd_config_get_default_engine(char** engine_id);
int ttsd_config_set_default_engine(const char* engine_id);
int ttsd_config_set_default_speed(int speed);
+int ttsd_config_save_error(int uid, int uttid, const char* lang, int vctype, const char* text,
+ const char* func, int line, const char* message);
+
#ifdef __cplusplus
}
#endif
* limitations under the License.
*/
-
+#include <vector>
#include "ttsd_main.h"
#include "ttsd_data.h"
using namespace std;
+typedef struct
+{
+ int pid;
+ int uid;
+ int utt_id_stopped;
+ app_state_e state;
+
+ std::vector<speak_data_s> m_speak_data;
+ std::vector<sound_data_s> m_wav_data;
+}app_data_s;
+
+typedef struct {
+ int pid;
+} setting_app_data_s;
+
static vector<app_data_s> g_app_list;
static vector<setting_app_data_s> g_setting_list;
{
int vsize = g_app_list.size();
- SLOG(LOG_DEBUG, TAG_TTSD, "----- client list -----");
+ SLOG(LOG_DEBUG, get_tag(), "----- client list -----");
for (int i=0; i<vsize; i++) {
- SLOG(LOG_DEBUG, TAG_TTSD, "[%dth] pid(%d), uid(%d), state(%d) \n", i, g_app_list[i].pid, g_app_list[i].uid, g_app_list[i].state );
+ SLOG(LOG_DEBUG, get_tag(), "[%dth] pid(%d), uid(%d), state(%d) \n", i, g_app_list[i].pid, g_app_list[i].uid, g_app_list[i].state );
}
if (0 == vsize) {
- SLOG(LOG_DEBUG, TAG_TTSD, "No Client \n");
+ SLOG(LOG_DEBUG, get_tag(), "No Client \n");
}
- SLOG(LOG_DEBUG, TAG_TTSD, "-----------------------");
+ SLOG(LOG_DEBUG, get_tag(), "-----------------------");
- SLOG(LOG_DEBUG, TAG_TTSD, "----- setting client list -----");
+ SLOG(LOG_DEBUG, get_tag(), "----- setting client list -----");
vsize = g_setting_list.size();
for (int i=0; i<vsize; i++) {
- SLOG(LOG_DEBUG, TAG_TTSD, "[%dth] pid(%d)", i, g_setting_list[i].pid );
+ SLOG(LOG_DEBUG, get_tag(), "[%dth] pid(%d)", i, g_setting_list[i].pid );
}
if (0 == vsize) {
- SLOG(LOG_DEBUG, TAG_TTSD, "No Setting Client");
+ SLOG(LOG_DEBUG, get_tag(), "No Setting Client");
}
- SLOG(LOG_DEBUG, TAG_TTSD, "--------------------------------");
+ SLOG(LOG_DEBUG, get_tag(), "--------------------------------");
return TTSD_ERROR_NONE;
}
int __data_show_sound_list(int index)
{
- SLOG(LOG_DEBUG, TAG_TTSD, "----- Sound list -----");
+ SLOG(LOG_DEBUG, get_tag(), "----- Sound list -----");
unsigned int i;
for (i=0 ; i < g_app_list[index].m_wav_data.size() ; i++) {
- SLOG(LOG_DEBUG, TAG_TTSD, "[%dth] data size(%ld), uttid(%d), type(%d) \n",
+ SLOG(LOG_DEBUG, get_tag(), "[%dth] data size(%ld), uttid(%d), type(%d) \n",
i+1, g_app_list[index].m_wav_data[i].data_size, g_app_list[index].m_wav_data[i].utt_id, g_app_list[index].m_wav_data[i].audio_type );
}
if (i == 0) {
- SLOG(LOG_DEBUG, TAG_TTSD, "No Sound Data \n");
+ SLOG(LOG_DEBUG, get_tag(), "No Sound Data \n");
}
- SLOG(LOG_DEBUG, TAG_TTSD, "----------------------");
+ SLOG(LOG_DEBUG, get_tag(), "----------------------");
return TTSD_ERROR_NONE;
}
int __data_show_text_list(int index)
{
- SLOG(LOG_DEBUG, TAG_TTSD, "----- Text list -----");
+ SLOG(LOG_DEBUG, get_tag(), "----- Text list -----");
unsigned int i;
for (i=0 ; i< g_app_list[index].m_speak_data.size() ; i++) {
- SLOG(LOG_DEBUG, TAG_TTSD, "[%dth] lang(%s), vctype(%d), speed(%d), uttid(%d), text(%s) \n",
+ SLOG(LOG_DEBUG, get_tag(), "[%dth] lang(%s), vctype(%d), speed(%d), uttid(%d), text(%s) \n",
i+1, g_app_list[index].m_speak_data[i].lang, g_app_list[index].m_speak_data[i].vctype, g_app_list[index].m_speak_data[i].speed,
g_app_list[index].m_speak_data[i].utt_id, g_app_list[index].m_speak_data[i].text );
}
if (0 == i) {
- SLOG(LOG_DEBUG, TAG_TTSD, "No Text Data \n");
+ SLOG(LOG_DEBUG, get_tag(), "No Text Data \n");
}
- SLOG(LOG_DEBUG, TAG_TTSD, "---------------------");
+ SLOG(LOG_DEBUG, get_tag(), "---------------------");
return TTSD_ERROR_NONE;
}
int ttsd_data_new_client(int pid, int uid)
{
if( -1 != ttsd_data_is_client(uid) ) {
- SLOG(LOG_ERROR, TAG_TTSD, "[DATA ERROR] ttsd_data_new_client() : uid is not valid (%d)\n", uid);
+ SLOG(LOG_ERROR, get_tag(), "[DATA ERROR] ttsd_data_new_client() : uid is not valid (%d)\n", uid);
return TTSD_ERROR_INVALID_PARAMETER;
}
index = ttsd_data_is_client(uid);
if (index < 0) {
- SLOG(LOG_ERROR, TAG_TTSD, "[DATA ERROR] ttsd_data_delete_client() : uid is not valid (%d)\n", uid);
+ SLOG(LOG_ERROR, get_tag(), "[DATA ERROR] ttsd_data_delete_client() : uid is not valid (%d)\n", uid);
return -1;
}
if (0 != ttsd_data_clear_data(uid)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[DATA ERROR] fail ttsd_data_clear_data()\n");
+ SLOG(LOG_ERROR, get_tag(), "[DATA ERROR] fail ttsd_data_clear_data()\n");
return -1;
}
index = ttsd_data_is_client(uid);
if (index < 0) {
- SLOG(LOG_ERROR, TAG_TTSD, "[DATA ERROR] ttsd_data_delete_client() : uid is not valid (%d)\n", uid);
+ SLOG(LOG_ERROR, get_tag(), "[DATA ERROR] ttsd_data_delete_client() : uid is not valid (%d)\n", uid);
return TTSD_ERROR_INVALID_PARAMETER;
}
index = ttsd_data_is_client(uid);
if (index < 0) {
- SLOG(LOG_ERROR, TAG_TTSD, "[DATA ERROR] ttsd_data_get_speak_data_size() : uid is not valid (%d)\n", uid);
+ SLOG(LOG_ERROR, get_tag(), "[DATA ERROR] ttsd_data_get_speak_data_size() : uid is not valid (%d)\n", uid);
return TTSD_ERROR_INVALID_PARAMETER;
}
index = ttsd_data_is_client(uid);
if (index < 0) {
- SLOG(LOG_ERROR, TAG_TTSD, "[DATA ERROR] ttsd_data_add_speak_data() : uid is not valid (%d)\n", uid);
+ SLOG(LOG_ERROR, get_tag(), "[DATA ERROR] ttsd_data_add_speak_data() : uid is not valid (%d)\n", uid);
return TTSD_ERROR_INVALID_PARAMETER;
}
index = ttsd_data_is_client(uid);
if (index < 0) {
- SLOG(LOG_ERROR, TAG_TTSD, "[DATA ERROR] ttsd_data_get_speak_data() : uid is not valid(%d)\n", uid);
+ SLOG(LOG_ERROR, get_tag(), "[DATA ERROR] ttsd_data_get_speak_data() : uid is not valid(%d)\n", uid);
return TTSD_ERROR_INVALID_PARAMETER;
}
if (0 == g_app_list[index].m_speak_data.size()) {
- SLOG(LOG_WARN, TAG_TTSD, "[DATA WARNING] There is no speak data\n");
+ SLOG(LOG_WARN, get_tag(), "[DATA WARNING] There is no speak data\n");
return -1;
}
index = ttsd_data_is_client(uid);
if(index < 0) {
- SLOG(LOG_ERROR, TAG_TTSD, "[DATA ERROR] ttsd_data_add_sound_data() : uid is not valid (%d)\n", uid);
+ SLOG(LOG_ERROR, get_tag(), "[DATA ERROR] ttsd_data_add_sound_data() : uid is not valid (%d)\n", uid);
return TTSD_ERROR_INVALID_PARAMETER;
}
index = ttsd_data_is_client(uid);
if (index < 0) {
- SLOG(LOG_ERROR, TAG_TTSD, "[DATA ERROR] ttsd_data_get_sound_data() : uid is not valid (%d)\n", uid);
+ SLOG(LOG_ERROR, get_tag(), "[DATA ERROR] ttsd_data_get_sound_data() : uid is not valid (%d)\n", uid);
return TTSD_ERROR_INVALID_PARAMETER;
}
if (0 == g_app_list[index].m_wav_data.size()) {
- SLOG(LOG_WARN, TAG_TTSD, "[DATA WARNING] There is no wav data\n");
+ SLOG(LOG_WARN, get_tag(), "[DATA WARNING] There is no wav data\n");
return -1;
}
index = ttsd_data_is_client(uid);
if (index < 0) {
- SLOG(LOG_ERROR, TAG_TTSD, "[DATA ERROR] ttsd_data_get_sound_data_size() : uid is not valid (%d)\n", uid);
+ SLOG(LOG_ERROR, get_tag(), "[DATA ERROR] ttsd_data_get_sound_data_size() : uid is not valid (%d)\n", uid);
return TTSD_ERROR_INVALID_PARAMETER;
}
index = ttsd_data_is_client(uid);
if (index < 0) {
- SLOG(LOG_ERROR, TAG_TTSD, "[DATA ERROR] ttsd_data_clear_data() : uid is not valid (%d)\n", uid);
+ SLOG(LOG_ERROR, get_tag(), "[DATA ERROR] ttsd_data_clear_data() : uid is not valid (%d)\n", uid);
return TTSD_ERROR_INVALID_PARAMETER;
}
index = ttsd_data_is_client(uid);
if (index < 0) {
- SLOG(LOG_ERROR, TAG_TTSD, "[DATA ERROR] ttsd_data_get_client_state() : uid is not valid (%d)\n", uid);
+ SLOG(LOG_ERROR, get_tag(), "[DATA ERROR] ttsd_data_get_client_state() : uid is not valid (%d)\n", uid);
return TTSD_ERROR_INVALID_PARAMETER;
}
index = ttsd_data_is_client(uid);
if (index < 0) {
- SLOG(LOG_ERROR, TAG_TTSD, "[DATA ERROR] ttsd_data_set_client_state() : uid is not valid (%d)\n", uid);
+ SLOG(LOG_ERROR, get_tag(), "[DATA ERROR] ttsd_data_set_client_state() : uid is not valid (%d)\n", uid);
return TTSD_ERROR_INVALID_PARAMETER;
}
int vsize = g_app_list.size();
for (int i=0 ; i<vsize ; i++) {
if(g_app_list[i].state == APP_STATE_PLAYING) {
- SLOG(LOG_ERROR, TAG_TTSD, "[DATA ERROR] ttsd_data_set_client_state() : a playing client has already existed. \n");
+ SLOG(LOG_ERROR, get_tag(), "[DATA ERROR] ttsd_data_set_client_state() : a playing client has already existed. \n");
g_mutex_state = false;
return -1;
}
}
}
- SLOG(LOG_DEBUG, TAG_TTSD, "[DATA] NO CURRENT PLAYING !!");
+ SLOG(LOG_DEBUG, get_tag(), "[DATA] NO CURRENT PLAYING !!");
return -1;
}
int ttsd_data_foreach_clients(ttsd_data_get_client_cb callback, void* user_data)
{
if (NULL == callback) {
- SLOG(LOG_ERROR, TAG_TTSD, "[DATA ERROR] input data is NULL!!");
+ SLOG(LOG_ERROR, get_tag(), "[DATA ERROR] input data is NULL!!");
return -1;
}
index = ttsd_data_is_client(uid);
if (index < 0) {
- SLOG(LOG_ERROR, TAG_TTSD, "[DATA ERROR] ttsd_data_set_client_state() : uid is not valid (%d)\n", uid);
+ SLOG(LOG_ERROR, get_tag(), "[DATA ERROR] ttsd_data_set_client_state() : uid is not valid (%d)\n", uid);
return TTSD_ERROR_INVALID_PARAMETER;
}
int ttsd_setting_data_add(int pid)
{
if (-1 != ttsd_setting_data_is_setting(pid)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[DATA ERROR] pid(%d) is not valid", pid);
+ SLOG(LOG_ERROR, get_tag(), "[DATA ERROR] pid(%d) is not valid", pid);
return TTSD_ERROR_INVALID_PARAMETER;
}
index = ttsd_setting_data_is_setting(pid);
if (index < 0) {
- SLOG(LOG_ERROR, TAG_TTSD, "[DATA ERROR] uid is not valid (%d)", pid);
+ SLOG(LOG_ERROR, get_tag(), "[DATA ERROR] uid is not valid (%d)", pid);
return -1;
}
int ttsd_setting_data_is_setting(int pid)
{
int vsize = g_setting_list.size();
-
for (int i=0; i<vsize; i++) {
if(g_setting_list[i].pid == pid) {
return i;
}
}
-
+
return -1;
+}
+
+int ttsd_data_save_error_log(int uid, FILE* fp)
+{
+ int ret;
+ int pid;
+ /* pid */
+ pid = ttsd_data_get_pid(uid);
+ if (0 > pid) {
+ SLOG(LOG_ERROR, get_tag(), "[ERROR] Fail to get pid");
+ } else {
+ fprintf(fp, "pid - %d\n", pid);
+ }
+ /* app state */
+ app_state_e state;
+ ret = ttsd_data_get_client_state(uid, &state);
+ if (0 != ret) {
+ SLOG(LOG_ERROR, get_tag(), "[ERROR] Fail to get app state");
+ } else {
+ fprintf(fp, "app state - %d\n", state);
+ }
+
+ int index = 0;
+ unsigned int i;
+
+ index = ttsd_data_is_client(uid);
+
+ /* get sound data */
+ fprintf(fp, "----- Sound list -----\n");
+
+ for (i=0 ; i < g_app_list[index].m_wav_data.size() ; i++) {
+ fprintf(fp, "[%dth] data size(%ld), uttid(%d), type(%d) \n",
+ i+1, g_app_list[index].m_wav_data[i].data_size, g_app_list[index].m_wav_data[i].utt_id, g_app_list[index].m_wav_data[i].audio_type );
+ }
+ fprintf(fp, "----------------------\n");
+
+ /* get speck data */
+ fprintf(fp, "----- Text list -----\n");
+
+ for (i=0 ; i< g_app_list[index].m_speak_data.size() ; i++) {
+ fprintf(fp, "[%dth] lang(%s), vctype(%d), speed(%d), uttid(%d), text(%s) \n",
+ i+1, g_app_list[index].m_speak_data[i].lang, g_app_list[index].m_speak_data[i].vctype, g_app_list[index].m_speak_data[i].speed,
+ g_app_list[index].m_speak_data[i].utt_id, g_app_list[index].m_speak_data[i].text );
+ }
+ fprintf(fp, "---------------------");
+
+ return 0;
}
\ No newline at end of file
#ifndef __TTSD_DATA_H_
#define __TTSD_DATA_H_
-#include <vector>
+//#include <vector>
#include "ttsp.h"
-using namespace std;
+//using namespace std;
#ifdef __cplusplus
extern "C" {
int channels;
}sound_data_s;
-typedef struct
-{
- int pid;
- int uid;
- int utt_id_stopped;
- app_state_e state;
-
- std::vector<speak_data_s> m_speak_data;
- std::vector<sound_data_s> m_wav_data;
-}app_data_s;
-
-typedef struct {
- int pid;
-} setting_app_data_s;
-
int ttsd_data_new_client(int pid, int uid);
int ttsd_data_delete_client(int uid);
int ttsd_setting_data_is_setting(int pid);
+/* for error log */
+int ttsd_data_save_error_log(int uid, FILE* fp);
+
#ifdef __cplusplus
}
#endif
static int g_waiting_time = 3000;
+static char *g_service_name;
+static char *g_service_interface;
+
int ttsdc_send_hello(int pid, int uid)
{
char service_name[64];
TTSD_METHOD_HELLO);
if (NULL == msg) {
- SLOG(LOG_ERROR, TAG_TTSD, "<<<< [Dbus ERROR] Fail to create hello message : uid(%d)", uid);
+ SLOG(LOG_ERROR, get_tag(), "<<<< [Dbus ERROR] Fail to create hello message : uid(%d)", uid);
return -1;
} else {
- SLOG(LOG_DEBUG, TAG_TTSD, "<<<< [Dbus] Send hello message : uid(%d)", uid);
+ SLOG(LOG_DEBUG, get_tag(), "<<<< [Dbus] Send hello message : uid(%d)", uid);
}
dbus_message_append_args(msg, DBUS_TYPE_INT32, &uid, DBUS_TYPE_INVALID);
dbus_message_get_args(result_msg, &err, DBUS_TYPE_INT32, &result, DBUS_TYPE_INVALID);
if (dbus_error_is_set(&err)) {
- SLOG(LOG_ERROR, TAG_TTSD, ">>>> [Dbus] Get arguments error (%s)", err.message);
+ SLOG(LOG_ERROR, get_tag(), ">>>> [Dbus] Get arguments error (%s)", err.message);
dbus_error_free(&err);
result = -1;
}
dbus_message_unref(result_msg);
} else {
- SLOG(LOG_DEBUG, TAG_TTSD, ">>>> [Dbus] Result message is NULL. Client is not available");
+ SLOG(LOG_DEBUG, get_tag(), ">>>> [Dbus] Result message is NULL. Client is not available");
result = 0;
}
method);
if (NULL == msg) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Dbus ERROR] Fail to create message : type(%s), uid(%d)\n", method, uid);
+ SLOG(LOG_ERROR, get_tag(), "[Dbus ERROR] Fail to create message : type(%s), uid(%d)\n", method, uid);
return -1;
}
/* send the message and flush the connection */
if (!dbus_connection_send(g_conn, msg, NULL)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Dbus ERROR] <<<< send message : Out Of Memory, type(%s), ifname(%s), uid(%d), data(%d)", method, target_if_name, uid, data);
+ SLOG(LOG_ERROR, get_tag(), "[Dbus ERROR] <<<< send message : Out Of Memory, type(%s), ifname(%s), uid(%d), data(%d)", method, target_if_name, uid, data);
} else {
- SLOG(LOG_DEBUG, TAG_TTSD, "<<<< send message : type(%s), uid(%d), data(%d)", method, uid, data);
+ SLOG(LOG_DEBUG, get_tag(), "<<<< send message : type(%s), uid(%d), data(%d)", method, uid, data);
dbus_connection_flush(g_conn);
}
TTSD_METHOD_ERROR);
if (NULL == msg) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Dbus ERROR] Fail to create error message : uid(%d)\n", uid);
+ SLOG(LOG_ERROR, get_tag(), "[Dbus ERROR] Fail to create error message : uid(%d)\n", uid);
return -1;
}
DBUS_TYPE_INVALID);
if (!dbus_connection_send(g_conn, msg, NULL)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Dbus ERROR] <<<< error message : Out Of Memory !\n");
+ SLOG(LOG_ERROR, get_tag(), "[Dbus ERROR] <<<< error message : Out Of Memory !\n");
} else {
- SLOG(LOG_DEBUG, TAG_TTSD, "<<<< Send error signal : uid(%d), reason(%d), uttid(%d)", uid, reason, uttid);
+ SLOG(LOG_DEBUG, get_tag(), "<<<< Send error signal : uid(%d), reason(%d), uttid(%d)", uid, reason, uttid);
dbus_connection_flush(g_conn);
}
if (NULL == msg || NULL == conn) {
return ECORE_CALLBACK_RENEW;
}
-
+
/* client event */
- if (dbus_message_is_method_call(msg, TTS_SERVER_SERVICE_INTERFACE, TTS_METHOD_HELLO))
+ if (dbus_message_is_method_call(msg, g_service_interface, TTS_METHOD_HELLO))
ttsd_dbus_server_hello(conn, msg);
- else if( dbus_message_is_method_call(msg, TTS_SERVER_SERVICE_INTERFACE, TTS_METHOD_INITIALIZE) )
+ else if( dbus_message_is_method_call(msg, g_service_interface, TTS_METHOD_INITIALIZE) )
ttsd_dbus_server_initialize(conn, msg);
- else if( dbus_message_is_method_call(msg, TTS_SERVER_SERVICE_INTERFACE, TTS_METHOD_FINALIZE) )
+ else if( dbus_message_is_method_call(msg, g_service_interface, TTS_METHOD_FINALIZE) )
ttsd_dbus_server_finalize(conn, msg);
- else if( dbus_message_is_method_call(msg, TTS_SERVER_SERVICE_INTERFACE, TTS_METHOD_GET_SUPPORT_VOICES) )
+ else if( dbus_message_is_method_call(msg, g_service_interface, TTS_METHOD_GET_SUPPORT_VOICES) )
ttsd_dbus_server_get_support_voices(conn, msg);
- else if( dbus_message_is_method_call(msg, TTS_SERVER_SERVICE_INTERFACE, TTS_METHOD_GET_CURRENT_VOICE) )
+ else if( dbus_message_is_method_call(msg, g_service_interface, TTS_METHOD_GET_CURRENT_VOICE) )
ttsd_dbus_server_get_current_voice(conn, msg);
- else if( dbus_message_is_method_call(msg, TTS_SERVER_SERVICE_INTERFACE, TTS_METHOD_ADD_QUEUE) )
+ else if( dbus_message_is_method_call(msg, g_service_interface, TTS_METHOD_ADD_QUEUE) )
ttsd_dbus_server_add_text(conn, msg);
- else if (dbus_message_is_method_call(msg, TTS_SERVER_SERVICE_INTERFACE, TTS_METHOD_PLAY))
+ else if (dbus_message_is_method_call(msg, g_service_interface, TTS_METHOD_PLAY))
ttsd_dbus_server_play(conn, msg);
- else if (dbus_message_is_method_call(msg, TTS_SERVER_SERVICE_INTERFACE, TTS_METHOD_STOP))
+ else if (dbus_message_is_method_call(msg, g_service_interface, TTS_METHOD_STOP))
ttsd_dbus_server_stop(conn, msg);
- else if (dbus_message_is_method_call(msg, TTS_SERVER_SERVICE_INTERFACE, TTS_METHOD_PAUSE))
+ else if (dbus_message_is_method_call(msg, g_service_interface, TTS_METHOD_PAUSE))
ttsd_dbus_server_pause(conn, msg);
/* setting event */
- else if (dbus_message_is_method_call(msg, TTS_SERVER_SERVICE_INTERFACE, TTS_SETTING_METHOD_HELLO))
+ else if (dbus_message_is_method_call(msg, g_service_interface, TTS_SETTING_METHOD_HELLO))
ttsd_dbus_server_hello(conn, msg);
- else if (dbus_message_is_method_call(msg, TTS_SERVER_SERVICE_INTERFACE, TTS_SETTING_METHOD_INITIALIZE) )
+ else if (dbus_message_is_method_call(msg, g_service_interface, TTS_SETTING_METHOD_INITIALIZE) )
ttsd_dbus_server_setting_initialize(conn, msg);
- else if (dbus_message_is_method_call(msg, TTS_SERVER_SERVICE_INTERFACE, TTS_SETTING_METHOD_FINALIZE) )
+ else if (dbus_message_is_method_call(msg, g_service_interface, TTS_SETTING_METHOD_FINALIZE) )
ttsd_dbus_server_setting_finalize(conn, msg);
- else if (dbus_message_is_method_call(msg, TTS_SERVER_SERVICE_INTERFACE, TTS_SETTING_METHOD_GET_ENGINE_LIST) )
+ else if (dbus_message_is_method_call(msg, g_service_interface, TTS_SETTING_METHOD_GET_ENGINE_LIST) )
ttsd_dbus_server_setting_get_engine_list(conn, msg);
- else if (dbus_message_is_method_call(msg, TTS_SERVER_SERVICE_INTERFACE, TTS_SETTING_METHOD_GET_ENGINE) )
+ else if (dbus_message_is_method_call(msg, g_service_interface, TTS_SETTING_METHOD_GET_ENGINE) )
ttsd_dbus_server_setting_get_engine(conn, msg);
- else if (dbus_message_is_method_call(msg, TTS_SERVER_SERVICE_INTERFACE, TTS_SETTING_METHOD_SET_ENGINE) )
+ else if (dbus_message_is_method_call(msg, g_service_interface, TTS_SETTING_METHOD_SET_ENGINE) )
ttsd_dbus_server_setting_set_engine(conn, msg);
- else if (dbus_message_is_method_call(msg, TTS_SERVER_SERVICE_INTERFACE, TTS_SETTING_METHOD_GET_VOICE_LIST) )
+ else if (dbus_message_is_method_call(msg, g_service_interface, TTS_SETTING_METHOD_GET_VOICE_LIST) )
ttsd_dbus_server_setting_get_voice_list(conn, msg);
- else if (dbus_message_is_method_call(msg, TTS_SERVER_SERVICE_INTERFACE, TTS_SETTING_METHOD_GET_DEFAULT_VOICE) )
+ else if (dbus_message_is_method_call(msg, g_service_interface, TTS_SETTING_METHOD_GET_DEFAULT_VOICE) )
ttsd_dbus_server_setting_get_default_voice(conn, msg);
- else if (dbus_message_is_method_call(msg, TTS_SERVER_SERVICE_INTERFACE, TTS_SETTING_METHOD_SET_DEFAULT_VOICE) )
+ else if (dbus_message_is_method_call(msg, g_service_interface, TTS_SETTING_METHOD_SET_DEFAULT_VOICE) )
ttsd_dbus_server_setting_set_default_voice(conn, msg);
- else if (dbus_message_is_method_call(msg, TTS_SERVER_SERVICE_INTERFACE, TTS_SETTING_METHOD_GET_DEFAULT_SPEED) )
+ else if (dbus_message_is_method_call(msg, g_service_interface, TTS_SETTING_METHOD_GET_DEFAULT_SPEED) )
ttsd_dbus_server_setting_get_speed(conn, msg);
- else if (dbus_message_is_method_call(msg, TTS_SERVER_SERVICE_INTERFACE, TTS_SETTING_METHOD_SET_DEFAULT_SPEED) )
+ else if (dbus_message_is_method_call(msg, g_service_interface, TTS_SETTING_METHOD_SET_DEFAULT_SPEED) )
ttsd_dbus_server_setting_set_speed(conn, msg);
- else if (dbus_message_is_method_call(msg, TTS_SERVER_SERVICE_INTERFACE, TTS_SETTING_METHOD_GET_ENGINE_SETTING) )
+ else if (dbus_message_is_method_call(msg, g_service_interface, TTS_SETTING_METHOD_GET_ENGINE_SETTING) )
ttsd_dbus_server_setting_get_engine_setting(conn, msg);
- else if (dbus_message_is_method_call(msg, TTS_SERVER_SERVICE_INTERFACE, TTS_SETTING_METHOD_SET_ENGINE_SETTING) )
+ else if (dbus_message_is_method_call(msg, g_service_interface, TTS_SETTING_METHOD_SET_ENGINE_SETTING) )
ttsd_dbus_server_setting_set_engine_setting(conn, msg);
return ECORE_CALLBACK_RENEW;
}
-int ttsd_dbus_open_connection()
+int ttsd_dbus_open_connection(ttsd_mode_e mode)
{
DBusError err;
dbus_error_init(&err);
g_conn = dbus_bus_get(DBUS_BUS_SYSTEM, &err);
if (dbus_error_is_set(&err)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Dbus ERROR] fail dbus_bus_get : %s\n", err.message);
+ SLOG(LOG_ERROR, get_tag(), "[Dbus ERROR] fail dbus_bus_get : %s\n", err.message);
dbus_error_free(&err);
}
if (NULL == g_conn) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Dbus ERROR] fail to get dbus connection \n" );
+ SLOG(LOG_ERROR, get_tag(), "[Dbus ERROR] fail to get dbus connection \n" );
return -1;
}
+ if (TTSD_MODE_SCREEN_READER == ttsd_get_mode()) {
+ g_service_name = (char*)malloc(sizeof(char) * strlen(TTS_SR_SERVER_SERVICE_NAME) + 1);
+ g_service_interface = (char*)malloc(sizeof(char) * strlen(TTS_SR_SERVER_SERVICE_INTERFACE) + 1);
+
+ strcpy(g_service_name, TTS_SR_SERVER_SERVICE_NAME);
+ strcpy(g_service_interface, TTS_SR_SERVER_SERVICE_INTERFACE);
+ } else if (TTSD_MODE_NOTIFICATION == ttsd_get_mode()) {
+ g_service_name = (char*)malloc(sizeof(char) * strlen(TTS_NOTI_SERVER_SERVICE_NAME) + 1);
+ g_service_interface = (char*)malloc(sizeof(char) * strlen(TTS_NOTI_SERVER_SERVICE_INTERFACE) + 1);
+
+ strcpy(g_service_name, TTS_NOTI_SERVER_SERVICE_NAME);
+ strcpy(g_service_interface, TTS_NOTI_SERVER_SERVICE_INTERFACE);
+ } else {
+ g_service_name = (char*)malloc(sizeof(char) * strlen(TTS_SERVER_SERVICE_NAME) + 1);
+ g_service_interface = (char*)malloc(sizeof(char) * strlen(TTS_SERVER_SERVICE_INTERFACE) + 1);
+
+ strcpy(g_service_name, TTS_SERVER_SERVICE_NAME);
+ strcpy(g_service_interface, TTS_SERVER_SERVICE_INTERFACE);
+ }
+
/* request our name on the bus and check for errors */
- ret = dbus_bus_request_name(g_conn, TTS_SERVER_SERVICE_NAME, DBUS_NAME_FLAG_REPLACE_EXISTING , &err);
+ ret = dbus_bus_request_name(g_conn, g_service_name, DBUS_NAME_FLAG_REPLACE_EXISTING , &err);
if (DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER != ret) {
printf("Fail to be primary owner in dbus request. \n");
- SLOG(LOG_ERROR, TAG_TTSD, "[Dbus ERROR] fail to be primary owner \n");
+ SLOG(LOG_ERROR, get_tag(), "[Dbus ERROR] fail to be primary owner \n");
return -1;
}
if (dbus_error_is_set(&err)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Dbus ERROR] dbus_bus_request_name() : %s \n", err.message);
+ SLOG(LOG_ERROR, get_tag(), "[Dbus ERROR] dbus_bus_request_name() : %s \n", err.message);
dbus_error_free(&err);
return -1;
/* add a rule for getting signal */
char rule[128];
- snprintf(rule, 128, "type='signal',interface='%s'", TTS_SERVER_SERVICE_INTERFACE);
+ snprintf(rule, 128, "type='signal',interface='%s'", g_service_interface);
/* add a rule for which messages we want to see */
dbus_bus_add_match(g_conn, rule, &err); /* see signals from the given interface */
dbus_connection_flush(g_conn);
if (dbus_error_is_set(&err)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Dbus ERROR] dbus_bus_add_match() : %s \n", err.message);
+ SLOG(LOG_ERROR, get_tag(), "[Dbus ERROR] dbus_bus_add_match() : %s \n", err.message);
return -1;
}
fd_handler = ecore_main_fd_handler_add(fd, ECORE_FD_READ , (Ecore_Fd_Cb)listener_event_callback, g_conn, NULL, NULL);
if (NULL == fd_handler) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Dbus ERROR] ecore_main_fd_handler_add() : fail to get fd handler \n");
+ SLOG(LOG_ERROR, get_tag(), "[Dbus ERROR] ecore_main_fd_handler_add() : fail to get fd handler \n");
return -1;
}
- SLOG(LOG_DEBUG, TAG_TTSD, "[Dbus SUCCESS] Open connection. ");
+ SLOG(LOG_DEBUG, get_tag(), "[Dbus SUCCESS] Open connection. ");
return 0;
}
DBusError err;
dbus_error_init(&err);
- dbus_bus_release_name (g_conn, TTS_SERVER_SERVICE_NAME, &err);
+ dbus_bus_release_name (g_conn, g_service_name, &err);
if (dbus_error_is_set(&err)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Dbus ERROR] dbus_bus_release_name() : %s\n", err.message);
+ SLOG(LOG_ERROR, get_tag(), "[Dbus ERROR] dbus_bus_release_name() : %s\n", err.message);
dbus_error_free(&err);
return -1;
}
- SLOG(LOG_DEBUG, TAG_TTSD, "[Dbus SUCCESS] Close connection. ");
+ if (NULL != g_service_name)
+ free(g_service_name);
+
+ if (NULL != g_service_interface)
+ free(g_service_interface);
+
+ SLOG(LOG_DEBUG, get_tag(), "[Dbus SUCCESS] Close connection. ");
return 0;
}
int ttsd_dbus_server_hello(DBusConnection* conn, DBusMessage* msg)
{
- SLOG(LOG_DEBUG, TAG_TTSD, ">>>>> TTS Hello");
+ SLOG(LOG_DEBUG, get_tag(), ">>>>> TTS Hello");
DBusMessage* reply;
reply = dbus_message_new_method_return(msg);
if (NULL != reply) {
if (!dbus_connection_send(conn, reply, NULL)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[OUT ERROR] Out Of Memory!");
+ SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] Out Of Memory!");
}
dbus_connection_flush(conn);
dbus_message_unref(reply);
} else {
- SLOG(LOG_ERROR, TAG_TTSD, "[OUT ERROR] Fail to create reply message!!");
+ SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] Fail to create reply message!!");
}
- SLOG(LOG_DEBUG, TAG_TTSD, "<<<<<");
- SLOG(LOG_DEBUG, TAG_TTSD, " ");
+ SLOG(LOG_DEBUG, get_tag(), "<<<<<");
+ SLOG(LOG_DEBUG, get_tag(), " ");
return 0;
}
DBUS_TYPE_INT32, &uid,
DBUS_TYPE_INVALID);
- SLOG(LOG_DEBUG, TAG_TTSD, ">>>>> TTS INITIALIZE");
+ SLOG(LOG_DEBUG, get_tag(), ">>>>> TTS INITIALIZE");
if (dbus_error_is_set(&err)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[IN ERROR] tts initialize : get arguments error (%s)\n", err.message);
+ SLOG(LOG_ERROR, get_tag(), "[IN ERROR] tts initialize : get arguments error (%s)\n", err.message);
dbus_error_free(&err);
ret = TTSD_ERROR_OPERATION_FAILED;
} else {
- SLOG(LOG_DEBUG, TAG_TTSD, "[IN] tts initialize : pid(%d), uid(%d) \n", pid , uid);
+ SLOG(LOG_DEBUG, get_tag(), "[IN] tts initialize : pid(%d), uid(%d) \n", pid , uid);
ret = ttsd_server_initialize(pid, uid);
}
dbus_message_append_args(reply, DBUS_TYPE_INT32, &ret, DBUS_TYPE_INVALID);
if (0 == ret) {
- SLOG(LOG_DEBUG, TAG_TTSD, "[OUT] tts initialize : result(%d) \n", ret);
+ SLOG(LOG_DEBUG, get_tag(), "[OUT] tts initialize : result(%d) \n", ret);
} else {
- SLOG(LOG_ERROR, TAG_TTSD, "[OUT ERROR] tts initialize : result(%d) \n", ret);
+ SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] tts initialize : result(%d) \n", ret);
}
if (!dbus_connection_send(conn, reply, NULL)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[OUT ERROR] tts initialize : Out Of Memory!\n");
+ SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] tts initialize : Out Of Memory!\n");
}
dbus_connection_flush(conn);
dbus_message_unref(reply);
} else {
- SLOG(LOG_ERROR, TAG_TTSD, "[OUT ERROR] tts initialize : fail to create reply message!!");
+ SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] tts initialize : fail to create reply message!!");
}
- SLOG(LOG_DEBUG, TAG_TTSD, "<<<<<");
- SLOG(LOG_DEBUG, TAG_TTSD, " ");
+ SLOG(LOG_DEBUG, get_tag(), "<<<<<");
+ SLOG(LOG_DEBUG, get_tag(), " ");
return 0;
}
dbus_message_get_args(msg, &err, DBUS_TYPE_INT32, &uid, DBUS_TYPE_INVALID);
- SLOG(LOG_DEBUG, TAG_TTSD, ">>>>> TTS FINALIZE");
+ SLOG(LOG_DEBUG, get_tag(), ">>>>> TTS FINALIZE");
if (dbus_error_is_set(&err)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[IN ERROR] tts finalize : get arguments error (%s)\n", err.message);
+ SLOG(LOG_ERROR, get_tag(), "[IN ERROR] tts finalize : get arguments error (%s)\n", err.message);
dbus_error_free(&err);
ret = TTSD_ERROR_OPERATION_FAILED;
} else {
- SLOG(LOG_DEBUG, TAG_TTSD, "[IN] tts finalize : uid(%d) \n", uid);
+ SLOG(LOG_DEBUG, get_tag(), "[IN] tts finalize : uid(%d) \n", uid);
ret = ttsd_server_finalize(uid);
}
dbus_message_append_args(reply, DBUS_TYPE_INT32, &ret, DBUS_TYPE_INVALID);
if (0 == ret) {
- SLOG(LOG_DEBUG, TAG_TTSD, "[OUT] tts finalize : result(%d) \n", ret);
+ SLOG(LOG_DEBUG, get_tag(), "[OUT] tts finalize : result(%d) \n", ret);
} else {
- SLOG(LOG_ERROR, TAG_TTSD, "[OUT ERROR] tts finalize : result(%d) \n", ret);
+ SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] tts finalize : result(%d) \n", ret);
}
if (!dbus_connection_send(conn, reply, NULL)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[OUT ERROR] tts finalize : Out Of Memory!\n");
+ SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] tts finalize : Out Of Memory!\n");
}
dbus_connection_flush(conn);
dbus_message_unref(reply);
} else {
- SLOG(LOG_ERROR, TAG_TTSD, "[OUT ERROR] tts finalize : fail to create reply message!!");
+ SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] tts finalize : fail to create reply message!!");
}
- SLOG(LOG_DEBUG, TAG_TTSD, "<<<<<");
- SLOG(LOG_DEBUG, TAG_TTSD, " ");
+ SLOG(LOG_DEBUG, get_tag(), "<<<<<");
+ SLOG(LOG_DEBUG, get_tag(), " ");
return 0;
}
dbus_message_get_args(msg, &err, DBUS_TYPE_INT32, &uid, DBUS_TYPE_INVALID);
- SLOG(LOG_DEBUG, TAG_TTSD, ">>>>> TTS GET VOICES");
+ SLOG(LOG_DEBUG, get_tag(), ">>>>> TTS GET VOICES");
if (dbus_error_is_set(&err)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[IN ERROR] tts get supported voices : get arguments error (%s)\n", err.message);
+ SLOG(LOG_ERROR, get_tag(), "[IN ERROR] tts get supported voices : get arguments error (%s)\n", err.message);
dbus_error_free(&err);
ret = TTSD_ERROR_OPERATION_FAILED;
} else {
- SLOG(LOG_DEBUG, TAG_TTSD, "[IN] get supported voices : uid(%d) \n", uid );
+ SLOG(LOG_DEBUG, get_tag(), "[IN] get supported voices : uid(%d) \n", uid );
ret = ttsd_server_get_support_voices(uid, &voice_list);
}
int size = g_list_length(voice_list);
if (!dbus_message_iter_append_basic(&args, DBUS_TYPE_INT32, &(size))) {
- SLOG(LOG_ERROR, TAG_TTSD, "[OUT ERROR] tts supported voices : Fail to append type \n");
+ SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] tts supported voices : Fail to append type \n");
ret = TTSD_ERROR_OPERATION_FAILED;
} else {
iter = g_list_first(voice_list);
}
}
- SLOG(LOG_DEBUG, TAG_TTSD, "[OUT] tts supported voices : result(%d) \n", ret);
+ SLOG(LOG_DEBUG, get_tag(), "[OUT] tts supported voices : result(%d) \n", ret);
} else {
- SLOG(LOG_ERROR, TAG_TTSD, "[OUT ERROR] tts supported voices : result(%d) \n", ret);
+ SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] tts supported voices : result(%d) \n", ret);
}
if (!dbus_connection_send(conn, reply, NULL)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[OUT ERROR] error : Out Of Memory!\n");
+ SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] error : Out Of Memory!\n");
}
dbus_connection_flush(conn);
dbus_message_unref(reply);
} else {
- SLOG(LOG_ERROR, TAG_TTSD, "[OUT ERROR] tts supported voices : fail to create reply message!!");
+ SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] tts supported voices : fail to create reply message!!");
}
- SLOG(LOG_DEBUG, TAG_TTSD, "<<<<<");
- SLOG(LOG_DEBUG, TAG_TTSD, " ");
+ SLOG(LOG_DEBUG, get_tag(), "<<<<<");
+ SLOG(LOG_DEBUG, get_tag(), " ");
return 0;
}
dbus_message_get_args(msg, &err, DBUS_TYPE_INT32, &uid, DBUS_TYPE_INVALID);
- SLOG(LOG_DEBUG, TAG_TTSD, ">>>>> TTS GET DEFAULT VOICE");
+ SLOG(LOG_DEBUG, get_tag(), ">>>>> TTS GET DEFAULT VOICE");
if (dbus_error_is_set(&err)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[IN ERROR] tts get default voice : Get arguments error (%s)\n", err.message);
+ SLOG(LOG_ERROR, get_tag(), "[IN ERROR] tts get default voice : Get arguments error (%s)\n", err.message);
dbus_error_free(&err);
ret = TTSD_ERROR_OPERATION_FAILED;
} else {
- SLOG(LOG_DEBUG, TAG_TTSD, "[IN] tts get default voice : uid(%d) \n", uid);
+ SLOG(LOG_DEBUG, get_tag(), "[IN] tts get default voice : uid(%d) \n", uid);
ret = ttsd_server_get_current_voice(uid, &lang, &voice_type);
}
DBUS_TYPE_STRING, &lang,
DBUS_TYPE_INT32, &voice_type,
DBUS_TYPE_INVALID);
- SLOG(LOG_DEBUG, TAG_TTSD, "[OUT] tts default voice : lang(%s), vctype(%d)\n", lang, voice_type );
+ SLOG(LOG_DEBUG, get_tag(), "[OUT] tts default voice : lang(%s), vctype(%d)\n", lang, voice_type );
} else {
dbus_message_append_args( reply,
DBUS_TYPE_INT32, &ret,
DBUS_TYPE_INVALID);
- SLOG(LOG_ERROR, TAG_TTSD, "[OUT ERROR] tts default voice : result(%d) \n", ret);
+ SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] tts default voice : result(%d) \n", ret);
}
if (!dbus_connection_send(conn, reply, NULL)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[OUT ERROR] tts default voice : Out Of Memory!\n");
+ SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] tts default voice : Out Of Memory!\n");
}
dbus_connection_flush(conn);
dbus_message_unref(reply);
} else {
- SLOG(LOG_ERROR, TAG_TTSD, "[OUT ERROR] tts default voice : fail to create reply message!!");
+ SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] tts default voice : fail to create reply message!!");
}
- SLOG(LOG_DEBUG, TAG_TTSD, "<<<<<");
- SLOG(LOG_DEBUG, TAG_TTSD, " ");
+ SLOG(LOG_DEBUG, get_tag(), "<<<<<");
+ SLOG(LOG_DEBUG, get_tag(), " ");
return 0;
}
DBUS_TYPE_INT32, &uttid,
DBUS_TYPE_INVALID);
- SLOG(LOG_DEBUG, TAG_TTSD, ">>>>> TTS ADD TEXT");
+ SLOG(LOG_DEBUG, get_tag(), ">>>>> TTS ADD TEXT");
if (dbus_error_is_set(&err)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[IN ERROR] tts add text : Get arguments error (%s)\n", err.message);
+ SLOG(LOG_ERROR, get_tag(), "[IN ERROR] tts add text : Get arguments error (%s)\n", err.message);
dbus_error_free(&err);
ret = TTSD_ERROR_OPERATION_FAILED;
} else {
- SLOG(LOG_DEBUG, TAG_TTSD, "[IN] tts add text : uid(%d), text(%s), lang(%s), type(%d), speed(%d), uttid(%d) \n",
+ SLOG(LOG_DEBUG, get_tag(), "[IN] tts add text : uid(%d), text(%s), lang(%s), type(%d), speed(%d), uttid(%d) \n",
uid, text, lang, voicetype, speed, uttid);
ret = ttsd_server_add_queue(uid, text, lang, voicetype, speed, uttid);
}
dbus_message_append_args(reply, DBUS_TYPE_INT32, &ret, DBUS_TYPE_INVALID);
if (0 == ret) {
- SLOG(LOG_DEBUG, TAG_TTSD, "[OUT] tts add text : result(%d) \n", ret);
+ SLOG(LOG_DEBUG, get_tag(), "[OUT] tts add text : result(%d) \n", ret);
} else {
- SLOG(LOG_ERROR, TAG_TTSD, "[OUT ERROR] tts add text : result(%d) \n", ret);
+ SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] tts add text : result(%d) \n", ret);
}
if (!dbus_connection_send(conn, reply, NULL)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[OUT ERROR] tts add text : Out Of Memory!\n");
+ SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] tts add text : Out Of Memory!\n");
}
dbus_connection_flush(conn);
dbus_message_unref(reply);
} else {
- SLOG(LOG_ERROR, TAG_TTSD, "[OUT ERROR] tts add text : fail to create reply message!!");
+ SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] tts add text : fail to create reply message!!");
}
- SLOG(LOG_DEBUG, TAG_TTSD, "<<<<<");
- SLOG(LOG_DEBUG, TAG_TTSD, " ");
+ SLOG(LOG_DEBUG, get_tag(), "<<<<<");
+ SLOG(LOG_DEBUG, get_tag(), " ");
return 0;
}
dbus_message_get_args(msg, &err, DBUS_TYPE_INT32, &uid, DBUS_TYPE_INVALID);
- SLOG(LOG_DEBUG, TAG_TTSD, ">>>>> TTS PLAY");
+ SLOG(LOG_DEBUG, get_tag(), ">>>>> TTS PLAY");
if (dbus_error_is_set(&err)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[IN ERROR] tts play : Get arguments error (%s)\n", err.message);
+ SLOG(LOG_ERROR, get_tag(), "[IN ERROR] tts play : Get arguments error (%s)\n", err.message);
dbus_error_free(&err);
ret = TTSD_ERROR_OPERATION_FAILED;
} else {
- SLOG(LOG_DEBUG, TAG_TTSD, "[IN] tts play : uid(%d) \n", uid );
+ SLOG(LOG_DEBUG, get_tag(), "[IN] tts play : uid(%d) \n", uid );
ret = ttsd_server_play(uid);
}
dbus_message_append_args(reply, DBUS_TYPE_INT32, &ret, DBUS_TYPE_INVALID);
if (0 == ret) {
- SLOG(LOG_DEBUG, TAG_TTSD, "[OUT] tts play : result(%d) \n", ret);
+ SLOG(LOG_DEBUG, get_tag(), "[OUT] tts play : result(%d) \n", ret);
} else {
- SLOG(LOG_ERROR, TAG_TTSD, "[OUT ERROR] tts play : result(%d) \n", ret);
+ SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] tts play : result(%d) \n", ret);
}
if (!dbus_connection_send(conn, reply, NULL)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[OUT ERROR] tts play : Out Of Memory!\n");
+ SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] tts play : Out Of Memory!\n");
}
dbus_connection_flush(conn);
dbus_message_unref(reply);
} else {
- SLOG(LOG_ERROR, TAG_TTSD, "[OUT ERROR] tts play : fail to create reply message!!");
+ SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] tts play : fail to create reply message!!");
}
- SLOG(LOG_DEBUG, TAG_TTSD, "<<<<<");
- SLOG(LOG_DEBUG, TAG_TTSD, " ");
+ SLOG(LOG_DEBUG, get_tag(), "<<<<<");
+ SLOG(LOG_DEBUG, get_tag(), " ");
return 0;
}
DBUS_TYPE_INT32, &uid,
DBUS_TYPE_INVALID);
- SLOG(LOG_DEBUG, TAG_TTSD, ">>>>> TTS STOP");
+ SLOG(LOG_DEBUG, get_tag(), ">>>>> TTS STOP");
if (dbus_error_is_set(&err)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[IN ERROR] tts stop : Get arguments error (%s)\n", err.message);
+ SLOG(LOG_ERROR, get_tag(), "[IN ERROR] tts stop : Get arguments error (%s)\n", err.message);
dbus_error_free(&err);
ret = TTSD_ERROR_OPERATION_FAILED;
} else {
- SLOG(LOG_DEBUG, TAG_TTSD, "[IN] tts stop : uid(%d)\n", uid);
+ SLOG(LOG_DEBUG, get_tag(), "[IN] tts stop : uid(%d)\n", uid);
ret = ttsd_server_stop(uid);
}
DBUS_TYPE_INVALID);
if (0 == ret) {
- SLOG(LOG_DEBUG, TAG_TTSD, "[OUT] tts stop : result(%d) \n", ret);
+ SLOG(LOG_DEBUG, get_tag(), "[OUT] tts stop : result(%d) \n", ret);
} else {
- SLOG(LOG_ERROR, TAG_TTSD, "[OUT ERROR] tts stop : result(%d) \n", ret);
+ SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] tts stop : result(%d) \n", ret);
}
if (!dbus_connection_send(conn, reply, NULL)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[OUT ERROR] tts stop : Out Of Memory!\n");
+ SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] tts stop : Out Of Memory!\n");
}
dbus_connection_flush(conn);
dbus_message_unref(reply);
} else {
- SLOG(LOG_ERROR, TAG_TTSD, "[OUT ERROR] tts stop : fail to create reply message!!");
+ SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] tts stop : fail to create reply message!!");
}
- SLOG(LOG_DEBUG, TAG_TTSD, "<<<<<");
- SLOG(LOG_DEBUG, TAG_TTSD, " ");
+ SLOG(LOG_DEBUG, get_tag(), "<<<<<");
+ SLOG(LOG_DEBUG, get_tag(), " ");
return 0;
}
DBUS_TYPE_INT32, &uid,
DBUS_TYPE_INVALID);
- SLOG(LOG_DEBUG, TAG_TTSD, ">>>>> TTS PAUSE");
+ SLOG(LOG_DEBUG, get_tag(), ">>>>> TTS PAUSE");
if (dbus_error_is_set(&err)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[IN ERROR] tts pause : Get arguments error (%s)\n", err.message);
+ SLOG(LOG_ERROR, get_tag(), "[IN ERROR] tts pause : Get arguments error (%s)\n", err.message);
dbus_error_free(&err);
ret = TTSD_ERROR_OPERATION_FAILED;
} else {
- SLOG(LOG_DEBUG, TAG_TTSD, "[IN] tts pause : uid(%d)\n", uid);
+ SLOG(LOG_DEBUG, get_tag(), "[IN] tts pause : uid(%d)\n", uid);
ret = ttsd_server_pause(uid, &uttid);
}
DBUS_TYPE_INVALID);
if (0 == ret) {
- SLOG(LOG_DEBUG, TAG_TTSD, "[OUT] tts pause : result(%d) \n", ret);
+ SLOG(LOG_DEBUG, get_tag(), "[OUT] tts pause : result(%d) \n", ret);
} else {
- SLOG(LOG_ERROR, TAG_TTSD, "[OUT ERROR] tts pause : result(%d) \n", ret);
+ SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] tts pause : result(%d) \n", ret);
}
if (!dbus_connection_send(conn, reply, NULL)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[OUT ERROR] tts pause : Out Of Memory!\n");
+ SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] tts pause : Out Of Memory!\n");
}
dbus_connection_flush(conn);
dbus_message_unref(reply);
} else {
- SLOG(LOG_ERROR, TAG_TTSD, "[OUT ERROR] tts pause : fail to create reply message!!");
+ SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] tts pause : fail to create reply message!!");
}
- SLOG(LOG_DEBUG, TAG_TTSD, "<<<<<");
- SLOG(LOG_DEBUG, TAG_TTSD, " ");
+ SLOG(LOG_DEBUG, get_tag(), "<<<<<");
+ SLOG(LOG_DEBUG, get_tag(), " ");
return 0;
}
DBUS_TYPE_INT32, &pid,
DBUS_TYPE_INVALID);
- SLOG(LOG_DEBUG, TAG_TTSD, ">>>>> SETTING INITIALIZE");
+ SLOG(LOG_DEBUG, get_tag(), ">>>>> SETTING INITIALIZE");
if (dbus_error_is_set(&err)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[IN ERROR] Receivce setting initialize : Get arguments error (%s)\n", err.message);
+ SLOG(LOG_ERROR, get_tag(), "[IN ERROR] Receivce setting initialize : Get arguments error (%s)\n", err.message);
dbus_error_free(&err);
ret = TTSD_ERROR_OPERATION_FAILED;
} else {
- SLOG(LOG_DEBUG, TAG_TTSD, "[IN] Receivce setting initialize : pid(%d) \n", pid);
+ SLOG(LOG_DEBUG, get_tag(), "[IN] Receivce setting initialize : pid(%d) \n", pid);
ret = ttsd_server_setting_initialize(pid);
}
dbus_message_append_args(reply, DBUS_TYPE_INT32, &ret, DBUS_TYPE_INVALID);
if (0 == ret) {
- SLOG(LOG_DEBUG, TAG_TTSD, "[OUT] setting initialize : result(%d) \n", ret);
+ SLOG(LOG_DEBUG, get_tag(), "[OUT] setting initialize : result(%d) \n", ret);
} else {
- SLOG(LOG_ERROR, TAG_TTSD, "[OUT ERROR] setting initialize : result(%d) \n", ret);
+ SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] setting initialize : result(%d) \n", ret);
}
if (!dbus_connection_send(conn, reply, NULL)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[OUT ERROR] setting initialize : Out Of Memory!\n");
+ SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] setting initialize : Out Of Memory!\n");
}
dbus_connection_flush(conn);
dbus_message_unref(reply);
} else {
- SLOG(LOG_ERROR, TAG_TTSD, "[OUT ERROR] setting initialize : fail to create reply message!!");
+ SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] setting initialize : fail to create reply message!!");
}
- SLOG(LOG_DEBUG, TAG_TTSD, "<<<<<");
- SLOG(LOG_DEBUG, TAG_TTSD, " ");
+ SLOG(LOG_DEBUG, get_tag(), "<<<<<");
+ SLOG(LOG_DEBUG, get_tag(), " ");
return 0;
}
dbus_message_get_args(msg, &err, DBUS_TYPE_INT32, &pid, DBUS_TYPE_INVALID);
- SLOG(LOG_DEBUG, TAG_TTSD, ">>>>> SETTING FINALIZE");
+ SLOG(LOG_DEBUG, get_tag(), ">>>>> SETTING FINALIZE");
if (dbus_error_is_set(&err)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[IN ERROR] setting finalize : Get arguments error (%s)\n", err.message);
+ SLOG(LOG_ERROR, get_tag(), "[IN ERROR] setting finalize : Get arguments error (%s)\n", err.message);
dbus_error_free(&err);
ret = TTSD_ERROR_OPERATION_FAILED;
} else {
- SLOG(LOG_DEBUG, TAG_TTSD, "[IN] setting finalize : pid(%d)\n", pid);
+ SLOG(LOG_DEBUG, get_tag(), "[IN] setting finalize : pid(%d)\n", pid);
ret = ttsd_server_setting_finalize(pid);
}
dbus_message_append_args(reply, DBUS_TYPE_INT32, &ret, DBUS_TYPE_INVALID);
if (0 == ret) {
- SLOG(LOG_DEBUG, TAG_TTSD, "[OUT] setting finalize : result(%d) \n", ret);
+ SLOG(LOG_DEBUG, get_tag(), "[OUT] setting finalize : result(%d) \n", ret);
} else {
- SLOG(LOG_ERROR, TAG_TTSD, "[OUT ERROR] setting finalize : result(%d) \n", ret);
+ SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] setting finalize : result(%d) \n", ret);
}
if (!dbus_connection_send(conn, reply, NULL)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[OUT ERROR] setting finalize : Out Of Memory!\n");
+ SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] setting finalize : Out Of Memory!\n");
}
dbus_connection_flush(conn);
dbus_message_unref(reply);
} else {
- SLOG(LOG_ERROR, TAG_TTSD, "[OUT ERROR] setting finalize : fail to create reply message!!");
+ SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] setting finalize : fail to create reply message!!");
}
- SLOG(LOG_DEBUG, TAG_TTSD, "<<<<<");
- SLOG(LOG_DEBUG, TAG_TTSD, " ");
+ SLOG(LOG_DEBUG, get_tag(), "<<<<<");
+ SLOG(LOG_DEBUG, get_tag(), " ");
return 0;
}
dbus_message_get_args(msg, &err, DBUS_TYPE_INT32, &pid, DBUS_TYPE_INVALID);
- SLOG(LOG_DEBUG, TAG_TTSD, ">>>>> SETTING GET ENGINE LIST");
+ SLOG(LOG_DEBUG, get_tag(), ">>>>> SETTING GET ENGINE LIST");
if (dbus_error_is_set(&err)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[IN ERROR] setting engine list : Get arguments error (%s)\n", err.message);
+ SLOG(LOG_ERROR, get_tag(), "[IN ERROR] setting engine list : Get arguments error (%s)\n", err.message);
dbus_error_free(&err);
ret = TTSD_ERROR_OPERATION_FAILED;
} else {
- SLOG(LOG_DEBUG, TAG_TTSD, "[IN] setting engine list : pid(%d) \n", pid);
+ SLOG(LOG_DEBUG, get_tag(), "[IN] setting engine list : pid(%d) \n", pid);
ret = ttsd_server_setting_get_engine_list(pid, &engine_list);
}
/* Append size */
int size = g_list_length(engine_list);
if (!dbus_message_iter_append_basic(&args, DBUS_TYPE_INT32, &(size))) {
- SLOG(LOG_ERROR, TAG_TTSD, "[OUT ERROR] setting engine list : fail to append engine size \n");
+ SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] setting engine list : fail to append engine size \n");
} else {
GList *iter = NULL;
engine = iter->data;
if (NULL != engine) {
- SLOG(LOG_DEBUG, TAG_TTSD, "engine id : %s, engine name : %s, ug_name, : %s",
+ SLOG(LOG_DEBUG, get_tag(), "engine id : %s, engine name : %s, ug_name, : %s",
engine->engine_id, engine->engine_name, engine->ug_name);
dbus_message_iter_append_basic(&args, DBUS_TYPE_STRING, &(engine->engine_id) );
iter = g_list_first(engine_list);
}
- SLOG(LOG_DEBUG, TAG_TTSD, "[OUT] setting engine list : result(%d) \n", ret);
+ SLOG(LOG_DEBUG, get_tag(), "[OUT] setting engine list : result(%d) \n", ret);
}
} else {
- SLOG(LOG_ERROR, TAG_TTSD, "[OUT ERROR] setting engine list : result(%d) \n", ret);
+ SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] setting engine list : result(%d) \n", ret);
}
if (!dbus_connection_send(conn, reply, NULL)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[OUT ERROR] setting engine list : Out Of Memory!\n");
+ SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] setting engine list : Out Of Memory!\n");
}
dbus_connection_flush(conn);
dbus_message_unref(reply);
} else {
- SLOG(LOG_ERROR, TAG_TTSD, "[OUT ERROR] setting engine list : fail to create reply message!!");
+ SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] setting engine list : fail to create reply message!!");
}
- SLOG(LOG_DEBUG, TAG_TTSD, "<<<<<");
- SLOG(LOG_DEBUG, TAG_TTSD, " ");
+ SLOG(LOG_DEBUG, get_tag(), "<<<<<");
+ SLOG(LOG_DEBUG, get_tag(), " ");
return 0;
}
DBUS_TYPE_INT32, &pid,
DBUS_TYPE_INVALID);
- SLOG(LOG_DEBUG, TAG_TTSD, ">>>>> SETTING GET ENGINE");
+ SLOG(LOG_DEBUG, get_tag(), ">>>>> SETTING GET ENGINE");
if (dbus_error_is_set(&err)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[IN ERROR] setting get engine : Get arguments error (%s)\n", err.message);
+ SLOG(LOG_ERROR, get_tag(), "[IN ERROR] setting get engine : Get arguments error (%s)\n", err.message);
dbus_error_free(&err);
ret = TTSD_ERROR_OPERATION_FAILED;
} else {
- SLOG(LOG_DEBUG, TAG_TTSD, "[IN] setting get engine : pid(%d)\n", pid);
+ SLOG(LOG_DEBUG, get_tag(), "[IN] setting get engine : pid(%d)\n", pid);
ret = ttsd_server_setting_get_current_engine(pid, &engine_id);
}
if (NULL != reply) {
if (0 == ret) {
dbus_message_append_args( reply, DBUS_TYPE_INT32, &ret, DBUS_TYPE_STRING, &engine_id, DBUS_TYPE_INVALID);
- SLOG(LOG_DEBUG, TAG_TTSD, "[OUT] setting get engine : result(%d), engine id(%s)\n", ret, engine_id);
+ SLOG(LOG_DEBUG, get_tag(), "[OUT] setting get engine : result(%d), engine id(%s)\n", ret, engine_id);
} else {
dbus_message_append_args( reply, DBUS_TYPE_INT32, &ret, DBUS_TYPE_INVALID);
- SLOG(LOG_ERROR, TAG_TTSD, "[OUT ERROR] setting get engine : result(%d)", ret);
+ SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] setting get engine : result(%d)", ret);
}
if (!dbus_connection_send(conn, reply, NULL)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[OUT ERROR] setting get engine : Out Of Memory!\n");
+ SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] setting get engine : Out Of Memory!\n");
}
dbus_connection_flush(conn);
dbus_message_unref(reply);
} else {
- SLOG(LOG_ERROR, TAG_TTSD, "[OUT ERROR] setting get engine : fail to create reply message!!");
+ SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] setting get engine : fail to create reply message!!");
}
if (NULL != engine_id)
free(engine_id);
- SLOG(LOG_DEBUG, TAG_TTSD, "<<<<<");
- SLOG(LOG_DEBUG, TAG_TTSD, " ");
+ SLOG(LOG_DEBUG, get_tag(), "<<<<<");
+ SLOG(LOG_DEBUG, get_tag(), " ");
return 0;
}
DBUS_TYPE_STRING, &engine_id,
DBUS_TYPE_INVALID);
- SLOG(LOG_DEBUG, TAG_TTSD, ">>>>> SETTING SET ENGINE");
+ SLOG(LOG_DEBUG, get_tag(), ">>>>> SETTING SET ENGINE");
if (dbus_error_is_set(&err)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[IN ERROR] setting set engine : Get arguments error (%s)\n", err.message);
+ SLOG(LOG_ERROR, get_tag(), "[IN ERROR] setting set engine : Get arguments error (%s)\n", err.message);
dbus_error_free(&err);
ret = TTSD_ERROR_OPERATION_FAILED;
} else {
- SLOG(LOG_DEBUG, TAG_TTSD, "[IN] setting set engine : pid(%d), engine id(%s)\n", pid, engine_id);
+ SLOG(LOG_DEBUG, get_tag(), "[IN] setting set engine : pid(%d), engine id(%s)\n", pid, engine_id);
ret = ttsd_server_setting_set_current_engine(pid, engine_id);
}
dbus_message_append_args(reply, DBUS_TYPE_INT32, &ret, DBUS_TYPE_INVALID);
if (0 == ret) {
- SLOG(LOG_DEBUG, TAG_TTSD, "[OUT] setting set engine : result(%d) \n", ret);
+ SLOG(LOG_DEBUG, get_tag(), "[OUT] setting set engine : result(%d) \n", ret);
} else {
- SLOG(LOG_ERROR, TAG_TTSD, "[OUT ERROR] setting set engine : result(%d) \n", ret);
+ SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] setting set engine : result(%d) \n", ret);
}
if (!dbus_connection_send(conn, reply, NULL)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[OUT ERROR] setting set engine : Out Of Memory!\n");
+ SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] setting set engine : Out Of Memory!\n");
}
dbus_connection_flush(conn);
dbus_message_unref(reply);
} else {
- SLOG(LOG_ERROR, TAG_TTSD, "[OUT ERROR] setting set engine : fail to create reply message!!");
+ SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] setting set engine : fail to create reply message!!");
}
- SLOG(LOG_DEBUG, TAG_TTSD, "<<<<<");
- SLOG(LOG_DEBUG, TAG_TTSD, " ");
+ SLOG(LOG_DEBUG, get_tag(), "<<<<<");
+ SLOG(LOG_DEBUG, get_tag(), " ");
return 0;
}
DBUS_TYPE_INT32, &pid,
DBUS_TYPE_INVALID);
- SLOG(LOG_DEBUG, TAG_TTSD, ">>>>> SETTING GET VOICE LIST");
+ SLOG(LOG_DEBUG, get_tag(), ">>>>> SETTING GET VOICE LIST");
if (dbus_error_is_set(&err)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[IN ERROR] setting voice list : Get arguments error (%s)\n", err.message);
+ SLOG(LOG_ERROR, get_tag(), "[IN ERROR] setting voice list : Get arguments error (%s)\n", err.message);
dbus_error_free(&err);
ret = TTSD_ERROR_OPERATION_FAILED;
} else {
- SLOG(LOG_DEBUG, TAG_TTSD, "[IN] setting voice list : pid(%d)\n", pid);
+ SLOG(LOG_DEBUG, get_tag(), "[IN] setting voice list : pid(%d)\n", pid);
ret = ttsd_server_setting_get_voice_list(pid, &engine_id, &voice_list);
}
/* Append voice size */
int size = g_list_length(voice_list);
if (!dbus_message_iter_append_basic(&args, DBUS_TYPE_INT32, &(size))) {
- SLOG(LOG_ERROR, TAG_TTSD, "[OUT ERROR] setting voice list : Fail to append type \n");
+ SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] setting voice list : Fail to append type \n");
ret = TTSD_ERROR_OPERATION_FAILED;
} else {
iter = g_list_first(voice_list);
}
}
- SLOG(LOG_DEBUG, TAG_TTSD, "[OUT] setting voice list : result(%d) \n", ret);
+ SLOG(LOG_DEBUG, get_tag(), "[OUT] setting voice list : result(%d) \n", ret);
} else {
- SLOG(LOG_ERROR, TAG_TTSD, "[OUT ERROR] setting voice list : Fail to append engine_id \n");
+ SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] setting voice list : Fail to append engine_id \n");
}
if (NULL != engine_id)
free(engine_id);
} else {
- SLOG(LOG_ERROR, TAG_TTSD, "[OUT ERROR] setting voice list : result(%d) \n", ret);
+ SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] setting voice list : result(%d) \n", ret);
}
if (!dbus_connection_send(conn, reply, NULL)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[OUT ERROR] setting voice list : Out Of Memory!\n");
+ SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] setting voice list : Out Of Memory!\n");
}
dbus_connection_flush(conn);
dbus_message_unref(reply);
} else {
- SLOG(LOG_ERROR, TAG_TTSD, "[OUT ERROR] setting voice list : fail to create reply message!!");
+ SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] setting voice list : fail to create reply message!!");
}
- SLOG(LOG_DEBUG, TAG_TTSD, "<<<<<");
- SLOG(LOG_DEBUG, TAG_TTSD, " ");
+ SLOG(LOG_DEBUG, get_tag(), "<<<<<");
+ SLOG(LOG_DEBUG, get_tag(), " ");
return 0;
}
DBUS_TYPE_INT32, &pid,
DBUS_TYPE_INVALID);
- SLOG(LOG_DEBUG, TAG_TTSD, ">>>>> SETTING GET DEFAULT VOICE");
+ SLOG(LOG_DEBUG, get_tag(), ">>>>> SETTING GET DEFAULT VOICE");
if (dbus_error_is_set(&err)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[IN ERROR] setting get default voice : Get arguments error (%s)\n", err.message);
+ SLOG(LOG_ERROR, get_tag(), "[IN ERROR] setting get default voice : Get arguments error (%s)\n", err.message);
dbus_error_free(&err);
ret = TTSD_ERROR_OPERATION_FAILED;
} else {
- SLOG(LOG_DEBUG, TAG_TTSD, "[IN] setting get default voice : pid(%d)\n", pid);
+ SLOG(LOG_DEBUG, get_tag(), "[IN] setting get default voice : pid(%d)\n", pid);
ret = ttsd_server_setting_get_default_voice(pid, &lang, &type);
}
DBUS_TYPE_STRING, &lang,
DBUS_TYPE_INT32, &type,
DBUS_TYPE_INVALID);
- SLOG(LOG_DEBUG, TAG_TTSD, "[OUT] setting get default voice : result(%d), language(%s), type(%d) \n", ret, lang, type);
+ SLOG(LOG_DEBUG, get_tag(), "[OUT] setting get default voice : result(%d), language(%s), type(%d) \n", ret, lang, type);
} else {
dbus_message_append_args(reply, DBUS_TYPE_INT32, &ret, DBUS_TYPE_INVALID);
- SLOG(LOG_ERROR, TAG_TTSD, "[OUT ERROR] setting get default voice : result(%d) \n", ret);
+ SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] setting get default voice : result(%d) \n", ret);
}
if (!dbus_connection_send(conn, reply, NULL)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[OUT ERROR] setting get default voice : Out Of Memory!\n");
+ SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] setting get default voice : Out Of Memory!\n");
}
dbus_connection_flush(conn);
dbus_message_unref(reply);
} else {
- SLOG(LOG_ERROR, TAG_TTSD, "[OUT ERROR] setting get default voice : fail to create reply message!!");
+ SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] setting get default voice : fail to create reply message!!");
}
- SLOG(LOG_DEBUG, TAG_TTSD, "<<<<<");
- SLOG(LOG_DEBUG, TAG_TTSD, " ");
+ SLOG(LOG_DEBUG, get_tag(), "<<<<<");
+ SLOG(LOG_DEBUG, get_tag(), " ");
return 0;
}
DBUS_TYPE_INT32, &voicetype,
DBUS_TYPE_INVALID);
- SLOG(LOG_DEBUG, TAG_TTSD, ">>>>> SET DEFAULT VOICE");
+ SLOG(LOG_DEBUG, get_tag(), ">>>>> SET DEFAULT VOICE");
if (dbus_error_is_set(&err)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[IN ERROR] setting set default voice : Get arguments error (%s)\n", err.message);
+ SLOG(LOG_ERROR, get_tag(), "[IN ERROR] setting set default voice : Get arguments error (%s)\n", err.message);
dbus_error_free(&err);
ret = TTSD_ERROR_OPERATION_FAILED;
} else {
- SLOG(LOG_DEBUG, TAG_TTSD, "[IN] setting set default voice : pid(%d), lang(%s), type(%d)\n"
+ SLOG(LOG_DEBUG, get_tag(), "[IN] setting set default voice : pid(%d), lang(%s), type(%d)\n"
, pid, language, voicetype);
ret = ttsd_server_setting_set_default_voice(pid, language, voicetype);
}
dbus_message_append_args(reply, DBUS_TYPE_INT32, &ret, DBUS_TYPE_INVALID);
if (0 == ret) {
- SLOG(LOG_DEBUG, TAG_TTSD, "[OUT] setting set default voice : result(%d) \n", ret);
+ SLOG(LOG_DEBUG, get_tag(), "[OUT] setting set default voice : result(%d) \n", ret);
} else {
- SLOG(LOG_ERROR, TAG_TTSD, "[OUT ERROR] setting set default voice : result(%d) \n", ret);
+ SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] setting set default voice : result(%d) \n", ret);
}
if (!dbus_connection_send(conn, reply, NULL)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[OUT ERROR] setting set default voice : Out Of Memory!\n");
+ SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] setting set default voice : Out Of Memory!\n");
}
dbus_connection_flush(conn);
dbus_message_unref(reply);
} else {
- SLOG(LOG_ERROR, TAG_TTSD, "[OUT ERROR] setting set default voice : fail to create reply message!!");
+ SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] setting set default voice : fail to create reply message!!");
}
- SLOG(LOG_DEBUG, TAG_TTSD, "<<<<<");
- SLOG(LOG_DEBUG, TAG_TTSD, " ");
+ SLOG(LOG_DEBUG, get_tag(), "<<<<<");
+ SLOG(LOG_DEBUG, get_tag(), " ");
return 0;
}
DBUS_TYPE_INT32, &pid,
DBUS_TYPE_INVALID);
- SLOG(LOG_DEBUG, TAG_TTSD, ">>>>> SETTING GET SPEED");
+ SLOG(LOG_DEBUG, get_tag(), ">>>>> SETTING GET SPEED");
if (dbus_error_is_set(&err)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[IN ERROR] setting get speed : Get arguments error (%s)\n", err.message);
+ SLOG(LOG_ERROR, get_tag(), "[IN ERROR] setting get speed : Get arguments error (%s)\n", err.message);
dbus_error_free(&err);
ret = TTSD_ERROR_OPERATION_FAILED;
} else {
- SLOG(LOG_DEBUG, TAG_TTSD, "[IN] setting get default speed : pid(%d)\n", pid);
+ SLOG(LOG_DEBUG, get_tag(), "[IN] setting get default speed : pid(%d)\n", pid);
ret = ttsd_server_setting_get_default_speed(pid, &speed);
}
if (NULL != reply) {
if (0 == ret) {
dbus_message_append_args( reply, DBUS_TYPE_INT32, &ret, DBUS_TYPE_INT32, &speed, DBUS_TYPE_INVALID);
- SLOG(LOG_DEBUG, TAG_TTSD, "[OUT] setting get default speed : result(%d), speed(%d) \n", ret, speed);
+ SLOG(LOG_DEBUG, get_tag(), "[OUT] setting get default speed : result(%d), speed(%d) \n", ret, speed);
} else {
dbus_message_append_args( reply, DBUS_TYPE_INT32, &ret, DBUS_TYPE_INVALID);
- SLOG(LOG_ERROR, TAG_TTSD, "[OUT ERROR] setting get default speed : result(%d) \n", ret);
+ SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] setting get default speed : result(%d) \n", ret);
}
if (!dbus_connection_send(conn, reply, NULL)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[OUT ERROR] setting get default speed : Out Of Memory!\n");
+ SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] setting get default speed : Out Of Memory!\n");
}
dbus_connection_flush(conn);
dbus_message_unref(reply);
} else {
- SLOG(LOG_ERROR, TAG_TTSD, "[OUT ERROR] setting get default speed : fail to create reply message!!");
+ SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] setting get default speed : fail to create reply message!!");
}
- SLOG(LOG_DEBUG, TAG_TTSD, "<<<<<");
- SLOG(LOG_DEBUG, TAG_TTSD, " ");
+ SLOG(LOG_DEBUG, get_tag(), "<<<<<");
+ SLOG(LOG_DEBUG, get_tag(), " ");
return 0;
}
DBUS_TYPE_INT32, &speed,
DBUS_TYPE_INVALID);
- SLOG(LOG_DEBUG, TAG_TTSD, ">>>>> SETTING GET SPEED");
+ SLOG(LOG_DEBUG, get_tag(), ">>>>> SETTING GET SPEED");
if (dbus_error_is_set(&err)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[IN ERROR] setting set default speed : Get arguments error (%s)\n", err.message);
+ SLOG(LOG_ERROR, get_tag(), "[IN ERROR] setting set default speed : Get arguments error (%s)\n", err.message);
dbus_error_free(&err);
ret = TTSD_ERROR_OPERATION_FAILED;
} else {
- SLOG(LOG_DEBUG, TAG_TTSD, "[IN] setting set default speed : pid(%d), speed(%d)\n", pid, speed);
+ SLOG(LOG_DEBUG, get_tag(), "[IN] setting set default speed : pid(%d), speed(%d)\n", pid, speed);
ret = ttsd_server_setting_set_default_speed(pid, speed);
}
dbus_message_append_args(reply, DBUS_TYPE_INT32, &ret, DBUS_TYPE_INVALID);
if (0 == ret) {
- SLOG(LOG_DEBUG, TAG_TTSD, "[OUT] setting set default speed : result(%d)", ret);
+ SLOG(LOG_DEBUG, get_tag(), "[OUT] setting set default speed : result(%d)", ret);
} else {
- SLOG(LOG_ERROR, TAG_TTSD, "[OUT ERROR] setting set default speed : result(%d)", ret);
+ SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] setting set default speed : result(%d)", ret);
}
if (!dbus_connection_send(conn, reply, NULL)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[OUT ERROR] setting set default speed : Out Of Memory!\n");
+ SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] setting set default speed : Out Of Memory!\n");
}
dbus_connection_flush(conn);
dbus_message_unref(reply);
} else {
- SLOG(LOG_ERROR, TAG_TTSD, "[OUT ERROR] setting set default speed : fail to create reply message!!");
+ SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] setting set default speed : fail to create reply message!!");
}
- SLOG(LOG_DEBUG, TAG_TTSD, "<<<<<");
- SLOG(LOG_DEBUG, TAG_TTSD, " ");
+ SLOG(LOG_DEBUG, get_tag(), "<<<<<");
+ SLOG(LOG_DEBUG, get_tag(), " ");
return 0;
}
DBUS_TYPE_INT32, &pid,
DBUS_TYPE_INVALID);
- SLOG(LOG_DEBUG, TAG_TTSD, ">>>>> SETTING GET ENGINE SETTING");
+ SLOG(LOG_DEBUG, get_tag(), ">>>>> SETTING GET ENGINE SETTING");
if (dbus_error_is_set(&err)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[IN ERROR] setting get engine option : Get arguments error (%s)\n", err.message);
+ SLOG(LOG_ERROR, get_tag(), "[IN ERROR] setting get engine option : Get arguments error (%s)\n", err.message);
dbus_error_free(&err);
ret = TTSD_ERROR_OPERATION_FAILED;
} else {
- SLOG(LOG_DEBUG, TAG_TTSD, "[IN] setting get engine option : pid(%d)", pid);
+ SLOG(LOG_DEBUG, get_tag(), "[IN] setting get engine option : pid(%d)", pid);
ret = ttsd_server_setting_get_engine_setting(pid, &engine_id, &engine_setting_list);
}
/* Append voice size */
int size = g_list_length(engine_setting_list);
if (!dbus_message_iter_append_basic(&args, DBUS_TYPE_INT32, &(size))) {
- SLOG(LOG_ERROR, TAG_TTSD, "[OUT ERROR] setting voice list : Fail to append type \n");
+ SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] setting voice list : Fail to append type \n");
ret = TTSD_ERROR_OPERATION_FAILED;
} else {
iter = g_list_first(engine_setting_list);
}
}
- SLOG(LOG_DEBUG, TAG_TTSD, "[OUT] setting engine setting list : result(%d) \n", ret);
+ SLOG(LOG_DEBUG, get_tag(), "[OUT] setting engine setting list : result(%d) \n", ret);
} else {
- SLOG(LOG_ERROR, TAG_TTSD, "[OUT ERROR] setting voice list : Fail to append engine_id \n");
+ SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] setting voice list : Fail to append engine_id \n");
}
if (NULL != engine_id)
free(engine_id);
} else {
- SLOG(LOG_ERROR, TAG_TTSD, "[OUT ERROR] setting get engine option : result(%d) \n", ret);
+ SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] setting get engine option : result(%d) \n", ret);
}
if (!dbus_connection_send(conn, reply, NULL)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[OUT ERROR] setting get engine option : Out Of Memory!\n");
+ SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] setting get engine option : Out Of Memory!\n");
}
dbus_connection_flush(conn);
dbus_message_unref(reply);
} else {
- SLOG(LOG_ERROR, TAG_TTSD, "[OUT ERROR] setting get engine option : fail to create reply message!!");
+ SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] setting get engine option : fail to create reply message!!");
}
- SLOG(LOG_DEBUG, TAG_TTSD, "<<<<<");
- SLOG(LOG_DEBUG, TAG_TTSD, " ");
+ SLOG(LOG_DEBUG, get_tag(), "<<<<<");
+ SLOG(LOG_DEBUG, get_tag(), " ");
return 0;
}
DBUS_TYPE_STRING, &value,
DBUS_TYPE_INVALID);
- SLOG(LOG_DEBUG, TAG_TTSD, ">>>>> SETTING SET ENGINE SETTING");
+ SLOG(LOG_DEBUG, get_tag(), ">>>>> SETTING SET ENGINE SETTING");
if (dbus_error_is_set(&err)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[IN ERROR] setting set engine option : Get arguments error (%s)\n", err.message);
+ SLOG(LOG_ERROR, get_tag(), "[IN ERROR] setting set engine option : Get arguments error (%s)\n", err.message);
dbus_error_free(&err);
ret = TTSD_ERROR_OPERATION_FAILED;
} else {
- SLOG(LOG_DEBUG, TAG_TTSD, "[IN] setting set engine option : pid(%d), key(%s), value(%s)\n", pid, key, value);
+ SLOG(LOG_DEBUG, get_tag(), "[IN] setting set engine option : pid(%d), key(%s), value(%s)\n", pid, key, value);
ret = ttsd_server_setting_set_engine_setting(pid, key, value);
}
dbus_message_append_args( reply, DBUS_TYPE_INT32, &ret, DBUS_TYPE_INVALID);
if (0 == ret) {
- SLOG(LOG_DEBUG, TAG_TTSD, "[OUT] setting set engine option : result(%d)", ret);
+ SLOG(LOG_DEBUG, get_tag(), "[OUT] setting set engine option : result(%d)", ret);
} else {
- SLOG(LOG_ERROR, TAG_TTSD, "[OUT ERROR] setting set engine option : result(%d)", ret);
+ SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] setting set engine option : result(%d)", ret);
}
if (!dbus_connection_send(conn, reply, NULL)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[OUT ERROR] setting set engine option : Out Of Memory!\n");
+ SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] setting set engine option : Out Of Memory!\n");
}
dbus_connection_flush(conn);
dbus_message_unref(reply);
} else {
- SLOG(LOG_ERROR, TAG_TTSD, "[OUT ERROR] setting set engine option : fail to create reply message!!");
+ SLOG(LOG_ERROR, get_tag(), "[OUT ERROR] setting set engine option : fail to create reply message!!");
}
- SLOG(LOG_DEBUG, TAG_TTSD, "<<<<<");
- SLOG(LOG_DEBUG, TAG_TTSD, " ");
+ SLOG(LOG_DEBUG, get_tag(), "<<<<<");
+ SLOG(LOG_DEBUG, get_tag(), " ");
return 0;
}
{
/* initialize static data */
if (result_cb == NULL) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Engine Agent ERROR] invalid parameter \n");
+ SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] invalid parameter");
return TTSD_ERROR_INVALID_PARAMETER;
}
g_agent_init = true;
if (0 != ttsd_config_get_default_voice(&(g_cur_engine.default_lang), &(g_cur_engine.default_vctype))) {
- SLOG(LOG_WARN, TAG_TTSD, "[Server WARNING] There is No default voice in config\n");
+ SLOG(LOG_WARN, get_tag(), "[Server WARNING] There is No default voice in config");
/* Set default voice */
g_cur_engine.default_lang = strdup("en_US");
g_cur_engine.default_vctype = TTSP_VOICE_TYPE_FEMALE;
}
if (0 != ttsd_config_get_default_speed(&(g_cur_engine.default_speed))) {
- SLOG(LOG_WARN, TAG_TTSD, "[Server WARNING] There is No default speed in config\n");
+ SLOG(LOG_WARN, get_tag(), "[Server WARNING] There is No default speed in config");
ttsd_config_set_default_speed((int)TTSP_SPEED_NORMAL);
g_cur_engine.default_speed = TTSP_SPEED_NORMAL;
}
- SLOG(LOG_DEBUG, TAG_TTSD, "[Engine Agent SUCCESS] Initialize Engine Agent ");
+ SLOG(LOG_DEBUG, get_tag(), "[Engine Agent SUCCESS] Initialize Engine Agent");
return 0;
}
int ttsd_engine_agent_release()
{
if (false == g_agent_init) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Engine Agent ERROR] Not Initialized \n" );
+ SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] Not Initialized");
return TTSD_ERROR_OPERATION_FAILED;
}
g_free(g_cur_engine.default_lang);
- SLOG(LOG_DEBUG, TAG_TTSD, "[Engine Agent SUCCESS] Release Engine Agent\n");
+ SLOG(LOG_DEBUG, get_tag(), "[Engine Agent SUCCESS] Release Engine Agent");
return 0;
}
int ttsd_engine_agent_initialize_current_engine()
{
if (false == g_agent_init) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Engine Agent ERROR] Not Initialized \n" );
+ SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] Not Initialized" );
return TTSD_ERROR_OPERATION_FAILED;
}
/* update engine list */
if (0 != __internal_update_engine_list()) {
- SLOG(LOG_WARN, TAG_TTSD, "[Engine Agent WARNING] No engine error \n");
+ SLOG(LOG_WARN, get_tag(), "[Engine Agent WARNING] No engine error");
return TTSD_ERROR_OPERATION_FAILED;
}
iter = g_list_next(iter);
}
} else {
- SLOG(LOG_WARN, TAG_TTSD, "[Engine Agent WARNING] Fail to set a engine of engine list\n");
+ SLOG(LOG_WARN, get_tag(), "[Engine Agent WARNING] Fail to set a engine of engine list\n");
return TTSD_ERROR_OPERATION_FAILED;
}
if (NULL != data->engine_uuid) {
cur_engine_uuid = strdup(data->engine_uuid);
} else {
- SLOG(LOG_ERROR, TAG_TTSD, "[Engine Agent ERROR] Data of current engine is corrupt\n");
+ SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] Data of current engine is corrupt\n");
return TTSD_ERROR_OPERATION_FAILED;
}
/* check whether cur engine uuid is valid or not. */
if (0 != __internal_check_engine_id(cur_engine_uuid)) {
- SLOG(LOG_WARN, TAG_TTSD, "[Engine Agent WARNING] It is not valid engine id from config \n");
+ SLOG(LOG_WARN, get_tag(), "[Engine Agent WARNING] It is not valid engine id from config");
GList *iter = NULL;
if (g_list_length(g_engine_list) > 0)
iter = g_list_first(g_engine_list);
else {
- SLOG(LOG_WARN, TAG_TTSD, "[Engine Agent ERROR] NO TTS Engine !! \n");
+ SLOG(LOG_WARN, get_tag(), "[Engine Agent ERROR] NO TTS Engine !!");
return TTSD_ERROR_OPERATION_FAILED;
}
}
if (NULL != cur_engine_uuid)
- SLOG(LOG_DEBUG, TAG_TTSD, "[Engine Agent] Current Engine Id : %s \n", cur_engine_uuid);
+ SLOG(LOG_DEBUG, get_tag(), "[Engine Agent] Current Engine Id : %s", cur_engine_uuid);
else
return TTSD_ERROR_OPERATION_FAILED;
/* set current engine */
if (0 != __internal_set_current_engine(cur_engine_uuid)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Engine Agent ERROR] fail to set current engine ");
+ SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] fail to set current engine ");
return TTSD_ERROR_OPERATION_FAILED;
}
if (false == is_get_engineid_from_config) {
if (0 != ttsd_config_set_default_engine(cur_engine_uuid))
- SLOG(LOG_ERROR, TAG_TTSD, "[Engine Agent ERROR] fail to set id to config \n");
+ SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] fail to set id to config");
}
if (NULL != cur_engine_uuid)
g_free(cur_engine_uuid);
- SLOG(LOG_DEBUG, TAG_TTSD, "[Engine Agent SUCCESS] Set current engine");
+ SLOG(LOG_DEBUG, get_tag(), "[Engine Agent SUCCESS] Set current engine");
return 0;
}
handle = dlopen (filepath, RTLD_LAZY );
if (!handle) {
- SLOG(LOG_WARN, TAG_TTSD, "[Engine Agent] Invalid engine : %s", filepath);
+ SLOG(LOG_WARN, get_tag(), "[Engine Agent] Invalid engine : %s", filepath);
return TTSD_ERROR_OPERATION_FAILED;
}
/* link engine to daemon */
dlsym(handle, "ttsp_load_engine");
if ((error = dlerror()) != NULL) {
- SLOG(LOG_WARN, TAG_TTSD, "[Engine Agent] Invalid engine. Fail to open ttsp_load_engine : %s", filepath);
+ SLOG(LOG_WARN, get_tag(), "[Engine Agent] Invalid engine. Fail to open ttsp_load_engine : %s", filepath);
dlclose(handle);
return TTSD_ERROR_OPERATION_FAILED;
}
dlsym(handle, "ttsp_unload_engine");
if ((error = dlerror()) != NULL) {
- SLOG(LOG_WARN, TAG_TTSD, "[Engine Agent] Invalid engine. Fail to open ttsp_unload_engine : %s", filepath);
+ SLOG(LOG_WARN, get_tag(), "[Engine Agent] Invalid engine. Fail to open ttsp_unload_engine : %s", filepath);
dlclose(handle);
return TTSD_ERROR_OPERATION_FAILED;
}
get_engine_info = (int (*)(ttsp_engine_info_cb, void*))dlsym(handle, "ttsp_get_engine_info");
if (NULL != (error = dlerror()) || NULL == get_engine_info) {
- SLOG(LOG_WARN, TAG_TTSD, "[Engine Agent] ttsp_get_engine_info() link error");
+ SLOG(LOG_WARN, get_tag(), "[Engine Agent] ttsp_get_engine_info() link error");
dlclose(handle);
return TTSD_ERROR_OPERATION_FAILED;
}
/* get engine info */
if (0 != get_engine_info(&__engine_info_cb, (void*)temp)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Engine Agent ERROR] fail to get engine info");
+ SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] fail to get engine info");
dlclose(handle);
g_free(temp);
return TTSD_ERROR_OPERATION_FAILED;
/* close engine */
dlclose(handle);
+ if (TTSD_MODE_NOTIFICATION == ttsd_get_mode() || TTSD_MODE_SCREEN_READER == ttsd_get_mode()) {
+ if (true == temp->use_network) {
+ free(temp);
+ SLOG(LOG_ERROR, get_tag(), "[Engine Agent WARNING] %s is invalid because of network based engine.", temp->engine_name);
+ return TTSD_ERROR_OPERATION_FAILED;
+ }
+ }
+
temp->engine_path = g_strdup(filepath);
- SLOG(LOG_DEBUG, TAG_TTSD, "----- Valid engine");
- SLOG(LOG_DEBUG, TAG_TTSD, "Engine uuid : %s", temp->engine_uuid);
- SLOG(LOG_DEBUG, TAG_TTSD, "Engine name : %s", temp->engine_name);
- SLOG(LOG_DEBUG, TAG_TTSD, "Setting ug path : %s", temp->setting_ug_path);
- SLOG(LOG_DEBUG, TAG_TTSD, "Engine path : %s", temp->engine_path);
- SLOG(LOG_DEBUG, TAG_TTSD, "Use network : %s", temp->use_network ? "true":"false");
- SLOG(LOG_DEBUG, TAG_TTSD, "-----");
- SLOG(LOG_DEBUG, TAG_TTSD, " ");
+ SLOG(LOG_DEBUG, get_tag(), "----- Valid engine");
+ SLOG(LOG_DEBUG, get_tag(), "Engine uuid : %s", temp->engine_uuid);
+ SLOG(LOG_DEBUG, get_tag(), "Engine name : %s", temp->engine_name);
+ SLOG(LOG_DEBUG, get_tag(), "Setting ug path : %s", temp->setting_ug_path);
+ SLOG(LOG_DEBUG, get_tag(), "Engine path : %s", temp->engine_path);
+ SLOG(LOG_DEBUG, get_tag(), "Use network : %s", temp->use_network ? "true":"false");
+ SLOG(LOG_DEBUG, get_tag(), "-----");
+ SLOG(LOG_DEBUG, get_tag(), " ");
*info = temp;
strncat(filepath, "/", strlen("/") );
strncat(filepath, dirp->d_name, strlen(dirp->d_name) );
} else {
- SLOG(LOG_ERROR, TAG_TTSD, "[Engine Agent ERROR] Not enough memory!! \n" );
+ SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] Not enough memory!!" );
continue;
}
strcat(filepath, "/");
strcat(filepath, dirp->d_name);
} else {
- SLOG(LOG_ERROR, TAG_TTSD, "[Engine Agent ERROR] Not enough memory!! \n" );
+ SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] Not enough memory!!" );
continue;
}
}
if (g_list_length(g_engine_list) <= 0) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Engine Agent ERROR] No Engine\n");
+ SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] No Engine\n");
return TTSD_ERROR_OPERATION_FAILED;
}
/* If current engine does not exist, return error */
if (false == flag) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Engine Agent ERROR] __internal_set_current_engine : Cannot find engine id \n");
+ SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] __internal_set_current_engine : Cannot find engine id");
return TTSD_ERROR_OPERATION_FAILED;
} else {
if (g_cur_engine.engine_uuid != NULL) {
/*compare current engine uuid */
if (0 == strncmp(g_cur_engine.engine_uuid, data->engine_uuid, strlen(engine_uuid))) {
- SLOG(LOG_DEBUG, TAG_TTSD, "[Engine Agent] tts engine has already been set \n");
+ SLOG(LOG_DEBUG, get_tag(), "[Engine Agent] tts engine has already been set");
return 0;
}
}
if (g_cur_engine.engine_path != NULL) g_free(g_cur_engine.engine_path);
if (NULL == data->engine_uuid || NULL == data->engine_name || NULL == data->engine_path) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Engine Agent ERROR] __internal_set_current_engine : Engine data is NULL");
+ SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] __internal_set_current_engine : Engine data is NULL");
return TTSD_ERROR_OPERATION_FAILED;
}
g_cur_engine.is_set = true;
g_cur_engine.need_network = data->use_network;
- SLOG(LOG_DEBUG, TAG_TTSD, "-----");
- SLOG(LOG_DEBUG, TAG_TTSD, "Current engine uuid : %s \n", g_cur_engine.engine_uuid);
- SLOG(LOG_DEBUG, TAG_TTSD, "Current engine name : %s \n", g_cur_engine.engine_name);
- SLOG(LOG_DEBUG, TAG_TTSD, "Current engine path : %s \n", g_cur_engine.engine_path);
- SLOG(LOG_DEBUG, TAG_TTSD, "-----");
+ SLOG(LOG_DEBUG, get_tag(), "-----");
+ SLOG(LOG_DEBUG, get_tag(), "Current engine uuid : %s", g_cur_engine.engine_uuid);
+ SLOG(LOG_DEBUG, get_tag(), "Current engine name : %s", g_cur_engine.engine_name);
+ SLOG(LOG_DEBUG, get_tag(), "Current engine path : %s", g_cur_engine.engine_path);
+ SLOG(LOG_DEBUG, get_tag(), "-----");
return 0;
}
int ttsd_engine_agent_load_current_engine()
{
if (false == g_agent_init) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Engine Agent ERROR] Not Initialized \n" );
+ SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] Not Initialized" );
return TTSD_ERROR_OPERATION_FAILED;
}
if (false == g_cur_engine.is_set) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Engine Agent ERROR] ttsd_engine_agent_load_current_engine : No Current Engine \n");
+ SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] ttsd_engine_agent_load_current_engine : No Current Engine ");
return TTSD_ERROR_OPERATION_FAILED;
}
/* check whether current engine is loaded or not */
if (true == g_cur_engine.is_loaded ) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Engine Agent] ttsd_engine_agent_load_current_engine : Engine has already been loaded \n" );
+ SLOG(LOG_ERROR, get_tag(), "[Engine Agent] ttsd_engine_agent_load_current_engine : Engine has already been loaded " );
return 0;
}
- SLOG(LOG_DEBUG, TAG_TTSD, "[Engine Agent] current engine path : %s\n", g_cur_engine.engine_path);
+ SLOG(LOG_DEBUG, get_tag(), "[Engine Agent] current engine path : %s\n", g_cur_engine.engine_path);
/* open engine */
char *error = NULL;
g_cur_engine.handle = dlopen(g_cur_engine.engine_path, RTLD_LAZY); /* RTLD_LAZY RTLD_NOW*/
if (NULL != (error = dlerror()) || NULL == g_cur_engine.handle) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Engine Agent ERROR] fail to get current engine handle : dlopen error ($s)", error);
+ SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] fail to get current engine handle : dlopen error ($s)", error);
return -2;
}
g_cur_engine.ttsp_unload_engine = (int (*)())dlsym(g_cur_engine.handle, "ttsp_unload_engine");
if (NULL != (error = dlerror()) || NULL == g_cur_engine.ttsp_unload_engine) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Engine Agent ERROR] fail to link daemon to ttsp_unload_engine() of current engine : (%s)", error);
+ SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] fail to link daemon to ttsp_unload_engine() of current engine : (%s)", error);
return -3;
}
g_cur_engine.ttsp_load_engine = (int (*)(const ttspd_funcs_s* , ttspe_funcs_s*) )dlsym(g_cur_engine.handle, "ttsp_load_engine");
if (NULL != (error = dlerror()) || NULL == g_cur_engine.ttsp_load_engine) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Engine Agent ERROR] fail to link daemon to ttsp_load_engine() of current engine : %s", error);
+ SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] fail to link daemon to ttsp_load_engine() of current engine : %s", error);
return -3;
}
ret = g_cur_engine.ttsp_load_engine(g_cur_engine.pdfuncs, g_cur_engine.pefuncs);
if (0 != ret) {
printf("Fail load '%s' engine\n", g_cur_engine.engine_path);
- SLOG(LOG_ERROR, TAG_TTSD, "[Engine Agent ERROR] fail to load engine : result(%d) \n");
+ SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] fail to load engine : result(%d)");
return TTSD_ERROR_OPERATION_FAILED;
}
- SLOG(LOG_DEBUG, TAG_TTSD, "[Engine Agent] engine info : version(%d), size(%d)\n",g_cur_engine.pefuncs->version, g_cur_engine.pefuncs->size );
+ SLOG(LOG_DEBUG, get_tag(), "[Engine Agent] engine info : version(%d), size(%d)\n",g_cur_engine.pefuncs->version, g_cur_engine.pefuncs->size );
/* engine error check */
if (g_cur_engine.pefuncs->size != sizeof(ttspe_funcs_s)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Engine Agent ERROR] ttsd_engine_agent_load_current_engine : current engine is not valid \n");
+ SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] ttsd_engine_agent_load_current_engine : current engine is not valid");
return TTSD_ERROR_OPERATION_FAILED;
}
/* initalize engine */
if (NULL == g_cur_engine.pefuncs->initialize) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Engine Agent ERROR] init function of engine is NULL!!");
+ SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] init function of engine is NULL!!");
return TTSD_ERROR_OPERATION_FAILED;
}
ret = g_cur_engine.pefuncs->initialize(__result_cb);
if (0 != ret) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Engine Agent ERROR] fail to initialize current engine : result(%d)\n", ret);
+ SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] fail to initialize current engine : result(%d)\n", ret);
return TTSD_ERROR_OPERATION_FAILED;
}
bool set_voice = false;
if (NULL != g_cur_engine.default_lang) {
if (NULL == g_cur_engine.pefuncs->is_valid_voice) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Engine Agent ERROR] is_valid_voice() of engine is NULL!!");
+ SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] is_valid_voice() of engine is NULL!!");
return TTSD_ERROR_OPERATION_FAILED;
}
if (true == g_cur_engine.pefuncs->is_valid_voice(g_cur_engine.default_lang, g_cur_engine.default_vctype)) {
set_voice = true;
- SLOG(LOG_DEBUG, TAG_TTSD, "[Engine Agent SUCCESS] Set origin default voice to current engine : lang(%s), type(%d) \n",
+ SLOG(LOG_DEBUG, get_tag(), "[Engine Agent SUCCESS] Set origin default voice to current engine : lang(%s), type(%d)",
g_cur_engine.default_lang, g_cur_engine.default_vctype);
} else {
- SLOG(LOG_WARN, TAG_TTSD, "[Engine Agent WARNING] Fail set origin default voice : lang(%s), type(%d)\n",
+ SLOG(LOG_WARN, get_tag(), "[Engine Agent WARNING] Fail set origin default voice : lang(%s), type(%d)\n",
g_cur_engine.default_lang, g_cur_engine.default_vctype);
}
}
if (false == set_voice) {
if (NULL == g_cur_engine.pefuncs->foreach_voices) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Engine Agent ERROR] get_voice_list of engine is NULL!!");
+ SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] get_voice_list of engine is NULL!!");
return TTSD_ERROR_OPERATION_FAILED;
}
voice = iter->data;
if (true != g_cur_engine.pefuncs->is_valid_voice(voice->language, voice->type)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Engine ERROR] Fail voice is NOT valid");
+ SLOG(LOG_ERROR, get_tag(), "[Engine ERROR] Fail voice is NOT valid");
return TTSD_ERROR_OPERATION_FAILED;
}
g_cur_engine.default_lang = g_strdup(voice->language);
g_cur_engine.default_vctype = voice->type;
- SLOG(LOG_DEBUG, TAG_TTSD, "[Engine Agent SUCCESS] Select default voice : lang(%s), type(%d) \n",
+ SLOG(LOG_DEBUG, get_tag(), "[Engine Agent SUCCESS] Select default voice : lang(%s), type(%d)",
voice->language, voice->type);
} else {
- SLOG(LOG_ERROR, TAG_TTSD, "[Engine ERROR] Fail to get language list : result(%d)\n", ret);
+ SLOG(LOG_ERROR, get_tag(), "[Engine ERROR] Fail to get language list : result(%d)\n", ret);
return TTSD_ERROR_OPERATION_FAILED;
}
__free_voice_list(voice_list);
} else {
- SLOG(LOG_ERROR, TAG_TTSD, "[Engine ERROR] Fail to get language list : result(%d)\n", ret);
+ SLOG(LOG_ERROR, get_tag(), "[Engine ERROR] Fail to get language list : result(%d)\n", ret);
return TTSD_ERROR_OPERATION_FAILED;
}
}
int ttsd_engine_agent_unload_current_engine()
{
if (false == g_agent_init) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Engine Agent ERROR] Not Initialized \n" );
+ SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] Not Initialized" );
return TTSD_ERROR_OPERATION_FAILED;
}
if (false == g_cur_engine.is_set) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Engine Agent ERROR] No Current Engine \n");
+ SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] No Current Engine ");
return TTSD_ERROR_OPERATION_FAILED;
}
if (false == g_cur_engine.is_loaded) {
- SLOG(LOG_DEBUG, TAG_TTSD, "[Engine Agent] Engine has already been unloaded \n" );
+ SLOG(LOG_DEBUG, get_tag(), "[Engine Agent] Engine has already been unloaded " );
return 0;
}
/* shutdown engine */
if (NULL == g_cur_engine.pefuncs->deinitialize) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Engine Agent ERROR] The deinitialize() of engine is NULL!!");
+ SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] The deinitialize() of engine is NULL!!");
} else {
int ret = 0;
ret = g_cur_engine.pefuncs->deinitialize();
if (0 != ret) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Engine Agent] Fail deinitialize() : result(%d)\n", ret);
+ SLOG(LOG_ERROR, get_tag(), "[Engine Agent] Fail deinitialize() : result(%d)\n", ret);
}
}
bool ttsd_engine_agent_need_network()
{
if (false == g_agent_init) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Engine Agent ERROR] Not Initialized \n" );
+ SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] Not Initialized" );
return TTSD_ERROR_OPERATION_FAILED;
}
if (false == g_cur_engine.is_loaded) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Engine Agent ERROR] Not loaded engine \n");
+ SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] Not loaded engine");
return TTSD_ERROR_OPERATION_FAILED;
}
return false;
}
- SLOG(LOG_DEBUG, TAG_TTSD, "[Engine Agent] Select voice : input lang(%s) , input type(%d), default lang(%s), default type(%d)",
+ SLOG(LOG_DEBUG, get_tag(), "[Engine Agent] Select voice : input lang(%s) , input type(%d), default lang(%s), default type(%d)",
lang, type, g_cur_engine.default_lang, g_cur_engine.default_vctype);
if (0 == strncmp(lang, "default", strlen("default")) && 0 == type) {
*out_lang = strdup(g_cur_engine.default_lang);
*out_type = g_cur_engine.default_vctype;
- return true;
-
+ return true;
}
/* Get voice list */
if (NULL == g_cur_engine.pefuncs->foreach_voices) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Engine Agent ERROR] foreach_voices of engine is NULL!!");
+ SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] foreach_voices of engine is NULL!!");
return TTSD_ERROR_OPERATION_FAILED;
}
ret = g_cur_engine.pefuncs->foreach_voices(__supported_voice_cb, &voice_list);
if (0 != ret || 0 >= g_list_length(voice_list)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Engine Agent ERROR] fail to get voice list : result(%d) \n", ret);
+ SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] fail to get voice list : result(%d)", ret);
return false;
}
}
if (true == result) {
- SLOG(LOG_DEBUG, TAG_TTSD, "[Engine Agent] Selected voice : lang(%s), type(%d) \n", *out_lang, *out_type);
+ SLOG(LOG_DEBUG, get_tag(), "[Engine Agent] Selected voice : lang(%s), type(%d)", *out_lang, *out_type);
}
__free_voice_list(voice_list);
bool ttsd_engine_agent_is_same_engine(const char* engine_id)
{
if (false == g_agent_init) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Engine Agent ERROR] Not Initialized \n" );
+ SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] Not Initialized" );
return false;
}
if (false == g_cur_engine.is_loaded) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Engine Agent ERROR] Not loaded engine \n");
+ SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] Not loaded engine");
return false;
}
return false;
}
+int ttsd_engine_agent_set_default_voice(const char* language, ttsp_voice_type_e vctype)
+{
+ if (false == g_agent_init) {
+ SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] Not Initialized" );
+ return TTSD_ERROR_OPERATION_FAILED;
+ }
+
+ if (false == g_cur_engine.is_loaded) {
+ SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] Not loaded engine");
+ return TTSD_ERROR_OPERATION_FAILED;
+ }
+
+ if (NULL == g_cur_engine.pefuncs->is_valid_voice) {
+ SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] The function of engine is NULL!!");
+ return TTSD_ERROR_OPERATION_FAILED;
+ }
+
+ int ret = -1;
+ if(false == g_cur_engine.pefuncs->is_valid_voice(language, vctype)) {
+ SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] Voice is NOT valid !!");
+ return TTSD_ERROR_INVALID_VOICE;
+ }
+
+ if (NULL != g_cur_engine.default_lang)
+ free(g_cur_engine.default_lang);
+
+ g_cur_engine.default_lang = strdup(language);
+ g_cur_engine.default_vctype = vctype;
+
+ ret = ttsd_config_set_default_voice(language, (int)vctype);
+ if (0 == ret) {
+ SLOG(LOG_DEBUG, get_tag(), "[Engine Agent SUCCESS] Set default voice : lang(%s), type(%d)",
+ g_cur_engine.default_lang, g_cur_engine.default_vctype);
+ } else {
+ SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] fail to write default voice to config (%d)", ret);
+ }
+}
+
/******************************************************************************************
* TTS Engine Interfaces for client
*******************************************************************************************/
int ttsd_engine_start_synthesis(const char* lang, const ttsp_voice_type_e vctype, const char* text, const int speed, void* user_param)
{
- SLOG(LOG_DEBUG, TAG_TTSD, "[Engine Agent] start ttsd_engine_start_synthesis() \n");
+ SLOG(LOG_DEBUG, get_tag(), "[Engine Agent] start ttsd_engine_start_synthesis()");
if (false == g_agent_init) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Engine Agent ERROR] Not Initialized \n" );
+ SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] Not Initialized" );
return TTSD_ERROR_OPERATION_FAILED;
}
if (false == g_cur_engine.is_loaded) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Engine Agent ERROR] Not loaded engine \n");
+ SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] Not loaded engine");
return TTSD_ERROR_OPERATION_FAILED;
}
char* temp_lang = NULL;
ttsp_voice_type_e temp_type;
if (true != ttsd_engine_select_valid_voice(lang, vctype, &temp_lang, &temp_type)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Engine Agent ERROR] Fail to select default voice \n");
+ SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] Fail to select default voice");
return TTSD_ERROR_INVALID_VOICE;
} else {
- SLOG(LOG_DEBUG, TAG_TTSD, "[Engine Agent] Start synthesis : language(%s), type(%d), speed(%d), text(%s) \n",
+ SLOG(LOG_DEBUG, get_tag(), "[Engine Agent] Start synthesis : language(%s), type(%d), speed(%d), text(%s)",
temp_lang, temp_type, speed, text);
}
if (NULL == g_cur_engine.pefuncs->start_synth) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Engine Agent ERROR] start_synth() of engine is NULL!!");
+ SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] start_synth() of engine is NULL!!");
return TTSD_ERROR_OPERATION_FAILED;
}
int ret = 0;
ret = g_cur_engine.pefuncs->start_synth(temp_lang, temp_type, text, temp_speed, user_param);
if (0 != ret) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Engine Agent ERROR] ***************************************", ret);
- SLOG(LOG_ERROR, TAG_TTSD, "[Engine Agent ERROR] * synthesize error : result(%6d) *", ret);
- SLOG(LOG_ERROR, TAG_TTSD, "[Engine Agent ERROR] ***************************************", ret);
+ SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] ***************************************", ret);
+ SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] * synthesize error : result(%6d) *", ret);
+ SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] ***************************************", ret);
return TTSD_ERROR_OPERATION_FAILED;
}
int ttsd_engine_cancel_synthesis()
{
- SLOG(LOG_DEBUG, TAG_TTSD, "[Engine Agent] start ttsd_engine_cancel_synthesis() \n");
+ SLOG(LOG_DEBUG, get_tag(), "[Engine Agent] start ttsd_engine_cancel_synthesis()");
if (false == g_agent_init) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Engine Agent ERROR] Not Initialized \n" );
+ SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] Not Initialized" );
return TTSD_ERROR_OPERATION_FAILED;
}
if (false == g_cur_engine.is_loaded) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Engine Agent ERROR] Not loaded engine \n");
+ SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] Not loaded engine");
return TTSD_ERROR_OPERATION_FAILED;
}
if (NULL == g_cur_engine.pefuncs->cancel_synth) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Engine Agent ERROR] cancel_synth() of engine is NULL!!");
+ SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] cancel_synth() of engine is NULL!!");
return TTSD_ERROR_OPERATION_FAILED;
}
int ret = 0;
ret = g_cur_engine.pefuncs->cancel_synth();
if (0 != ret) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Engine Agent ERROR] fail cancel synthesis : result(%d) \n", ret);
+ SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] fail cancel synthesis : result(%d)", ret);
return TTSD_ERROR_OPERATION_FAILED;
}
int ttsd_engine_get_audio_format( ttsp_audio_type_e* type, int* rate, int* channels)
{
if (false == g_agent_init) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Engine Agent ERROR] Not Initialized \n" );
+ SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] Not Initialized" );
return TTSD_ERROR_OPERATION_FAILED;
}
if (false == g_cur_engine.is_loaded) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Engine Agent ERROR] Not loaded engine \n");
+ SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] Not loaded engine");
return TTSD_ERROR_OPERATION_FAILED;
}
if (NULL == g_cur_engine.pefuncs->get_audio_format) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Engine Agent ERROR] get_audio_format() of engine is NULL!!");
+ SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] get_audio_format() of engine is NULL!!");
return TTSD_ERROR_OPERATION_FAILED;
}
int ret = 0;
ret = g_cur_engine.pefuncs->get_audio_format(type, rate, channels);
if (0 != ret) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Engine Agent ERROR] fail to get audio format : result(%d) \n", ret);
+ SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] fail to get audio format : result(%d)", ret);
return TTSD_ERROR_OPERATION_FAILED;
} else
- SLOG(LOG_DEBUG, TAG_TTSD, "[Engine Agent] get audio format : type(%d), rate(%d), channel(%d) \n", *type, *rate, *channels);
+ SLOG(LOG_DEBUG, get_tag(), "[Engine Agent] get audio format : type(%d), rate(%d), channel(%d)", *type, *rate, *channels);
return 0;
}
GList** voice_list = (GList**)user_data;
if (NULL == language || NULL == voice_list) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Engine Agent ERROR] Input parameter is NULL in voice list callback!!!!");
+ SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] Input parameter is NULL in voice list callback!!!!");
return false;
}
- SLOG(LOG_DEBUG, TAG_TTSD, "-- Language(%s), Type(%d)", language, type);
+ SLOG(LOG_DEBUG, get_tag(), "-- Language(%s), Type(%d)", language, type);
voice_s* voice = g_malloc0(sizeof(voice_s));
voice->language = strdup(language);
int ttsd_engine_get_voice_list(GList** voice_list)
{
if (false == g_agent_init) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Engine Agent ERROR] Not Initialized \n" );
+ SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] Not Initialized" );
return TTSD_ERROR_OPERATION_FAILED;
}
if (false == g_cur_engine.is_loaded) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Engine Agent ERROR] Not loaded engine \n");
+ SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] Not loaded engine");
return TTSD_ERROR_OPERATION_FAILED;
}
if (NULL == g_cur_engine.pefuncs->foreach_voices) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Engine Agent ERROR] The function of engine is NULL!!");
+ SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] The function of engine is NULL!!");
return TTSD_ERROR_OPERATION_FAILED;
}
int ret = 0;
ret = g_cur_engine.pefuncs->foreach_voices(__supported_voice_cb, (void*)voice_list);
if (0 != ret) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Engine Agent ERROR] Fail to get voice list : result(%d) \n", ret);
+ SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] Fail to get voice list : result(%d)", ret);
return TTSD_ERROR_OPERATION_FAILED;
}
int ttsd_engine_get_default_voice( char** lang, ttsp_voice_type_e* vctype )
{
if (false == g_agent_init) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Engine Agent ERROR] Not Initialized \n" );
+ SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] Not Initialized" );
return TTSD_ERROR_OPERATION_FAILED;
}
if (false == g_cur_engine.is_loaded) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Engine Agent ERROR] Not loaded engine \n");
+ SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] Not loaded engine");
return TTSD_ERROR_OPERATION_FAILED;
}
if (NULL == lang || NULL == vctype) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Engine Agent ERROR] BAD Parameter \n");
+ SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] BAD Parameter");
return TTSD_ERROR_INVALID_PARAMETER;
}
*lang = g_strdup(g_cur_engine.default_lang);
*vctype = g_cur_engine.default_vctype;
- SLOG(LOG_DEBUG, TAG_TTSD, "[Engine] Get default voice : language(%s), type(%d)\n", *lang, *vctype);
+ SLOG(LOG_DEBUG, get_tag(), "[Engine] Get default voice : language(%s), type(%d)\n", *lang, *vctype);
} else {
if (NULL == g_cur_engine.pefuncs->foreach_voices) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Engine Agent ERROR] get_voice_list of engine is NULL!!");
+ SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] get_voice_list of engine is NULL!!");
return TTSD_ERROR_OPERATION_FAILED;
}
voice = iter->data;
if (true != g_cur_engine.pefuncs->is_valid_voice(voice->language, voice->type)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Engine ERROR] Fail voice is NOT valid ");
+ SLOG(LOG_ERROR, get_tag(), "[Engine ERROR] Fail voice is NOT valid ");
return TTSD_ERROR_OPERATION_FAILED;
}
*lang = g_strdup(g_cur_engine.default_lang);
*vctype = g_cur_engine.default_vctype = voice->type;
- SLOG(LOG_DEBUG, TAG_TTSD, "[Engine] Get default voice (New selected) : language(%s), type(%d)\n", *lang, *vctype);
+ SLOG(LOG_DEBUG, get_tag(), "[Engine] Get default voice (New selected) : language(%s), type(%d)\n", *lang, *vctype);
} else {
- SLOG(LOG_ERROR, TAG_TTSD, "[Engine ERROR] Fail to get language list : result(%d)\n", ret);
+ SLOG(LOG_ERROR, get_tag(), "[Engine ERROR] Fail to get language list : result(%d)\n", ret);
return TTSD_ERROR_OPERATION_FAILED;
}
__free_voice_list(voice_list);
} else {
- SLOG(LOG_ERROR, TAG_TTSD, "[Engine ERROR] Fail to get language list : result(%d)\n", ret);
+ SLOG(LOG_ERROR, get_tag(), "[Engine ERROR] Fail to get language list : result(%d)\n", ret);
return TTSD_ERROR_OPERATION_FAILED;
}
}
int ttsd_engine_setting_get_engine_list(GList** engine_list)
{
if (false == g_agent_init) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Engine Agent ERROR] Not Initialized \n" );
+ SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] Not Initialized" );
return TTSD_ERROR_OPERATION_FAILED;
}
if (NULL == engine_list) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Engine Agent ERROR] Input parameter is NULL" );
+ SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] Input parameter is NULL" );
return TTSD_ERROR_INVALID_PARAMETER;
}
/* update engine list */
if (0 != __internal_update_engine_list()) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Engine Agent ERROR] fail __internal_update_engine_list() \n");
+ SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] fail __internal_update_engine_list()");
return TTSD_ERROR_OPERATION_FAILED;
}
iter = g_list_first(g_engine_list);
- SLOG(LOG_DEBUG, TAG_TTSD, "----- [Engine Agent] engine list -----");
+ SLOG(LOG_DEBUG, get_tag(), "----- [Engine Agent] engine list -----");
while (NULL != iter) {
engine_s* temp_engine;
iter = g_list_next(iter);
- SLOG(LOG_DEBUG, TAG_TTSD, " -- engine id(%s) engine name(%s) ug name(%s) \n",
+ SLOG(LOG_DEBUG, get_tag(), " -- engine id(%s) engine name(%s) ug name(%s)",
temp_engine->engine_id, temp_engine->engine_name, temp_engine->ug_name);
}
- SLOG(LOG_DEBUG, TAG_TTSD, "--------------------------------------");
+ SLOG(LOG_DEBUG, get_tag(), "--------------------------------------");
return 0;
}
int ttsd_engine_setting_get_engine(char** engine_id)
{
if (false == g_agent_init) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Engine Agent ERROR] Not Initialized \n" );
+ SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] Not Initialized" );
return TTSD_ERROR_OPERATION_FAILED;
}
if (false == g_cur_engine.is_loaded) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Engine Agent ERROR] Not loaded engine \n");
+ SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] Not loaded engine");
return TTSD_ERROR_ENGINE_NOT_FOUND;
}
int ttsd_engine_setting_set_engine(const char* engine_id)
{
if (false == g_agent_init) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Engine Agent ERROR] Not Initialized \n" );
+ SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] Not Initialized" );
return TTSD_ERROR_OPERATION_FAILED;
}
/* compare current engine and new engine.*/
if (0 == strncmp(g_cur_engine.engine_uuid, engine_id, strlen(engine_id))) {
- SLOG(LOG_DEBUG, TAG_TTSD, "[Engine Agent] new engine(%s) is the same as current engine(%s) \n", engine_id, g_cur_engine.engine_uuid);
+ SLOG(LOG_DEBUG, get_tag(), "[Engine Agent] new engine(%s) is the same as current engine(%s)", engine_id, g_cur_engine.engine_uuid);
return 0;
}
/* unload engine */
if (0 != ttsd_engine_agent_unload_current_engine()) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Engine Agent Error] fail to unload current engine \n");
+ SLOG(LOG_ERROR, get_tag(), "[Engine Agent Error] fail to unload current engine");
} else {
- SLOG(LOG_DEBUG, TAG_TTSD, "[Engine Agent SUCCESS] unload current engine \n");
+ SLOG(LOG_DEBUG, get_tag(), "[Engine Agent SUCCESS] unload current engine");
}
/* change current engine */
if (0 != __internal_set_current_engine(engine_id)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Engine Agent ERROR] fail __internal_set_current_engine() \n");
+ SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] fail __internal_set_current_engine()");
/* roll back to old current engine. */
__internal_set_current_engine(tmp_uuid);
/* load engine */
if (0 != ttsd_engine_agent_load_current_engine()) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Engine Agent Error] fail to load new engine \n");
+ SLOG(LOG_ERROR, get_tag(), "[Engine Agent Error] fail to load new engine");
if( tmp_uuid != NULL )
free(tmp_uuid);
return TTSD_ERROR_OPERATION_FAILED;
} else {
- SLOG(LOG_DEBUG, TAG_TTSD, "[Engine Agent SUCCESS] load new engine \n");
+ SLOG(LOG_DEBUG, get_tag(), "[Engine Agent SUCCESS] load new engine");
}
/* save engine id to config */
if (0 != ttsd_config_set_default_engine(engine_id)) {
- SLOG(LOG_WARN, TAG_TTSD, "[Engine Agent WARNING] Fail to save engine id to config \n");
+ SLOG(LOG_WARN, get_tag(), "[Engine Agent WARNING] Fail to save engine id to config");
}
if (tmp_uuid != NULL)
int ttsd_engine_setting_get_voice_list(char** engine_id, GList** voice_list)
{
if (false == g_agent_init) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Engine Agent ERROR] Not Initialized \n" );
+ SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] Not Initialized" );
return TTSD_ERROR_OPERATION_FAILED;
}
if (false == g_cur_engine.is_loaded) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Engine Agent ERROR] Not loaded engine \n");
+ SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] Not loaded engine");
return TTSD_ERROR_OPERATION_FAILED;
}
/* get language list from engine*/
ret = ttsd_engine_get_voice_list(voice_list);
if (0 != ret) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Server Error] fail ttsd_engine_get_voice_list() \n");
+ SLOG(LOG_ERROR, get_tag(), "[Server Error] fail ttsd_engine_get_voice_list() ");
return ret;
}
int ttsd_engine_setting_get_default_voice(char** language, ttsp_voice_type_e* vctype)
{
if (false == g_agent_init) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Engine Agent ERROR] Not Initialized \n" );
+ SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] Not Initialized" );
return TTSD_ERROR_OPERATION_FAILED;
}
if (false == g_cur_engine.is_loaded) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Engine Agent ERROR] Not loaded engine \n");
+ SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] Not loaded engine");
return TTSD_ERROR_OPERATION_FAILED;
}
ret = ttsd_engine_get_default_voice(&temp_lang, &temp_int);
if (0 != ret) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Server Error] fail ttsd_engine_get_default_voice() \n");
+ SLOG(LOG_ERROR, get_tag(), "[Server Error] fail ttsd_engine_get_default_voice()");
return ret;
}
*vctype = temp_int;
free(temp_lang);
} else {
- SLOG(LOG_ERROR, TAG_TTSD, "[Server Error] fail to get default language \n");
+ SLOG(LOG_ERROR, get_tag(), "[Server Error] fail to get default language");
return TTSD_ERROR_OPERATION_FAILED;
}
int ttsd_engine_setting_set_default_voice(const char* language, ttsp_voice_type_e vctype)
{
if (false == g_agent_init) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Engine Agent ERROR] Not Initialized \n" );
+ SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] Not Initialized" );
return TTSD_ERROR_OPERATION_FAILED;
}
if (false == g_cur_engine.is_loaded) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Engine Agent ERROR] Not loaded engine \n");
+ SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] Not loaded engine");
return TTSD_ERROR_OPERATION_FAILED;
}
if (NULL == g_cur_engine.pefuncs->is_valid_voice) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Engine Agent ERROR] The function of engine is NULL!!");
+ SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] The function of engine is NULL!!");
return TTSD_ERROR_OPERATION_FAILED;
}
int ret = -1;
if(false == g_cur_engine.pefuncs->is_valid_voice(language, vctype)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Engine Agent ERROR] Voice is NOT valid !!");
+ SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] Voice is NOT valid !!");
return TTSD_ERROR_INVALID_VOICE;
}
ret = ttsd_config_set_default_voice(language, (int)vctype);
if (0 == ret) {
- SLOG(LOG_DEBUG, TAG_TTSD, "[Engine Agent SUCCESS] Set default voice : lang(%s), type(%d) \n",
+ SLOG(LOG_DEBUG, get_tag(), "[Engine Agent SUCCESS] Set default voice : lang(%s), type(%d)",
g_cur_engine.default_lang, g_cur_engine.default_vctype);
} else {
- SLOG(LOG_ERROR, TAG_TTSD, "[Engine Agent ERROR] fail to write default voice to config (%d) \n", ret);
+ SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] fail to write default voice to config (%d)", ret);
}
return 0;
int ttsd_engine_setting_get_default_speed(ttsp_speed_e* speed)
{
if (false == g_agent_init) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Engine Agent ERROR] Not Initialized \n" );
+ SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] Not Initialized" );
return TTSD_ERROR_OPERATION_FAILED;
}
if (false == g_cur_engine.is_loaded) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Engine Agent ERROR] Not loaded engine \n");
+ SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] Not loaded engine");
return TTSD_ERROR_OPERATION_FAILED;
}
int ttsd_engine_setting_set_default_speed(const ttsp_speed_e speed)
{
if (false == g_agent_init) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Engine Agent ERROR] Not Initialized \n" );
+ SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] Not Initialized" );
return TTSD_ERROR_OPERATION_FAILED;
}
if (false == g_cur_engine.is_loaded) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Engine Agent ERROR] Not loaded engine \n");
+ SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] Not loaded engine");
return TTSD_ERROR_OPERATION_FAILED;
}
g_cur_engine.default_speed = speed;
if (0 != ttsd_config_set_default_speed(speed)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Engine Agent ERROR] fail to set default speed to config");
+ SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] fail to set default speed to config");
}
return 0;
GList** engine_setting_list = (GList**)user_data;
if (NULL == engine_setting_list || NULL == key || NULL == value) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Engine Agent ERROR] Input parameter is NULL in engine setting callback!!!!");
+ SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] Input parameter is NULL in engine setting callback!!!!");
return false;
}
int ttsd_engine_setting_get_engine_setting_info(char** engine_id, GList** setting_list)
{
if (false == g_agent_init) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Engine Agent ERROR] Not Initialized" );
+ SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] Not Initialized" );
return TTSD_ERROR_OPERATION_FAILED;
}
if (false == g_cur_engine.is_loaded) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Engine Agent ERROR] Not loaded engine");
+ SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] Not loaded engine");
return TTSD_ERROR_OPERATION_FAILED;
}
if (NULL == setting_list) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Engine Agent ERROR] Input parameter is NULL");
+ SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] Input parameter is NULL");
return TTSD_ERROR_INVALID_PARAMETER;
}
if (NULL == g_cur_engine.pefuncs->foreach_engine_setting) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Engine Agent ERROR] foreach_engine_setting() of engine is NULL!!");
+ SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] foreach_engine_setting() of engine is NULL!!");
return TTSD_ERROR_OPERATION_FAILED;
}
if (0 == result && 0 < g_list_length(*setting_list)) {
*engine_id = strdup(g_cur_engine.engine_uuid);
} else {
- SLOG(LOG_ERROR, TAG_TTSD, "[Engine Agent ERROR] fail to get setting info : result(%d)\n", result);
+ SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] fail to get setting info : result(%d)\n", result);
result = TTSD_ERROR_OPERATION_FAILED;
}
int ttsd_engine_setting_set_engine_setting(const char* key, const char* value)
{
if (false == g_agent_init) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Engine Agent ERROR] Not Initialized \n" );
+ SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] Not Initialized" );
return TTSD_ERROR_OPERATION_FAILED;
}
if (false == g_cur_engine.is_loaded) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Engine Agent ERROR] Not loaded engine \n");
+ SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] Not loaded engine");
return TTSD_ERROR_OPERATION_FAILED;
}
if (NULL == g_cur_engine.pefuncs->set_engine_setting) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Engine Agent ERROR] set_setting_info of engine is NULL!! \n");
+ SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] set_setting_info of engine is NULL!!");
return TTSD_ERROR_OPERATION_FAILED;
}
ret = g_cur_engine.pefuncs->set_engine_setting(key, value);
if (0 != ret) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Engine Agent ERROR] fail to set engine setting : result(%d)\n", ret);
+ SLOG(LOG_ERROR, get_tag(), "[Engine Agent ERROR] fail to set engine setting : result(%d)\n", ret);
return TTSD_ERROR_OPERATION_FAILED;
}
if (g_list_length(g_engine_list) > 0) {
iter = g_list_first(g_engine_list);
- SLOG(LOG_DEBUG, TAG_TTSD, "----- engine list -----");
+ SLOG(LOG_DEBUG, get_tag(), "----- engine list -----");
int i = 1;
while (NULL != iter) {
data = iter->data;
- SLOG(LOG_DEBUG, TAG_TTSD, "[%dth]\n", i);
- SLOG(LOG_DEBUG, TAG_TTSD, "engine uuid : %s\n", data->engine_uuid);
- SLOG(LOG_DEBUG, TAG_TTSD, "engine name : %s\n", data->engine_name);
- SLOG(LOG_DEBUG, TAG_TTSD, "engine path : %s\n", data->engine_path);
- SLOG(LOG_DEBUG, TAG_TTSD, "setting ug path : %s\n", data->setting_ug_path);
+ SLOG(LOG_DEBUG, get_tag(), "[%dth]\n", i);
+ SLOG(LOG_DEBUG, get_tag(), "engine uuid : %s\n", data->engine_uuid);
+ SLOG(LOG_DEBUG, get_tag(), "engine name : %s\n", data->engine_name);
+ SLOG(LOG_DEBUG, get_tag(), "engine path : %s\n", data->engine_path);
+ SLOG(LOG_DEBUG, get_tag(), "setting ug path : %s\n", data->setting_ug_path);
iter = g_list_next(iter);
i++;
}
- SLOG(LOG_DEBUG, TAG_TTSD, "-----------------------");
- SLOG(LOG_DEBUG, TAG_TTSD, " ");
+ SLOG(LOG_DEBUG, get_tag(), "-----------------------");
+ SLOG(LOG_DEBUG, get_tag(), " ");
} else {
- SLOG(LOG_DEBUG, TAG_TTSD, "----- engine list -----");
- SLOG(LOG_DEBUG, TAG_TTSD, "No Engine in directory");
- SLOG(LOG_DEBUG, TAG_TTSD, "-----------------------");
+ SLOG(LOG_DEBUG, get_tag(), "----- engine list -----");
+ SLOG(LOG_DEBUG, get_tag(), "No Engine in directory");
+ SLOG(LOG_DEBUG, get_tag(), "-----------------------");
}
return 0;
#define CLIENT_CLEAN_UP_TIME 500
+char* get_tag()
+{
+ return "ttsd";
+}
+
+ttsd_mode_e ttsd_get_mode()
+{
+ return TTSD_MODE_DEFAULT;
+}
+
/* Main of TTS Daemon */
int main()
{
- SLOG(LOG_DEBUG, TAG_TTSD, " ");
- SLOG(LOG_DEBUG, TAG_TTSD, " ");
- SLOG(LOG_DEBUG, TAG_TTSD, "===== TTS DAEMON INITIALIZE");
+ SLOG(LOG_DEBUG, get_tag(), " ");
+ SLOG(LOG_DEBUG, get_tag(), " ");
+ SLOG(LOG_DEBUG, get_tag(), "===== TTS DAEMON DEFAULT INITIALIZE");
if (!ecore_init()) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Main ERROR] fail ecore_init() \n");
+ SLOG(LOG_ERROR, get_tag(), "[Main ERROR] fail ecore_init() \n");
return -1;
}
if (0 != ttsd_initialize()) {
printf("Fail to initialize tts-daemon \n");
- SLOG(LOG_ERROR, TAG_TTSD, "[Main ERROR] fail to initialize tts-daemon \n");
+ SLOG(LOG_ERROR, get_tag(), "[Main ERROR] fail to initialize tts-daemon");
return EXIT_FAILURE;
}
if (0 != ttsd_dbus_open_connection()) {
printf("Fail to initialize IPC connection \n");
- SLOG(LOG_ERROR, TAG_TTSD, "[Main ERROR] fail to open dbus connection \n");
+ SLOG(LOG_ERROR, get_tag(), "[Main ERROR] fail to open dbus connection");
return EXIT_FAILURE;
}
if (0 != ttsd_network_initialize()) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Main ERROR] fail to initialize network \n");
+ SLOG(LOG_ERROR, get_tag(), "[Main ERROR] fail to initialize network");
return EXIT_FAILURE;
}
ecore_timer_add(CLIENT_CLEAN_UP_TIME, ttsd_cleanup_client, NULL);
- SLOG(LOG_DEBUG, TAG_TTSD, "[Main] tts-daemon start...\n");
- SLOG(LOG_DEBUG, TAG_TTSD, "=====");
- SLOG(LOG_DEBUG, TAG_TTSD, " ");
- SLOG(LOG_DEBUG, TAG_TTSD, " ");
+ SLOG(LOG_DEBUG, get_tag(), "[Main] tts-daemon start...\n");
+ SLOG(LOG_DEBUG, get_tag(), "=====");
+ SLOG(LOG_DEBUG, get_tag(), " ");
+ SLOG(LOG_DEBUG, get_tag(), " ");
- printf("TTS-Daemon Start...\n");
+ printf("Start tts-daemon ...\n");
ecore_main_loop_begin();
- SLOG(LOG_DEBUG, TAG_TTSD, "===== TTS DAEMON FINALIZE");
+ SLOG(LOG_DEBUG, get_tag(), "===== TTS DAEMON DEFAULT FINALIZE");
+ ttsd_network_finalize();
+
ttsd_dbus_close_connection();
- ttsd_network_finalize();
+ ttsd_finalize();
ecore_shutdown();
- SLOG(LOG_DEBUG, TAG_TTSD, "=====");
- SLOG(LOG_DEBUG, TAG_TTSD, " ");
- SLOG(LOG_DEBUG, TAG_TTSD, " ");
+ SLOG(LOG_DEBUG, get_tag(), "=====");
+ SLOG(LOG_DEBUG, get_tag(), " ");
+ SLOG(LOG_DEBUG, get_tag(), " ");
return 0;
}
#endif
/* TTS Daemon Define */
-#define TAG_TTSD "ttsd"
-
#define BASE_DIRECTORY_DEFAULT "/usr/lib/voice/tts/1.0"
#define ENGINE_DIRECTORY_DEFAULT "/usr/lib/voice/tts/1.0/engine"
#define ENGINE_DIRECTORY_DEFAULT_SETTING "/usr/lib/voice/tts/1.0/setting"
TTSD_ERROR_OPERATION_FAILED = -0x0100000 | 0x25 /**< Operation failed */
}ttsd_error_e;
+typedef enum {
+ TTSD_MODE_DEFAULT = 0, /**< Default mode for normal application */
+ TTSD_MODE_NOTIFICATION, /**< Notification mode */
+ TTSD_MODE_SCREEN_READER /**< Screen reader mode */
+}ttsd_mode_e;
typedef enum {
TTSD_INTERRUPTED_PAUSED = 0, /**< Current state change 'Pause' */
char* value;
}engine_setting_s;
+/* get daemon mode : default, notification or screen reader */
+ttsd_mode_e ttsd_get_mode();
+
+/* Get log tag : default, notification, screen reader */
+char* get_tag();
+
#ifdef __cplusplus
}
#endif
--- /dev/null
+/*
+* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd All Rights Reserved
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+* http://www.apache.org/licenses/LICENSE-2.0
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+
+#include "ttsd_main.h"
+#include "ttsd_server.h"
+#include "ttsd_dbus.h"
+#include "ttsd_network.h"
+
+#include <Ecore.h>
+
+#define CLIENT_CLEAN_UP_TIME 500
+
+char* get_tag()
+{
+ return "ttsdnoti";
+}
+
+ttsd_mode_e ttsd_get_mode()
+{
+ return TTSD_MODE_NOTIFICATION;
+}
+
+/* Main of TTS Daemon */
+int main()
+{
+ SLOG(LOG_DEBUG, get_tag(), " ");
+ SLOG(LOG_DEBUG, get_tag(), " ");
+ SLOG(LOG_DEBUG, get_tag(), "===== TTS DAEMON NOTI INITIALIZE");
+ if (!ecore_init()) {
+ SLOG(LOG_ERROR, get_tag(), "[Main ERROR] fail ecore_init()");
+ return -1;
+ }
+
+ if (0 != ttsd_initialize()) {
+ printf("Fail to initialize tts-daemon-noti \n");
+ SLOG(LOG_ERROR, get_tag(), "[Main ERROR] fail to initialize tts-daemon-noti");
+ return EXIT_FAILURE;
+ }
+
+ if (0 != ttsd_dbus_open_connection()) {
+ printf("Fail to initialize IPC connection \n");
+ SLOG(LOG_ERROR, get_tag(), "[Main ERROR] fail to open dbus connection");
+ return EXIT_FAILURE;
+ }
+
+ if (0 != ttsd_network_initialize()) {
+ SLOG(LOG_ERROR, get_tag(), "[Main ERROR] fail to initialize network");
+ return EXIT_FAILURE;
+ }
+
+ ecore_timer_add(CLIENT_CLEAN_UP_TIME, ttsd_cleanup_client, NULL);
+
+ SLOG(LOG_DEBUG, get_tag(), "[Main] start tts-daemon-noti start...");
+ SLOG(LOG_DEBUG, get_tag(), "=====");
+ SLOG(LOG_DEBUG, get_tag(), " ");
+ SLOG(LOG_DEBUG, get_tag(), " ");
+
+ printf("Start tts-daemon-noti ...\n");
+
+ ecore_main_loop_begin();
+
+ SLOG(LOG_DEBUG, get_tag(), "===== TTS DAEMON NOTI FINALIZE");
+
+ ttsd_network_finalize();
+
+ ttsd_dbus_close_connection();
+
+ ttsd_finalize();
+
+ ecore_shutdown();
+
+ SLOG(LOG_DEBUG, get_tag(), "=====");
+ SLOG(LOG_DEBUG, get_tag(), " ");
+ SLOG(LOG_DEBUG, get_tag(), " ");
+
+ return 0;
+}
+
--- /dev/null
+/*
+* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd All Rights Reserved
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+* http://www.apache.org/licenses/LICENSE-2.0
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+#include "ttsd_main.h"
+#include "ttsd_server.h"
+#include "ttsd_dbus.h"
+#include "ttsd_network.h"
+
+#include <Ecore.h>
+
+#define CLIENT_CLEAN_UP_TIME 500
+
+char* get_tag()
+{
+ return "ttsdsr";
+}
+
+ttsd_mode_e ttsd_get_mode()
+{
+ return TTSD_MODE_SCREEN_READER;
+}
+
+/* Main of TTS Daemon */
+int main()
+{
+ SLOG(LOG_DEBUG, get_tag(), " ");
+ SLOG(LOG_DEBUG, get_tag(), " ");
+ SLOG(LOG_DEBUG, get_tag(), "===== TTS DAEMON SR INITIALIZE");
+ if (!ecore_init()) {
+ SLOG(LOG_ERROR, get_tag(), "[Main ERROR] fail ecore_init()");
+ return -1;
+ }
+
+ if (0 != ttsd_initialize()) {
+ printf("Fail to initialize tts-daemon-sr \n");
+ SLOG(LOG_ERROR, get_tag(), "[Main ERROR] fail to initialize tts-daemon-sr");
+ return EXIT_FAILURE;
+ }
+
+ if (0 != ttsd_dbus_open_connection()) {
+ printf("Fail to initialize IPC connection \n");
+ SLOG(LOG_ERROR, get_tag(), "[Main ERROR] fail to open dbus connection");
+ return EXIT_FAILURE;
+ }
+
+ if (0 != ttsd_network_initialize()) {
+ SLOG(LOG_ERROR, get_tag(), "[Main ERROR] fail to initialize network \n");
+ return EXIT_FAILURE;
+ }
+
+ ecore_timer_add(CLIENT_CLEAN_UP_TIME, ttsd_cleanup_client, NULL);
+
+ SLOG(LOG_DEBUG, get_tag(), "[Main] tts-daemon-sr start...\n");
+ SLOG(LOG_DEBUG, get_tag(), "=====");
+ SLOG(LOG_DEBUG, get_tag(), " ");
+ SLOG(LOG_DEBUG, get_tag(), " ");
+
+ printf("Start tts-daemon-sr...\n");
+
+ ecore_main_loop_begin();
+
+ SLOG(LOG_DEBUG, get_tag(), "===== TTS DAEMON SR FINALIZE");
+
+ ttsd_network_finalize();
+
+ ttsd_dbus_close_connection();
+
+ ttsd_finalize();
+
+ ecore_shutdown();
+
+ SLOG(LOG_DEBUG, get_tag(), "=====");
+ SLOG(LOG_DEBUG, get_tag(), " ");
+ SLOG(LOG_DEBUG, get_tag(), " ");
+
+ return 0;
+}
+
{
int network_configuration = 0;
vconf_get_int(VCONFKEY_NETWORK_CONFIGURATION_CHANGE_IND , &network_configuration);
- SLOG(LOG_DEBUG, TAG_TTSD, "[Network DEBUG] Network configuration : %d", network_configuration);
+ SLOG(LOG_DEBUG, get_tag(), "[Network DEBUG] Network configuration : %d", network_configuration);
if (network_configuration == 0) {
- SLOG(LOG_DEBUG, TAG_TTSD, "[Network] Notification : Network connection is OFF ");
+ SLOG(LOG_DEBUG, get_tag(), "[Network] Notification : Network connection is OFF ");
g_is_connected = false;
} else {
- SLOG(LOG_DEBUG, TAG_TTSD, "[Network] Notification : Network connection is ON ");
+ SLOG(LOG_DEBUG, get_tag(), "[Network] Notification : Network connection is ON ");
g_is_connected = true;
/* need to notify changing net to engine. */
{
int network_configuration = 0;
vconf_get_int(VCONFKEY_NETWORK_CONFIGURATION_CHANGE_IND , &network_configuration);
- SLOG(LOG_DEBUG, TAG_TTSD, "[Network DEBUG] Network configuration : %d", network_configuration);
+ SLOG(LOG_DEBUG, get_tag(), "[Network DEBUG] Network configuration : %d", network_configuration);
if (network_configuration == 0) {
/* "0" means the network configuration is not set.
vconf_get_int(VCONFKEY_NETWORK_STATUS, &network_status);
if(network_status == VCONFKEY_NETWORK_OFF){
- SLOG(LOG_DEBUG, TAG_TTSD, "[Network] Current network connection is OFF.");
+ SLOG(LOG_DEBUG, get_tag(), "[Network] Current network connection is OFF.");
}
else{
/*
* This is the problem of network connection
* Just terminate the application, network f/w will fix the problem automatically.
*/
- SLOG(LOG_WARN, TAG_TTSD, "network status is wrong or IP is not set\n");
- SLOG(LOG_WARN, TAG_TTSD, "network has problem, try again\n");
+ SLOG(LOG_WARN, get_tag(), "network status is wrong or IP is not set\n");
+ SLOG(LOG_WARN, get_tag(), "network has problem, try again\n");
return -1;
}
g_is_connected = false;
} else {
- SLOG(LOG_DEBUG, TAG_TTSD, "[Network] Current network connection is ON.");
+ SLOG(LOG_DEBUG, get_tag(), "[Network] Current network connection is ON.");
g_is_connected = true;
}
vconf_notify_key_changed(VCONFKEY_NETWORK_CONFIGURATION_CHANGE_IND, __net_config_change_cb, NULL);
- SLOG(LOG_DEBUG, TAG_TTSD, "[Network SUCCESS] Initialize network ...\n");
+ SLOG(LOG_DEBUG, get_tag(), "[Network SUCCESS] Initialize network ...\n");
return 0;
}
#include <mm_types.h>
#include <mm_player.h>
#include <mm_player_internal.h>
+#include <mm_session.h>
#include <mm_error.h>
#include <Ecore.h>
static bool g_pause_info;
static int g_paused_uid;
-
/*
* Internal Interfaces
*/
+
player_s* __player_get_item(int uid);
int __save_file(const int uid, const int index, const sound_data_s data, char** filename);
static int msg_callback(int message, void *data, void *user_param) ;
+
/*
* Player Interfaces
*/
int ttsd_player_init(player_result_callback_func result_cb)
{
if (NULL == result_cb) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Player ERROR] invalid parameter");
+ SLOG(LOG_ERROR, get_tag(), "[Player ERROR] invalid parameter");
return TTSD_ERROR_INVALID_PARAMETER;
}
g_index = 1;
g_player_init = true;
- g_pause_info = false;
- g_paused_uid = -1;
+ if (TTSD_MODE_DEFAULT == ttsd_get_mode()) {
+ if (MM_ERROR_NONE != mm_session_init(MM_SESSION_TYPE_EXCLUSIVE)) {
+ SLOG(LOG_ERROR, get_tag(), "[Player ERROR] Fail mm_session_init(MM_SESSION_TYPE_EXCLUSIVE)");
+ } else {
+ SLOG(LOG_ERROR, get_tag(), "[Player SUCCESS] mm_session_init(MM_SESSION_TYPE_EXCLUSIVE)");
+ }
+ }
+
return 0;
}
int ttsd_player_release(void)
{
if (false == g_player_init) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Player ERROR] Not Initialized");
+ SLOG(LOG_ERROR, get_tag(), "[Player ERROR] Not Initialized");
return TTSD_ERROR_OPERATION_FAILED;
}
int ttsd_player_create_instance(const int uid)
{
if (false == g_player_init) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Player ERROR] Not Initialized" );
+ SLOG(LOG_ERROR, get_tag(), "[Player ERROR] Not Initialized" );
return -1;
}
/* Check uid is duplicated */
if (NULL != __player_get_item(uid)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Player ERROR] uid(%d) is already registered", uid);
+ SLOG(LOG_ERROR, get_tag(), "[Player ERROR] uid(%d) is already registered", uid);
return -1;
}
ret = mm_player_create(&player_handle);
if (ret != MM_ERROR_NONE || 0 == player_handle) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Player ERROR] fail mm_player_create() : %x", ret);
+ SLOG(LOG_ERROR, get_tag(), "[Player ERROR] fail mm_player_create() : %x", ret);
return -2;
}
new_client->utt_id = -1;
new_client->event = TTSP_RESULT_EVENT_FINISH;
- SLOG(LOG_DEBUG, TAG_TTSD, "[Player] Create player : uid(%d), handle(%d)", uid, player_handle );
+ SLOG(LOG_DEBUG, get_tag(), "[Player] Create player : uid(%d), handle(%d)", uid, player_handle );
g_player_list = g_list_append(g_player_list, new_client);
int ttsd_player_destroy_instance(int uid)
{
if (false == g_player_init) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Player ERROR] Not Initialized" );
+ SLOG(LOG_ERROR, get_tag(), "[Player ERROR] Not Initialized" );
return -1;
}
player_s* current;
current = __player_get_item(uid);
if (NULL == current) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Player ERROR] uid(%d) is not valid", uid);
+ SLOG(LOG_ERROR, get_tag(), "[Player ERROR] uid(%d) is not valid", uid);
return -1;
}
MMPlayerStateType player_state;
mm_player_get_state(current->player_handle, &player_state);
- SLOG(LOG_DEBUG, TAG_TTSD, "[PLAYER] State changed : state(%d)", player_state);
+ SLOG(LOG_DEBUG, get_tag(), "[PLAYER] State changed : state(%d)", player_state);
int ret = -1;
/* destroy player */
case MM_PLAYER_STATE_READY:
ret = mm_player_unrealize(current->player_handle);
if (MM_ERROR_NONE != ret) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Player ERROR] fail mm_player_unrealize() : %x", ret);
+ SLOG(LOG_ERROR, get_tag(), "[Player ERROR] fail mm_player_unrealize() : %x", ret);
}
/* NO break for destroy */
case MM_PLAYER_STATE_NULL:
ret = mm_player_destroy(current->player_handle);
if (MM_ERROR_NONE != ret) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Player ERROR] fail mm_player_destroy() : %x", ret);
+ SLOG(LOG_ERROR, get_tag(), "[Player ERROR] fail mm_player_destroy() : %x", ret);
}
break;
}
}
- SLOG(LOG_DEBUG, TAG_TTSD, "[PLAYER Success] Destroy instance");
+ SLOG(LOG_DEBUG, get_tag(), "[PLAYER Success] Destroy instance");
return 0;
}
int ttsd_player_play(const int uid)
{
- SLOG(LOG_DEBUG, TAG_TTSD, "[Player] start play : uid(%d)", uid );
+ SLOG(LOG_DEBUG, get_tag(), "[Player] start play : uid(%d)", uid );
if (false == g_player_init) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Player ERROR] Not Initialized" );
+ SLOG(LOG_ERROR, get_tag(), "[Player ERROR] Not Initialized" );
return -1;
}
if (NULL != g_playing_info) {
if (uid == g_playing_info->uid) {
- SLOG(LOG_WARN, TAG_TTSD, "[Player WARNING] uid(%d) has already played", g_playing_info->uid);
+ SLOG(LOG_WARN, get_tag(), "[Player WARNING] uid(%d) has already played", g_playing_info->uid);
return 0;
}
}
/* Check sound queue size */
if (0 == ttsd_data_get_sound_data_size(uid)) {
- SLOG(LOG_WARN, TAG_TTSD, "[Player WARNING] A sound queue of current player(%d) is empty", uid);
+ SLOG(LOG_WARN, get_tag(), "[Player WARNING] A sound queue of current player(%d) is empty", uid);
return -1;
}
player_s* current;
current = __player_get_item(uid);
if (NULL == current) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Player ERROR] uid(%d) is not valid", uid);
+ SLOG(LOG_ERROR, get_tag(), "[Player ERROR] uid(%d) is not valid", uid);
return -1;
}
MMPlayerStateType player_state;
mm_player_get_state(current->player_handle, &player_state);
- SLOG(LOG_DEBUG, TAG_TTSD, "[PLAYER] State changed : state(%d)", player_state);
+ SLOG(LOG_DEBUG, get_tag(), "[PLAYER] State changed : state(%d)", player_state);
switch (player_state) {
case MM_PLAYER_STATE_PLAYING:
- SLOG(LOG_WARN, TAG_TTSD, "[Player] Current player is playing. Do not start new sound.");
+ SLOG(LOG_WARN, get_tag(), "[Player] Current player is playing. Do not start new sound.");
return 0;
case MM_PLAYER_STATE_PAUSED:
- SLOG(LOG_WARN, TAG_TTSD, "[Player] Player is paused. Do not start new sound.");
+ SLOG(LOG_WARN, get_tag(), "[Player] Player is paused. Do not start new sound.");
return -1;
case MM_PLAYER_STATE_READY:
- SLOG(LOG_WARN, TAG_TTSD, "[Player] Player is ready for next play. Do not start new sound.");
+ SLOG(LOG_WARN, get_tag(), "[Player] Player is ready for next play. Do not start new sound.");
return -1;
case MM_PLAYER_STATE_NULL:
break;
case MM_PLAYER_STATE_NONE:
- SLOG(LOG_WARN, TAG_TTSD, "[Player] Player is created. Do not start new sound.");
+ SLOG(LOG_WARN, get_tag(), "[Player] Player is created. Do not start new sound.");
return -1;
default:
int ret;
ret = __set_and_start(current);
if (0 != ret) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Player ERROR] fail to set or start mm_player");
+ SLOG(LOG_ERROR, get_tag(), "[Player ERROR] fail to set or start mm_player");
}
- SLOG(LOG_DEBUG, TAG_TTSD, "[Player] Started play and wait for played callback : uid(%d)", uid);
+ SLOG(LOG_DEBUG, get_tag(), "[Player] Started play and wait for played callback : uid(%d)", uid);
return 0;
}
int ttsd_player_next_play(int uid)
{
if (false == g_player_init) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Player ERROR] Not Initialized" );
+ SLOG(LOG_ERROR, get_tag(), "[Player ERROR] Not Initialized" );
return -1;
}
player_s* current;
current = __player_get_item(uid);
if (NULL == current) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Player ERROR] uid(%d) is not valid", uid);
+ SLOG(LOG_ERROR, get_tag(), "[Player ERROR] uid(%d) is not valid", uid);
g_playing_info = NULL;
return -1;
}
if (NULL != g_playing_info) {
if (uid != g_playing_info->uid) {
- SLOG(LOG_WARN, TAG_TTSD, "[Player WARNING] Current player(%d) is NOT uid(%d)", g_playing_info->uid, uid);
+ SLOG(LOG_WARN, get_tag(), "[Player WARNING] Current player(%d) is NOT uid(%d)", g_playing_info->uid, uid);
return 0;
}
} else {
- SLOG(LOG_WARN, TAG_TTSD, "[Player WARNING] Current player do NOT exist");
+ SLOG(LOG_WARN, get_tag(), "[Player WARNING] Current player do NOT exist");
return -1;
}
MMPlayerStateType player_state;
mm_player_get_state(current->player_handle, &player_state);
- SLOG(LOG_DEBUG, TAG_TTSD, "[PLAYER] State changed : state(%d)", player_state);
+ SLOG(LOG_DEBUG, get_tag(), "[PLAYER] State changed : state(%d)", player_state);
int ret = -1;
/* stop player */
case MM_PLAYER_STATE_READY:
ret = mm_player_unrealize(current->player_handle);
if (MM_ERROR_NONE != ret) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Player ERROR] fail mm_player_unrealize() : %x", ret);
+ SLOG(LOG_ERROR, get_tag(), "[Player ERROR] fail mm_player_unrealize() : %x", ret);
return -1;
}
break;
/* Check sound queue size */
if (0 == ttsd_data_get_sound_data_size(uid)) {
- SLOG(LOG_WARN, TAG_TTSD, "[Player WARNING] A sound queue of current player(%d) is empty", uid);
+ SLOG(LOG_WARN, get_tag(), "[Player WARNING] A sound queue of current player(%d) is empty", uid);
g_playing_info = NULL;
return -1;
}
ret = __set_and_start(current);
if (0 != ret) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Player ERROR] fail to set or start mm_player");
+ SLOG(LOG_ERROR, get_tag(), "[Player ERROR] fail to set or start mm_player");
}
- SLOG(LOG_DEBUG, TAG_TTSD, "[Player] Started play and wait for played callback : uid(%d)", uid);
+ SLOG(LOG_DEBUG, get_tag(), "[Player] Started play and wait for played callback : uid(%d)", uid);
return 0;
}
int ttsd_player_stop(const int uid)
{
- SLOG(LOG_DEBUG, TAG_TTSD, "[Player] stop player : uid(%d)", uid );
+ SLOG(LOG_DEBUG, get_tag(), "[Player] stop player : uid(%d)", uid );
if (false == g_player_init) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Player ERROR] Not Initialized" );
+ SLOG(LOG_ERROR, get_tag(), "[Player ERROR] Not Initialized" );
return -1;
}
player_s* current;
current = __player_get_item(uid);
if (NULL == current) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Player ERROR] uid(%d) is not valid", uid);
+ SLOG(LOG_ERROR, get_tag(), "[Player ERROR] uid(%d) is not valid", uid);
return -1;
}
g_playing_info = NULL;
}
} else {
- SLOG(LOG_DEBUG, TAG_TTSD, "[Player] No current playing");
+ SLOG(LOG_DEBUG, get_tag(), "[Player] No current playing");
}
current->utt_id = -1;
MMPlayerStateType player_state;
mm_player_get_state(current->player_handle, &player_state);
- SLOG(LOG_DEBUG, TAG_TTSD, "[PLAYER] Current state(%d)", player_state);
+ SLOG(LOG_DEBUG, get_tag(), "[PLAYER] Current state(%d)", player_state);
int ret = -1;
switch (player_state) {
case MM_PLAYER_STATE_READY:
ret = mm_player_unrealize(current->player_handle);
if (MM_ERROR_NONE != ret) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Player ERROR] fail mm_player_unrealize() : %x", ret);
+ SLOG(LOG_ERROR, get_tag(), "[Player ERROR] fail mm_player_unrealize() : %x", ret);
return -1;
}
break;
break;
}
- SLOG(LOG_DEBUG, TAG_TTSD, "[Player SUCCESS] Stop player : uid(%d)", uid);
+ SLOG(LOG_DEBUG, get_tag(), "[Player SUCCESS] Stop player : uid(%d)", uid);
return 0;
}
int ttsd_player_pause(const int uid)
{
- SLOG(LOG_DEBUG, TAG_TTSD, "[Player] pause player : uid(%d)", uid );
+ SLOG(LOG_DEBUG, get_tag(), "[Player] pause player : uid(%d)", uid );
if (false == g_player_init) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Player ERROR] Not Initialized" );
+ SLOG(LOG_ERROR, get_tag(), "[Player ERROR] Not Initialized" );
return -1;
}
player_s* current;
current = __player_get_item(uid);
if (NULL == current) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Player ERROR] ttsd_player_pause() : uid(%d) is not valid", uid);
+ SLOG(LOG_ERROR, get_tag(), "[Player ERROR] ttsd_player_pause() : uid(%d) is not valid", uid);
return -1;
}
MMPlayerStateType player_state;
mm_player_get_state(current->player_handle, &player_state);
- SLOG(LOG_DEBUG, TAG_TTSD, "[PLAYER] Current state(%d)", player_state);
+ SLOG(LOG_DEBUG, get_tag(), "[PLAYER] Current state(%d)", player_state);
int ret = 0;
if (MM_PLAYER_STATE_PLAYING == player_state) {
ret = mm_player_pause(current->player_handle);
if (MM_ERROR_NONE != ret) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Player ERROR] fail mm_player_pause : %x ", ret);
+ SLOG(LOG_ERROR, get_tag(), "[Player ERROR] fail mm_player_pause : %x ", ret);
}
} else {
- SLOG(LOG_WARN, TAG_TTSD, "[Player WARNING] Current player is NOT 'playing'");
+ SLOG(LOG_WARN, get_tag(), "[Player WARNING] Current player is NOT 'playing'");
}
int ttsd_player_resume(const int uid)
{
- SLOG(LOG_DEBUG, TAG_TTSD, "[Player] Resume player : uid(%d)", uid );
+ SLOG(LOG_DEBUG, get_tag(), "[Player] Resume player : uid(%d)", uid );
if (false == g_player_init) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Player ERROR] Not Initialized" );
+ SLOG(LOG_ERROR, get_tag(), "[Player ERROR] Not Initialized" );
return -1;
}
player_s* current;
current = __player_get_item(uid);
if (NULL == current) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Player ERROR] uid(%d) is not valid", uid);
+ SLOG(LOG_ERROR, get_tag(), "[Player ERROR] uid(%d) is not valid", uid);
return -1;
}
MMPlayerStateType player_state;
mm_player_get_state(current->player_handle, &player_state);
- SLOG(LOG_DEBUG, TAG_TTSD, "[PLAYER] Current state(%d)", player_state);
+ SLOG(LOG_DEBUG, get_tag(), "[PLAYER] Current state(%d)", player_state);
int ret = -1;
if (MM_PLAYER_STATE_PAUSED == player_state) {
/* Current state need load and play */
ret = ttsd_player_next_play(uid);
if (0 != ret) {
- SLOG(LOG_ERROR, TAG_TTSD, "[player] Fail to next play in resume function");
+ SLOG(LOG_ERROR, get_tag(), "[player] Fail to next play in resume function");
}
} else {
ret = mm_player_resume(current->player_handle);
if (MM_ERROR_NONE != ret) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Player ERROR] fail mm_player_resume() : %d", ret);
+ SLOG(LOG_ERROR, get_tag(), "[Player ERROR] fail mm_player_resume() : %d", ret);
return -1;
} else {
- SLOG(LOG_DEBUG, TAG_TTSD, "[Player] Resume player");
+ SLOG(LOG_DEBUG, get_tag(), "[Player] Resume player");
}
g_playing_info = current;
}
} else {
- SLOG(LOG_WARN, TAG_TTSD, "[Player WARNING] Current uid is NOT paused state.");
+ SLOG(LOG_WARN, get_tag(), "[Player WARNING] Current uid is NOT paused state.");
}
return 0;
int ttsd_player_get_current_client()
{
if (false == g_player_init) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Player ERROR] Not Initialized" );
+ SLOG(LOG_ERROR, get_tag(), "[Player ERROR] Not Initialized" );
return -1;
}
if (NULL != g_playing_info)
return g_playing_info->uid;
- SLOG(LOG_WARN, TAG_TTSD, "[Player WARNING] No current player");
+ SLOG(LOG_WARN, get_tag(), "[Player WARNING] No current player");
return 0;
}
int ttsd_player_get_current_utterance_id(const int uid)
{
- SLOG(LOG_DEBUG, TAG_TTSD, "[Player] get current utt id : uid(%d)", uid );
+ SLOG(LOG_DEBUG, get_tag(), "[Player] get current utt id : uid(%d)", uid );
if (false == g_player_init) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Player ERROR] Not Initialized" );
+ SLOG(LOG_ERROR, get_tag(), "[Player ERROR] Not Initialized" );
return -1;
}
player_s* current;
current = __player_get_item(uid);
if (NULL == current) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Player ERROR] uid(%d) is not valid", uid);
+ SLOG(LOG_ERROR, get_tag(), "[Player ERROR] uid(%d) is not valid", uid);
return -1;
}
int ttsd_player_all_stop()
{
if (false == g_player_init) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Player ERROR] Not Initialized" );
+ SLOG(LOG_ERROR, get_tag(), "[Player ERROR] Not Initialized" );
return -1;
}
app_state_e state;
if (0 > ttsd_data_get_client_state(data->uid, &state)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[player ERROR] ttsd_player_all_stop : uid is not valid ");
+ SLOG(LOG_ERROR, get_tag(), "[player ERROR] ttsd_player_all_stop : uid is not valid ");
ttsd_player_destroy_instance(data->uid);
iter = g_list_next(iter);
continue;
/* unrealize player */
ret = mm_player_unrealize(data->player_handle);
if (MM_ERROR_NONE != ret) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Player ERROR] fail mm_player_unrealize() : %x", ret);
+ SLOG(LOG_ERROR, get_tag(), "[Player ERROR] fail mm_player_unrealize() : %x", ret);
}
data->utt_id = -1;
}
}
- SLOG(LOG_DEBUG, TAG_TTSD, "[Player SUCCESS] player all stop!! ");
+ SLOG(LOG_DEBUG, get_tag(), "[Player SUCCESS] player all stop!! ");
return 0;
}
static Eina_Bool __player_next_play(void *data)
{
- SLOG(LOG_DEBUG, TAG_TTSD, "===== PLAYER NEXT PLAY");
+ SLOG(LOG_DEBUG, get_tag(), "===== PLAYER NEXT PLAY");
int* uid = (int*)data;
if (NULL == uid) {
- SLOG(LOG_ERROR, TAG_TTSD, "[PLAYER ERROR] uid is NULL");
- SLOG(LOG_DEBUG, TAG_TTSD, "=====");
- SLOG(LOG_DEBUG, TAG_TTSD, " ");
+ SLOG(LOG_ERROR, get_tag(), "[PLAYER ERROR] uid is NULL");
+ SLOG(LOG_DEBUG, get_tag(), "=====");
+ SLOG(LOG_DEBUG, get_tag(), " ");
return EINA_FALSE;
}
- SLOG(LOG_DEBUG, TAG_TTSD, "[PLAYER] uid = %d", *uid);
+ SLOG(LOG_DEBUG, get_tag(), "[PLAYER] uid = %d", *uid);
if (0 != ttsd_player_next_play(*uid)) {
- SLOG(LOG_WARN, TAG_TTSD, "[PLAYER WARNING] Fail to play next");
+ SLOG(LOG_WARN, get_tag(), "[PLAYER WARNING] Fail to play next");
}
free(uid);
- SLOG(LOG_DEBUG, TAG_TTSD, "=====");
- SLOG(LOG_DEBUG, TAG_TTSD, " ");
+ SLOG(LOG_DEBUG, get_tag(), "=====");
+ SLOG(LOG_DEBUG, get_tag(), " ");
return EINA_FALSE;
}
user_data = (user_data_s*)user_param;
if (NULL == user_data) {
- SLOG(LOG_ERROR, TAG_TTSD, "[PLAYER ERROR] user_param is NULL");
+ SLOG(LOG_ERROR, get_tag(), "[PLAYER ERROR] user_param is NULL");
return -1;
}
switch (message) {
case MM_MESSAGE_ERROR:
{
- SLOG(LOG_DEBUG, TAG_TTSD, "===== PLAYER ERROR CALLBACK");
- SLOG(LOG_ERROR, TAG_TTSD, "[PLAYER ERROR] Info : uid(%d), utt id(%d), error file(%s)", uid, utt_id, user_data->filename);
+ SLOG(LOG_DEBUG, get_tag(), "===== PLAYER ERROR CALLBACK");
+ SLOG(LOG_ERROR, get_tag(), "[PLAYER ERROR] Info : uid(%d), utt id(%d), error file(%s)", uid, utt_id, user_data->filename);
/* send error info */
g_result_callback(PLAYER_ERROR, uid, utt_id);
player_s* current;
current = __player_get_item(uid);
if (NULL == current) {
- SLOG(LOG_ERROR, TAG_TTSD, "[PLAYER ERROR] uid(%d) is NOT valid ", uid);
+ SLOG(LOG_ERROR, get_tag(), "[PLAYER ERROR] uid(%d) is NOT valid ", uid);
} else {
current->event = TTSP_RESULT_EVENT_FINISH;
}
if (NULL != g_playing_info) {
if (uid == g_playing_info->uid) {
g_playing_info = NULL;
- SLOG(LOG_WARN, TAG_TTSD, "[PLAYER] Current Player is NOT uid(%d)", uid);
+ SLOG(LOG_WARN, get_tag(), "[PLAYER] Current Player is NOT uid(%d)", uid);
}
}
- SLOG(LOG_DEBUG, TAG_TTSD, "=====");
- SLOG(LOG_DEBUG, TAG_TTSD, " ");
+ SLOG(LOG_DEBUG, get_tag(), "=====");
+ SLOG(LOG_DEBUG, get_tag(), " ");
}
break; /*MM_MESSAGE_ERROR*/
case MM_MESSAGE_END_OF_STREAM:
{
- SLOG(LOG_DEBUG, TAG_TTSD, "===== END OF STREAM CALLBACK");
+ SLOG(LOG_DEBUG, get_tag(), "===== END OF STREAM CALLBACK");
if (-1 == remove(user_data->filename)) {
- SLOG(LOG_WARN, TAG_TTSD, "[PLAYER WARNING] Fail to remove temp file", user_data->filename);
+ SLOG(LOG_WARN, get_tag(), "[PLAYER WARNING] Fail to remove temp file", user_data->filename);
}
/* Check uid */
player_s* current;
current = __player_get_item(uid);
if (NULL == current) {
- SLOG(LOG_ERROR, TAG_TTSD, "[PLAYER ERROR] uid(%d) is NOT valid", uid);
+ SLOG(LOG_ERROR, get_tag(), "[PLAYER ERROR] uid(%d) is NOT valid", uid);
if (NULL != g_playing_info) {
if (uid == g_playing_info->uid) {
g_playing_info = NULL;
- SLOG(LOG_WARN, TAG_TTSD, "[PLAYER] Current Player is NOT uid(%d)", uid);
+ SLOG(LOG_WARN, get_tag(), "[PLAYER] Current Player is NOT uid(%d)", uid);
}
}
- SLOG(LOG_DEBUG, TAG_TTSD, "=====");
- SLOG(LOG_DEBUG, TAG_TTSD, " ");
+ SLOG(LOG_DEBUG, get_tag(), "=====");
+ SLOG(LOG_DEBUG, get_tag(), " ");
return -1;
}
/* send utterence finish signal */
if (TTSP_RESULT_EVENT_FINISH == current->event) {
if (0 == ttsdc_send_utt_finish_message(pid, uid, utt_id))
- SLOG(LOG_DEBUG, TAG_TTSD, "[Send SUCCESS] Send Utterance Completed Signal : pid(%d), uid(%d), uttid(%d)", pid, uid, utt_id);
+ SLOG(LOG_DEBUG, get_tag(), "[Send SUCCESS] Send Utterance Completed Signal : pid(%d), uid(%d), uttid(%d)", pid, uid, utt_id);
else
- SLOG(LOG_ERROR, TAG_TTSD, "[Send ERROR] Fail to send Utterance Completed Signal : pid(%d), uid(%d), uttid(%d)", pid, uid, utt_id);
+ SLOG(LOG_ERROR, get_tag(), "[Send ERROR] Fail to send Utterance Completed Signal : pid(%d), uid(%d), uttid(%d)", pid, uid, utt_id);
}
/* for sync problem */
int* uid_data = (int*) g_malloc0(sizeof(int));
*uid_data = uid;
- SLOG(LOG_DEBUG, TAG_TTSD, "[PLAYER] uid = %d", *uid_data);
+ SLOG(LOG_DEBUG, get_tag(), "[PLAYER] uid = %d", *uid_data);
ecore_timer_add(0, __player_next_play, (void*)uid_data);
}
- SLOG(LOG_DEBUG, TAG_TTSD, "=====");
- SLOG(LOG_DEBUG, TAG_TTSD, " ");
+ SLOG(LOG_DEBUG, get_tag(), "=====");
+ SLOG(LOG_DEBUG, get_tag(), " ");
}
break; /*MM_MESSAGE_END_OF_STREAM*/
case MM_MESSAGE_STATE_INTERRUPTED:
if (MM_PLAYER_STATE_PAUSED == msg->state.current) {
- SLOG(LOG_DEBUG, TAG_TTSD, "===== INTERRUPTED CALLBACK");
+ SLOG(LOG_DEBUG, get_tag(), "===== INTERRUPTED CALLBACK");
ttsd_data_set_client_state(uid, APP_STATE_PAUSED);
/* send message to client about changing state */
ttsdc_send_set_state_message (pid, uid, APP_STATE_PAUSED);
- SLOG(LOG_DEBUG, TAG_TTSD, "=====");
- SLOG(LOG_DEBUG, TAG_TTSD, " ");
+ SLOG(LOG_DEBUG, get_tag(), "=====");
+ SLOG(LOG_DEBUG, get_tag(), " ");
}
break;
strcpy(postfix, "amr");
break;
default:
- SLOG(LOG_ERROR, TAG_TTSD, "[Player ERROR] Audio type(%d) is NOT valid", data.audio_type);
+ SLOG(LOG_ERROR, get_tag(), "[Player ERROR] Audio type(%d) is NOT valid", data.audio_type);
return -1;
}
char* temp;
temp = (char*)g_malloc0(sizeof(char) * FILE_PATH_SIZE);
if (NULL == temp) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Player Error] make buf is failed");
+ SLOG(LOG_ERROR, get_tag(), "[Player Error] make buf is failed");
return -1;
}
fp = fopen(temp, "wb");
if (fp == NULL) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Player ERROR] temp file open error");
+ SLOG(LOG_ERROR, get_tag(), "[Player ERROR] temp file open error");
if (NULL != temp)
g_free(temp);
return -1;
}
if (0 >= fwrite(&header, sizeof(WavHeader), 1, fp)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Player ERROR] fail to write wav header to file");
+ SLOG(LOG_ERROR, get_tag(), "[Player ERROR] fail to write wav header to file");
fclose(fp);
if (NULL != temp)
g_free(temp);
if (size <= 0) {
size = fwrite("0000000000", DEFAULT_FILE_SIZE, 1, fp);
if (size <= 0) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Player ERROR] Fail to write date");
+ SLOG(LOG_ERROR, get_tag(), "[Player ERROR] Fail to write date");
fclose(fp);
if (NULL != temp)
g_free(temp);
fclose(fp);
*filename = temp;
- SLOG(LOG_DEBUG, TAG_TTSD, " ");
- SLOG(LOG_DEBUG, TAG_TTSD, "Filepath : %s ", *filename);
- SLOG(LOG_DEBUG, TAG_TTSD, "Header : Data size(%d), Sample rate(%d), Channel(%d) ", data.data_size, data.rate, data.channels);
+ SLOG(LOG_DEBUG, get_tag(), " ");
+ SLOG(LOG_DEBUG, get_tag(), "Filepath : %s ", *filename);
+ SLOG(LOG_DEBUG, get_tag(), "Header : Data size(%d), Sample rate(%d), Channel(%d) ", data.data_size, data.rate, data.channels);
return 0;
}
int __init_wave_header (WavHeader* hdr, size_t nsamples, size_t sampling_rate, int channel)
{
if (hdr == NULL || sampling_rate <= 0 || channel <= 0) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Player ERROR] __init_wave_header : input parameter invalid");
- SLOG(LOG_ERROR, TAG_TTSD, "[Player ERROR] hdr : %p", hdr);
- SLOG(LOG_ERROR, TAG_TTSD, "[Player ERROR] nsample : %d", nsamples);
- SLOG(LOG_ERROR, TAG_TTSD, "[Player ERROR] sampling_rate : %", sampling_rate);
- SLOG(LOG_ERROR, TAG_TTSD, "[Player ERROR] channel : %", channel);
+ SLOG(LOG_ERROR, get_tag(), "[Player ERROR] __init_wave_header : input parameter invalid");
+ SLOG(LOG_ERROR, get_tag(), "[Player ERROR] hdr : %p", hdr);
+ SLOG(LOG_ERROR, get_tag(), "[Player ERROR] nsample : %d", nsamples);
+ SLOG(LOG_ERROR, get_tag(), "[Player ERROR] sampling_rate : %", sampling_rate);
+ SLOG(LOG_ERROR, get_tag(), "[Player ERROR] channel : %", channel);
return TTSD_ERROR_INVALID_PARAMETER;
}
/* get sound data */
sound_data_s wdata;
if (0 != ttsd_data_get_sound_data(player->uid, &wdata)) {
- SLOG(LOG_WARN, TAG_TTSD, "[Player WARNING] A sound queue of current player(%d) is empty", player->uid);
+ SLOG(LOG_WARN, get_tag(), "[Player WARNING] A sound queue of current player(%d) is empty", player->uid);
return -1;
}
char* sound_file = NULL;
ret = __save_file(player->uid, g_index, wdata, &sound_file);
if (0 != ret || NULL == sound_file) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Player ERROR] fail to make sound file");
+ SLOG(LOG_ERROR, get_tag(), "[Player ERROR] fail to make sound file");
return -1;
}
memset(user_data->filename, 0, TEMP_FILE_MAX);
strncpy( user_data->filename, sound_file, strlen(sound_file) );
- SLOG(LOG_DEBUG, TAG_TTSD, "Info : uid(%d), utt(%d), filename(%s) , event(%d)",
+ SLOG(LOG_DEBUG, get_tag(), "Info : uid(%d), utt(%d), filename(%s) , event(%d)",
user_data->uid, user_data->utt_id, user_data->filename, user_data->event);
- SLOG(LOG_DEBUG, TAG_TTSD, " ");
+ SLOG(LOG_DEBUG, get_tag(), " ");
/* set callback func */
ret = mm_player_set_message_callback(player->player_handle, msg_callback, (void*)user_data);
if (MM_ERROR_NONE != ret) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Player ERROR] Fail mm_player_set_message_callback() : %x ", ret);
+ SLOG(LOG_ERROR, get_tag(), "[Player ERROR] Fail mm_player_set_message_callback() : %x ", ret);
return -1;
}
char* err_attr_name = NULL;
if (0 != access(sound_file, R_OK)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Player ERROR] Fail to read sound file (%s)", sound_file);
+ SLOG(LOG_ERROR, get_tag(), "[Player ERROR] Fail to read sound file (%s)", sound_file);
return -1;
}
if (MM_ERROR_NONE != ret) {
if (NULL != err_attr_name) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Player ERROR] Fail mm_player_set_attribute() : msg(%s), result(%x) ", err_attr_name, ret);
+ SLOG(LOG_ERROR, get_tag(), "[Player ERROR] Fail mm_player_set_attribute() : msg(%s), result(%x) ", err_attr_name, ret);
}
return -1;
}
- ret = mm_player_ignore_session(player->player_handle);
- if (MM_ERROR_NONE != ret) {
- SLOG(LOG_WARN, TAG_TTSD, "[Player WARNING] fail mm_player_ignore_session() : %x", ret);
+ if (TTSD_MODE_DEFAULT != ttsd_get_mode()) {
+ ret = mm_player_ignore_session(player->player_handle);
+ if (MM_ERROR_NONE != ret) {
+ SLOG(LOG_WARN, get_tag(), "[Player WARNING] fail mm_player_ignore_session() : %x", ret);
+ }
}
-
+
/* realize and start mm player */
ret = mm_player_realize(player->player_handle);
if (MM_ERROR_NONE != ret) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Player ERROR] fail mm_player_realize() : %x", ret);
+ SLOG(LOG_ERROR, get_tag(), "[Player ERROR] fail mm_player_realize() : %x", ret);
return -2;
}
ret = mm_player_start(player->player_handle);
if (MM_ERROR_NONE != ret) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Player ERROR] fail mm_player_start() : %x", ret);
+ SLOG(LOG_ERROR, get_tag(), "[Player ERROR] fail mm_player_start() : %x", ret);
mm_player_unrealize(player->player_handle);
return -3;
/* send utterance start message */
if (0 != ttsdc_send_utt_start_message(pid, player->uid, wdata.utt_id)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Send ERROR] Fail to send Utterance Start Signal : pid(%d), uid(%d), uttid(%d)", pid, player->uid, wdata.utt_id);
+ SLOG(LOG_ERROR, get_tag(), "[Send ERROR] Fail to send Utterance Start Signal : pid(%d), uid(%d), uttid(%d)", pid, player->uid, wdata.utt_id);
}
} else {
- SLOG(LOG_DEBUG, TAG_TTSD, "[PLAYER] Don't need to send Utterance Start Signal");
+ SLOG(LOG_DEBUG, get_tag(), "[PLAYER] Don't need to send Utterance Start Signal");
}
g_playing_info = player;
int __server_set_is_synthesizing(bool flag)
{
g_is_synthesizing = flag;
-
return 0;
}
int __server_set_is_next_synthesis(bool flag)
{
g_is_next_synthesis = flag;
-
return 0;
}
/* check if tts-engine is running */
if (true == __server_get_is_synthesizing()) {
- SLOG(LOG_DEBUG, TAG_TTSD, "[Server] TTS-engine is running ");
+ SLOG(LOG_DEBUG, get_tag(), "[Server] TTS-engine is running ");
} else {
speak_data_s sdata;
if (0 == ttsd_data_get_speak_data(uid, &sdata)) {
utterance_t* utt = (utterance_t*)g_malloc0(sizeof(utterance_t));
if (NULL == utt) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Server ERROR] Out of memory : utterance ");
+ SLOG(LOG_ERROR, get_tag(), "[Server ERROR] Out of memory : utterance ");
return TTSD_ERROR_OUT_OF_MEMORY;
}
utt->uid = uid;
utt->uttid = sdata.utt_id;
- SLOG(LOG_DEBUG, TAG_TTSD, "-----------------------------------------------------------");
- SLOG(LOG_DEBUG, TAG_TTSD, "ID : uid (%d), uttid(%d) ", utt->uid, utt->uttid );
- SLOG(LOG_DEBUG, TAG_TTSD, "Voice : langauge(%s), type(%d), speed(%d)", sdata.lang, sdata.vctype, sdata.speed);
- SLOG(LOG_DEBUG, TAG_TTSD, "Text : %s", sdata.text);
- SLOG(LOG_DEBUG, TAG_TTSD, "-----------------------------------------------------------");
+ SLOG(LOG_DEBUG, get_tag(), "-----------------------------------------------------------");
+ SLOG(LOG_DEBUG, get_tag(), "ID : uid (%d), uttid(%d) ", utt->uid, utt->uttid );
+ SLOG(LOG_DEBUG, get_tag(), "Voice : langauge(%s), type(%d), speed(%d)", sdata.lang, sdata.vctype, sdata.speed);
+ SLOG(LOG_DEBUG, get_tag(), "Text : %s", sdata.text);
+ SLOG(LOG_DEBUG, get_tag(), "-----------------------------------------------------------");
__server_set_is_synthesizing(true);
int ret = 0;
ret = ttsd_engine_start_synthesis(sdata.lang, sdata.vctype, sdata.text, sdata.speed, (void*)utt);
if (0 != ret) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Server ERROR] * FAIL to start SYNTHESIS !!!! * ");
+ SLOG(LOG_ERROR, get_tag(), "[Server ERROR][%s] * FAIL to start SYNTHESIS !!!! * ", __FUNCTION__);
__server_set_is_synthesizing(false);
g_free(utt);
+ /* mode 2 : Add text in playing state */
if (2 == mode) {
__server_send_error(uid, sdata.utt_id, TTSD_ERROR_OPERATION_FAILED);
+ //ttsd_config_save_error();
+
ttsd_server_stop(uid);
int pid = ttsd_data_get_pid(uid);
ttsdc_send_set_state_message(pid, uid, APP_STATE_READY);
}
} else {
- SLOG(LOG_DEBUG, TAG_TTSD, "[Server] SUCCESS to start synthesis");
+ SLOG(LOG_DEBUG, get_tag(), "[Server] SUCCESS to start synthesis");
}
if(sdata.text != NULL)
g_free(sdata.text);
} else {
- SLOG(LOG_DEBUG, TAG_TTSD, "[Server] Text List is EMPTY!! ");
+ SLOG(LOG_DEBUG, get_tag(), "[Server] Text List is EMPTY!! ");
}
}
int ret = 0;
if (APP_STATE_PAUSED == state) {
-
- SLOG(LOG_DEBUG, TAG_TTSD, "[Server] uid(%d) is 'Pause' state : Next step is resume player and start synthesis ", uid);
+ SLOG(LOG_DEBUG, get_tag(), "[Server] uid(%d) is 'Pause' state : Next step is resume player and start synthesis ", uid);
/* resume player and start speech synthesis */
if (0 != ttsd_player_resume(uid)) {
- SLOG(LOG_WARN, TAG_TTSD, "[Server WARNING] fail to ttsd_player_resume()");
+ SLOG(LOG_WARN, get_tag(), "[Server WARNING] fail to ttsd_player_resume()");
}
/* mode 1 for play */
ret = __server_start_synthesis(uid, 1);
} else if(APP_STATE_READY == state) {
- SLOG(LOG_DEBUG, TAG_TTSD, "[Server] uid(%d) is 'Ready' state : Next step is start synthesis ", uid);
+ SLOG(LOG_DEBUG, get_tag(), "[Server] uid(%d) is 'Ready' state : Next step is start synthesis ", uid);
/* mode 1 for play */
ret = __server_start_synthesis(uid, 1);
int __server_next_synthesis(int uid)
{
- SLOG(LOG_DEBUG, TAG_TTSD, "===== NEXT SYNTHESIS & PLAY START");
+ SLOG(LOG_DEBUG, get_tag(), "===== NEXT SYNTHESIS & PLAY START");
/* get current playing client */
int current_uid = ttsd_data_get_current_playing();
if (0 > current_uid) {
- SLOG(LOG_WARN, TAG_TTSD, "[Server WARNING] Current uid is not valid");
- SLOG(LOG_DEBUG, TAG_TTSD, "=====");
- SLOG(LOG_DEBUG, TAG_TTSD, " ");
+ SLOG(LOG_WARN, get_tag(), "[Server WARNING] Current uid is not valid");
+ SLOG(LOG_DEBUG, get_tag(), "=====");
+ SLOG(LOG_DEBUG, get_tag(), " ");
return 0;
}
if (true == __server_get_is_synthesizing()) {
- SLOG(LOG_WARN, TAG_TTSD, "[Server WARNING] Engine has already been running. ");
- SLOG(LOG_DEBUG, TAG_TTSD, "=====");
- SLOG(LOG_DEBUG, TAG_TTSD, " ");
+ SLOG(LOG_WARN, get_tag(), "[Server WARNING] Engine has already been running. ");
+ SLOG(LOG_DEBUG, get_tag(), "=====");
+ SLOG(LOG_DEBUG, get_tag(), " ");
return 0;
}
utterance_t* utt = (utterance_t*)g_malloc0(sizeof(utterance_t));
if (NULL == utt) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Server ERROR] fail to allocate memory : utterance ");
-
- __server_send_error(current_uid, sdata.utt_id, TTSD_ERROR_OUT_OF_MEMORY);
+ SLOG(LOG_ERROR, get_tag(), "[Server ERROR][%s] fail to allocate memory : utterance ", __FUNCTION__);
return TTSD_ERROR_OUT_OF_MEMORY;
}
utt->uid = current_uid;
utt->uttid = sdata.utt_id;
- SLOG(LOG_DEBUG, TAG_TTSD, "-----------------------------------------------------------");
- SLOG(LOG_DEBUG, TAG_TTSD, "ID : uid (%d), uttid(%d) ", utt->uid, utt->uttid );
- SLOG(LOG_DEBUG, TAG_TTSD, "Voice : langauge(%s), type(%d), speed(%d)", sdata.lang, sdata.vctype, sdata.speed);
- SLOG(LOG_DEBUG, TAG_TTSD, "Text : %s", sdata.text);
- SLOG(LOG_DEBUG, TAG_TTSD, "-----------------------------------------------------------");
+ SLOG(LOG_DEBUG, get_tag(), "-----------------------------------------------------------");
+ SLOG(LOG_DEBUG, get_tag(), "ID : uid (%d), uttid(%d) ", utt->uid, utt->uttid );
+ SLOG(LOG_DEBUG, get_tag(), "Voice : langauge(%s), type(%d), speed(%d)", sdata.lang, sdata.vctype, sdata.speed);
+ SLOG(LOG_DEBUG, get_tag(), "Text : %s", sdata.text);
+ SLOG(LOG_DEBUG, get_tag(), "-----------------------------------------------------------");
__server_set_is_synthesizing(true);
int ret = 0;
ret = ttsd_engine_start_synthesis(sdata.lang, sdata.vctype, sdata.text, sdata.speed, (void*)utt);
if (0 != ret) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Server ERROR] * FAIL to start SYNTHESIS !!!! * ");
+ SLOG(LOG_ERROR, get_tag(), "[Server ERROR][%s] * FAIL to start SYNTHESIS !!!! * ", __FUNCTION__);
__server_set_is_synthesizing(false);
if(sdata.text != NULL)
g_free(sdata.text);
} else {
- SLOG(LOG_DEBUG, TAG_TTSD, "[Server] --------------------");
- SLOG(LOG_DEBUG, TAG_TTSD, "[Server] Text queue is empty.");
- SLOG(LOG_DEBUG, TAG_TTSD, "[Server] --------------------");
+ SLOG(LOG_DEBUG, get_tag(), "[Server] --------------------");
+ SLOG(LOG_DEBUG, get_tag(), "[Server] Text queue is empty.");
+ SLOG(LOG_DEBUG, get_tag(), "[Server] --------------------");
}
if (0 != ttsd_player_play(current_uid)) {
- SLOG(LOG_WARN, TAG_TTSD, "[Server WARNING] __server_next_synthesis : fail ttsd_player_play() ");
+ SLOG(LOG_WARN, get_tag(), "[Server WARNING] __server_next_synthesis : fail ttsd_player_play() ");
} else {
/* success playing */
- SLOG(LOG_DEBUG, TAG_TTSD, "[Server] Success to start player");
+ SLOG(LOG_DEBUG, get_tag(), "[Server] Success to start player");
}
- SLOG(LOG_DEBUG, TAG_TTSD, "===== NEXT SYNTHESIS & PLAY END");
- SLOG(LOG_DEBUG, TAG_TTSD, " ");
+ SLOG(LOG_DEBUG, get_tag(), "===== NEXT SYNTHESIS & PLAY END");
+ SLOG(LOG_DEBUG, get_tag(), " ");
return 0;
}
int __player_result_callback(player_event_e event, int uid, int utt_id)
{
switch(event) {
+ case PLAYER_ERROR:
+ SLOG(LOG_ERROR, get_tag(), "[SERVER ERROR][%s] player result error", __FUNCTION__);
+ __server_send_error(uid, utt_id, TTSD_ERROR_OPERATION_FAILED);
+ // break;
+
case PLAYER_EMPTY_SOUND_QUEUE:
/* check whether synthesis is running */
if (false == __server_get_is_synthesizing()) {
/* check text queue is empty */
if (0 == ttsd_data_get_speak_data_size(uid) && 0 == ttsd_data_get_sound_data_size(uid)) {
- SLOG(LOG_DEBUG, TAG_TTSD, "[SERVER Callback] all play completed ");
+ SLOG(LOG_DEBUG, get_tag(), "[SERVER Callback] all play completed ");
}
}
break;
-
- case PLAYER_ERROR:
- SLOG(LOG_ERROR, TAG_TTSD, "[SERVER Callback ERROR] callback : player error ");
-
- __server_send_error(uid, utt_id, TTSD_ERROR_OPERATION_FAILED);
- break;
case PLAYER_END_OF_PLAYING:
break;
int __synthesis_result_callback(ttsp_result_event_e event, const void* data, unsigned int data_size, void *user_data)
{
- SLOG(LOG_DEBUG, TAG_TTSD, "===== SYNTHESIS RESULT CALLBACK START");
+ SLOG(LOG_DEBUG, get_tag(), "===== SYNTHESIS RESULT CALLBACK START");
utterance_t* utt_get_param;
utt_get_param = (utterance_t*)user_data;
if (NULL == utt_get_param) {
- SLOG(LOG_ERROR, TAG_TTSD, "[SERVER ERROR] User data is NULL " );
- SLOG(LOG_DEBUG, TAG_TTSD, "=====");
- SLOG(LOG_DEBUG, TAG_TTSD, " ");
+ SLOG(LOG_ERROR, get_tag(), "[SERVER ERROR] User data is NULL " );
+ SLOG(LOG_DEBUG, get_tag(), "=====");
+ SLOG(LOG_DEBUG, get_tag(), " ");
return -1;
}
/* Synthesis is success */
if (TTSP_RESULT_EVENT_START == event || TTSP_RESULT_EVENT_CONTINUE == event || TTSP_RESULT_EVENT_FINISH == event) {
- if (TTSP_RESULT_EVENT_START == event) SLOG(LOG_DEBUG, TAG_TTSD, "[SERVER] Event : TTSP_RESULT_EVENT_START");
- if (TTSP_RESULT_EVENT_CONTINUE == event) SLOG(LOG_DEBUG, TAG_TTSD, "[SERVER] Event : TTSP_RESULT_EVENT_CONTINUE");
- if (TTSP_RESULT_EVENT_FINISH == event) SLOG(LOG_DEBUG, TAG_TTSD, "[SERVER] Event : TTSP_RESULT_EVENT_FINISH");
+ if (TTSP_RESULT_EVENT_START == event) SLOG(LOG_DEBUG, get_tag(), "[SERVER] Event : TTSP_RESULT_EVENT_START");
+ if (TTSP_RESULT_EVENT_CONTINUE == event) SLOG(LOG_DEBUG, get_tag(), "[SERVER] Event : TTSP_RESULT_EVENT_CONTINUE");
+ if (TTSP_RESULT_EVENT_FINISH == event) SLOG(LOG_DEBUG, get_tag(), "[SERVER] Event : TTSP_RESULT_EVENT_FINISH");
if (false == ttsd_data_is_uttid_valid(uid, uttid)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[SERVER ERROR] uttid is NOT valid !!!! - uid(%d), uttid(%d)", uid, uttid);
- SLOG(LOG_DEBUG, TAG_TTSD, "=====");
- SLOG(LOG_DEBUG, TAG_TTSD, " ");
+ SLOG(LOG_ERROR, get_tag(), "[SERVER ERROR] uttid is NOT valid !!!! - uid(%d), uttid(%d)", uid, uttid);
+ SLOG(LOG_DEBUG, get_tag(), "=====");
+ SLOG(LOG_DEBUG, get_tag(), " ");
return 0;
}
- SLOG(LOG_DEBUG, TAG_TTSD, "[SERVER] Result Info : uid(%d), utt(%d), data(%p), data size(%d) ",
+ SLOG(LOG_DEBUG, get_tag(), "[SERVER] Result Info : uid(%d), utt(%d), data(%p), data size(%d) ",
uid, uttid, data, data_size);
/* add wav data */
int channels;
if (ttsd_engine_get_audio_format(&audio_type, &rate, &channels)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Server ERROR] Fail to get audio format ");
- SLOG(LOG_DEBUG, TAG_TTSD, "=====");
- SLOG(LOG_DEBUG, TAG_TTSD, " ");
+ SLOG(LOG_ERROR, get_tag(), "[Server ERROR] Fail to get audio format ");
+ SLOG(LOG_DEBUG, get_tag(), "=====");
+ SLOG(LOG_DEBUG, get_tag(), " ");
return -1;
}
temp_data.channels = channels;
if (0 != ttsd_data_add_sound_data(uid, temp_data)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[SERVER ERROR] Fail to add sound data : uid(%d)", utt_get_param->uid);
+ SLOG(LOG_ERROR, get_tag(), "[SERVER ERROR] Fail to add sound data : uid(%d)", utt_get_param->uid);
}
if (event == TTSP_RESULT_EVENT_FINISH) {
}
else if (event == TTSP_RESULT_EVENT_CANCEL) {
- SLOG(LOG_DEBUG, TAG_TTSD, "[SERVER] Event : TTSP_RESULT_EVENT_CANCEL");
+ SLOG(LOG_DEBUG, get_tag(), "[SERVER] Event : TTSP_RESULT_EVENT_CANCEL");
__server_set_is_synthesizing(false);
__server_set_is_next_synthesis(true);
}
else {
- SLOG(LOG_DEBUG, TAG_TTSD, "[SERVER] Event ERROR");
+ SLOG(LOG_DEBUG, get_tag(), "[SERVER] Event ERROR");
__server_set_is_synthesizing(false);
__server_set_is_next_synthesis(true);
}
free(utt_get_param);
}
- SLOG(LOG_DEBUG, TAG_TTSD, "===== SYNTHESIS RESULT CALLBACK END");
- SLOG(LOG_DEBUG, TAG_TTSD, " ");
+ SLOG(LOG_DEBUG, get_tag(), "===== SYNTHESIS RESULT CALLBACK END");
+ SLOG(LOG_DEBUG, get_tag(), " ");
return 0;
}
+bool __get_client_cb(int pid, int uid, app_state_e state, void* user_data)
+{
+ /* clear client data */
+ ttsd_data_clear_data(uid);
+ ttsd_data_set_client_state(uid, APP_STATE_READY);
+
+ /* send message */
+ if ( 0 != ttsdc_send_set_state_message(pid, uid, APP_STATE_READY)) {
+ /* remove client */
+ ttsd_data_delete_client(uid);
+ }
+
+ return true;
+}
+
+
+void __config_lang_changed_cb(const char* language, int type)
+{
+ char* out_lang;
+ ttsp_voice_type_e out_type;
+ int ret = -1;
+
+ if (true == ttsd_engine_select_valid_voice(language, type, &out_lang, &out_type)) {
+ SLOG(LOG_ERROR, get_tag(), "[Server] vaild language : lang(%s), type(%d)", out_lang, out_type);
+ ret = ttsd_engine_setting_set_default_voice(out_lang, out_type);
+ if (0 != ret)
+ SLOG(LOG_ERROR, get_tag(), "[Server ERROR] Fail to set vaild language : lang(%s), type(%d)", out_lang, out_type);
+
+ if (NULL == out_lang)
+ free(out_lang);
+ } else {
+ /* Current language is not available */
+ if (true == ttsd_engine_select_valid_voice("en_US", type, &out_lang, &out_type)) {
+ ret = ttsd_engine_setting_set_default_voice(out_lang, out_type);
+ if (0 != ret)
+ SLOG(LOG_ERROR, get_tag(), "[Server ERROR] Fail to set vaild language : lang(%s), type(%d)", out_lang, out_type);
+
+ if (NULL == out_lang)
+ free(out_lang);
+ }
+ }
+
+ return;
+}
+
+
/*
* Daemon init
*/
int ttsd_initialize()
{
- if (ttsd_config_initialize()) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Server WARNING] Fail to initialize config.");
+ if (ttsd_config_initialize(__config_lang_changed_cb)) {
+ SLOG(LOG_ERROR, get_tag(), "[Server WARNING] Fail to initialize config.");
}
/* player init */
if (ttsd_player_init(__player_result_callback)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Server ERROR] Fail to initialize player init.");
+ SLOG(LOG_ERROR, get_tag(), "[Server ERROR] Fail to initialize player init.");
return TTSD_ERROR_OPERATION_FAILED;
}
/* Engine Agent initialize */
if (0 != ttsd_engine_agent_init(__synthesis_result_callback)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Server ERROR] Fail to engine agent initialize.");
+ SLOG(LOG_ERROR, get_tag(), "[Server ERROR] Fail to engine agent initialize.");
return TTSD_ERROR_OPERATION_FAILED;
}
/* set current engine */
if (0 != ttsd_engine_agent_initialize_current_engine()) {
- SLOG(LOG_WARN, TAG_TTSD, "[Server WARNING] No Engine !!!" );
+ SLOG(LOG_WARN, get_tag(), "[Server WARNING] No Engine !!!" );
g_is_engine = false;
} else
g_is_engine = true;
+
+ return TTSD_ERROR_NONE;
+}
+int ttsd_finalize()
+{
+ ttsd_config_finalize();
+
+ ttsd_player_release();
+
+ ttsd_engine_agent_release();
return TTSD_ERROR_NONE;
}
-
bool __get_client_for_clean_up(int pid, int uid, app_state_e state, void* user_data)
{
int result = 1;
result = ttsdc_send_hello(pid, uid);
if (0 == result) {
- SLOG(LOG_DEBUG, TAG_TTSD, "[Server] uid(%d) should be removed.", uid);
+ SLOG(LOG_DEBUG, get_tag(), "[Server] uid(%d) should be removed.", uid);
ttsd_server_finalize(uid);
} else if (-1 == result) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Server ERROR] Hello result has error");
+ SLOG(LOG_ERROR, get_tag(), "[Server ERROR] Hello result has error");
}
return true;
Eina_Bool ttsd_cleanup_client(void *data)
{
- SLOG(LOG_DEBUG, TAG_TTSD, "===== CLEAN UP CLIENT START");
+ SLOG(LOG_DEBUG, get_tag(), "===== CLEAN UP CLIENT START");
ttsd_data_foreach_clients(__get_client_for_clean_up, NULL);
- SLOG(LOG_DEBUG, TAG_TTSD, "=====");
- SLOG(LOG_DEBUG, TAG_TTSD, " ");
+ SLOG(LOG_DEBUG, get_tag(), "=====");
+ SLOG(LOG_DEBUG, get_tag(), " ");
return EINA_TRUE;
}
{
if (false == g_is_engine) {
if (0 != ttsd_engine_agent_initialize_current_engine()) {
- SLOG(LOG_WARN, TAG_TTSD, "[Server WARNING] No Engine !!! " );
+ SLOG(LOG_WARN, get_tag(), "[Server WARNING] No Engine !!! " );
g_is_engine = false;
return TTSD_ERROR_ENGINE_NOT_FOUND;
}
if (-1 != ttsd_data_is_client(uid)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Server ERROR] Uid has already been registered ");
+ SLOG(LOG_ERROR, get_tag(), "[Server ERROR] Uid has already been registered ");
return TTSD_ERROR_INVALID_PARAMETER;
}
if (0 == ttsd_data_get_client_count()) {
if (0 != ttsd_engine_agent_load_current_engine()) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Server ERROR] Fail to load current engine ");
+ SLOG(LOG_ERROR, get_tag(), "[Server ERROR] Fail to load current engine ");
return TTSD_ERROR_OPERATION_FAILED;
}
+
+ /* Check system language */
+ ttsd_config_update_language();
}
if (0 != ttsd_data_new_client(pid, uid)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Server ERROR] Fail to add client info ");
+ SLOG(LOG_ERROR, get_tag(), "[Server ERROR] Fail to add client info ");
return TTSD_ERROR_OPERATION_FAILED;
}
if (0 != ttsd_player_create_instance(uid)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Server ERROR] Fail to create player ");
+ SLOG(LOG_ERROR, get_tag(), "[Server ERROR] Fail to create player ");
return TTSD_ERROR_OPERATION_FAILED;
}
static Eina_Bool __quit_ecore_loop(void *data)
{
ecore_main_loop_quit();
- SLOG(LOG_DEBUG, TAG_TTSD, "[Server] quit ecore main loop");
+ SLOG(LOG_DEBUG, get_tag(), "[Server] quit ecore main loop");
return EINA_FALSE;
}
{
app_state_e state;
if (0 > ttsd_data_get_client_state(uid, &state)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Server ERROR] ttsd_server_finalize : uid is not valid ");
+ SLOG(LOG_ERROR, get_tag(), "[Server ERROR] ttsd_server_finalize : uid is not valid ");
return TTSD_ERROR_INVALID_PARAMETER;
}
/* unload engine, if ref count of client is 0 */
if (0 == ttsd_data_get_client_count()) {
- if (0 != ttsd_engine_agent_release()) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Server ERROR] fail to release engine agent");
- } else {
- SLOG(LOG_DEBUG, TAG_TTSD, "[Server SUCCESS] release engine agent");
- }
-
ecore_timer_add(0, __quit_ecore_loop, NULL);
}
{
app_state_e state;
if (0 > ttsd_data_get_client_state(uid, &state)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Server ERROR] ttsd_server_add_queue : uid is not valid ");
+ SLOG(LOG_ERROR, get_tag(), "[Server ERROR] ttsd_server_add_queue : uid is not valid ");
return TTSD_ERROR_INVALID_PARAMETER;
}
char* temp_lang = NULL;
ttsp_voice_type_e temp_type;
if (true != ttsd_engine_select_valid_voice((const char*)lang, (const ttsp_voice_type_e)voice_type, &temp_lang, &temp_type)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Server ERROR] Fail to select valid voice ");
+ SLOG(LOG_ERROR, get_tag(), "[Server ERROR] Fail to select valid voice ");
return TTSD_ERROR_INVALID_VOICE;
} else {
if (NULL == temp_lang)
/* if state is APP_STATE_READY , APP_STATE_PAUSED , only need to add speak data to queue*/
if (0 != ttsd_data_add_speak_data(uid, data)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Server ERROR] ttsd_server_add_queue : Current state of uid is not 'ready' ");
+ SLOG(LOG_ERROR, get_tag(), "[Server ERROR] ttsd_server_add_queue : Current state of uid is not 'ready' ");
return TTSD_ERROR_OPERATION_FAILED;
}
/* check if engine use network */
if (ttsd_engine_agent_need_network()) {
if (false == ttsd_network_is_connected()) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Server ERROR] Disconnect network. Current engine needs network.");
+ SLOG(LOG_ERROR, get_tag(), "[Server ERROR] Disconnect network. Current engine needs network.");
return TTSD_ERROR_OPERATION_FAILED;
}
}
/* mode 2 for add text */
if (0 != __server_start_synthesis(uid, 2)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Server ERROR] fail to schedule synthesis : uid(%d)", uid);
+ SLOG(LOG_ERROR, get_tag(), "[Server ERROR] fail to schedule synthesis : uid(%d)", uid);
return TTSD_ERROR_OPERATION_FAILED;
}
}
{
app_state_e state;
if (0 > ttsd_data_get_client_state(uid, &state)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Server ERROR] uid(%d) is NOT valid ", uid);
+ SLOG(LOG_ERROR, get_tag(), "[Server ERROR] uid(%d) is NOT valid ", uid);
return TTSD_ERROR_INVALID_PARAMETER;
}
if (APP_STATE_PLAYING == state) {
- SLOG(LOG_WARN, TAG_TTSD, "[Server WARNING] Current state(%d) is 'play' ", uid);
+ SLOG(LOG_WARN, get_tag(), "[Server WARNING] Current state(%d) is 'play' ", uid);
return TTSD_ERROR_NONE;
}
/* check if engine use network */
if (ttsd_engine_agent_need_network()) {
if (false == ttsd_network_is_connected()) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Server ERROR] Disconnect network. Current engine needs network service!!!.");
+ SLOG(LOG_ERROR, get_tag(), "[Server ERROR] Disconnect network. Current engine needs network service!!!.");
return TTSD_ERROR_OUT_OF_NETWORK;
}
}
if (uid != current_uid && -1 != current_uid) {
/* Send interrupt message */
- SLOG(LOG_DEBUG, TAG_TTSD, "[Server] Old uid(%d) will be interrupted into 'Pause' state ", current_uid);
+ SLOG(LOG_DEBUG, get_tag(), "[Server] Old uid(%d) will be interrupted into 'Pause' state ", current_uid);
/* pause player */
if (0 != ttsd_player_pause(current_uid)) {
- SLOG(LOG_WARN, TAG_TTSD, "[Server ERROR] fail to ttsd_player_pause() : uid (%d)", current_uid);
+ SLOG(LOG_WARN, get_tag(), "[Server ERROR] fail to ttsd_player_pause() : uid (%d)", current_uid);
}
/* change state */
/* Change current play */
if (0 != ttsd_data_set_client_state(uid, APP_STATE_PLAYING)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Server ERROR] Fail to set state : uid(%d)", uid);
+ SLOG(LOG_ERROR, get_tag(), "[Server ERROR] Fail to set state : uid(%d)", uid);
return TTSD_ERROR_OPERATION_FAILED;
}
if (0 != __server_play_internal(uid, state)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Server ERROR] Fail to start synthesis : uid(%d)", uid);
+ SLOG(LOG_ERROR, get_tag(), "[Server ERROR] Fail to start synthesis : uid(%d)", uid);
return TTSD_ERROR_OPERATION_FAILED;
}
{
app_state_e state;
if (0 > ttsd_data_get_client_state(uid, &state)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Server ERROR] uid is not valid ");
+ SLOG(LOG_ERROR, get_tag(), "[Server ERROR] uid is not valid ");
return TTSD_ERROR_INVALID_PARAMETER;
}
ttsd_data_set_client_state(uid, APP_STATE_READY);
if (0 != ttsd_player_stop(uid))
- SLOG(LOG_WARN, TAG_TTSD, "[Server] Fail to ttsd_player_stop()");
+ SLOG(LOG_WARN, get_tag(), "[Server] Fail to ttsd_player_stop()");
if (true == __server_get_is_synthesizing()) {
- SLOG(LOG_DEBUG, TAG_TTSD, "[Server] TTS-engine is running ");
+ SLOG(LOG_DEBUG, get_tag(), "[Server] TTS-engine is running ");
int ret = 0;
ret = ttsd_engine_cancel_synthesis();
if (0 != ret)
- SLOG(LOG_ERROR, TAG_TTSD, "[Server ERROR] Fail to cancel synthesis : ret(%d)", ret);
+ SLOG(LOG_ERROR, get_tag(), "[Server ERROR] Fail to cancel synthesis : ret(%d)", ret);
__server_set_is_synthesizing(false);
}
} else {
- SLOG(LOG_WARN, TAG_TTSD, "[Server WARNING] Current state is 'ready' ");
+ SLOG(LOG_WARN, get_tag(), "[Server WARNING] Current state is 'ready' ");
}
return TTSD_ERROR_NONE;
{
app_state_e state;
if (0 > ttsd_data_get_client_state(uid, &state)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Server ERROR] ttsd_server_pause : uid is not valid ");
+ SLOG(LOG_ERROR, get_tag(), "[Server ERROR] ttsd_server_pause : uid is not valid ");
return TTSD_ERROR_INVALID_PARAMETER;
}
if (APP_STATE_PLAYING != state) {
- SLOG(LOG_WARN, TAG_TTSD, "[Server WARNING] Current state is not 'play' ");
+ SLOG(LOG_WARN, get_tag(), "[Server WARNING] Current state is not 'play' ");
return TTSD_ERROR_INVALID_STATE;
}
int ret = 0;
ret = ttsd_player_pause(uid);
if (0 != ret) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Server ERROR] fail player_pause() : ret(%d)", ret);
+ SLOG(LOG_ERROR, get_tag(), "[Server ERROR] fail player_pause() : ret(%d)", ret);
return TTSD_ERROR_OPERATION_FAILED;
}
{
app_state_e state;
if (0 > ttsd_data_get_client_state(uid, &state)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Server ERROR] uid is not valid ");
+ SLOG(LOG_ERROR, get_tag(), "[Server ERROR] uid is not valid ");
return TTSD_ERROR_INVALID_PARAMETER;
}
/* get voice list*/
if (0 != ttsd_engine_get_voice_list(voice_list)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Server ERROR] Fail ttsd_server_get_support_voices() ");
+ SLOG(LOG_ERROR, get_tag(), "[Server ERROR] Fail ttsd_server_get_support_voices() ");
return TTSD_ERROR_OPERATION_FAILED;
}
- SLOG(LOG_DEBUG, TAG_TTSD, "[Server SUCCESS] Get supported voices ");
+ SLOG(LOG_DEBUG, get_tag(), "[Server SUCCESS] Get supported voices ");
return TTSD_ERROR_NONE;
}
{
app_state_e state;
if (0 > ttsd_data_get_client_state(uid, &state)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Server ERROR] ttsd_server_get_current_voice : uid is not valid ");
+ SLOG(LOG_ERROR, get_tag(), "[Server ERROR] ttsd_server_get_current_voice : uid is not valid ");
return TTSD_ERROR_INVALID_PARAMETER;
}
/* get current voice */
int ret = ttsd_engine_get_default_voice(language, (ttsp_voice_type_e*)voice_type);
if (0 != ret) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Server ERROR] fail ttsd_server_get_support_voices() ");
+ SLOG(LOG_ERROR, get_tag(), "[Server ERROR] fail ttsd_server_get_support_voices() ");
return ret;
}
- SLOG(LOG_DEBUG, TAG_TTSD, "[Server] Get default language (%s), voice type(%d) ", *language, *voice_type);
+ SLOG(LOG_DEBUG, get_tag(), "[Server] Get default language (%s), voice type(%d) ", *language, *voice_type);
return TTSD_ERROR_NONE;
}
{
if (false == g_is_engine) {
if (0 != ttsd_engine_agent_initialize_current_engine()) {
- SLOG(LOG_WARN, TAG_TTSD, "[Server Setting WARNING] No Engine !!! " );
+ SLOG(LOG_WARN, get_tag(), "[Server Setting WARNING] No Engine !!! " );
g_is_engine = false;
return TTSD_ERROR_ENGINE_NOT_FOUND;
} else {
}
if (-1 != ttsd_setting_data_is_setting(uid)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Server Setting ERROR] pid has already been registered ");
+ SLOG(LOG_ERROR, get_tag(), "[Server Setting ERROR] pid has already been registered ");
return TTSD_ERROR_INVALID_PARAMETER;
}
if (0 == ttsd_data_get_client_count()) {
if( 0 != ttsd_engine_agent_load_current_engine() ) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Server Setting ERROR] Fail to load current engine ");
+ SLOG(LOG_ERROR, get_tag(), "[Server Setting ERROR] Fail to load current engine ");
return TTSD_ERROR_OPERATION_FAILED;
}
}
/* register pid */
if (0 != ttsd_setting_data_add(uid)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Server Setting ERROR] Fail to add client info ");
+ SLOG(LOG_ERROR, get_tag(), "[Server Setting ERROR] Fail to add client info ");
return TTSD_ERROR_OPERATION_FAILED;
}
int ttsd_server_setting_finalize(int uid)
{
if (-1 == ttsd_setting_data_is_setting(uid)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Server Setting ERROR] uid is not valid (%s)", uid);
+ SLOG(LOG_ERROR, get_tag(), "[Server Setting ERROR] uid is not valid (%s)", uid);
return TTSD_ERROR_INVALID_PARAMETER;
}
ttsd_setting_data_delete(uid);
/* unload engine, if ref count of client is 0 */
- if (0 == ttsd_data_get_client_count())
- {
- if (0 != ttsd_engine_agent_release()) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Server Setting ERROR] Fail to release engine agent");
- } else {
- SLOG(LOG_DEBUG, TAG_TTSD, "[Server Setting SUCCESS] Release engine agent");
- }
+ if (0 == ttsd_data_get_client_count()) {
ecore_timer_add(0, __quit_ecore_loop, NULL);
}
int ttsd_server_setting_get_engine_list(int uid, GList** engine_list)
{
if (-1 == ttsd_setting_data_is_setting(uid)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Server Setting ERROR] uid is not valid (%s)", uid);
+ SLOG(LOG_ERROR, get_tag(), "[Server Setting ERROR] uid is not valid (%s)", uid);
return TTSD_ERROR_INVALID_PARAMETER;
}
int ret = 0;
ret = ttsd_engine_setting_get_engine_list(engine_list);
if (0 != ret) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Server Setting ERROR] fail to get engine list : result(%d)", ret);
+ SLOG(LOG_ERROR, get_tag(), "[Server Setting ERROR] fail to get engine list : result(%d)", ret);
return ret;
}
int ttsd_server_setting_get_current_engine(int uid, char** engine_id)
{
if (-1 == ttsd_setting_data_is_setting(uid)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Server Setting ERROR] uid is not valid (%s)", uid);
+ SLOG(LOG_ERROR, get_tag(), "[Server Setting ERROR] uid is not valid (%s)", uid);
return TTSD_ERROR_INVALID_PARAMETER;
}
int ret = 0;
ret = ttsd_engine_setting_get_engine(engine_id);
if (0 != ret) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Server Setting ERROR] Fail to get current engine : result(%d) ", ret);
+ SLOG(LOG_ERROR, get_tag(), "[Server Setting ERROR] Fail to get current engine : result(%d) ", ret);
return ret;
}
-
return TTSD_ERROR_NONE;
}
-bool __get_client_cb(int pid, int uid, app_state_e state, void* user_data)
-{
- /* clear client data */
- ttsd_data_clear_data(uid);
- ttsd_data_set_client_state(uid, APP_STATE_READY);
-
- /* send message */
- if ( 0 != ttsdc_send_set_state_message(pid, uid, APP_STATE_READY)) {
- /* remove client */
- ttsd_data_delete_client(uid);
- }
-
- return true;
-}
-
int ttsd_server_setting_set_current_engine(int uid, const char* engine_id)
{
/* check if uid is valid */
if (-1 == ttsd_setting_data_is_setting(uid)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Server Setting ERROR] uid is not valid (%s)", uid);
+ SLOG(LOG_ERROR, get_tag(), "[Server Setting ERROR] uid is not valid (%s)", uid);
return TTSD_ERROR_INVALID_PARAMETER;
}
if (true == ttsd_engine_agent_is_same_engine(engine_id)) {
- SLOG(LOG_DEBUG, TAG_TTSD, "[Server Setting] new engine is the same as current engine ");
+ SLOG(LOG_DEBUG, get_tag(), "[Server Setting] new engine is the same as current engine ");
return TTSD_ERROR_NONE;
}
int ret = 0;
ret = ttsd_engine_setting_set_engine(engine_id);
if (0 != ret) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Server Setting ERROR] fail to set current engine : result(%d) ", ret);
+ SLOG(LOG_ERROR, get_tag(), "[Server Setting ERROR] fail to set current engine : result(%d) ", ret);
return ret;
}
{
/* check if uid is valid */
if (-1 == ttsd_setting_data_is_setting(uid)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Server Setting ERROR] uid is not valid (%s)", uid);
+ SLOG(LOG_ERROR, get_tag(), "[Server Setting ERROR] uid is not valid (%s)", uid);
return TTSD_ERROR_INVALID_PARAMETER;
}
int ret = 0;
ret = ttsd_engine_setting_get_voice_list(engine_id, voice_list);
if (0 != ret) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Server Setting ERROR] Fail to get voice list : result(%d)", ret);
+ SLOG(LOG_ERROR, get_tag(), "[Server Setting ERROR] Fail to get voice list : result(%d)", ret);
return ret;
}
{
/* check if uid is valid */
if (-1 == ttsd_setting_data_is_setting(uid)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Server Setting ERROR] uid is not valid (%s)", uid);
+ SLOG(LOG_ERROR, get_tag(), "[Server Setting ERROR] uid is not valid (%s)", uid);
return TTSD_ERROR_INVALID_PARAMETER;
}
int ret = 0;
ret = ttsd_engine_setting_get_default_voice(language, vctype);
if (0 != ret) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Server Setting ERROR] Fail to get default voice : result(%d) ", ret);
+ SLOG(LOG_ERROR, get_tag(), "[Server Setting ERROR] Fail to get default voice : result(%d) ", ret);
return ret;
}
{
/* check if uid is valid */
if (-1 == ttsd_setting_data_is_setting(uid)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Server Setting ERROR] uid is not valid (%s)", uid);
+ SLOG(LOG_ERROR, get_tag(), "[Server Setting ERROR] uid is not valid (%s)", uid);
return TTSD_ERROR_INVALID_PARAMETER;
}
int ret = 0;
ret = ttsd_engine_setting_set_default_voice((const char*)language, (const ttsp_voice_type_e)vctype);
if (0 != ret) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Server Setting ERROR] fail to set default voice : result(%d) ", ret);
+ SLOG(LOG_ERROR, get_tag(), "[Server Setting ERROR] fail to set default voice : result(%d) ", ret);
return ret;
}
{
/* check if uid is valid */
if (-1 == ttsd_setting_data_is_setting(uid)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Server Setting ERROR] uid is not valid (%s)", uid);
+ SLOG(LOG_ERROR, get_tag(), "[Server Setting ERROR] uid is not valid (%s)", uid);
return TTSD_ERROR_INVALID_PARAMETER;
}
int ret = 0;
ret = ttsd_engine_setting_get_engine_setting_info(engine_id, engine_setting_list);
if (0 != ret) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Server Setting ERROR] fail to get engine setting info : result(%d)", ret);
+ SLOG(LOG_ERROR, get_tag(), "[Server Setting ERROR] fail to get engine setting info : result(%d)", ret);
return ret;
}
{
/* check if uid is valid */
if (-1 == ttsd_setting_data_is_setting(uid)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Server Setting ERROR] uid is not valid (%s)", uid);
+ SLOG(LOG_ERROR, get_tag(), "[Server Setting ERROR] uid is not valid (%s)", uid);
return TTSD_ERROR_INVALID_PARAMETER;
}
int ret = 0;
ret = ttsd_engine_setting_set_engine_setting(key, value);
if (0 != ret) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Server Setting ERROR] fail to set engine setting info : result(%d)", ret);
+ SLOG(LOG_ERROR, get_tag(), "[Server Setting ERROR] fail to set engine setting info : result(%d)", ret);
return ret;
}
{
/* check if uid is valid */
if (-1 == ttsd_setting_data_is_setting(uid)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Server Setting ERROR] uid is not valid (%s)", uid);
+ SLOG(LOG_ERROR, get_tag(), "[Server Setting ERROR] uid is not valid (%s)", uid);
return TTSD_ERROR_INVALID_PARAMETER;
}
int ret = 0;
ret = ttsd_engine_setting_get_default_speed((ttsp_speed_e*)default_speed);
if (0 != ret) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Server Setting ERROR] fail to get default speed : result(%d)", ret);
+ SLOG(LOG_ERROR, get_tag(), "[Server Setting ERROR] fail to get default speed : result(%d)", ret);
return ret;
}
{
/* check if uid is valid */
if (-1 == ttsd_setting_data_is_setting(uid)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Server Setting ERROR] uid is not valid (%s)", uid);
+ SLOG(LOG_ERROR, get_tag(), "[Server Setting ERROR] uid is not valid (%s)", uid);
return TTSD_ERROR_INVALID_PARAMETER;
}
int ret = 0;
ret = ttsd_engine_setting_set_default_speed((ttsp_speed_e)default_speed);
if (0 != ret) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Server Setting ERROR] fail to set default speed : result(%d)", ret);
+ SLOG(LOG_ERROR, get_tag(), "[Server Setting ERROR] fail to set default speed : result(%d)", ret);
return ret;
}
/** Daemon initialize */
int ttsd_initialize();
+int ttsd_finalize();
+
Eina_Bool ttsd_cleanup_client(void *data);
/*
tts-server system::use_internet rw
system::use_internet tts-server w
tts-server stt-server rwx
+tts-server sys-assert::core rwx