{
if (true == g_agent_init) {
SLOG(LOG_WARN, tts_tag(), "[Engine Agent] Already initialized");
- return TTSD_ERROR_OPERATION_FAILED;
+ return TTSD_ERROR_NONE;
}
ttsengine_info_s* temp;
return TTSD_ERROR_OPERATION_FAILED;
}
- /* check whether current engine is loaded or not */
- if (true == g_engine_info->is_loaded) {
- SLOG(LOG_ERROR, tts_tag(), "[Engine Agent] Engine has already been loaded ");
- return 0;
- }
-
if (NULL == callback) {
SLOG(LOG_ERROR, tts_tag(), "[Engine Agent ERROR] Invalid engine");
return TTSD_ERROR_ENGINE_NOT_FOUND;
return TTSD_ERROR_ENGINE_NOT_FOUND;
}
+ /* check whether current engine is loaded or not */
+ if (true == g_engine_info->is_loaded) {
+ SLOG(LOG_INFO, tts_tag(), "[Engine Agent] Engine has already been loaded ");
+ return 0;
+ }
+
/* Get current engine info */
int ret = __internal_get_engine_info(callback);
if (0 != ret) {
#include "ttsd_dbus.h"
#include "ttsd_network.h"
+#include <aul.h>
#include <bundle.h>
#include <bundle_internal.h>
#include <dlog.h>
#include <Ecore.h>
+#include <vconf.h>
#include "ttse.h"
#include "ttse_internal.h"
return;
}
+static bool __is_default_engine()
+{
+ char* engine = NULL;
+ engine = vconf_get_str(VCONFKEY_TTS_ENGINE_DEFAULT);
+ if (NULL == engine) {
+ SLOG(LOG_ERROR, tts_tag(), "[Server ERROR] Fail to get sting for vc engine");
+ return FALSE;
+ }
+
+ char appid[1024] = {'\0', };
+ if (0 != aul_app_get_appid_bypid(getpid(), appid, sizeof(appid) - 1)) {
+ SLOG(LOG_ERROR, tts_tag(), "[Server ERROR] Fail to get callee appid by pid");
+ }
+
+ SLOG(LOG_DEBUG, tts_tag(), "[Server] TTS Default Engine(%s), appId(%s)", engine, appid);
+ if (0 == strncmp(engine, appid, strlen(engine))) {
+ free(engine);
+ return TRUE;
+ }
+ free(engine);
+ return FALSE;
+}
+
int ttse_main(int argc, char** argv, ttse_request_callback_s *callback)
{
bundle *b = NULL;
ret = ttsd_initialize(callback);
if (0 != ret) {
SLOG(LOG_ERROR, tts_tag(), "[ERROR] Fail to initialize");
- ttsd_dbus_close_connection();
ecore_shutdown();
return ret;
}
- if (0 != ttsd_dbus_open_connection()) {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] Fail to open dbus connection");
- ecore_shutdown();
- return TTSE_ERROR_OPERATION_FAILED;
+ if (TRUE == __is_default_engine()) {
+ if (0 != ttsd_dbus_open_connection()) {
+ SLOG(LOG_ERROR, tts_tag(), "[ERROR] Fail to open dbus connection");
+ ecore_shutdown();
+ return TTSE_ERROR_OPERATION_FAILED;
+ }
}
if (0 != ttsd_network_initialize()) {