/*
-* Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+* Copyright (c) 2012 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
#include <sys/wait.h>
+#include <Ecore.h>
#include "tts_main.h"
#include "tts_client.h"
#include "tts_dbus.h"
#define MAX_TEXT_COUNT 1000
-#define CONNECTION_RETRY_COUNT 2
+
+static bool g_is_daemon_started = false;
/* Function definition */
-int __tts_check_tts_daemon();
+static int __tts_check_tts_daemon();
+static Eina_Bool __tts_notify_state_changed(void *data);
+static Eina_Bool __tts_notify_error(void *data);
int tts_create(tts_h* tts)
{
- int ret = 0;
-
SLOG(LOG_DEBUG, TAG_TTSC, "===== Create TTS");
/* check param */
}
}
- /* Send hello */
- if (0 != tts_dbus_request_hello()) {
- __tts_check_tts_daemon();
- }
-
if (0 != tts_client_new(tts)) {
SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to create client!!!!!");
SLOG(LOG_DEBUG, TAG_TTSC, "=====");
return TTS_ERROR_OUT_OF_MEMORY;
}
- /* do request initialize */
- int i = 1;
- while(1) {
- ret = tts_dbus_request_initialize((*tts)->handle);
-
- if (TTS_ERROR_ENGINE_NOT_FOUND == ret) {
- tts_client_destroy(*tts);
- SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Engine not found");
- SLOG(LOG_DEBUG, TAG_TTSC, "=====");
- SLOG(LOG_DEBUG, TAG_TTSC, " ");
- return ret;
- } else if (TTS_ERROR_NONE != ret) {
- usleep(1);
- if (i == CONNECTION_RETRY_COUNT) {
- SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to connection");
- SLOG(LOG_DEBUG, TAG_TTSC, "=====");
- SLOG(LOG_DEBUG, TAG_TTSC, " ");
- return TTS_ERROR_TIMED_OUT;
- }
- i++;
- } else {
- /* success to connect tts-daemon */
- break;
- }
- }
-
- SLOG(LOG_DEBUG, TAG_TTSC, "[SUCCESS] uid(%d)", (*tts)->handle);
-
SLOG(LOG_DEBUG, TAG_TTSC, "=====");
SLOG(LOG_DEBUG, TAG_TTSC, " ");
return TTS_ERROR_INVALID_PARAMETER;
}
- /* Request Finalize */
- int ret = tts_dbus_request_finalize(client->uid);
- if (0 != ret) {
- SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to request finalize ");
- }
-
- /* Free resources */
- tts_client_destroy(tts);
-
+ int ret = -1;
+
+ /* check state */
+ switch (client->current_state) {
+ case TTS_STATE_PAUSED:
+ case TTS_STATE_PLAYING:
+ case TTS_STATE_READY:
+ /* Request Finalize */
+ ret = tts_dbus_request_finalize(client->uid);
+ if (0 != ret) {
+ SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to request finalize");
+ }
+ case TTS_STATE_CREATED:
+ /* Free resources */
+ tts_client_destroy(tts);
+ break;
+ }
+
if (0 == tts_client_get_size()) {
if (0 != tts_dbus_close_connection()) {
- SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to close connection\n ");
+ SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to close connection");
}
}
return TTS_ERROR_NONE;
}
+static Eina_Bool __tts_connect_daemon(void *data)
+{
+ SLOG(LOG_DEBUG, TAG_TTSC, "===== Connect daemon");
+
+ tts_h tts = (tts_h)data;
+
+ tts_client_s* client = tts_client_get(tts);
+
+ /* check handle */
+ if (NULL == client) {
+ SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] A handle is not valid");
+ SLOG(LOG_DEBUG, TAG_TTSC, "=====");
+ SLOG(LOG_DEBUG, TAG_TTSC, " ");
+ return EINA_FALSE;
+ }
+
+ /* Send hello */
+ if (0 != tts_dbus_request_hello()) {
+ if (false == g_is_daemon_started) {
+ g_is_daemon_started = true;
+ __tts_check_tts_daemon();
+ }
+ return EINA_TRUE;
+ }
+
+ /* do request initialize */
+ int ret = -1;
+
+ ret = tts_dbus_request_initialize(client->uid);
+
+ if (TTS_ERROR_ENGINE_NOT_FOUND == ret) {
+ SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Engine not found");
+
+ client->reason = TTS_ERROR_ENGINE_NOT_FOUND;
+ client->utt_id = -1;
+
+ ecore_timer_add(0, __tts_notify_error, (void*)client->tts);
+ return EINA_FALSE;
+
+ } else if (TTS_ERROR_NONE != ret) {
+ SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to connection");
+
+ client->reason = TTS_ERROR_TIMED_OUT;
+ client->utt_id = -1;
+
+ ecore_timer_add(0, __tts_notify_error, (void*)client->tts);
+ return EINA_FALSE;
+ } else {
+ /* success to connect tts-daemon */
+ }
+
+ client->before_state = client->current_state;
+ client->current_state = TTS_STATE_READY;
+
+ ecore_timer_add(0, __tts_notify_state_changed, (void*)client->tts);
+
+ SLOG(LOG_DEBUG, TAG_TTSC, "[SUCCESS] uid(%d)", client->uid);
+
+ SLOG(LOG_DEBUG, TAG_TTSC, "=====");
+ SLOG(LOG_DEBUG, TAG_TTSC, " ");
+
+ return EINA_FALSE;
+}
+
+
+int tts_prepare(tts_h tts)
+{
+ SLOG(LOG_DEBUG, TAG_TTSC, "===== Prepare TTS");
+
+ tts_client_s* client = tts_client_get(tts);
+
+ /* check handle */
+ if (NULL == client) {
+ SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] A handle is not available");
+ SLOG(LOG_DEBUG, TAG_TTSC, "=====");
+ SLOG(LOG_DEBUG, TAG_TTSC, " ");
+ return TTS_ERROR_INVALID_PARAMETER;
+ }
+
+ /* check state */
+ if (client->current_state != TTS_STATE_CREATED) {
+ SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Invalid State: Current state is not 'CREATED'");
+ SLOG(LOG_DEBUG, TAG_TTSC, "=====");
+ SLOG(LOG_DEBUG, TAG_TTSC, " ");
+ return TTS_ERROR_INVALID_STATE;
+ }
+
+ ecore_timer_add(0, __tts_connect_daemon, (void*)tts);
+
+ SLOG(LOG_DEBUG, TAG_TTSC, "=====");
+ SLOG(LOG_DEBUG, TAG_TTSC, " ");
+
+ return TTS_ERROR_NONE;
+}
+
+int tts_unprepare(tts_h tts)
+{
+ SLOG(LOG_DEBUG, TAG_TTSC, "===== Unprepare TTS");
+
+ tts_client_s* client = tts_client_get(tts);
+
+ /* check handle */
+ if (NULL == client) {
+ SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] A handle is not available");
+ return TTS_ERROR_INVALID_PARAMETER;
+ }
+
+ /* check state */
+ if (client->current_state != TTS_STATE_READY) {
+ SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Invalid State: Current state is not 'READY'");
+ SLOG(LOG_DEBUG, TAG_TTSC, "=====");
+ SLOG(LOG_DEBUG, TAG_TTSC, " ");
+ return TTS_ERROR_INVALID_STATE;
+ }
+
+ int ret = tts_dbus_request_finalize(client->uid);
+ if (0 != ret) {
+ SLOG(LOG_WARN, TAG_TTSC, "[ERROR] Fail to request finalize");
+ }
+
+ client->before_state = client->current_state;
+ client->current_state = TTS_STATE_CREATED;
+
+ ecore_timer_add(0, __tts_notify_state_changed, (void*)tts);
+
+ SLOG(LOG_DEBUG, TAG_TTSC, "=====");
+ SLOG(LOG_DEBUG, TAG_TTSC, " ");
+
+ return TTS_ERROR_NONE;
+}
+
int tts_foreach_supported_voices(tts_h tts, tts_supported_voice_cb callback, void* user_data)
{
SLOG(LOG_DEBUG, TAG_TTSC, "===== Foreach supported voices");
*state = client->current_state;
switch(*state) {
+ case TTS_STATE_CREATED: SLOG(LOG_DEBUG, TAG_TTSC, "Current state is 'Created'"); break;
case TTS_STATE_READY: SLOG(LOG_DEBUG, TAG_TTSC, "Current state is 'Ready'"); break;
case TTS_STATE_PLAYING: SLOG(LOG_DEBUG, TAG_TTSC, "Current state is 'Playing'"); break;
case TTS_STATE_PAUSED: SLOG(LOG_DEBUG, TAG_TTSC, "Current state is 'Paused'"); break;
return TTS_ERROR_INVALID_PARAMETER;
}
+ if (TTS_STATE_CREATED == client->current_state) {
+ SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Current state is 'CREATED'.");
+ return TTS_ERROR_INVALID_STATE;
+ }
+
/* change default language value */
char* temp = NULL;
SLOG(LOG_DEBUG, TAG_TTSC, "===== Play tts");
if (NULL == tts) {
- SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Input handle is null");
+ SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Input handle is null.");
SLOG(LOG_DEBUG, TAG_TTSC, "=====");
SLOG(LOG_DEBUG, TAG_TTSC, " ");
return TTS_ERROR_INVALID_PARAMETER;
tts_client_s* client = tts_client_get(tts);
if (NULL == client) {
- SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] A handle is not valid");
+ SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] A handle is not valid.");
SLOG(LOG_DEBUG, TAG_TTSC, "=====");
SLOG(LOG_DEBUG, TAG_TTSC, " ");
return TTS_ERROR_INVALID_PARAMETER;
}
- if (TTS_STATE_PLAYING == client->current_state) {
- SLOG(LOG_ERROR, TAG_TTSC, "Current state is 'playing'. This request should be skipped.\n");
+ if (TTS_STATE_PLAYING == client->current_state || TTS_STATE_CREATED == client->current_state) {
+ SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] The current state is invalid.");
return TTS_ERROR_INVALID_STATE;
}
int ret = 0;
ret = tts_dbus_request_play(client->uid);
if (0 != ret) {
- SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] result : %d", ret);
+ SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Request play : result(%d)", ret);
SLOG(LOG_DEBUG, TAG_TTSC, "=====");
SLOG(LOG_DEBUG, TAG_TTSC, " ");
return ret;
}
- /* change state */
+ client->before_state = client->current_state;
client->current_state = TTS_STATE_PLAYING;
+ if (NULL != client->state_changed_cb) {
+ ecore_timer_add(0, __tts_notify_state_changed, (void*)tts);
+ } else {
+ SLOG(LOG_WARN, TAG_TTSC, "[WARNING] State changed callback is null");
+ }
+
SLOG(LOG_DEBUG, TAG_TTSC, "=====");
SLOG(LOG_DEBUG, TAG_TTSC, " ");
return TTS_ERROR_INVALID_PARAMETER;
}
- SLOG(LOG_DEBUG, TAG_TTSC, "change state to ready\n");
- client->current_state = TTS_STATE_READY;
+ if (TTS_STATE_CREATED == client->current_state) {
+ SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Current state is 'CREATED'.");
+ return TTS_ERROR_INVALID_STATE;
+ }
int ret = 0;
ret = tts_dbus_request_stop(client->uid);
return ret;
}
+ client->before_state = client->current_state;
+ client->current_state = TTS_STATE_READY;
+
+ if (NULL != client->state_changed_cb) {
+ ecore_timer_add(0, __tts_notify_state_changed, (void*)tts);
+ } else {
+ SLOG(LOG_WARN, TAG_TTSC, "[WARNING] State changed callback is null");
+ }
+
SLOG(LOG_DEBUG, TAG_TTSC, "=====");
SLOG(LOG_DEBUG, TAG_TTSC, " ");
}
if (TTS_STATE_PLAYING != client->current_state) {
- SLOG(LOG_ERROR, TAG_TTSC, "Error : Current state is NOT 'playing'. So this request should be not running.\n");
+ SLOG(LOG_ERROR, TAG_TTSC, "[Error] The Current state is NOT 'playing'. So this request should be not running.");
SLOG(LOG_DEBUG, TAG_TTSC, "=====");
SLOG(LOG_DEBUG, TAG_TTSC, " ");
return TTS_ERROR_INVALID_STATE;
int ret = 0;
ret = tts_dbus_request_pause(client->uid);
if (0 != ret) {
- SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] result : %d", ret);
+ SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Request pause : result(%d)", ret);
SLOG(LOG_DEBUG, TAG_TTSC, "=====");
SLOG(LOG_DEBUG, TAG_TTSC, " ");
return ret;
}
+ client->before_state = client->current_state;
client->current_state = TTS_STATE_PAUSED;
+ if (NULL != client->state_changed_cb) {
+ ecore_timer_add(0, __tts_notify_state_changed, (void*)tts);
+ } else {
+ SLOG(LOG_WARN, TAG_TTSC, "[WARNING] State changed callback is null");
+ }
+
SLOG(LOG_DEBUG, TAG_TTSC, "=====");
SLOG(LOG_DEBUG, TAG_TTSC, " ");
return TTS_ERROR_NONE;
}
+static Eina_Bool __tts_notify_error(void *data)
+{
+ tts_h tts = (tts_h)data;
+
+ tts_client_s* client = tts_client_get(tts);
+
+ /* check handle */
+ if (NULL == client) {
+ SLOG(LOG_WARN, TAG_TTSC, "Fail to notify error : A handle is not valid");
+ return EINA_FALSE;
+ }
+
+ if (NULL != client->error_cb) {
+ SLOG(LOG_DEBUG, TAG_TTSC, "Call callback function of error");
+ tts_client_use_callback(client);
+ client->error_cb(client->tts, client->utt_id, client->reason, client->error_user_data );
+ tts_client_not_use_callback(client);
+ } else {
+ SLOG(LOG_WARN, TAG_TTSC, "No registered callback function of error \n");
+ }
+
+ return EINA_FALSE;
+}
+
int __tts_cb_error(int uid, tts_error_e reason, int utt_id)
{
tts_client_s* client = tts_client_get_by_uid(uid);
return TTS_ERROR_INVALID_PARAMETER;
}
+ client->utt_id = utt_id;
+ client->reason = reason;
+
/* call callback function */
if (NULL != client->error_cb) {
- SLOG(LOG_DEBUG, TAG_TTSC, "Call callback function of error");
- tts_client_use_callback(client);
- client->error_cb(client->tts, utt_id, reason, client->error_user_data );
- tts_client_not_use_callback(client);
+ ecore_timer_add(0, __tts_notify_error, client->tts);
} else {
SLOG(LOG_WARN, TAG_TTSC, "No registered callback function of error \n");
}
return 0;
}
-int __tts_cb_interrupt(int uid, tts_interrupted_code_e code)
+static Eina_Bool __tts_notify_state_changed(void *data)
{
- tts_client_s* client = tts_client_get_by_uid(uid);
+ tts_h tts = (tts_h)data;
+
+ tts_client_s* client = tts_client_get(tts);
+ /* check handle */
if (NULL == client) {
- SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] A handle is not valid");
- return TTS_ERROR_INVALID_PARAMETER;
+ SLOG(LOG_WARN, TAG_TTSC, "Fail to notify error : A handle is not valid");
+ return EINA_FALSE;
}
- /* change state by interrupt code */
- if (TTS_INTERRUPTED_PAUSED == code) {
- SLOG(LOG_DEBUG, TAG_TTSC, "change state to ready");
- client->current_state = TTS_STATE_PAUSED;
- } else if (TTS_INTERRUPTED_STOPPED == code) {
- SLOG(LOG_DEBUG, TAG_TTSC, "change state to ready");
- client->current_state = TTS_STATE_READY;
+ if (NULL != client->state_changed_cb) {
+ tts_client_use_callback(client);
+ client->state_changed_cb(client->tts, client->before_state, client->current_state, client->state_changed_user_data);
+ tts_client_not_use_callback(client);
+ SLOG(LOG_DEBUG, TAG_TTSC, "State changed callback is called");
} else {
- SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Interrupt code is not available");
+ SLOG(LOG_WARN, TAG_TTSC, "[WARNING] State changed callback is null");
+ }
+
+ return EINA_FALSE;
+}
+
+int __tts_cb_set_state(int uid, int state)
+{
+ tts_client_s* client = tts_client_get_by_uid(uid);
+ if( NULL == client ) {
+ SLOG(LOG_ERROR, TAG_TTSC, "Handle not found");
return -1;
}
- /* call callback function */
- if (NULL != client->interrupted_cb) {
- SLOG(LOG_DEBUG, TAG_TTSC, "Call callback function of stopped \n");
+ tts_state_e state_from_daemon = (tts_state_e)state;
+
+ if (client->current_state == state_from_daemon) {
+ SLOG(LOG_DEBUG, TAG_TTSC, "Current state has already been %d", client->current_state);
+ return 0;
+ }
+
+ if (NULL != client->state_changed_cb) {
+ ecore_timer_add(0, __tts_notify_state_changed, client->tts);
+ } else {
+ SLOG(LOG_WARN, TAG_TTSC, "[WARNING] State changed callback is null");
+ }
+
+ client->before_state = client->current_state;
+ client->current_state = state_from_daemon;
+
+ return 0;
+}
+
+static Eina_Bool __tts_notify_utt_started(void *data)
+{
+ tts_h tts = (tts_h)data;
+
+ tts_client_s* client = tts_client_get(tts);
+
+ /* check handle */
+ if (NULL == client) {
+ SLOG(LOG_WARN, TAG_TTSC, "[WARNING] Fail to notify utt started : A handle is not valid");
+ return EINA_FALSE;
+ }
+
+ if (NULL != client->utt_started_cb) {
+ SLOG(LOG_DEBUG, TAG_TTSC, "Call callback function of utterance started \n");
tts_client_use_callback(client);
- client->interrupted_cb(client->tts, code, client->interrupted_user_data);
+ client->utt_started_cb(client->tts, client->utt_id, client->utt_started_user_data);
tts_client_not_use_callback(client);
} else {
- SLOG(LOG_WARN, TAG_TTSC, "No registered callback function of stopped \n");
+ SLOG(LOG_WARN, TAG_TTSC, "No registered callback function of utterance started \n");
}
- return 0;
+ return EINA_FALSE;
}
int __tts_cb_utt_started(int uid, int utt_id)
SLOG(LOG_DEBUG, TAG_TTSC, "utterance started : uttid(%d) \n", utt_id);
+ client->utt_id = utt_id;
+
/* call callback function */
if (NULL != client->utt_started_cb) {
- SLOG(LOG_DEBUG, TAG_TTSC, "Call callback function of utterance started \n");
- tts_client_use_callback(client);
- client->utt_started_cb(client->tts, utt_id, client->utt_started_user_data);
- tts_client_not_use_callback(client);
+ ecore_timer_add(0, __tts_notify_utt_started, client->tts);
} else {
SLOG(LOG_WARN, TAG_TTSC, "No registered callback function of utterance started \n");
}
return 0;
}
+static Eina_Bool __tts_notify_utt_completed(void *data)
+{
+ tts_h tts = (tts_h)data;
+
+ tts_client_s* client = tts_client_get(tts);
+
+ /* check handle */
+ if (NULL == client) {
+ SLOG(LOG_WARN, TAG_TTSC, "[WARNING] Fail to notify utt completed : A handle is not valid");
+ return EINA_FALSE;
+ }
+
+ if (NULL != client->utt_completeted_cb) {
+ SLOG(LOG_DEBUG, TAG_TTSC, "Call callback function of utterance completed \n");
+ tts_client_use_callback(client);
+ client->utt_completeted_cb(client->tts, client->utt_id, client->utt_completed_user_data);
+ tts_client_not_use_callback(client);
+ } else {
+ SLOG(LOG_WARN, TAG_TTSC, "No registered callback function of utterance completed \n");
+ }
+
+ return EINA_FALSE;
+}
+
int __tts_cb_utt_completed(int uid, int utt_id)
{
tts_client_s* client = tts_client_get_by_uid(uid);
SLOG(LOG_DEBUG, TAG_TTSC, "utterance completed : uttid(%d) \n", utt_id);
+ client->utt_id = utt_id;
+
/* call callback function */
if (NULL != client->utt_completeted_cb) {
- SLOG(LOG_DEBUG, TAG_TTSC, "Call callback function of utterance completed \n");
- tts_client_use_callback(client);
- client->utt_completeted_cb(client->tts, utt_id, client->utt_completed_user_data);
- tts_client_not_use_callback(client);
+ ecore_timer_add(0, __tts_notify_utt_completed, client->tts);
} else {
SLOG(LOG_WARN, TAG_TTSC, "No registered callback function of utterance completed \n");
}
return 0;
}
-int tts_set_interrupted_cb(tts_h tts, tts_interrupted_cb callback, void* user_data)
+int tts_set_state_changed_cb(tts_h tts, tts_state_changed_cb callback, void* user_data)
{
if (NULL == tts || NULL == callback) {
- SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Set interrupted cb : Input parameter is null");
+ SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Set state changed cb : Input parameter is null");
return TTS_ERROR_INVALID_PARAMETER;
}
tts_client_s* client = tts_client_get(tts);
if (NULL == client) {
- SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Set interrupted cb : A handle is not valid");
+ SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Set state changed cb : A handle is not valid");
return TTS_ERROR_INVALID_PARAMETER;
}
- if (TTS_STATE_READY != client->current_state) {
- SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Set interrupted cb : Current state is not 'ready'.");
+ if (TTS_STATE_CREATED != client->current_state) {
+ SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Set state changed cb : Current state is not 'Created'.");
return TTS_ERROR_INVALID_STATE;
}
- client->interrupted_cb = callback;
- client->interrupted_user_data = user_data;
+ client->state_changed_cb = callback;
+ client->state_changed_user_data = user_data;
- SLOG(LOG_DEBUG, TAG_TTSC, "[SUCCESS] Set interrupted cb");
+ SLOG(LOG_DEBUG, TAG_TTSC, "[SUCCESS] Set state changed cb");
return 0;
}
-int tts_unset_interrupted_cb(tts_h tts)
+int tts_unset_state_changed_cb(tts_h tts)
{
if (NULL == tts) {
- SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Unset interrupted cb : Input parameter is null");
+ SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Unset state changed cb : Input parameter is null");
return TTS_ERROR_INVALID_PARAMETER;
}
tts_client_s* client = tts_client_get(tts);
if (NULL == client) {
- SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Unset interrupted cb : A handle is not valid");
+ SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Unset state changed cb : A handle is not valid");
return TTS_ERROR_INVALID_PARAMETER;
}
- if (TTS_STATE_READY != client->current_state) {
- SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Unset interrupted cb : Current state is not 'ready'.");
+ if (TTS_STATE_CREATED != client->current_state) {
+ SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Unset state changed cb : Current state is not 'Created'.");
return TTS_ERROR_INVALID_STATE;
}
- client->interrupted_cb = NULL;
- client->interrupted_user_data = NULL;
+ client->state_changed_cb = NULL;
+ client->state_changed_user_data = NULL;
- SLOG(LOG_DEBUG, TAG_TTSC, "[SUCCESS] Unset interrupted cb");
+ SLOG(LOG_DEBUG, TAG_TTSC, "[SUCCESS] Unset state changed cb");
return 0;
}
return TTS_ERROR_INVALID_PARAMETER;
}
- if (TTS_STATE_READY != client->current_state) {
- SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Set utt started cb : Current state is not 'ready'.");
+ if (TTS_STATE_CREATED != client->current_state) {
+ SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Set utt started cb : Current state is not 'Created'.");
return TTS_ERROR_INVALID_STATE;
}
return TTS_ERROR_INVALID_PARAMETER;
}
- if (TTS_STATE_READY != client->current_state) {
- SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Unset utt started cb : Current state is not 'ready'.");
+ if (TTS_STATE_CREATED != client->current_state) {
+ SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Unset utt started cb : Current state is not 'Created'.");
return TTS_ERROR_INVALID_STATE;
}
return TTS_ERROR_INVALID_PARAMETER;
}
- if (TTS_STATE_READY != client->current_state) {
- SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Set utt completed cb : Current state is not 'ready'.");
+ if (TTS_STATE_CREATED != client->current_state) {
+ SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Set utt completed cb : Current state is not 'Created'.");
return TTS_ERROR_INVALID_STATE;
}
return TTS_ERROR_INVALID_PARAMETER;
}
- if (TTS_STATE_READY != client->current_state) {
- SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Unset utt completed cb : Current state is not 'ready'.");
+ if (TTS_STATE_CREATED != client->current_state) {
+ SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Unset utt completed cb : Current state is not 'Created'.");
return TTS_ERROR_INVALID_STATE;
}
return TTS_ERROR_INVALID_PARAMETER;
}
- if (TTS_STATE_READY != client->current_state) {
- SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Set error cb : Current state is not 'ready'.");
+ if (TTS_STATE_CREATED != client->current_state) {
+ SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Set error cb : Current state is not 'Created'.");
return TTS_ERROR_INVALID_STATE;
}
return TTS_ERROR_INVALID_PARAMETER;
}
- if (TTS_STATE_READY != client->current_state) {
- SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Unset error cb : Current state is not 'ready'.");
+ if (TTS_STATE_CREATED != client->current_state) {
+ SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Unset error cb : Current state is not 'Created'.");
return TTS_ERROR_INVALID_STATE;
}
memset(cmd, '\0', sizeof(char) * 256);
if ((fp = popen("ps -eo \"cmd\"", "r")) == NULL) {
- SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] popen error \n");
+ SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] popen error");
return FALSE;
}
if (0 == strncmp(cmd, "[tts-daemon]", strlen("[tts-daemon]")) ||
0 == strncmp(cmd, "tts-daemon", strlen("tts-daemon")) ||
0 == strncmp(cmd, "/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 !!");
fclose(fp);
return TRUE;
}
fclose(fp);
- SLOG(LOG_DEBUG, TAG_TTSC, "THERE IS NO tts-daemon !! \n");
+ SLOG(LOG_DEBUG, TAG_TTSC, "THERE IS NO tts-daemon !!");
return FALSE;
}
return;
}
-int __tts_check_tts_daemon()
+static int __tts_check_tts_daemon()
{
if (TRUE == _tts_is_alive())
return 0;
switch(pid) {
case -1:
- SLOG(LOG_ERROR, TAG_TTSC, "fail to create TTS-DAEMON \n");
+ SLOG(LOG_ERROR, TAG_TTSC, "Fail to create tts-daemon");
break;
case 0:
break;
default:
- sleep(1);
break;
}
/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2012 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.
* @brief Enumerations of speaking speed.
*/
typedef enum {
- TTS_SPEED_AUTO, /**< Speed from settings */
- TTS_SPEED_VERY_SLOW, /**< Very slow */
- TTS_SPEED_SLOW, /**< Slow */
- TTS_SPEED_NORMAL, /**< Normal */
- TTS_SPEED_FAST, /**< Fast */
- TTS_SPEED_VERY_FAST /**< Very fast */
+ TTS_SPEED_AUTO, /**< Speed from settings */
+ TTS_SPEED_VERY_SLOW, /**< Very slow */
+ TTS_SPEED_SLOW, /**< Slow */
+ TTS_SPEED_NORMAL, /**< Normal */
+ TTS_SPEED_FAST, /**< Fast */
+ TTS_SPEED_VERY_FAST /**< Very fast */
} tts_speed_e;
/**
* @brief Enumerations of voice type.
*/
typedef enum {
- TTS_VOICE_TYPE_AUTO, /**< Voice type from settings or auto selection based language */
- TTS_VOICE_TYPE_MALE, /**< Male */
- TTS_VOICE_TYPE_FEMALE, /**< Female */
- TTS_VOICE_TYPE_CHILD, /**< Child */
- TTS_VOICE_TYPE_USER1, /**< Engine defined */
- TTS_VOICE_TYPE_USER2, /**< Engine defined */
- TTS_VOICE_TYPE_USER3 /**< Engine defined */
+ TTS_VOICE_TYPE_AUTO, /**< Voice type from settings or auto selection based language */
+ TTS_VOICE_TYPE_MALE, /**< Male */
+ TTS_VOICE_TYPE_FEMALE, /**< Female */
+ TTS_VOICE_TYPE_CHILD, /**< Child */
+ TTS_VOICE_TYPE_USER1, /**< Engine defined */
+ TTS_VOICE_TYPE_USER2, /**< Engine defined */
+ TTS_VOICE_TYPE_USER3 /**< Engine defined */
} tts_voice_type_e;
/**
-* @brief Enumerations of interrupted code.
-*/
-typedef enum {
- TTS_INTERRUPTED_PAUSED = 0, /**< The current state be changed #TTS_STATE_PAUSED by the daemon */
- TTS_INTERRUPTED_STOPPED /**< The current state be changed #TTS_STATE_READY by the daemon */
-} tts_interrupted_code_e;
-
-/**
* @brief Enumerations of state.
*/
typedef enum {
- TTS_STATE_READY = 0, /**< 'READY' state */
- TTS_STATE_PLAYING, /**< 'PLAYING' state */
- TTS_STATE_PAUSED /**< 'PAUSED' state*/
+ TTS_STATE_CREATED = 0, /**< 'CREATED' state */
+ TTS_STATE_READY, /**< 'READY' state */
+ TTS_STATE_PLAYING, /**< 'PLAYING' state */
+ TTS_STATE_PAUSED /**< 'PAUSED' state*/
}tts_state_e;
/**
/**
-* @brief Called when the TTS state has changed by the daemon.
+* @brief Called when the state of TTS is changed.
*
* @details If the daemon must stop player because of changing engine and
* the daemon must pause player because of other requests, this callback function is called.
*
* @param[in] tts The handle for TTS
-* @param[in] code The interrupt type
-* @param[in] user_data The user data passed from the the callback registration function
+* @param[in] previous A previous state
+* @param[in] current A current state
+* @param[in] user_data The user data passed from the callback registration function.
*
-* @pre An application registers this callback using tts_set_interrupted_cb() to detect interrupts.
-* @post If this function is called, the TTS state will be #TTS_STATE_READY or #TTS_STATE_PAUSED.
+* @pre An application registers this callback using tts_set_state_changed_cb() to detect changing state.
*
-* @see tts_set_interrupted_cb()
-* @see tts_unset_interrupted_cb()
+* @see tts_set_state_changed_cb()
+* @see tts_unset_state_changed_cb()
*/
-typedef void (*tts_interrupted_cb)(tts_h tts, tts_interrupted_code_e code, void* user_data);
+typedef void (*tts_state_changed_cb)(tts_h tts, tts_state_e previous, tts_state_e current, void* user_data);
/**
* @brief Called when utterance has started.
*/
typedef bool(*tts_supported_voice_cb)(tts_h tts, const char* language, tts_voice_type_e voice_type, void* user_data);
+
/**
-* @brief Creates a handle for TTS and connects the daemon.
+* @brief Creates a handle for TTS.
*
* @param[out] tts The handle for TTS
*
* @return 0 on success, otherwise a negative error value
* @retval #TTS_ERROR_NONE Successful
-* @retval #TTS_ERROR_TIMED_OUT The daemon is blocked or do not exist
-* @retval #TTS_ERROR_ENGINE_NOT_FOUND No available engine \n Engine should be installed
* @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
-* @retval #TTS_ERROR_OUT_OF_MEMORY Out of memory
*
* @see tts_destroy()
*/
int tts_destroy(tts_h tts);
/**
+* @brief Connects the daemon asynchronously.
+*
+* @param[in] tts The handle for TTS
+*
+* @return 0 on success, otherwise a negative error value
+* @retval #TTS_ERROR_NONE Successful
+* @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
+* @retval #TTS_ERROR_INVALID_STATE Invalid state
+*
+* @pre The state should be #TTS_STATE_CREATED.
+* @post If this function is called, the TTS state will be #TTS_STATE_READY.
+*
+* @see tts_unprepare()
+*/
+int tts_prepare(tts_h tts);
+
+/**
+* @brief Disconnects the daemon.
+*
+* @param[in] tts The handle for TTS
+*
+* @return 0 on success, otherwise a negative error value
+* @retval #TTS_ERROR_NONE Successful
+* @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
+* @retval #STT_ERROR_INVALID_STATE Invalid state
+*
+* @pre The state should be #TTS_STATE_READY.
+* @post If this function is called, the TTS state will be #TTS_STATE_CREATED.
+*
+* @see tts_prepare()
+*/
+int tts_unprepare(tts_h tts);
+
+/**
* @brief Retrieves all supported voices of the current engine using callback function.
*
* @param[in] tts The handle for TTS
* @retval #TTS_ERROR_NONE Successful
* @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #TTS_ERROR_OPERATION_FAILED Operation failure
+*
+* @pre The state should be #TTS_STATE_READY.
* @post This function invokes tts_supported_voice_cb() repeatedly for getting voices.
*
* @see tts_get_default_voice()
* @retval #TTS_ERROR_OUT_OF_MEMORY Out of memory
* @retval #TTS_ERROR_OPERATION_FAILED Operation failure
*
+* @pre The state should be #TTS_STATE_READY.
+*
* @see tts_foreach_supported_voices()
*/
int tts_get_default_voice(tts_h tts, char** language, tts_voice_type_e* voice_type);
* @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #TTS_ERROR_OPERATION_FAILED Operation failure
*
+* @pre The state should be #TTS_STATE_READY.
+*
* @see tts_add_text()
*/
int tts_get_max_text_count(tts_h tts, int* count);
* @retval #TTS_ERROR_OUT_OF_MEMORY Out of memory
* @retval #TTS_ERROR_OPERATION_FAILED Operation failure
*
+* @pre The state should be #TTS_STATE_READY, #TTS_STATE_PLAYING or #TTS_STATE_PAUSED.
* @see tts_get_max_text_count()
*/
int tts_add_text(tts_h tts, const char* text, const char* language, tts_voice_type_e voice_type, tts_speed_e speed, int* utt_id);
int tts_pause(tts_h tts);
/**
-* @brief Registers a callback function for detecting player interrupted.
+* @brief Registers a callback function to be called when TTS state changes.
*
* @param[in] tts The handle for TTS
* @param[in] callback The callback function to register
* @retval #TTS_ERROR_NONE Successful
* @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
*
-* @see tts_interrupted_cb()
-* @see tts_unset_interrupted_cb()
+* @pre The state should be #TTS_STATE_CREATED.
+*
+* @see tts_state_changed_cb()
+* @see tts_unset_state_changed_cb()
*/
-int tts_set_interrupted_cb(tts_h tts, tts_interrupted_cb callback, void* user_data);
+int tts_set_state_changed_cb(tts_h tts, tts_state_changed_cb callback, void* user_data);
/**
* @brief Unregisters the callback function.
* @retval #TTS_ERROR_NONE Successful
* @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
*
-* @see tts_set_interrupted_cb()
+* @pre The state should be #TTS_STATE_CREATED.
+*
+* @see tts_set_state_changed_cb()
*/
-int tts_unset_interrupted_cb(tts_h tts);
+int tts_unset_state_changed_cb(tts_h tts);
/**
* @brief Registers a callback function for detecting utterance started.
* @retval #TTS_ERROR_NONE Successful
* @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
*
+* @pre The state should be #TTS_STATE_CREATED.
+*
* @see tts_utterance_started_cb()
* @see tts_unset_utterance_started_cb()
*/
* @retval #TTS_ERROR_NONE Successful
* @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
*
+* @pre The state should be #TTS_STATE_CREATED.
+*
* @see tts_set_utterance_started_cb()
*/
int tts_unset_utterance_started_cb(tts_h tts);
* @retval #TTS_ERROR_NONE Successful
* @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
*
+* @pre The state should be #TTS_STATE_CREATED.
+*
* @see tts_utterance_completed_cb()
* @see tts_unset_utterance_completed_cb()
*/
* @retval #TTS_ERROR_NONE Successful
* @retval #TTS_ERROR_OUT_OF_MEMORY Out of memory
*
+* @pre The state should be #TTS_STATE_CREATED.
+*
* @see tts_set_utterance_completed_cb()
*/
int tts_unset_utterance_completed_cb(tts_h tts);
* @retval #TTS_ERROR_NONE Successful
* @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
*
+* @pre The state should be #TTS_STATE_CREATED.
+*
* @see tts_error_cb()
* @see tts_unset_error_cb()
*/
* @retval #TTS_ERROR_NONE Successful
* @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
*
+* @pre The state should be #TTS_STATE_CREATED.
+*
* @see tts_set_error_cb()
*/
int tts_unset_error_cb(tts_h tts);
/*
-* Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+* Copyright (c) 2012 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
client->uid = temp->handle;
client->current_utt_id = 0;
- client->interrupted_cb = NULL;
- client->interrupted_user_data = NULL;
+ client->state_changed_cb = NULL;
+ client->state_changed_user_data = NULL;
client->utt_started_cb = NULL;
client->utt_started_user_data = NULL;
client->error_cb = NULL;
client->error_user_data = NULL;
- client->current_state = TTS_STATE_READY;
+ client->before_state = TTS_STATE_CREATED;
+ client->current_state = TTS_STATE_CREATED;
client->cb_ref_count = 0;
/*
-* Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+* Copyright (c) 2012 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
int current_utt_id;
/* callback info */
- tts_interrupted_cb interrupted_cb;
- void* interrupted_user_data;
+ tts_state_changed_cb state_changed_cb;
+ void* state_changed_user_data;
tts_utterance_started_cb utt_started_cb;
void* utt_started_user_data;
tts_utterance_completed_cb utt_completeted_cb;
void* error_user_data;
/* state */
+ tts_state_e before_state;
tts_state_e current_state;
/* semaphore */
int cb_ref_count;
+
+ /* callback data */
+ int utt_id;
+ int reason;
}tts_client_s;
int tts_client_new(tts_h* tts);
/*
-* Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+* Copyright (c) 2012 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
#include "tts_main.h"
#include "tts_dbus.h"
#include "tts_defs.h"
+#include "tts_client.h"
+#define INIT_WAITING_TIME 5000
#define WAITING_TIME 1000
static Ecore_Fd_Handler* g_fd_handler = NULL;
extern int __tts_cb_error(int uid, tts_error_e reason, int utt_id);
-extern int __tts_cb_interrupt(int uid, tts_interrupted_code_e code);
+extern int __tts_cb_set_state(int uid, int state);
extern int __tts_cb_utt_started(int uid, int utt_id);
snprintf(if_name, 64, "%s%d", TTS_CLIENT_SERVICE_INTERFACE, getpid());
/* check if the message is a signal from the correct interface and with the correct name */
- if (dbus_message_is_method_call(msg, if_name, TTS_METHOD_UTTERANCE_STARTED)) {
+ if (dbus_message_is_method_call(msg, if_name, TTSD_METHOD_HELLO)) {
+ SLOG(LOG_DEBUG, TAG_TTSC, "===== Get Hello");
+ int uid = 0;
+ int response = -1;
+
+ dbus_message_get_args(msg, &err, DBUS_TYPE_INT32, &uid, DBUS_TYPE_INVALID);
+
+ if (uid > 0) {
+ SLOG(LOG_DEBUG, TAG_TTSC, "<<<< tts get hello : uid(%d) \n", uid);
+
+ /* check uid */
+ tts_client_s* client = tts_client_get_by_uid(uid);
+ if (NULL != client)
+ response = 1;
+ else
+ response = 0;
+ } else {
+ SLOG(LOG_ERROR, TAG_TTSC, "<<<< tts get hello : invalid uid \n");
+ }
+
+ reply = dbus_message_new_method_return(msg);
+
+ if (NULL != reply) {
+ dbus_message_append_args(reply, DBUS_TYPE_INT32, &response, DBUS_TYPE_INVALID);
+
+ if (!dbus_connection_send(conn, reply, NULL))
+ SLOG(LOG_ERROR, TAG_TTSC, ">>>> tts get hello : fail to send reply");
+ else
+ SLOG(LOG_DEBUG, TAG_TTSC, ">>>> tts get hello : result(%d)", response);
+
+ dbus_connection_flush(conn);
+ dbus_message_unref(reply);
+ } else {
+ SLOG(LOG_ERROR, TAG_TTSC, ">>>> tts get hello : fail to create reply message");
+ }
+
+ SLOG(LOG_DEBUG, TAG_TTSC, "=====");
+ SLOG(LOG_DEBUG, TAG_TTSC, " ");
+ } /* TTSD_METHOD_HELLO */
+
+ else if (dbus_message_is_method_call(msg, if_name, TTSD_METHOD_UTTERANCE_STARTED)) {
SLOG(LOG_DEBUG, TAG_TTSC, "===== Get utterance started");
int uid, uttid;
dbus_message_get_args(msg, &err,
SLOG(LOG_ERROR, TAG_TTSC, "<<<< Get Utterance started - Get arguments error (%s)\n", err.message);
dbus_error_free(&err);
} else {
- SLOG(LOG_DEBUG, TAG_TTSC, "<<<< Get Utterance started signal : uid(%d), uttid(%d) \n", uid, uttid);
+ SLOG(LOG_DEBUG, TAG_TTSC, "<<<< Get Utterance started message : uid(%d), uttid(%d) \n", uid, uttid);
__tts_cb_utt_started(uid, uttid);
}
- reply = dbus_message_new_method_return(msg);
- dbus_connection_send(conn, reply, NULL);
- dbus_connection_flush(conn);
- dbus_message_unref(reply);
SLOG(LOG_DEBUG, TAG_TTSC, "=====");
SLOG(LOG_DEBUG, TAG_TTSC, " ");
}/* TTS_SIGNAL_UTTERANCE_STARTED */
- else if (dbus_message_is_method_call(msg, if_name, TTS_METHOD_UTTERANCE_COMPLETED)) {
+ else if (dbus_message_is_method_call(msg, if_name, TTSD_METHOD_UTTERANCE_COMPLETED)) {
SLOG(LOG_DEBUG, TAG_TTSC, "===== Get utterance completed");
int uid, uttid;
dbus_message_get_args(msg, &err,
SLOG(LOG_ERROR, TAG_TTSC, "<<<< Get Utterance completed - Get arguments error (%s)\n", err.message);
dbus_error_free(&err);
} else {
- SLOG(LOG_DEBUG, TAG_TTSC, "<<<< Get Utterance completed signal : uid(%d), uttid(%d) \n", uid, uttid);
+ SLOG(LOG_DEBUG, TAG_TTSC, "<<<< Get Utterance completed message : uid(%d), uttid(%d) \n", uid, uttid);
__tts_cb_utt_completed(uid, uttid);
}
- reply = dbus_message_new_method_return(msg);
- dbus_connection_send(conn, reply, NULL);
- dbus_connection_flush(conn);
- dbus_message_unref(reply);
-
SLOG(LOG_DEBUG, TAG_TTSC, "=====");
SLOG(LOG_DEBUG, TAG_TTSC, " ");
}/* TTS_SIGNAL_UTTERANCE_COMPLETED */
- else if (dbus_message_is_method_call(msg, if_name, TTS_METHOD_INTERRUPT)) {
- SLOG(LOG_DEBUG, TAG_TTSC, "===== Get interrupt callback");
+ else if (dbus_message_is_method_call(msg, if_name, TTSD_METHOD_SET_STATE)) {
+ SLOG(LOG_DEBUG, TAG_TTSC, "===== Get state changed callback");
int uid;
- int code;
+ int state;
dbus_message_get_args(msg, &err,
DBUS_TYPE_INT32, &uid,
- DBUS_TYPE_INT32, &code,
+ DBUS_TYPE_INT32, &state,
DBUS_TYPE_INVALID);
if (dbus_error_is_set(&err)) {
- SLOG(LOG_ERROR, TAG_TTSC, "<<<< Get Stop signal - Get arguments error (%s)\n", err.message);
+ SLOG(LOG_ERROR, TAG_TTSC, "<<<< Get state change - Get arguments error (%s)", err.message);
dbus_error_free(&err);
} else {
- SLOG(LOG_DEBUG, TAG_TTSC, "<<<< Get Interrupt signal : uid(%d) , interrupt code(%d)\n", uid, code);
- __tts_cb_interrupt(uid, (tts_interrupted_code_e)code);
+ SLOG(LOG_DEBUG, TAG_TTSC, "<<<< Get state change : uid(%d) , state(%d)", uid, state);
+ __tts_cb_set_state(uid, state);
}
- reply = dbus_message_new_method_return(msg);
- dbus_connection_send(conn, reply, NULL);
- dbus_connection_flush(conn);
- dbus_message_unref(reply);
-
SLOG(LOG_DEBUG, TAG_TTSC, "=====");
SLOG(LOG_DEBUG, TAG_TTSC, " ");
- } /* TTS_SIGNAL_INTERRUPT */
+ } /* TTSD_METHOD_SET_STATE */
- else if (dbus_message_is_method_call(msg, if_name, TTS_METHOD_ERROR)) {
+ else if (dbus_message_is_method_call(msg, if_name, TTSD_METHOD_ERROR)) {
SLOG(LOG_DEBUG, TAG_TTSC, "===== Get error callback");
int uid;
__tts_cb_error(uid, reason, uttid);
}
- reply = dbus_message_new_method_return(msg);
- dbus_connection_send(conn, reply, NULL);
- dbus_connection_flush(conn);
- dbus_message_unref(reply);
-
SLOG(LOG_DEBUG, TAG_TTSC, "=====");
SLOG(LOG_DEBUG, TAG_TTSC, " ");
}/* TTS_SIGNAL_ERROR */
int fd = 0;
dbus_connection_get_unix_fd(g_conn, &fd);
- g_fd_handler = ecore_main_fd_handler_add(fd, ECORE_FD_READ | ECORE_FD_ERROR | ECORE_FD_WRITE, (Ecore_Fd_Cb)listener_event_callback, g_conn, NULL, NULL);
+ g_fd_handler = ecore_main_fd_handler_add(fd, ECORE_FD_READ, (Ecore_Fd_Cb)listener_event_callback, g_conn, NULL, NULL);
if (NULL == g_fd_handler) {
SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to get fd handler from ecore \n");
DBusError err;
dbus_error_init(&err);
+ ecore_main_fd_handler_del(g_fd_handler);
+
int pid = getpid();
char service_name[64];
dbus_bus_release_name (g_conn, service_name, &err);
dbus_connection_close(g_conn);
-
+
+ g_fd_handler = NULL;
g_conn = NULL;
return 0;
DBusMessage* result_msg = NULL;
int result = 0;
- result_msg = dbus_connection_send_with_reply_and_block(g_conn, msg, 500, &err);
+ result_msg = dbus_connection_send_with_reply_and_block(g_conn, msg, WAITING_TIME, &err);
dbus_message_unref(msg);
DBusMessage* result_msg;
int result = TTS_ERROR_OPERATION_FAILED;
- result_msg = dbus_connection_send_with_reply_and_block(g_conn, msg, WAITING_TIME, &err);
+ result_msg = dbus_connection_send_with_reply_and_block(g_conn, msg, INIT_WAITING_TIME, &err);
dbus_message_unref(msg);
if (dbus_error_is_set(&err))
/*
-* Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+* Copyright (c) 2012 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
/*
-* Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+* Copyright (c) 2012 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
/*
-* Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+* Copyright (c) 2012 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
#include <sys/wait.h>
+#include <Ecore.h>
#include "tts_main.h"
#include "tts_setting.h"
#include "tts_setting_dbus.h"
-#define CONNECTION_RETRY_COUNT 2
-
-static bool g_is_setting_initialized = false;
+static bool g_is_daemon_started = false;
static int __check_tts_daemon();
+static tts_setting_state_e g_state = TTS_SETTING_STATE_NONE;
+
+static tts_setting_initialized_cb g_initialized_cb;
+static void* g_user_data;
+
+static int g_reason;
/* API Implementation */
+static Eina_Bool __tts_setting_initialized(void *data)
+{
+ g_initialized_cb(g_state, g_reason, g_user_data);
+
+ return EINA_FALSE;
+}
+
+static Eina_Bool __tts_setting_connect_daemon(void *data)
+{
+ /* Send hello */
+ if (0 != tts_setting_dbus_request_hello()) {
+ if (false == g_is_daemon_started) {
+ g_is_daemon_started = true;
+ __check_tts_daemon();
+ }
+ return EINA_TRUE;
+ }
+
+ SLOG(LOG_DEBUG, TAG_TTSC, "===== Connect daemon");
+
+ /* do request initialize */
+ int ret = -1;
+
+ ret = tts_setting_dbus_request_initialize();
+
+ if (TTS_SETTING_ERROR_ENGINE_NOT_FOUND == ret) {
+ SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Engine not found");
+ } else if (TTS_SETTING_ERROR_NONE != ret) {
+ SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to connection : %d", ret);
+ } else {
+ /* success to connect tts-daemon */
+ g_state = TTS_SETTING_STATE_READY;
+ }
+
+ g_reason = ret;
+
+ ecore_timer_add(0, __tts_setting_initialized, NULL);
+
+ SLOG(LOG_DEBUG, TAG_TTSC, "=====");
+ SLOG(LOG_DEBUG, TAG_TTSC, " ");
+
+ return EINA_FALSE;
+}
+
int tts_setting_initialize()
{
SLOG(LOG_DEBUG, TAG_TTSC, "===== Initialize TTS Setting");
- if (true == g_is_setting_initialized) {
+ if (TTS_SETTING_STATE_READY == g_state) {
SLOG(LOG_WARN, TAG_TTSC, "[WARNING] TTS Setting has already been initialized. \n");
SLOG(LOG_DEBUG, TAG_TTSC, "=====");
SLOG(LOG_DEBUG, TAG_TTSC, " ");
SLOG(LOG_DEBUG, TAG_TTSC, " ");
return TTS_SETTING_ERROR_OPERATION_FAILED;
}
-
+
/* Send hello */
if (0 != tts_setting_dbus_request_hello()) {
__check_tts_daemon();
SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Engine not found");
break;
} else if(ret) {
- usleep(1);
- if (i == CONNECTION_RETRY_COUNT) {
+ sleep(1);
+ if (i == 3) {
SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Connection Time out");
ret = TTS_SETTING_ERROR_TIMED_OUT;
break;
}
if (TTS_SETTING_ERROR_NONE == ret) {
- g_is_setting_initialized = true;
+ g_state = TTS_SETTING_STATE_READY;
SLOG(LOG_DEBUG, TAG_TTSC, "[SUCCESS] Initialize");
}
return ret;
}
+int tts_setting_initialize_async(tts_setting_initialized_cb callback, void* user_data)
+{
+ 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_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_DEBUG, TAG_TTSC, "=====");
+ SLOG(LOG_DEBUG, TAG_TTSC, " ");
+ return TTS_SETTING_ERROR_OPERATION_FAILED;
+ }
+
+ g_initialized_cb = callback;
+ g_user_data = user_data;
+
+ ecore_timer_add(0, __tts_setting_connect_daemon, NULL);
+
+ SLOG(LOG_DEBUG, TAG_TTSC, "=====");
+ SLOG(LOG_DEBUG, TAG_TTSC, " ");
+
+ return TTS_SETTING_ERROR_NONE;
+}
+
int tts_setting_finalize()
{
SLOG(LOG_DEBUG, TAG_TTSC, "===== Finalize TTS Setting");
- if (false == g_is_setting_initialized) {
+ if (TTS_SETTING_STATE_NONE == g_state) {
SLOG(LOG_WARN, TAG_TTSC, "[WARNING] Not initialized");
SLOG(LOG_DEBUG, TAG_TTSC, "=====");
SLOG(LOG_DEBUG, TAG_TTSC, " ");
- return TTS_SETTING_ERROR_NONE;
+ return TTS_SETTING_ERROR_INVALID_STATE;
}
int ret = tts_setting_dbus_request_finalilze();
SLOG(LOG_DEBUG, TAG_TTSC, "[SUCCESS] Finalize");
}
- g_is_setting_initialized = false;
+ g_state = TTS_SETTING_STATE_NONE;
SLOG(LOG_DEBUG, TAG_TTSC, "=====");
SLOG(LOG_DEBUG, TAG_TTSC, " ");
{
SLOG(LOG_DEBUG, TAG_TTSC, "===== Foreach supported engines");
- if (false == g_is_setting_initialized) {
+ if (TTS_SETTING_STATE_NONE == g_state) {
SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Not initialized");
SLOG(LOG_DEBUG, TAG_TTSC, "=====");
SLOG(LOG_DEBUG, TAG_TTSC, " ");
{
SLOG(LOG_DEBUG, TAG_TTSC, "===== Get current engine");
- if (false == g_is_setting_initialized) {
+ if (TTS_SETTING_STATE_NONE == g_state) {
SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Not initialized");
SLOG(LOG_DEBUG, TAG_TTSC, "=====");
SLOG(LOG_DEBUG, TAG_TTSC, " ");
{
SLOG(LOG_DEBUG, TAG_TTSC, "===== Set current engine");
- if (false == g_is_setting_initialized) {
+ if (TTS_SETTING_STATE_NONE == g_state) {
SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Not initialized");
SLOG(LOG_DEBUG, TAG_TTSC, "=====");
SLOG(LOG_DEBUG, TAG_TTSC, " ");
{
SLOG(LOG_DEBUG, TAG_TTSC, "===== Foreach supported voices");
- if (false == g_is_setting_initialized) {
+ if (TTS_SETTING_STATE_NONE == g_state) {
SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Not initialized");
SLOG(LOG_DEBUG, TAG_TTSC, "=====");
SLOG(LOG_DEBUG, TAG_TTSC, " ");
{
SLOG(LOG_DEBUG, TAG_TTSC, "===== Get default voice");
- if (false == g_is_setting_initialized) {
+ if (TTS_SETTING_STATE_NONE == g_state) {
SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Not initialized");
SLOG(LOG_DEBUG, TAG_TTSC, "=====");
SLOG(LOG_DEBUG, TAG_TTSC, " ");
{
SLOG(LOG_DEBUG, TAG_TTSC, "===== Set default voice");
- if (false == g_is_setting_initialized) {
+ if (TTS_SETTING_STATE_NONE == g_state) {
SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Not initialized");
SLOG(LOG_DEBUG, TAG_TTSC, "=====");
SLOG(LOG_DEBUG, TAG_TTSC, " ");
return TTS_SETTING_ERROR_INVALID_PARAMETER;
}
- if (voice_type < TTS_SETTING_VOICE_TYPE_MALE && TTS_SETTING_VOICE_TYPE_USER3 < voice_type ) {
+ if (voice_type < TTS_SETTING_VOICE_TYPE_MALE || TTS_SETTING_VOICE_TYPE_USER3 < voice_type ) {
SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Invalid voice type");
SLOG(LOG_DEBUG, TAG_TTSC, "=====");
SLOG(LOG_DEBUG, TAG_TTSC, " ");
SLOG(LOG_DEBUG, TAG_TTSC, "=====");
SLOG(LOG_DEBUG, TAG_TTSC, " ");
- return TTS_SETTING_ERROR_NONE;
+ return ret;
}
{
SLOG(LOG_DEBUG, TAG_TTSC, "===== Get default speed");
- if (!g_is_setting_initialized) {
+ if (TTS_SETTING_STATE_NONE == g_state) {
SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Not initialized");
SLOG(LOG_DEBUG, TAG_TTSC, "=====");
SLOG(LOG_DEBUG, TAG_TTSC, " ");
{
SLOG(LOG_DEBUG, TAG_TTSC, "===== Set default speed");
- if (!g_is_setting_initialized) {
+ if (TTS_SETTING_STATE_NONE == g_state) {
SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Not initialized");
SLOG(LOG_DEBUG, TAG_TTSC, "=====");
SLOG(LOG_DEBUG, TAG_TTSC, " ");
return TTS_SETTING_ERROR_INVALID_STATE;
}
- if (speed < TTS_SETTING_SPEED_VERY_SLOW && TTS_SETTING_SPEED_VERY_FAST < speed ) {
+ if (speed < TTS_SETTING_SPEED_VERY_SLOW || TTS_SETTING_SPEED_VERY_FAST < speed) {
SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Invalid speed");
SLOG(LOG_DEBUG, TAG_TTSC, "=====");
SLOG(LOG_DEBUG, TAG_TTSC, " ");
{
SLOG(LOG_DEBUG, TAG_TTSC, "===== Foreach engine setting");
- if (!g_is_setting_initialized) {
+ if (TTS_SETTING_STATE_NONE == g_state) {
SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Not initialized");
SLOG(LOG_DEBUG, TAG_TTSC, "=====");
SLOG(LOG_DEBUG, TAG_TTSC, " ");
{
SLOG(LOG_DEBUG, TAG_TTSC, "===== Set engine setting");
- if (!g_is_setting_initialized) {
+ if (TTS_SETTING_STATE_NONE == g_state) {
SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Not initialized");
SLOG(LOG_DEBUG, TAG_TTSC, "=====");
SLOG(LOG_DEBUG, TAG_TTSC, " ");
fp = popen("ps", "r");
if (NULL == fp) {
- SLOG(LOG_DEBUG, TAG_TTSC, "[TTS SETTING ERROR] popen error \n");
+ SLOG(LOG_DEBUG, TAG_TTSC, "[TTS SETTING ERROR] popen error");
return FALSE;
}
break;
default:
- sleep(1);
break;
}
/*
-* Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+* Copyright (c) 2012 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
TTS_SETTING_VOICE_TYPE_USER3 /**< Engine defined */
} tts_setting_voice_type_e;
+/**
+* @brief Enumerations of setting state.
+*/
+typedef enum {
+ TTS_SETTING_STATE_NONE = 0,
+ TTS_SETTING_STATE_READY
+} tts_setting_state_e;
+
/**
* @brief Called to get a engine information.
*
*/
typedef bool(*tts_setting_engine_setting_cb)(const char* engine_id, const char* key, const char* value, void* user_data);
+/**
+* @brief Called to initialize setting.
+*
+* @param[in] state Current state.
+* @param[in] reason Error reason.
+* @param[in] user_data User data passed from the tts_setting_initialize_async().
+*
+* @pre tts_setting_initialize_async() will invoke this callback.
+*
+* @see tts_setting_initialize_async()
+*/
+typedef void(*tts_setting_initialized_cb)(tts_setting_state_e state, tts_setting_error_e reason, void* user_data);
/**
-* @brief Initialize TTS setting and connect to tts-daemon.
+* @brief Initialize TTS setting and connect to tts-daemon asynchronously.
*
* @return 0 on success, otherwise a negative error value.
* @retval #TTS_SETTING_ERROR_NONE Success.
*
* @see tts_setting_finalize()
*/
-int tts_setting_initialize(void);
+int tts_setting_initialize();
+
+int tts_setting_initialize_async(tts_setting_initialized_cb callback, void* user_data);
/**
* @brief finalize tts setting and disconnect to tts-daemon.
/*
-* Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+* Copyright (c) 2012 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
dbus_bus_release_name(g_conn, service_name, &err);
+ dbus_connection_close(g_conn);
+
g_conn = NULL;
return 0;
/*
-* Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+* Copyright (c) 2012 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_METHOD_STOP "tts_method_stop"
#define TTS_METHOD_PAUSE "tts_method_pause"
-#define TTS_METHOD_INTERRUPT "tts_method_interrupt"
-#define TTS_METHOD_UTTERANCE_STARTED "tts_method_utterance_started"
-#define TTS_METHOD_UTTERANCE_COMPLETED "tts_method_utterance_completed"
-#define TTS_METHOD_ERROR "tts_method_error"
-
+#define TTSD_METHOD_HELLO "ttsd_method_hello"
+#define TTSD_METHOD_UTTERANCE_STARTED "ttsd_method_utterance_started"
+#define TTSD_METHOD_UTTERANCE_COMPLETED "ttsd_method_utterance_completed"
+#define TTSD_METHOD_ERROR "ttsd_method_error"
+#define TTSD_METHOD_SET_STATE "ttsd_method_set_state"
+#define TTSD_METHOD_GET_STATE "ttsd_method_get_state"
/******************************************************************************************
* Message Definition for Setting
#define TTS_SETTING_METHOD_GET_ENGINE_SETTING "tts_setting_method_get_engine_setting"
#define TTS_SETTING_METHOD_SET_ENGINE_SETTING "tts_setting_method_set_engine_setting"
-/******************************************************************************************
-* Message Definition for tts-daemon internal
-*******************************************************************************************/
-
-#define TTS_METHOD_NEXT_PLAY "tts_method_start_play"
-#define TTS_METHOD_NEXT_SYNTHESIS "tts_method_start_synthesis"
-
-
#ifdef __cplusplus
}
#endif
-tts (0.1.1-1) unstable; urgency=low
+tts (0.1.1-37slp2+1) unstable; urgency=low
- * 1.0 release.
- * Git: pkgs/t/tts
- * Tag: tts_0.1.1-1
+ * Fix the bug of player BS
+ * Git: framework/uifw/voice/tts
+ * Tag: tts_0.1.1-37slp2+1
+
+ -- Dongyeol Lee <dy3.lee@samsung.com> Thu, 16 Aug 2012 11:30:47 +0900
+
+tts (0.1.1-36slp2+1) unstable; urgency=low
+
+ * Update Setting API for async init
+ * Git: slp/pkgs/t/tts
+ * Tag: tts_0.1.1-36slp2+1
+
+ -- Dongyeol Lee <dy3.lee@samsung.com> Mon, 06 Aug 2012 19:30:59 +0900
+
+tts (0.1.1-35slp2+1) unstable; urgency=low
+
+ * Remove fd write option of dbus in client lib
+ * Git: slp/pkgs/t/tts
+ * Tag: tts_0.1.1-35slp2+1
+
+ -- Dongyeol Lee <dy3.lee@samsung.com> Tue, 31 Jul 2012 10:17:11 +0900
+
+tts (0.1.1-34slp2+1) unstable; urgency=low
+
+ * Fix the bug of setting client management
+ * Git: slp/pkgs/t/tts
+ * Tag: tts_0.1.1-34slp2+1
+
+ -- Dongyeol Lee <dy3.lee@samsung.com> Tue, 24 Jul 2012 13:47:43 +0900
+
+tts (0.1.1-33slp2+1) unstable; urgency=low
+
+ * Update API for async init
+ * Git: slp/pkgs/t/tts
+ * Tag: tts_0.1.1-33slp2+1
+
+ -- Dongyeol Lee <dy3.lee@samsung.com> Mon, 04 Jun 2012 19:48:29 +0900
+
+tts (0.1.1-32slp2+1) unstable; urgency=low
+
+ * Add config file
+ * Git: slp/pkgs/t/tts
+ * Tag: tts_0.1.1-32slp2+1
+
+ -- Dongyeol Lee <dy3.lee@samsung.com> Thu, 24 May 2012 14:50:30 +0900
+
+tts (0.1.1-31slp2+1) unstable; urgency=low
+
+ * update config not to depend on VConf
+ * Git: slp/pkgs/t/tts
+ * Tag: tts_0.1.1-31slp2+1
+
+ -- Dongyeol Lee <dy3.lee@samsung.com> Fri, 18 May 2012 18:56:19 +0900
+
+tts (0.1.1-30slp2+1) unstable; urgency=low
+
+ * fix bug about fork daemon
+ * Git: slp/pkgs/t/tts
+ * Tag: tts_0.1.1-30slp2+1
+
+ -- Dongyeol Lee <dy3.lee@samsung.com> Mon, 26 Mar 2012 15:48:37 +0900
+
+tts (0.1.1-29slp2+1) unstable; urgency=low
+
+ * udpate changelog
+ * Git: slp/pkgs/t/tts
+ * Tag: tts_0.1.1-29slp2+1
+
+ -- Dongyeol Lee <dy3.lee@samsung.com> Mon, 19 Mar 2012 19:20:22 +0900
+
+tts (0.1.1-28slp2+1) unstable; urgency=low
+
+ * udpate setting api
+ * Git: slp/pkgs/t/tts
+ * Tag: tts_0.1.1-28slp2+1
-- Dongyeol Lee <dy3.lee@samsung.com> Mon, 19 Mar 2012 11:37:32 +0900
+tts (0.1.1-27slp2+1) unstable; urgency=low
+
+ * fix IPC bug
+ * Git: slp/pkgs/t/tts
+ * Tag: tts_0.1.1-27slp2+1
+
+ -- Dongyeol Lee <dy3.lee@samsung.com> Wed, 14 Mar 2012 16:14:08 +0900
+
+tts (0.1.1-26slp2+1) unstable; urgency=low
+
+ * beta release
+ * Git: slp/pkgs/t/tts
+ * Tag: tts_0.1.1-26slp2+1
+
+ -- Dongyeol Lee <dy3.lee@samsung.com> Fri, 17 Feb 2012 17:42:12 +0900
+
+tts (0.1.1-25slp2+1) unstable; urgency=low
+
+ * fix player bug and update doxygen
+ * Git: slp/pkgs/t/tts
+ * Tag: tts_0.1.1-25slp2+1
+
+ -- Dongyeol Lee <dy3.lee@samsung.com> Fri, 17 Feb 2012 10:45:28 +0900
+
+tts (0.1.1-24slp2+1) unstable; urgency=low
+
+ * update engine api
+ * Git: slp/pkgs/t/tts
+ * Tag: tts_0.1.1-24slp2+1
+
+ -- Dongyeol Lee <dy3.lee@samsung.com> Thu, 05 Jan 2012 15:53:48 +0900
+
+tts (0.1.1-23slp2+1) unstable; urgency=low
+
+ * update changelog
+ * Git: slp/pkgs/t/tts
+ * Tag: tts_0.1.1-23slp2+1
+
+ -- Dongyeol Lee <dy3.lee@samsung.com> Mon, 19 Dec 2011 13:50:50 +0900
+
+tts (0.1.1-22slp2+1) unstable; urgency=low
+
+ * code cleanup and update log
+ * Git: slp/pkgs/t/tts
+ * Tag: tts_0.1.1-22slp2+1
+
+ -- Dongyeol Lee <dy3.lee@samsung.com> Fri, 16 Dec 2011 15:56:08 +0900
+
+tts (0.1.1-21slp2+1) unstable; urgency=low
+
+ * code cleanup and update log
+ * Git: 165.213.180.234:slp/pkgs/t/tts
+ * Tag: tts_0.1.1-21slp2+1
+
+ -- Dongyeol Lee <dy3.lee@samsung.com> Tue, 06 Dec 2011 19:01:19 +0900
+
+tts (0.1.1-20slp2+1) unstable; urgency=low
+
+ * change boiler plate
+ * Git: 165.213.180.234:slp/pkgs/t/tts
+ * Tag: tts_0.1.1-20slp2+1
+
+ -- Dongyeol Lee <dy3.lee@samsung.com> Fri, 02 Dec 2011 10:52:46 +0900
+
+tts (0.1.1-19slp2+1) unstable; urgency=low
+
+ * update for connman
+ * Git: 165.213.180.234:slp/pkgs/t/tts
+ * Tag: tts_0.1.1-19slp2+1
+
+ -- Dongyeol Lee <dy3.lee@samsung.com> Tue, 29 Nov 2011 16:14:14 +0900
+
+tts (0.1.1-18slp2+1) unstable; urgency=low
+
+ * bug fix about unref message
+ * Git: 165.213.180.234:slp/pkgs/t/tts
+ * Tag: tts_0.1.1-18slp2+1
+
+ -- Dongyeol Lee <dy3.lee@samsung.com> Wed, 23 Nov 2011 15:34:46 +0900
+
+tts (0.1.1-17slp2+1) unstable; urgency=low
+
+ * update API : change sync function and use add_text in 'Play' state
+ * Git: 165.213.180.234:slp/pkgs/t/tts
+ * Tag: tts_0.1.1-17slp2+1
+
+ -- Dongyeol Lee <dy3.lee@samsung.com> Wed, 16 Nov 2011 11:28:03 +0900
+
+tts (0.1.1-16slp2+1) unstable; urgency=low
+
+ * update Setting API
+ * Git: 165.213.180.234:slp/pkgs/t/tts
+ * Tag: tts_0.1.1-16slp2+1
+
+ -- Dongyeol Lee <dy3.lee@samsung.com> Tue, 01 Nov 2011 11:24:58 +0900
+
+tts (0.1.1-15slp2+1) unstable; urgency=low
+
+ * update API doxygen and fix bug about initial default voice
+ * Git: 165.213.180.234:slp/pkgs/t/tts
+ * Tag: tts_0.1.1-15slp2+1
+
+ -- Dongyeol Lee <dy3.lee@samsung.com> Thu, 27 Oct 2011 11:06:49 +0900
+
+tts (0.1.1-14slp2+1) unstable; urgency=low
+
+ * change API for SDK release
+ * Git: 165.213.180.234:slp/pkgs/t/tts
+ * Tag: tts_0.1.1-14slp2+1
+
+ -- Dongyeol Lee <dy3.lee@samsung.com> Fri, 21 Oct 2011 16:42:51 +0900
+
+tts (0.1.1-13slp2+1) unstable; urgency=low
+
+ * update API's new callback
+ * Git: 165.213.180.234:slp/pkgs/t/tts
+ * Tag: tts_0.1.1-13slp2+1
+
+ -- Dongyeol Lee <dy3.lee@samsung.com> Thu, 20 Oct 2011 17:49:13 +0900
+
+tts (0.1.1-12slp2+1) unstable; urgency=low
+
+ * update new API for sdk release and change boilerplate
+ * Git: 165.213.180.234:slp/pkgs/t/tts
+ * Tag: tts_0.1.1-12slp2+1
+
+ -- Dongyeol Lee <dy3.lee@samsung.com> Wed, 19 Oct 2011 16:31:50 +0900
+
+tts (0.1.1-11slp2+1) unstable; urgency=low
+
+ * update bug of prevent and remove dependency of gtk
+ * Git: 165.213.180.234:slp/pkgs/t/tts
+ * Tag: tts_0.1.1-11slp2+1
+
+ -- Dongyeol Lee <dy3.lee@samsung.com> Wed, 07 Sep 2011 14:47:34 +0900
+
+tts (0.1.1-10slp2+1) unstable; urgency=low
+
+ * update build file
+ * Git: 165.213.180.234:slp/pkgs/t/tts
+ * Tag: tts_0.1.1-10slp2+1
+
+ -- Dongyeol Lee <dy3.lee@samsung.com> Tue, 19 Jul 2011 16:15:13 +0900
+
+tts (0.1.1-9slp2+1) unstable; urgency=low
+
+ * update build file
+ * Git: 165.213.180.234:slp/pkgs/t/tts
+ * Tag: tts_0.1.1-9slp2+1
+
+ -- Dongyeol Lee <dy3.lee@samsung.com> Mon, 18 Jul 2011 10:27:52 +0900
+
+tts (0.1.1-8slp2+1) unstable; urgency=low
+
+ * Change IPC and Code Cleanup
+ * Git: 165.213.180.234:slp/pkgs/t/tts
+ * Tag: tts_0.1.1-8slp2+1
+
+ -- Dongyeol Lee <dy3.lee@samsung.com> Fri, 15 Jul 2011 18:01:31 +0900
+
+tts (0.1.1-7slp2+1) unstable; urgency=low
+
+ * support multi instance
+ * Git: 165.213.180.234:slp/pkgs/t/tts
+ * Tag: tts_0.1.1-7slp2+1
+
+ -- Dongyeol Lee <dy3.lee@samsung.com> Fri, 24 Jun 2011 14:36:36 +0900
+
+tts (0.1.1-6slp2+1) unstable; urgency=low
+
+ * fix defect from prevent
+ * Git: 165.213.180.234:slp/pkgs/t/tts
+ * Tag: tts_0.1.1-6slp2+1
+
+ -- Dongyeol Lee <dy3.lee@samsung.com> Tue, 07 Jun 2011 17:05:49 +0900
+
+tts (0.1.1-5slp2+1) unstable; urgency=low
+
+ * Git: 165.213.180.234:slp/pkgs/t/tts
+ * Tag: tts_0.1.1-5slp2+1
+
+ -- Dongyeol Lee <dy3.lee@samsung.com> Mon, 23 May 2011 15:14:10 +0900
+
+tts (0.1.1-4slp2+1) unstable; urgency=low
+
+ * Change API - change error code
+ * Git: 165.213.180.234:slp/pkgs/t/tts
+ * Tag: tts_0.1.1-4slp2+1
+
+ -- Dongyeol Lee <dy3.lee@samsung.com> Mon, 23 May 2011 09:00:57 +0900
+
+tts (0.1.1-3slp2+1) unstable; urgency=low
+
+ * change control file
+ * Git: 165.213.180.234:slp/pkgs/t/tts
+ * Tag: tts_0.1.1-3slp2+1
+
+ -- Jae-Yong Lee <jaeyong911.lee@samsung.com> Mon, 16 May 2011 10:45:01 +0900
+
+tts (0.1.1-2slp2+1) unstable; urgency=low
+
+ * Initial Release (change files to unix type).
+ * Git: 165.213.180.234:slp/pkgs/t/tts
+ * Tag: tts_0.1.1-2slp2+1
+
+ -- Jae-Yong Lee <jaeyong911.lee@samsung.com> Mon, 16 May 2011 10:11:02 +0900
+
+tts (0.1.1-1slp2+1) unstable; urgency=low
+
+ * Initial Release.
+ * Git: 165.213.180.234:slp/pkgs/t/tts
+ * Tag: tts_0.1.1-1slp2+1
+
+ -- Jae-Yong Lee <jaeyong911.lee@samsung.com> Fri, 13 May 2011 16:15:22 +0900
+++ /dev/null
-Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved \r
- Licensed under the Apache License, Version 2.0 (the "License");\r
- you may not use this file except in compliance with the License.\r
- You may obtain a copy of the License at\r
- http://www.apache.org/licenses/LICENSE-2.0\r
- Unless required by applicable law or agreed to in writing, software\r
- distributed under the License is distributed on an "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- See the License for the specific language governing permissions and\r
- limitations under the License.\r
-
-
@PREFIX@/lib/lib*.so*
@PREFIX@/bin/tts-daemon
+@PREFIX@/lib/voice/tts/1.0/ttsd.conf
\ No newline at end of file
Release: 1
Group: libs
License: Samsung
-Source0: tts-0.1.1.tar.gz
+Source0: %{name}-%{version}.tar.gz
Requires(post): /sbin/ldconfig
Requires(postun): /sbin/ldconfig
BuildRequires: pkgconfig(glib-2.0)
%files
%defattr(-,root,root,-)
%{_libdir}/lib*.so
+%{_libdir}/voice/tts/1.0/ttsd.conf
%{_bindir}/tts-daemon
## Dependent packages ##
INCLUDE(FindPkgConfig)
pkg_check_modules(pkgs REQUIRED
- mm-player mm-common vconf dbus-1
+ mm-player vconf mm-common dbus-1
dlog openssl
)
## Install ##
INSTALL(TARGETS ${PROJECT_NAME} 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)
+
--- /dev/null
+ENGINE_ID 27F277E9-BBC4-4dca-B553-D9884A3CDAA0\r
+VOICE en_US 2\r
+SPEED 3
\ No newline at end of file
* limitations under the License.
*/
-
-#include <vconf.h>
#include "ttsd_main.h"
#include "ttsd_config.h"
-/*
-* tts-daemon config
-*/
-int ttsd_config_get_char_type(const char* key, char** value)
-{
- if (NULL == key || NULL == value) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Config ERROR] Input parameter is NULL\n");
- return TTSD_ERROR_INVALID_PARAMETER;
- }
-
- *value = vconf_get_str(key);
- if (NULL == *value) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Config ERROR] fail to get char type from config : key(%s)\n", key);
- return -1;
- }
+#define CONFIG_FILE_PATH BASE_DIRECTORY_DOWNLOAD"ttsd.conf"
+#define CONFIG_DEFAULT BASE_DIRECTORY_DEFAULT"ttsd.conf"
+
+#define ENGINE_ID "ENGINE_ID"
+#define VOICE "VOICE"
+#define SPEED "SPEED"
- return 0;
-}
-int ttsd_config_set_char_type(const char* key, const char* value)
+static char* g_engine_id;
+static char* g_language;
+static int g_vc_type;
+static int g_speed;
+
+int __ttsd_config_save()
{
- if (NULL == key || NULL == value) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Config ERROR] Input parameter is NULL\n");
- return TTSD_ERROR_INVALID_PARAMETER;
- }
+ FILE* config_fp;
+ config_fp = fopen(CONFIG_FILE_PATH, "w+");
- if (0 != vconf_set_str(key, value)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Config ERROR] fail to set char type \n");
+ if (NULL == config_fp) {
+ /* make file and file default */
+ SLOG(LOG_ERROR, TAG_TTSD, "[Config ERROR] Fail to load config (engine id)");
return -1;
}
- return 0;
-}
+ /* Write engine id */
+ fprintf(config_fp, "%s %s\n", ENGINE_ID, g_engine_id);
-int ttsd_config_get_bool_type(const char* key, bool* value)
-{
- if (NULL == key || NULL == value) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Config ERROR] Input parameter is NULL\n");
- return TTSD_ERROR_INVALID_PARAMETER;
- }
-
- int result ;
- if (0 != vconf_get_int(key, &result)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Config ERROR] fail to get bool type config : key(%s)\n", key);
- return -1;
- }
+ /* Write voice */
+ fprintf(config_fp, "%s %s %d\n", VOICE, g_language, g_vc_type);
- *value = (bool) result;
+ /* Read speed */
+ fprintf(config_fp, "%s %d\n", SPEED, g_speed);
+
+ fclose(config_fp);
return 0;
}
-int ttsd_config_set_bool_type(const char* key, const bool value)
+
+int __ttsd_config_load()
{
- if (NULL == key) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Config ERROR] Input parameter is NULL\n");
- return TTSD_ERROR_INVALID_PARAMETER;
- }
-
- int result = (int)value;
- if (0 != vconf_set_int(key, result)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Config ERROR] fail to set bool type config : key(%s)\n", key);
- return -1;
- }
+ FILE* config_fp;
+ char buf_id[256] = {0};
+ char buf_param[256] = {0};
+ int int_param = 0;
- return 0;
-}
+ config_fp = fopen(CONFIG_FILE_PATH, "r");
-int ttsd_config_get_int_type(const char* key, int* value)
-{
- if (NULL == key || NULL == value) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Config ERROR] Input parameter is NULL\n");
- return TTSD_ERROR_INVALID_PARAMETER;
- }
+ if (NULL == config_fp) {
+ SLOG(LOG_WARN, TAG_TTSD, "[Config WARNING] Not open file(%s)", CONFIG_FILE_PATH);
+
+ config_fp = fopen(CONFIG_DEFAULT, "r");
+ if (NULL == config_fp) {
+ SLOG(LOG_WARN, TAG_TTSD, "[Config WARNING] Not open original config file(%s)", CONFIG_FILE_PATH);
+ __ttsd_config_save();
+ return -1;
+ }
+ }
- if (0 != vconf_get_int(key, value)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Config ERROR] fail to get bool type config : key(%s)\n", key);
+ /* Read engine id */
+ fscanf(config_fp, "%s %s", buf_id, buf_param);
+ if (0 == strncmp(ENGINE_ID, buf_id, strlen(ENGINE_ID))) {
+ g_engine_id = strdup(buf_param);
+ } else {
+ fclose(config_fp);
+ SLOG(LOG_WARN, TAG_TTSD, "[Config WARNING] Fail to load config (engine id)");
+ __ttsd_config_save();
return -1;
}
- return 0;
-}
-
-int ttsd_config_set_int_type(const char* key, const int value)
-{
- if (NULL == key) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Config ERROR] Input parameter is NULL\n");
- return TTSD_ERROR_INVALID_PARAMETER;
- }
+ /* Read voice */
+ fscanf(config_fp, "%s %s %d", buf_id, buf_param, &int_param);
+ if (0 == strncmp(VOICE, buf_id, strlen(VOICE))) {
+ g_language = strdup(buf_param);
+ g_vc_type = int_param;
+ } else {
+ fclose(config_fp);
+ SLOG(LOG_WARN, TAG_TTSD, "[Config WARNING] Fail to load config (voice)");
+ __ttsd_config_save();
+ return -1;
+ }
- if (0 != vconf_set_int(key, value)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Config ERROR] fail to set int type config : key(%s)\n", key);
+ /* Read speed */
+ fscanf(config_fp, "%s %d", buf_id, &int_param);
+ if (0 == strncmp(SPEED, buf_id, strlen(SPEED))) {
+ g_speed = int_param;
+ } else {
+ fclose(config_fp);
+ SLOG(LOG_WARN, TAG_TTSD, "[Config WARNING] Fail to load config (speed)");
+ __ttsd_config_save();
return -1;
}
+ SLOG(LOG_DEBUG, TAG_TTSD, "[Config] Load config : engine(%s), voice(%s,%d), speed(%d)",
+ g_engine_id, g_language, g_vc_type, g_speed);
+
return 0;
}
-/*
-* interface for engine plug-in
-*/
-
-int config_make_key_for_engine(const char* engine_id, const char* key, char** out_key)
+int ttsd_config_initialize()
{
- int key_size = strlen(TTSD_CONFIG_PREFIX) + strlen(engine_id) + strlen(key) + 2; /* 2 is '/' and '\0' */
+ g_engine_id = NULL;
+ g_language = NULL;
+ g_vc_type = 1;
+ g_speed = 3;
- *out_key = (char*) g_malloc0( sizeof(char) * key_size);
-
- if (*out_key == NULL) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Config ERROR] Not enough memory!! \n");
- return -1;
- } else {
- snprintf(*out_key, key_size, "%s%s/%s", TTSD_CONFIG_PREFIX, engine_id, key );
- SLOG(LOG_DEBUG, TAG_TTSD, "[Config DEBUG] make key (%s) \n", *out_key);
- }
+ __ttsd_config_load();
return 0;
}
-int ttsd_config_set_persistent_data(const char* engine_id, const char* key, const char* value)
+int ttsd_config_finalize()
{
- char* vconf_key = NULL;
+ __ttsd_config_save();
+ return 0;
+}
- if (0 != config_make_key_for_engine(engine_id, key, &vconf_key)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Config ERROR] fail config_make_key_for_engine()\n");
+int ttsd_config_get_default_engine(char** engine_id)
+{
+ if (NULL == engine_id)
return -1;
- }
- if (0 != vconf_set_str(vconf_key, value)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Config ERROR] fail to set key, value\n");
-
- if(vconf_key != NULL)
- g_free(vconf_key);
+ *engine_id = strdup(g_engine_id);
+ return 0;
+}
+int ttsd_config_set_default_engine(const char* engine_id)
+{
+ if (NULL == engine_id)
return -1;
- }
-
- SLOG(LOG_DEBUG, TAG_TTSD, "[Config DEBUG] Set data : key(%s), value(%s) \n", vconf_key, value);
- if (vconf_key != NULL)
- g_free(vconf_key);
+ if (NULL != g_engine_id)
+ free(g_engine_id);
+ g_engine_id = strdup(engine_id);
+ __ttsd_config_save();
return 0;
}
-int ttsd_config_get_persistent_data(const char* engine_id, const char* key, char** value)
+int ttsd_config_get_default_voice(char** language, int* type)
{
- char* vconf_key = NULL;
-
- if (0 != config_make_key_for_engine(engine_id, key, &vconf_key)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Config ERROR] fail config_make_key_for_engine()\n");
+ if (NULL == language || NULL == type)
return -1;
- }
- char* temp;
- temp = vconf_get_str(vconf_key);
- if (temp == NULL) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Config ERROR] fail to get value\n");
+ *language = strdup(g_language);
+ *type = g_vc_type;
- if(vconf_key != NULL)
- g_free(vconf_key);
+ return 0;
+}
+int ttsd_config_set_default_voice(const char* language, int type)
+{
+ if (NULL == language)
return -1;
- }
-
- *value = g_strdup(temp);
- SLOG(LOG_DEBUG, TAG_TTSD, "[Config DEBUG] Get data : key(%s), value(%s) \n", vconf_key, *value);
+ if (NULL != g_language)
+ free(g_language);
- if (NULL != vconf_key)
- g_free(vconf_key);
+ g_language = strdup(language);
+ g_vc_type = type;
- if (NULL != temp)
- g_free(temp);
+ __ttsd_config_save();
return 0;
}
-int ttsd_config_remove_persistent_data(const char* engine_id, const char* key)
+int ttsd_config_get_default_speed(int* speed)
{
- char* vconf_key = NULL;
- int result = 0;
-
- if (0 != config_make_key_for_engine(engine_id, key, &vconf_key)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Config ERROR] fail config_make_key_for_engine()\n");
+ if (NULL == speed)
return -1;
- }
- if( NULL == vconf_key )
- return -1;
-
- if (0 != vconf_unset(vconf_key)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Config ERROR] fail to remove key\n");
- result = -1;
- } else {
- SLOG(LOG_DEBUG, TAG_TTSD, "[Config DEBUG] Remove data : key(%s)", vconf_key);
- }
+ *speed = g_speed;
- if( vconf_key != NULL )
- g_free(vconf_key);
+ return 0;
+}
- return result;
+int ttsd_config_set_default_speed(int speed)
+{
+ g_speed = speed;
+ __ttsd_config_save();
+ return 0;
}
#ifndef __TTSD_CONFIG_H_
#define __TTSD_CONFIG_H_
-#include <stdbool.h>
-
#ifdef __cplusplus
extern "C" {
#endif
-#define TTSD_CONFIG_PREFIX "db/ttsd/"
-
-#define CONFIG_KEY_DEFAULT_ENGINE_ID TTSD_CONFIG_PREFIX"engine"
-#define CONFIG_KEY_DEFAULT_LANGUAGE TTSD_CONFIG_PREFIX"language"
-#define CONFIG_KEY_DEFAULT_VOICE_TYPE TTSD_CONFIG_PREFIX"vctype"
-#define CONFIG_KEY_DEFAULT_SPEED TTSD_CONFIG_PREFIX"speed"
-
-/*
-* tts-daemon config
-*/
-
-int ttsd_config_get_char_type(const char* key, char** value);
+int ttsd_config_initialize();
-int ttsd_config_set_char_type(const char* key, const char* value);
+int ttsd_config_finalize();
-int ttsd_config_get_bool_type(const char* key, bool* value);
+int ttsd_config_get_default_engine(char** engine_id);
-int ttsd_config_set_bool_type(const char* key, const bool value);
-
-int ttsd_config_get_int_type(const char* key, int* value);
-
-int ttsd_config_set_int_type(const char* key, const int value);
-
-/*
-* interface for engine plug-in
-*/
+int ttsd_config_set_default_engine(const char* engine_id);
-int ttsd_config_set_persistent_data(const char* engine_id, const char* key, const char* value);
+int ttsd_config_get_default_voice(char** language, int* type);
-int ttsd_config_get_persistent_data(const char* engine_id, const char* key, char** value);
+int ttsd_config_set_default_voice(const char* langauge, int type);
-int ttsd_config_remove_persistent_data(const char* engine_id, const char* key);
+int ttsd_config_get_default_speed(int* speed);
+int ttsd_config_set_default_speed(int speed);
#ifdef __cplusplus
}
static vector<app_data_s> g_app_list;
+static vector<setting_app_data_s> g_setting_list;
+
static bool g_mutex_state = false;
/*
}
SLOG(LOG_DEBUG, TAG_TTSD, "-----------------------");
+
+ SLOG(LOG_DEBUG, TAG_TTSD, "----- 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 );
+ }
+
+ if (0 == vsize) {
+ SLOG(LOG_DEBUG, TAG_TTSD, "No Setting Client");
+ }
+
+ SLOG(LOG_DEBUG, TAG_TTSD, "--------------------------------");
+
return TTSD_ERROR_NONE;
}
-int __data_show_sound_list(const int index)
+int __data_show_sound_list(int index)
{
SLOG(LOG_DEBUG, TAG_TTSD, "----- Sound list -----");
return TTSD_ERROR_NONE;
}
-int __data_show_text_list(const int index)
+int __data_show_text_list(int index)
{
SLOG(LOG_DEBUG, TAG_TTSD, "----- Text list -----");
* ttsd data functions
*/
-int ttsd_data_new_client(const int pid, const int uid)
+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);
return TTSD_ERROR_NONE;
}
-int ttsd_data_delete_client(const int uid)
+int ttsd_data_delete_client(int uid)
{
int index = 0;
return TTSD_ERROR_NONE;
}
-int ttsd_data_is_client(const int uid)
+int ttsd_data_is_client(int uid)
{
int vsize = g_app_list.size();
int ttsd_data_get_client_count()
{
- return g_app_list.size();
+ return g_app_list.size() + g_setting_list.size();
}
-int ttsd_data_get_pid(const int uid)
+int ttsd_data_get_pid(int uid)
{
int index;
return g_app_list[index].pid;
}
-int ttsd_data_get_speak_data_size(const int uid)
+int ttsd_data_get_speak_data_size(int uid)
{
int index = 0;
index = ttsd_data_is_client(uid);
return size;
}
-int ttsd_data_add_speak_data(const int uid, const speak_data_s data)
+int ttsd_data_add_speak_data(int uid, speak_data_s data)
{
int index = 0;
index = ttsd_data_is_client(uid);
return TTSD_ERROR_NONE;
}
-int ttsd_data_get_speak_data(const int uid, speak_data_s* data)
+int ttsd_data_get_speak_data(int uid, speak_data_s* data)
{
int index = 0;
index = ttsd_data_is_client(uid);
return TTSD_ERROR_NONE;
}
-int ttsd_data_add_sound_data(const int uid, const sound_data_s data)
+int ttsd_data_add_sound_data(int uid, sound_data_s data)
{
int index = 0;
index = ttsd_data_is_client(uid);
return TTSD_ERROR_NONE;
}
-int ttsd_data_get_sound_data(const int uid, sound_data_s* data)
+int ttsd_data_get_sound_data(int uid, sound_data_s* data)
{
int index = 0;
index = ttsd_data_is_client(uid);
return TTSD_ERROR_NONE;
}
-int ttsd_data_get_sound_data_size(const int uid)
+int ttsd_data_get_sound_data_size(int uid)
{
int index = 0;
index = ttsd_data_is_client(uid);
return g_app_list[index].m_wav_data.size();
}
-int ttsd_data_clear_data(const int uid)
+int ttsd_data_clear_data(int uid)
{
int index = 0;
return TTSD_ERROR_NONE;
}
-int ttsd_data_get_client_state(const int uid, app_state_e* state)
+int ttsd_data_get_client_state(int uid, app_state_e* state)
{
int index = 0;
return TTSD_ERROR_NONE;
}
-int ttsd_data_set_client_state(const int uid, const app_state_e state)
+int ttsd_data_set_client_state(int uid, app_state_e state)
{
int index = 0;
return true;
}
+
+int ttsd_data_is_current_playing()
+{
+ int vsize = g_app_list.size();
+
+ for (int i=0; i<vsize; i++) {
+ if(g_app_list[i].state == APP_STATE_PLAYING) {
+ return g_app_list[i].uid;
+ }
+ }
+
+ return -1;
+}
+
+/*
+* setting data
+*/
+
+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);
+ return TTSD_ERROR_INVALID_PARAMETER;
+ }
+
+ setting_app_data_s setting_app;
+ setting_app.pid = pid;
+
+ g_setting_list.insert(g_setting_list.end(), setting_app);
+
+#ifdef DATA_DEBUG
+ __data_show_list();
+#endif
+ return TTSD_ERROR_NONE;
+
+}
+
+int ttsd_setting_data_delete(int pid)
+{
+ int index = 0;
+
+ index = ttsd_setting_data_is_setting(pid);
+
+ if (index < 0) {
+ SLOG(LOG_ERROR, TAG_TTSD, "[DATA ERROR] uid is not valid (%d)", pid);
+ return -1;
+ }
+
+ g_setting_list.erase(g_setting_list.begin()+index);
+
+#ifdef DATA_DEBUG
+ __data_show_list();
+#endif
+ return TTSD_ERROR_NONE;
+}
+
+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;
+}
\ No newline at end of file
#endif
typedef enum {
- APP_STATE_READY = 0,
+ APP_STATE_CREATED = 0,
+ APP_STATE_READY,
APP_STATE_PLAYING,
APP_STATE_PAUSED
}app_state_e;
std::vector<sound_data_s> m_wav_data;
}app_data_s;
+typedef struct {
+ int pid;
+} setting_app_data_s;
-int ttsd_data_new_client(const int pid, const int uid);
+int ttsd_data_new_client(int pid, int uid);
-int ttsd_data_delete_client(const int uid);
+int ttsd_data_delete_client(int uid);
-int ttsd_data_is_client(const int uid);
+int ttsd_data_is_client(int uid);
int ttsd_data_get_client_count();
-int ttsd_data_get_pid(const int uid);
+int ttsd_data_get_pid(int uid);
-int ttsd_data_add_speak_data(const int uid, const speak_data_s data);
+int ttsd_data_add_speak_data(int uid, speak_data_s data);
-int ttsd_data_get_speak_data(const int uid, speak_data_s* data);
+int ttsd_data_get_speak_data(int uid, speak_data_s* data);
-int ttsd_data_get_speak_data_size(const int uid);
+int ttsd_data_get_speak_data_size(int uid);
-int ttsd_data_add_sound_data(const int uid, const sound_data_s data);
+int ttsd_data_add_sound_data(int uid, sound_data_s data);
-int ttsd_data_get_sound_data(const int uid, sound_data_s* data);
+int ttsd_data_get_sound_data(int uid, sound_data_s* data);
-int ttsd_data_get_sound_data_size(const int uid);
+int ttsd_data_get_sound_data_size(int uid);
-int ttsd_data_clear_data(const int uid);
+int ttsd_data_clear_data(int uid);
-int ttsd_data_get_client_state(const int pid, app_state_e* state);
+int ttsd_data_get_client_state(int pid, app_state_e* state);
-int ttsd_data_set_client_state(const int pid, const app_state_e state);
+int ttsd_data_set_client_state(int pid, app_state_e state);
int ttsd_data_get_current_playing();
-
typedef bool(*ttsd_data_get_client_cb)(int pid, int uid, app_state_e state, void* user_data);
int ttsd_data_foreach_clients(ttsd_data_get_client_cb callback, void* user_data);
bool ttsd_data_is_uttid_valid(int uid, int uttid);
+int ttsd_data_is_current_playing();
+
+
+int ttsd_setting_data_add(int pid);
+
+int ttsd_setting_data_delete(int pid);
+
+int ttsd_setting_data_is_setting(int pid);
+
#ifdef __cplusplus
}
#endif
static DBusConnection* g_conn;
-int ttsdc_send_message(int pid, int uid, int uttid, char *method)
+static int g_waiting_time = 3000;
+
+int ttsdc_send_hello(int pid, int uid)
+{
+ char service_name[64];
+ memset(service_name, 0, 64);
+ snprintf(service_name, 64, "%s%d", TTS_CLIENT_SERVICE_NAME, pid);
+
+ char target_if_name[64];
+ snprintf(target_if_name, sizeof(target_if_name), "%s%d", TTS_CLIENT_SERVICE_INTERFACE, pid);
+
+ DBusMessage* msg;
+
+ /* create a message & check for errors */
+ msg = dbus_message_new_method_call(
+ service_name,
+ TTS_CLIENT_SERVICE_OBJECT_PATH,
+ target_if_name,
+ TTSD_METHOD_HELLO);
+
+ if (NULL == msg) {
+ SLOG(LOG_ERROR, TAG_TTSD, "<<<< [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);
+ }
+
+ dbus_message_append_args(msg, DBUS_TYPE_INT32, &uid, DBUS_TYPE_INVALID);
+
+ DBusError err;
+ dbus_error_init(&err);
+
+ DBusMessage* result_msg;
+ int result = -1;
+
+ result_msg = dbus_connection_send_with_reply_and_block(g_conn, msg, g_waiting_time, &err);
+ dbus_message_unref(msg);
+
+ if (NULL != result_msg) {
+ 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);
+ 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");
+ result = 0;
+ }
+
+ return result;
+}
+
+int ttsdc_send_message(int pid, int uid, int data, char *method)
{
char service_name[64];
memset(service_name, 0, 64);
if (NULL == msg) {
SLOG(LOG_ERROR, TAG_TTSD, "[Dbus ERROR] Fail to create message : type(%s), uid(%d)\n", method, uid);
return -1;
- }
+ }
- dbus_message_append_args(msg, DBUS_TYPE_INT32, &uid, DBUS_TYPE_INT32, &uttid, DBUS_TYPE_INVALID);
+ dbus_message_append_args(msg, DBUS_TYPE_INT32, &uid, DBUS_TYPE_INT32, &data, DBUS_TYPE_INVALID);
/* 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), uttid(%d)", method, target_if_name, uid, uttid);
+ 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);
} else {
- SLOG(LOG_DEBUG, TAG_TTSD, "<<<< send message : type(%s), uid(%d), uttid(%d)", method, uid, uttid);
+ SLOG(LOG_DEBUG, TAG_TTSD, "<<<< send message : type(%s), uid(%d), data(%d)", method, uid, data);
dbus_connection_flush(g_conn);
}
int ttsdc_send_utt_start_message(int pid, int uid, int uttid)
{
- return ttsdc_send_message(pid, uid, uttid, TTS_METHOD_UTTERANCE_STARTED);
+ return ttsdc_send_message(pid, uid, uttid, TTSD_METHOD_UTTERANCE_STARTED);
}
int ttsdc_send_utt_finish_message(int pid, int uid, int uttid)
{
- return ttsdc_send_message(pid, uid, uttid, TTS_METHOD_UTTERANCE_COMPLETED);
+ return ttsdc_send_message(pid, uid, uttid, TTSD_METHOD_UTTERANCE_COMPLETED);
}
-int ttsdc_send_interrupt_message(int pid, int uid, ttsd_interrupted_code_e code)
+int ttsdc_send_set_state_message(int pid, int uid, int state)
{
- return ttsdc_send_message(pid, uid, (int)code, TTS_METHOD_INTERRUPT);
+ return ttsdc_send_message(pid, uid, state, TTSD_METHOD_SET_STATE);
}
int ttsdc_send_error_message(int pid, int uid, int uttid, int reason)
service_name,
TTS_CLIENT_SERVICE_OBJECT_PATH,
target_if_name,
- TTS_METHOD_ERROR);
+ TTSD_METHOD_ERROR);
if (NULL == msg) {
SLOG(LOG_ERROR, TAG_TTSD, "[Dbus ERROR] Fail to create error message : uid(%d)\n", uid);
else if (dbus_message_is_method_call(msg, TTS_SERVER_SERVICE_INTERFACE, TTS_SETTING_METHOD_SET_ENGINE_SETTING) )
ttsd_dbus_server_setting_set_engine_setting(conn, msg);
-
-
- else if (dbus_message_is_method_call(msg, TTS_SERVER_SERVICE_INTERFACE, TTS_METHOD_NEXT_PLAY))
- ttsd_dbus_server_start_next_play(msg);
-
- else if (dbus_message_is_method_call(msg, TTS_SERVER_SERVICE_INTERFACE, TTS_METHOD_NEXT_SYNTHESIS))
- ttsd_dbus_server_start_next_synthesis(msg);
/* free the message */
return 0;
}
-
-int ttsd_send_start_next_play_message(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_NEXT_PLAY);
-
- if (NULL == msg) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Dbus ERROR] >>>> Fail to make message for 'start next play'");
- return -1;
- }
-
- dbus_message_append_args(msg, DBUS_TYPE_INT32, &uid, DBUS_TYPE_INVALID);
-
- if (!dbus_connection_send(g_conn, msg, NULL)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Dbus ERROR] >>>> Fail to send message for 'start next play'\n");
- return -1;
- }
-
- dbus_connection_flush(g_conn);
- dbus_message_unref(msg);
-
- return 0;
-}
-
-int ttsd_send_start_next_synthesis_message(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_NEXT_SYNTHESIS);
-
- if (NULL == msg) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Dbus ERROR] >>>> Fail to make message for 'start next synthesis'\n");
- return -1;
- }
-
- dbus_message_append_args(msg, DBUS_TYPE_INT32, &uid, DBUS_TYPE_INVALID);
-
- if (!dbus_connection_send(g_conn, msg, NULL)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Dbus ERROR] >>>> Fail to send message for 'start next synthesis'\n");
- return -1;
- }
-
- dbus_connection_flush(g_conn);
- dbus_message_unref(msg);
-
- return 0;
-}
int ttsd_dbus_close_connection();
+int ttsdc_send_hello(int pid, int uid);
+
int ttsdc_send_utt_start_message(int pid, int uid, int uttid);
int ttsdc_send_utt_finish_message(int pid, int uid, int uttid);
int ttsdc_send_error_message(int pid, int uid, int uttid, int reason);
-int ttsdc_send_interrupt_message(int pid, int uid, ttsd_interrupted_code_e code);
-
-int ttsd_send_start_next_play_message(int uid);
-
-int ttsd_send_start_next_synthesis_message(int uid);
+int ttsdc_send_set_state_message(int pid, int uid, int state);
#ifdef __cplusplus
}
return 0;
}
-
-/*
-* Dbus Server functions for tts daemon intenal
-*/
-
-int ttsd_dbus_server_start_next_play(DBusMessage* msg)
-{
- DBusError err;
- dbus_error_init(&err);
-
- int uid;
-
- dbus_message_get_args(msg, &err,
- DBUS_TYPE_INT32, &uid,
- DBUS_TYPE_INVALID);
-
- SLOG(LOG_DEBUG, TAG_TTSD, ">>>>> TTSD NEXT PLAY");
-
- if (dbus_error_is_set(&err)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[IN ERROR] ttsd 'start next play' : Get arguments error (%s)\n", err.message);
- dbus_error_free(&err);
- } else {
- SLOG(LOG_DEBUG, TAG_TTSD, "[IN] ttsd 'start next play' : uid(%d) \n", uid);
- int ret = ttsd_server_start_next_play(uid);
- SLOG(LOG_DEBUG, TAG_TTSD, "[OUT] ttsd 'start next play' : result(%d) \n", ret);
- }
-
- SLOG(LOG_DEBUG, TAG_TTSD, "<<<<<");
- SLOG(LOG_DEBUG, TAG_TTSD, " ");
-
- return 0;
-}
-
-int ttsd_dbus_server_start_next_synthesis(DBusMessage* msg)
-{
- DBusError err;
- dbus_error_init(&err);
-
- int uid;
-
- dbus_message_get_args(msg, &err,
- DBUS_TYPE_INT32, &uid,
- DBUS_TYPE_INVALID);
-
- SLOG(LOG_DEBUG, TAG_TTSD, ">>>>> TTSD NEXT SYNTHESIS");
-
- if (dbus_error_is_set(&err)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[IN ERROR] ttsd 'start next synthesis' : Get arguments error (%s)\n", err.message);
- dbus_error_free(&err);
- } else {
- SLOG(LOG_DEBUG, TAG_TTSD, "[IN] ttsd 'start next synthesis' : uid(%d) \n", uid);
- int ret = ttsd_server_start_next_synthesis(uid);
- SLOG(LOG_DEBUG, TAG_TTSD, "[OUT] ttsd 'start next synthesis' : result(%d) \n", ret);
- }
-
- SLOG(LOG_DEBUG, TAG_TTSD, "<<<<<");
- SLOG(LOG_DEBUG, TAG_TTSD, " ");
-
- return 0;
-}
\ No newline at end of file
int ttsd_dbus_server_setting_set_engine_setting(DBusConnection* conn, DBusMessage* msg);
-/*
-* Dbus Server functions for tts daemon internal
-*/
-
-int ttsd_dbus_server_start_next_play(DBusMessage* msg);
-
-int ttsd_dbus_server_start_next_synthesis(DBusMessage* msg);
-
#ifdef __cplusplus
}
#endif
g_agent_init = true;
- if (0 != ttsd_config_get_char_type(CONFIG_KEY_DEFAULT_LANGUAGE, &(g_cur_engine.default_lang)) &&
- 0 != ttsd_config_get_int_type(CONFIG_KEY_DEFAULT_VOICE_TYPE, &(g_cur_engine.default_vctype)) ) {
- /* Set default voice */
+ 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");
+ /* 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_int_type(CONFIG_KEY_DEFAULT_SPEED, &(g_cur_engine.default_speed))) {
+ 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");
- ttsd_config_set_int_type(CONFIG_KEY_DEFAULT_SPEED, TTSP_SPEED_NORMAL);
+ ttsd_config_set_default_speed((int)TTSP_SPEED_NORMAL);
g_cur_engine.default_speed = TTSP_SPEED_NORMAL;
}
g_list_free(iter);
/* release current engine data */
- if( g_cur_engine.pefuncs != NULL)
+ if (g_cur_engine.pefuncs != NULL)
g_free(g_cur_engine.pefuncs);
- if( g_cur_engine.pdfuncs != NULL)
+ if (g_cur_engine.pdfuncs != NULL)
g_free(g_cur_engine.pdfuncs);
g_result_cb = NULL;
g_agent_init = false;
+ if (g_cur_engine.default_lang != NULL)
+ g_free(g_cur_engine.default_lang);
+
+
SLOG(LOG_DEBUG, TAG_TTSD, "[Engine Agent SUCCESS] Release Engine Agent\n");
return 0;
char* cur_engine_uuid = NULL;
bool is_get_engineid_from_config = false;
- if (0 != ttsd_config_get_char_type(CONFIG_KEY_DEFAULT_ENGINE_ID ,&cur_engine_uuid)) {
+ if (0 != ttsd_config_get_default_engine(&cur_engine_uuid)) {
/*not set current engine */
/*set system default engine*/
GList *iter = NULL;
}
if (false == is_get_engineid_from_config) {
- if (0 != ttsd_config_set_char_type(CONFIG_KEY_DEFAULT_ENGINE_ID ,cur_engine_uuid))
+ 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");
}
if (g_cur_engine.engine_name != NULL) g_free(g_cur_engine.engine_name);
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");
+ return TTSD_ERROR_OPERATION_FAILED;
+ }
+
g_cur_engine.engine_uuid = g_strdup(data->engine_uuid);
g_cur_engine.engine_name = g_strdup(data->engine_name);
g_cur_engine.engine_path = g_strdup(data->engine_path);
return TTSD_ERROR_OPERATION_FAILED;
}
- ttsd_config_set_char_type(CONFIG_KEY_DEFAULT_LANGUAGE, voice->language);
- ttsd_config_set_int_type(CONFIG_KEY_DEFAULT_VOICE_TYPE, voice->type);
-
+ ttsd_config_set_default_voice(voice->language, (int)voice->type);
+
g_cur_engine.default_lang = g_strdup(voice->language);
g_cur_engine.default_vctype = voice->type;
SLOG(LOG_ERROR, TAG_TTSD, "[Engine ERROR] Fail voice is NOT valid ");
return TTSD_ERROR_OPERATION_FAILED;
}
-
- ttsd_config_set_char_type(CONFIG_KEY_DEFAULT_LANGUAGE, voice->language);
- ttsd_config_set_int_type(CONFIG_KEY_DEFAULT_VOICE_TYPE, voice->type);
-
+
+ ttsd_config_set_default_voice(voice->language, (int)voice->type);
+
if (NULL != g_cur_engine.default_lang)
g_free(g_cur_engine.default_lang);
/* roll back to old current engine. */
__internal_set_current_engine(tmp_uuid);
-
- if( tmp_uuid != NULL )
+ ttsd_engine_agent_load_current_engine();
+
+ if (tmp_uuid != NULL)
free(tmp_uuid);
return TTSD_ERROR_OPERATION_FAILED;
}
/* save engine id to config */
- if (0 != ttsd_config_set_char_type(CONFIG_KEY_DEFAULT_ENGINE_ID, engine_id)) {
+ 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");
}
g_cur_engine.default_lang = strdup(language);
g_cur_engine.default_vctype = vctype;
- ret = ttsd_config_set_char_type(CONFIG_KEY_DEFAULT_LANGUAGE, language);
+ ret = ttsd_config_set_default_voice(language, (int)vctype);
if (0 == ret) {
- ret = ttsd_config_set_int_type(CONFIG_KEY_DEFAULT_VOICE_TYPE, vctype);
- if (0 != ret) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Engine Agent ERROR] fail to write default voice to config (%d) \n", ret);
- } else {
- SLOG(LOG_DEBUG, TAG_TTSD, "[Engine Agent SUCCESS] Set default voice : lang(%s), type(%d) \n",
+ SLOG(LOG_DEBUG, TAG_TTSD, "[Engine Agent SUCCESS] Set default voice : lang(%s), type(%d) \n",
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);
}
g_cur_engine.default_speed = speed;
- if (0 != ttsd_config_set_int_type(CONFIG_KEY_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");
}
#include <Ecore.h>
+#define CLIENT_CLEAN_UP_TIME 500
+
/* Main of TTS Daemon */
int main()
{
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, " ");
/* 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"
+#define BASE_DIRECTORY_DOWNLOAD "/opt/apps/voice/tts/1.0/"
#define ENGINE_DIRECTORY_DOWNLOAD "/opt/apps/voice/tts/1.0/engine"
#define ENGINE_DIRECTORY_DOWNLOAD_SETTING "/opt/apps/voice/tts/1.0/setting"
vconf_get_int(VCONFKEY_NETWORK_STATUS, &network_status);
if(network_status == VCONFKEY_NETWORK_OFF){
- printf("Current network connection is OFF!! \n");
SLOG(LOG_DEBUG, TAG_TTSD, "[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.
*/
- printf("network status is wrong or IP is not set\n");
- printf("network has problem, try again\n");
+ 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");
return -1;
}
g_is_connected = false;
} else {
- printf("Current network connection is ON. \n");
SLOG(LOG_DEBUG, TAG_TTSD, "[Network] Current network connection is ON.");
g_is_connected = true;
#include <mm_types.h>
#include <mm_player.h>
#include <mm_error.h>
+#include <Ecore.h>
#include "ttsd_main.h"
#include "ttsd_player.h"
switch (player_state) {
case MM_PLAYER_STATE_PLAYING:
case MM_PLAYER_STATE_PAUSED:
- ret = mm_player_stop(current->player_handle);
- if (MM_ERROR_NONE != ret) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Player WARNING] fail mm_player_stop() : %x", ret);
- }
- /* NO break for unrealize */
-
case MM_PLAYER_STATE_READY:
ret = mm_player_unrealize(current->player_handle);
if (MM_ERROR_NONE != ret) {
/* NO break for destroy */
case MM_PLAYER_STATE_NULL:
- mm_player_destroy(current->player_handle);
+ 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);
+ }
break;
default:
break;
}
-
+
GList *iter = NULL;
player_s *data = NULL;
}
}
+ SLOG(LOG_DEBUG, TAG_TTSD, "[PLAYER Success] Destroy instance");
+
return 0;
}
return 0;
}
} else {
- SLOG(LOG_ERROR, TAG_TTSD, "[Player ERROR] Current player do NOT exist");
+ SLOG(LOG_WARN, TAG_TTSD, "[Player WARNING] Current player do NOT exist");
return -1;
}
switch (player_state) {
case MM_PLAYER_STATE_PLAYING:
case MM_PLAYER_STATE_PAUSED:
- ret = mm_player_stop(current->player_handle);
- if (MM_ERROR_NONE != ret) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Player WARNING] fail mm_player_stop() : %x", ret);
- }
- /* NO break for unrealize */
-
case MM_PLAYER_STATE_READY:
ret = mm_player_unrealize(current->player_handle);
if (MM_ERROR_NONE != ret) {
switch (player_state) {
case MM_PLAYER_STATE_PLAYING:
case MM_PLAYER_STATE_PAUSED:
- ret = mm_player_stop(current->player_handle);
- if (MM_ERROR_NONE != ret) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Player WARNING] fail mm_player_stop() : %x", ret);
- }
- /* NO break for unrealize */
-
case MM_PLAYER_STATE_READY:
ret = mm_player_unrealize(current->player_handle);
if (MM_ERROR_NONE != ret) {
if (MM_ERROR_NONE != ret) {
SLOG(LOG_ERROR, TAG_TTSD, "[Player ERROR] fail mm_player_resume() : %d", ret);
return -1;
+ } else {
+ SLOG(LOG_DEBUG, TAG_TTSD, "[Player] Resume player");
}
g_playing_info = current;
}
if (APP_STATE_PLAYING == state || APP_STATE_PAUSED == state) {
- ret = mm_player_stop(data->player_handle);
- if (MM_ERROR_NONE != ret) {
- SLOG(LOG_WARN, TAG_TTSD, "[player WARNING] fail mm_player_stop() : %x ", ret);
- }
-
/* unrealize player */
ret = mm_player_unrealize(data->player_handle);
if (MM_ERROR_NONE != ret) {
return 0;
}
+static Eina_Bool __player_next_play(void *data)
+{
+ SLOG(LOG_DEBUG, TAG_TTSD, "===== PLAYER NEXT PLAY");
+
+ int* uid = (int*)data;
+
+ SLOG(LOG_DEBUG, TAG_TTSD, "[PLAYER] uid = %d", *uid);
+
+ if (0 != ttsd_player_next_play(*uid)) {
+ SLOG(LOG_WARN, TAG_TTSD, "[PLAYER WARNING] Fail to play next");
+ }
+
+ if (NULL != uid)
+ free(uid);
+
+ SLOG(LOG_DEBUG, TAG_TTSD, "=====");
+ SLOG(LOG_DEBUG, TAG_TTSD, " ");
+
+ return EINA_FALSE;
+}
+
static int msg_callback(int message, void *data, void *user_param)
{
user_data_s* user_data;
SLOG(LOG_ERROR, TAG_TTSD, "[Send ERROR] Fail to send Utterance Completed Signal : pid(%d), uid(%d), uttid(%d)", pid, uid, utt_id);
}
- ttsd_send_start_next_play_message(uid);
+ int* uid_data = (int*) g_malloc0(sizeof(int));
+ *uid_data = uid;
+
+ SLOG(LOG_DEBUG, TAG_TTSD, "[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, " ");
* limitations under the License.
*/
-
+#include <Ecore.h>
#include "ttsd_main.h"
#include "ttsd_player.h"
#include "ttsd_data.h"
} utterance_t;
/* If current engine exist */
-static bool g_is_engine;
+static bool g_is_engine;
/* If engine is running */
-static bool g_is_synthesizing;
+static bool g_is_synthesizing;
+
+/* If the daemon get the result */
+Ecore_Timer* g_timer;
+static bool g_is_next_synthesis;
+
+/* Function definitions */
+int __server_next_synthesis(int uid);
+
int __server_set_is_synthesizing(bool flag)
{
return 0;
}
-int __server_interrupt_client(int org_uid)
-{
- int pid = ttsd_data_get_pid(org_uid);
-
- /* pause player */
- if (0 != ttsd_player_pause(org_uid)) {
- SLOG(LOG_WARN, TAG_TTSD, "[Server ERROR] fail to ttsd_player_pause() : uid (%d)\n", org_uid);
- }
-
- /* send message to client about changing state */
- ttsdc_send_interrupt_message (pid, org_uid, TTSD_INTERRUPTED_PAUSED);
-
- /* change state */
- ttsd_data_set_client_state(org_uid, APP_STATE_PAUSED);
-
- return 0;
-}
-
-int __server_start_synthesis(int uid)
+int __server_start_synthesis(int uid, int mode)
{
int result = 0;
/* check if tts-engine is running */
if (true == __server_get_current_synthesis()) {
- SLOG(LOG_DEBUG, TAG_TTSD, "[Server] TTS-engine is running \n");
+ SLOG(LOG_DEBUG, TAG_TTSD, "[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 \n");
+ SLOG(LOG_ERROR, TAG_TTSD, "[Server ERROR] Out of memory : utterance ");
return TTSD_ERROR_OUT_OF_MEMORY;
}
__server_set_is_synthesizing(true);
int ret = 0;
- ret = ttsd_engine_start_synthesis( sdata.lang, sdata.vctype, sdata.text, sdata.speed, (void*)utt);
+ 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 !!!! * ");
result = TTSD_ERROR_OPERATION_FAILED;
g_free(utt);
+
+ if (2 == mode) {
+ __server_send_error(uid, sdata.utt_id, TTSD_ERROR_OPERATION_FAILED);
+ 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");
}
/* resume player and start speech synthesis */
if (0 != ttsd_player_resume(uid)) {
- SLOG(LOG_WARN, TAG_TTSD, "[Server WARNING] fail to ttsd_player_resume() \n");
+ SLOG(LOG_WARN, TAG_TTSD, "[Server WARNING] fail to ttsd_player_resume()");
}
- ret = __server_start_synthesis(uid);
+ /* 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);
-
- ret = __server_start_synthesis(uid);
+
+ /* mode 1 for play */
+ ret = __server_start_synthesis(uid, 1);
} else {
/* NO this case */
}
}
if (true == __server_get_current_synthesis()) {
- SLOG(LOG_WARN, TAG_TTSD, "[Server WARNING] Engine has already been running. \n");
+ SLOG(LOG_WARN, TAG_TTSD, "[Server WARNING] Engine has already been running. ");
SLOG(LOG_DEBUG, TAG_TTSD, "=====");
SLOG(LOG_DEBUG, TAG_TTSD, " ");
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 \n");
+ 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);
return TTSD_ERROR_OUT_OF_MEMORY;
__server_send_error(current_uid, sdata.utt_id, TTSD_ERROR_OPERATION_FAILED);
g_free(utt);
+
+ ttsd_server_stop(current_uid);
+
+ int pid = ttsd_data_get_pid(current_uid);
+ ttsdc_send_set_state_message(pid, current_uid, APP_STATE_READY);
}
if(sdata.text != NULL)
}
if (0 != ttsd_player_play(current_uid)) {
- SLOG(LOG_WARN, TAG_TTSD, "[Server WARNING] __synthesis_result_callback : fail ttsd_player_play() \n");
+ SLOG(LOG_WARN, TAG_TTSD, "[Server WARNING] __synthesis_result_callback : fail ttsd_player_play() ");
} else {
/* success playing */
SLOG(LOG_DEBUG, TAG_TTSD, "[Server] Success to start player");
if (false == __server_get_current_synthesis()) {
/* 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 \n");
+ SLOG(LOG_DEBUG, TAG_TTSD, "[SERVER Callback] all play completed ");
}
}
break;
case PLAYER_ERROR:
- SLOG(LOG_ERROR, TAG_TTSD, "[SERVER Callback ERROR] callback : player error \n");
+ SLOG(LOG_ERROR, TAG_TTSD, "[SERVER Callback ERROR] callback : player error ");
__server_send_error(uid, utt_id, TTSD_ERROR_OPERATION_FAILED);
break;
return 0;
}
+Eina_Bool __start_next_synthesis(void *data)
+{
+ /* get current play */
+ int uid = ttsd_data_is_current_playing();
+
+ if (uid < 0)
+ return EINA_FALSE;
+
+ if (true == g_is_next_synthesis) {
+ SLOG(LOG_DEBUG, TAG_TTSD, "===== NEXT SYNTHESIS START");
+ __server_next_synthesis(uid);
+ SLOG(LOG_DEBUG, TAG_TTSD, "===== ");
+ SLOG(LOG_DEBUG, TAG_TTSD, " ");
+
+ g_is_next_synthesis = false;
+ }
+
+ return EINA_TRUE;
+}
+
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");
+ SLOG(LOG_DEBUG, TAG_TTSD, "===== SYNTHESIS RESULT CALLBACK START");
utterance_t* utt_get_param;
utt_get_param = (utterance_t*)user_data;
int uttid = utt_get_param->uttid;
if (NULL == utt_get_param) {
- SLOG(LOG_ERROR, TAG_TTSD, "[SERVER ERROR] User data is NULL \n" );
+ SLOG(LOG_ERROR, TAG_TTSD, "[SERVER ERROR] User data is NULL " );
SLOG(LOG_DEBUG, TAG_TTSD, "=====");
SLOG(LOG_DEBUG, TAG_TTSD, " ");
return -1;
if (TTSP_RESULT_EVENT_FINISH == event) SLOG(LOG_DEBUG, TAG_TTSD, "[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 !!!! \n" );
+ SLOG(LOG_ERROR, TAG_TTSD, "[SERVER ERROR] uttid is NOT valid !!!! " );
SLOG(LOG_DEBUG, TAG_TTSD, "=====");
SLOG(LOG_DEBUG, TAG_TTSD, " ");
}
- SLOG(LOG_DEBUG, TAG_TTSD, "[SERVER] Result Info : uid(%d), utt(%d), data(%p), data size(%d) \n",
+ SLOG(LOG_DEBUG, TAG_TTSD, "[SERVER] Result Info : uid(%d), utt(%d), data(%p), data size(%d) ",
uid, uttid, data, data_size);
/* add wav data */
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)\n", utt_get_param->uid);
+ SLOG(LOG_ERROR, TAG_TTSD, "[SERVER ERROR] Fail to add sound data : uid(%d)", utt_get_param->uid);
}
if (event == TTSP_RESULT_EVENT_FINISH) {
__server_set_is_synthesizing(false);
-
- if (0 != ttsd_send_start_next_synthesis_message(uid)) {
- /* critical error */
- SLOG(LOG_ERROR, TAG_TTSD, "[SERVER ERROR] IPC ERROR FOR NEXT SYNTHESIS \n");
- }
+
+ g_is_next_synthesis = true;
}
}
SLOG(LOG_DEBUG, TAG_TTSD, "[SERVER] Event : TTSP_RESULT_EVENT_CANCEL");
__server_set_is_synthesizing(false);
- if (0 != ttsd_send_start_next_synthesis_message(uid)) {
- /* critical error */
- SLOG(LOG_ERROR, TAG_TTSD, "[SERVER ERROR] IPC ERROR FOR NEXT SYNTHESIS \n");
- }
+ g_is_next_synthesis = true;
}
else {
- SLOG(LOG_DEBUG, TAG_TTSD, "[SERVER] Event : TTSP_RESULT_EVENT_CANCEL");
+ SLOG(LOG_DEBUG, TAG_TTSD, "[SERVER] Event : etc");
__server_set_is_synthesizing(false);
- if (0 != ttsd_send_start_next_synthesis_message(uid)) {
- /* critical error */
- SLOG(LOG_ERROR, TAG_TTSD, "[SERVER ERROR] IPC ERROR FOR NEXT SYNTHESIS \n");
- }
+
+ g_is_next_synthesis = true;
}
if (TTSP_RESULT_EVENT_FINISH == event || TTSP_RESULT_EVENT_CANCEL == event || TTSP_RESULT_EVENT_FAIL == event) {
free(utt_get_param);
}
- SLOG(LOG_DEBUG, TAG_TTSD, "=====");
+ SLOG(LOG_DEBUG, TAG_TTSD, "===== SYNTHESIS RESULT CALLBACK END");
SLOG(LOG_DEBUG, TAG_TTSD, " ");
return 0;
int ttsd_initialize()
{
+ if (ttsd_config_initialize()) {
+ SLOG(LOG_ERROR, TAG_TTSD, "[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 \n");
+ SLOG(LOG_ERROR, TAG_TTSD, "[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 \n");
+ SLOG(LOG_ERROR, TAG_TTSD, "[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 !!! \n" );
+ SLOG(LOG_WARN, TAG_TTSD, "[Server WARNING] No Engine !!!" );
g_is_engine = false;
} else
g_is_engine = true;
+ g_timer = NULL;
+
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);
+ ttsd_server_finalize(uid);
+ } else if (-1 == result) {
+ SLOG(LOG_ERROR, TAG_TTSD, "[Server ERROR] Hello result has error");
+ }
+
+ return true;
+}
+
+
+Eina_Bool ttsd_cleanup_client(void *data)
+{
+ SLOG(LOG_DEBUG, TAG_TTSD, "===== CLEAN UP CLIENT START");
+ ttsd_data_foreach_clients(__get_client_for_clean_up, NULL);
+ SLOG(LOG_DEBUG, TAG_TTSD, "=====");
+ SLOG(LOG_DEBUG, TAG_TTSD, " ");
+
+ return EINA_TRUE;
+}
+
/*
* TTS Server Functions for Client
*/
{
if (false == g_is_engine) {
if (0 != ttsd_engine_agent_initialize_current_engine()) {
- SLOG(LOG_WARN, TAG_TTSD, "[Server WARNING] No Engine !!! \n" );
+ SLOG(LOG_WARN, TAG_TTSD, "[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 \n");
+ SLOG(LOG_ERROR, TAG_TTSD, "[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 \n");
+ SLOG(LOG_ERROR, TAG_TTSD, "[Server ERROR] Fail to load current engine ");
return TTSD_ERROR_OPERATION_FAILED;
}
}
if (0 != ttsd_data_new_client(pid, uid)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Server ERROR] Fail to add client info \n");
+ SLOG(LOG_ERROR, TAG_TTSD, "[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 \n");
+ SLOG(LOG_ERROR, TAG_TTSD, "[Server ERROR] Fail to create player ");
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] ttsd_server_finalize : uid is not valid \n");
+ SLOG(LOG_ERROR, TAG_TTSD, "[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_unload_current_engine()) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Server ERROR] fail to unload current engine \n");
+ SLOG(LOG_ERROR, TAG_TTSD, "[Server ERROR] fail to unload current engine ");
} else {
- SLOG(LOG_DEBUG, TAG_TTSD, "[Server SUCCESS] unload current engine \n");
+ SLOG(LOG_DEBUG, TAG_TTSD, "[Server SUCCESS] unload current engine ");
}
}
{
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 \n");
+ SLOG(LOG_ERROR, TAG_TTSD, "[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 \n");
+ SLOG(LOG_ERROR, TAG_TTSD, "[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' \n");
+ SLOG(LOG_ERROR, TAG_TTSD, "[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.\n");
+ SLOG(LOG_ERROR, TAG_TTSD, "[Server ERROR] Disconnect network. Current engine needs network.");
return TTSD_ERROR_OPERATION_FAILED;
}
}
- if (0 != __server_start_synthesis(uid)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Server ERROR] fail to schedule synthesis : uid(%d)\n", uid);
+ /* 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);
return TTSD_ERROR_OPERATION_FAILED;
}
}
return TTSD_ERROR_NONE;
}
+Eina_Bool __send_interrupt_client(void *data)
+{
+ int* uid = (int*)data;
+
+ if (NULL != uid) {
+ int pid = ttsd_data_get_pid(*uid);
+ /* send message to client about changing state */
+ ttsdc_send_set_state_message (pid, *uid, APP_STATE_PAUSED);
+ free(uid);
+ }
+ return EINA_FALSE;
+}
+
int ttsd_server_play(int uid)
{
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 \n", uid);
+ SLOG(LOG_ERROR, TAG_TTSD, "[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' \n", uid);
+ SLOG(LOG_WARN, TAG_TTSD, "[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!!!.\n");
+ SLOG(LOG_ERROR, TAG_TTSD, "[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 \n", current_uid);
- __server_interrupt_client(current_uid);
+ SLOG(LOG_DEBUG, TAG_TTSD, "[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);
+ }
+
+ /* change state */
+ ttsd_data_set_client_state(current_uid, APP_STATE_PAUSED);
+
+ int* temp_uid = (int*)malloc(sizeof(int));
+ *temp_uid = current_uid;
+ ecore_timer_add(0, __send_interrupt_client, temp_uid);
}
/* 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)\n", uid);
+ SLOG(LOG_ERROR, TAG_TTSD, "[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)\n", uid);
+ SLOG(LOG_ERROR, TAG_TTSD, "[Server ERROR] Fail to start synthesis : uid(%d)", uid);
return TTSD_ERROR_OPERATION_FAILED;
}
+ if (NULL == g_timer)
+ ecore_timer_add(0, __start_next_synthesis, NULL);
+
return TTSD_ERROR_NONE;
}
{
app_state_e state;
if (0 > ttsd_data_get_client_state(uid, &state)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Server ERROR] uid is not valid \n");
+ SLOG(LOG_ERROR, TAG_TTSD, "[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()\n");
+ SLOG(LOG_WARN, TAG_TTSD, "[Server] Fail to ttsd_player_stop()");
if (true == __server_get_current_synthesis()) {
- SLOG(LOG_DEBUG, TAG_TTSD, "[Server] TTS-engine is running \n");
+ SLOG(LOG_DEBUG, TAG_TTSD, "[Server] TTS-engine is running ");
int ret = 0;
ret = ttsd_engine_cancel_synthesis();
__server_set_is_synthesizing(false);
}
} else {
- SLOG(LOG_WARN, TAG_TTSD, "[Server WARNING] Current state is 'ready' \n");
+ SLOG(LOG_WARN, TAG_TTSD, "[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 \n");
+ SLOG(LOG_ERROR, TAG_TTSD, "[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' \n");
+ SLOG(LOG_WARN, TAG_TTSD, "[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)\n", ret);
+ SLOG(LOG_ERROR, TAG_TTSD, "[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 \n");
+ SLOG(LOG_ERROR, TAG_TTSD, "[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() \n");
+ SLOG(LOG_ERROR, TAG_TTSD, "[Server ERROR] Fail ttsd_server_get_support_voices() ");
return TTSD_ERROR_OPERATION_FAILED;
}
- SLOG(LOG_DEBUG, TAG_TTSD, "[Server SUCCESS] Get supported voices \n");
+ SLOG(LOG_DEBUG, TAG_TTSD, "[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 \n");
+ SLOG(LOG_ERROR, TAG_TTSD, "[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() \n");
+ SLOG(LOG_ERROR, TAG_TTSD, "[Server ERROR] fail ttsd_server_get_support_voices() ");
return ret;
}
- SLOG(LOG_DEBUG, TAG_TTSD, "[Server] Get default language (%s), voice type(%d) \n", *language, *voice_type);
+ SLOG(LOG_DEBUG, TAG_TTSD, "[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 !!! \n" );
+ SLOG(LOG_WARN, TAG_TTSD, "[Server Setting WARNING] No Engine !!! " );
g_is_engine = false;
return TTSD_ERROR_ENGINE_NOT_FOUND;
} else {
}
}
- if (-1 != ttsd_data_is_client(uid)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Server Setting ERROR] pid has already been registered \n");
+ if (-1 != ttsd_setting_data_is_setting(uid)) {
+ SLOG(LOG_ERROR, TAG_TTSD, "[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 \n");
+ SLOG(LOG_ERROR, TAG_TTSD, "[Server Setting ERROR] Fail to load current engine ");
return TTSD_ERROR_OPERATION_FAILED;
}
}
/* register pid */
- if (0 != ttsd_data_new_client(uid, uid)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Server Setting ERROR] Fail to add client info \n");
+ if (0 != ttsd_setting_data_add(uid)) {
+ SLOG(LOG_ERROR, TAG_TTSD, "[Server Setting ERROR] Fail to add client info ");
return TTSD_ERROR_OPERATION_FAILED;
}
int ttsd_server_setting_finalize(int uid)
{
- app_state_e state;
- if (0 > ttsd_data_get_client_state(uid, &state)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Server Setting ERROR] uid is not valid (%s)\n", uid);
+ if (-1 == ttsd_setting_data_is_setting(uid)) {
+ SLOG(LOG_ERROR, TAG_TTSD, "[Server Setting ERROR] uid is not valid (%s)", uid);
return TTSD_ERROR_INVALID_PARAMETER;
}
- ttsd_data_delete_client(uid);
+ 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_unload_current_engine())
- SLOG(LOG_ERROR, TAG_TTSD, "[Server Setting ERROR] fail to unload current engine \n");
+ SLOG(LOG_ERROR, TAG_TTSD, "[Server Setting ERROR] fail to unload current engine ");
else
- SLOG(LOG_DEBUG, TAG_TTSD, "[Server Setting SUCCESS] unload current engine \n");
+ SLOG(LOG_DEBUG, TAG_TTSD, "[Server Setting SUCCESS] unload current engine ");
}
return TTSD_ERROR_NONE;
int ttsd_server_setting_get_engine_list(int uid, GList** engine_list)
{
- app_state_e state;
- if (0 > ttsd_data_get_client_state(uid, &state)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Server Setting ERROR] uid is not valid \n");
+ if (-1 == ttsd_setting_data_is_setting(uid)) {
+ SLOG(LOG_ERROR, TAG_TTSD, "[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)\n", ret);
+ SLOG(LOG_ERROR, TAG_TTSD, "[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)
{
- app_state_e state;
- if (0 > ttsd_data_get_client_state(uid, &state)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Server Setting ERROR] uid is not valid \n");
+ if (-1 == ttsd_setting_data_is_setting(uid)) {
+ SLOG(LOG_ERROR, TAG_TTSD, "[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) \n", ret);
+ SLOG(LOG_ERROR, TAG_TTSD, "[Server Setting ERROR] Fail to get current engine : result(%d) ", ret);
return ret;
}
ttsd_data_set_client_state(uid, APP_STATE_READY);
/* send message */
- if ( 0 != ttsdc_send_interrupt_message(pid, uid, TTSD_INTERRUPTED_STOPPED)) {
+ if ( 0 != ttsdc_send_set_state_message(pid, uid, APP_STATE_READY)) {
/* remove client */
ttsd_data_delete_client(uid);
}
int ttsd_server_setting_set_current_engine(int uid, const char* engine_id)
{
- /* check if pid is valid */
- app_state_e state;
- if (0 > ttsd_data_get_client_state(uid, &state)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Server Setting ERROR] uid is not valid \n");
+ /* 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);
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 \n");
+ SLOG(LOG_DEBUG, TAG_TTSD, "[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) \n", ret);
+ SLOG(LOG_ERROR, TAG_TTSD, "[Server Setting ERROR] fail to set current engine : result(%d) ", ret);
return ret;
}
int ttsd_server_setting_get_voice_list(int uid, char** engine_id, GList** voice_list)
{
- app_state_e state;
- if (0 > ttsd_data_get_client_state(uid, &state)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Server Setting ERROR] uid is not valid \n");
+ /* 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);
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)\n", ret);
+ SLOG(LOG_ERROR, TAG_TTSD, "[Server Setting ERROR] Fail to get voice list : result(%d)", ret);
return ret;
}
int ttsd_server_setting_get_default_voice(int uid, char** language, ttsp_voice_type_e* vctype)
{
- app_state_e state;
- if (0 > ttsd_data_get_client_state(uid, &state)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Server Setting ERROR] uid is not valid \n");
+ /* 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);
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) \n", ret);
+ SLOG(LOG_ERROR, TAG_TTSD, "[Server Setting ERROR] Fail to get default voice : result(%d) ", ret);
return ret;
}
int ttsd_server_setting_set_default_voice(int uid, const char* language, int vctype)
{
- app_state_e state;
- if (0 > ttsd_data_get_client_state(uid, &state)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Server Setting ERROR] uid is not valid \n");
+ /* 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);
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) \n", ret);
+ SLOG(LOG_ERROR, TAG_TTSD, "[Server Setting ERROR] fail to set default voice : result(%d) ", ret);
return ret;
}
int ttsd_server_setting_get_engine_setting(int uid, char** engine_id, GList** engine_setting_list)
{
- app_state_e state;
- if (0 > ttsd_data_get_client_state(uid, &state)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Server Setting ERROR] uid is not valid \n");
+ /* 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);
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)\n", ret);
+ SLOG(LOG_ERROR, TAG_TTSD, "[Server Setting ERROR] fail to get engine setting info : result(%d)", ret);
return ret;
}
int ttsd_server_setting_set_engine_setting(int uid, const char* key, const char* value)
{
- app_state_e state;
- if (0 > ttsd_data_get_client_state(uid, &state)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Server Setting ERROR] uid is not valid \n");
+ /* 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);
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)\n", ret);
+ SLOG(LOG_ERROR, TAG_TTSD, "[Server Setting ERROR] fail to set engine setting info : result(%d)", ret);
return ret;
}
int ttsd_server_setting_get_default_speed(int uid, int* default_speed)
{
- app_state_e state;
- if (0 > ttsd_data_get_client_state(uid, &state)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Server Setting ERROR] uid is not valid \n");
+ /* 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);
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)\n", ret);
+ SLOG(LOG_ERROR, TAG_TTSD, "[Server Setting ERROR] fail to get default speed : result(%d)", ret);
return ret;
}
int ttsd_server_setting_set_default_speed(int uid, int default_speed)
{
- app_state_e state;
- if (0 > ttsd_data_get_client_state(uid, &state)) {
- SLOG(LOG_ERROR, TAG_TTSD, "[Server Setting ERROR] uid is not valid \n");
+ /* 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);
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)\n", ret);
+ SLOG(LOG_ERROR, TAG_TTSD, "[Server Setting ERROR] fail to set default speed : result(%d)", ret);
return ret;
}
return TTSD_ERROR_NONE;
}
-/*
-* Server API for Internal event
-*/
-
-int ttsd_server_start_next_play(int uid)
-{
- SLOG(LOG_DEBUG, TAG_TTSD, "===== NEXT PLAY START");
-
- int ret = ttsd_player_next_play(uid);
-
- SLOG(LOG_DEBUG, TAG_TTSD, "===== ");
- SLOG(LOG_DEBUG, TAG_TTSD, " ");
-
- return ret ;
-}
-
-int ttsd_server_start_next_synthesis(int uid)
-{
- return __server_next_synthesis(uid);
-}
-
#define __TTSD_SERVER_CORE_H_
#include <glib.h>
+#include <Ecore.h>
#ifdef __cplusplus
extern "C" {
/** Daemon initialize */
int ttsd_initialize();
+Eina_Bool ttsd_cleanup_client(void *data);
+
/*
* Server API for client
*/
int ttsd_server_pause(int uid, int* utt_id);
/*
-* Server API for Internal event
-*/
-
-int ttsd_server_start_next_play(int uid);
-
-int ttsd_server_start_next_synthesis(int uid);
-
-/*
* Server API for setting
*/