return TTS_ERROR_OPERATION_FAILED;
}
- SLOG(LOG_ERROR, TAG_TTSC, "[INFO] tts_h(%p), tts_client(%p), uid(%d)", tts, client, client->uid);
+ int uid = tts_client_get_uid(client);
+ SLOG(LOG_ERROR, TAG_TTSC, "[INFO] tts_h(%p), tts_client(%p), uid(%d)", tts, client, uid);
if (false == tts_ipc_is_method_set()) {
int pid = getpid();
}
}
- if (0 != tts_ipc_open_connection(client->uid)) {
+ if (0 != tts_ipc_open_connection(uid)) {
SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to open dbus connection");
return TTS_ERROR_OPERATION_FAILED;
}
- int ret = tts_config_mgr_initialize(client->uid);
+ int ret = tts_config_mgr_initialize(uid);
if (0 != ret) {
SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to init config manager : %d", ret);
tts_client_destroy(*tts);
return __tts_convert_config_error_code(ret);
}
- ret = tts_config_mgr_set_callback(client->uid, _tts_config_engine_changed_cb, __tts_config_voice_changed_cb, NULL, NULL, NULL, tts);
+ ret = tts_config_mgr_set_callback(uid, _tts_config_engine_changed_cb, __tts_config_voice_changed_cb, NULL, NULL, NULL, tts);
if (0 != ret) {
SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to set config changed : %d", ret);
tts_client_destroy(*tts);
return TTS_ERROR_INVALID_PARAMETER;
}
- SLOG(LOG_ERROR, TAG_TTSC, "[INFO] tts_h(%p), tts_client(%p), uid(%d)", tts, client, client->uid);
+ int uid = tts_client_get_uid(client);
+ SLOG(LOG_ERROR, TAG_TTSC, "[INFO] tts_h(%p), tts_client(%p), uid(%d)", tts, client, uid);
/* check used callback */
if (0 != tts_client_get_use_callback(client)) {
return TTS_ERROR_OPERATION_FAILED;
}
- tts_config_mgr_finalize(client->uid);
+ tts_config_mgr_finalize(uid);
// TODO: move into tts_client
if (client->hello_timer) {
thread_count = ecore_thread_active_get();
}
- if (0 != tts_ipc_close_connection(client->uid)) {
+ if (0 != tts_ipc_close_connection(uid)) {
SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to close connection");
return TTS_ERROR_OPERATION_FAILED;
}
key = NULL;
SLOG(LOG_DEBUG, TAG_TTSC, "@@@");
-
return TTS_ERROR_NONE;
}
// LCOV_EXCL_STOP
}
SLOG(LOG_DEBUG, TAG_TTSC, "@@@");
-
return TTS_ERROR_NONE;
}
}
SLOG(LOG_DEBUG, TAG_TTSC, "@@@");
-
return TTS_ERROR_NONE;
}
//LCOV_EXCL_STOP
}
SLOG(LOG_DEBUG, TAG_TTSC, "@@@");
-
return TTS_ERROR_NONE;
}
}
/* do request */
+ int uid = tts_client_get_uid(client);
int ret = -1;
int count = 0;
bool is_prepared = false;
while (0 != ret) {
- ret = tts_ipc_request_add_text(client->uid, text, temp, voice_type, speed, client->current_utt_id, client->credential);
+ ret = tts_ipc_request_add_text(uid, text, temp, voice_type, speed, client->current_utt_id, client->credential);
if (0 != ret) {
//LCOV_EXCL_START
if (TTS_ERROR_INVALID_PARAMETER == ret && false == is_prepared) {
return;
}
+ int uid = tts_client_get_uid(client);
int ret = -1;
int count = 0;
bool is_prepared = false;
while (0 != ret) {
- ret = tts_ipc_request_play(client->uid, client->credential);
+ ret = tts_ipc_request_play(uid, client->credential);
if (0 != ret) {
if (TTS_ERROR_INVALID_PARAMETER == ret && false == is_prepared) {
tts_client_set_current_state(client, TTS_STATE_CREATED);
return TTS_ERROR_PERMISSION_DENIED;
}
+ int uid = tts_client_get_uid(client);
ret = -1;
int count = 0;
bool is_prepared = false;
while (0 != ret) {
- ret = tts_ipc_request_play(client->uid, client->credential);
+ ret = tts_ipc_request_play(uid, client->credential);
if (0 != ret) {
//LCOV_EXCL_START
if (TTS_ERROR_INVALID_PARAMETER == ret && false == is_prepared) {
return;
}
+ int uid = tts_client_get_uid(client);
int ret = -1;
int count = 0;
bool is_prepared = false;
while (0 != ret) {
- ret = tts_ipc_request_stop(client->uid);
+ ret = tts_ipc_request_stop(uid);
if (0 != ret) {
if (TTS_ERROR_INVALID_PARAMETER == ret && false == is_prepared) {
tts_client_set_current_state(client, TTS_STATE_CREATED);
return TTS_ERROR_INVALID_STATE;
}
+ int uid = tts_client_get_uid(client);
int ret = -1;
int count = 0;
bool is_prepared = false;
while (0 != ret) {
- ret = tts_ipc_request_stop(client->uid);
+ ret = tts_ipc_request_stop(uid);
if (0 != ret) {
//LCOV_EXCL_START
if (TTS_ERROR_INVALID_PARAMETER == ret && false == is_prepared) {
return;
}
+ int uid = tts_client_get_uid(client);
int ret = -1;
int count = 0;
bool is_prepared = false;
while (0 != ret) {
- ret = tts_ipc_request_pause(client->uid);
+ ret = tts_ipc_request_pause(uid);
if (0 != ret) {
if (TTS_ERROR_INVALID_PARAMETER == ret && false == is_prepared) {
tts_client_set_current_state(client, TTS_STATE_CREATED);
return TTS_ERROR_INVALID_STATE;
}
+ int uid = tts_client_get_uid(client);
int ret = -1;
int count = 0;
bool is_prepared = false;
while (0 != ret) {
- ret = tts_ipc_request_pause(client->uid);
+ ret = tts_ipc_request_pause(uid);
if (0 != ret) {
//LCOV_EXCL_START
if (TTS_ERROR_INVALID_PARAMETER == ret && false == is_prepared) {
return TTS_ERROR_INVALID_PARAMETER;
}
+ int uid = tts_client_get_uid(client);
int ret = -1;
int count = 0;
bool is_prepared = false;
while (0 != ret) {
- ret = tts_ipc_request_set_private_data(client->uid, key, data);
+ ret = tts_ipc_request_set_private_data(uid, key, data);
if (0 != ret) {
//LCOV_EXCL_START
if (TTS_ERROR_INVALID_PARAMETER == ret && false == is_prepared) {
return TTS_ERROR_INVALID_STATE;
}
+ int uid = tts_client_get_uid(client);
int ret = -1;
int count = 0;
bool is_prepared = false;
while (0 != ret) {
- ret = tts_ipc_request_get_private_data(client->uid, key, data);
+ ret = tts_ipc_request_get_private_data(uid, key, data);
if (0 != ret) {
//LCOV_EXCL_START
if (TTS_ERROR_INVALID_PARAMETER == ret && false == is_prepared) {
return TTS_ERROR_INVALID_STATE;
}
+ int uid = tts_client_get_uid(client);
int ret = -1;
int count = 0;
bool is_prepared = false;
while (0 != ret) {
- ret = tts_ipc_request_add_pcm(client->uid, event, data, data_size, audio_type, rate);
+ ret = tts_ipc_request_add_pcm(uid, event, data, data_size, audio_type, rate);
if (0 != ret) {
if (TTS_ERROR_INVALID_PARAMETER == ret && false == is_prepared) {
tts_client_set_current_state(client, TTS_STATE_CREATED);
return TTS_ERROR_INVALID_STATE;
}
+ int uid = tts_client_get_uid(client);
int ret = -1;
int count = 0;
bool is_prepared = false;
while (0 != ret) {
- ret = tts_ipc_request_play_pcm(client->uid);
+ ret = tts_ipc_request_play_pcm(uid);
if (0 != ret) {
if (TTS_ERROR_INVALID_PARAMETER == ret && false == is_prepared) {
tts_client_set_current_state(client, TTS_STATE_CREATED);
return TTS_ERROR_INVALID_STATE;
}
+ int uid = tts_client_get_uid(client);
int ret = -1;
int count = 0;
bool is_prepared = false;
while (0 != ret) {
- ret = tts_ipc_request_stop_pcm(client->uid);
+ ret = tts_ipc_request_stop_pcm(uid);
if (0 != ret) {
if (TTS_ERROR_INVALID_PARAMETER == ret && false == is_prepared) {
tts_client_set_current_state(client, TTS_STATE_CREATED);
}
//LCOV_EXCL_STOP
+int tts_client_get_uid(tts_client_s* client)
+{
+ if (NULL == client || false == tts_client_is_valid_client(client)) {
+ SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Client(%p) is not valid", client);
+ return INVALID_HANDLE;
+ }
+
+ return client->uid;
+}
+
void tts_client_set_current_state(tts_client_s* client, tts_state_e state)
{
if (false == tts_client_is_valid_client(client)) {
GList* tts_client_get_client_list();
+int tts_client_get_uid(tts_client_s* client);
+
void tts_client_set_current_state(tts_client_s* client, tts_state_e state);
tts_state_e tts_client_get_current_state(tts_client_s* client);
return TTS_ERROR_INVALID_STATE;
}
- SLOG(LOG_INFO, TAG_TTSC, "[INFO] tts_h(%p), tts_client(%p), uid(%d)", tts_client_get_handle(client), client, client->uid);
+ int uid = tts_client_get_uid(client);
+ SLOG(LOG_INFO, TAG_TTSC, "[INFO] tts_h(%p), tts_client(%p), uid(%d)", tts_client_get_handle(client), client, uid);
/* check service engine status */
bool is_launched = __is_engine_launched(tts_client_get_mode(client));
}
/* Send hello */
- int ret = tts_ipc_request_hello(client->uid);
+ int ret = tts_ipc_request_hello(uid);
if (0 != ret) {
SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to request hello !!"); //LCOV_EXCL_LINE
} else {
}
}
// TODO: make function duplicated block
-
- /* Send hello */
- if (0 != tts_ipc_request_hello_sync(client->uid)) {
+ int uid = tts_client_get_uid(client);
+ if (0 != tts_ipc_request_hello_sync(uid)) {
return EINA_TRUE;
}
int ret = -1;
bool credential_needed = false;
- ret = tts_ipc_request_initialize(client->uid, &credential_needed);
-
+ ret = tts_ipc_request_initialize(uid, &credential_needed);
if (TTS_ERROR_ENGINE_NOT_FOUND == ret || TTS_ERROR_PERMISSION_DENIED == ret) {
SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to initialize : %s", __tts_get_error_code(ret));
tts_core_notify_error_async(client, ret, -1, NULL);
if (NULL != client->notify_state_timer) {
ecore_timer_del(client->notify_state_timer);
}
- client->notify_state_timer = ecore_timer_add(0, __notify_state_timer_cb, (void*)client->uid);
+ client->notify_state_timer = ecore_timer_add(0, __notify_state_timer_cb, (void*)tts_client_get_uid(client));
return TTS_ERROR_NONE;
}
if (NULL != client->notify_error_timer) {
ecore_timer_del(client->notify_error_timer);
}
- client->notify_error_timer = ecore_timer_add(0, __notify_error_timer_cb, (void*)client->uid);
+ client->notify_error_timer = ecore_timer_add(0, __notify_error_timer_cb, (void*)tts_client_get_uid(client));
return TTS_ERROR_NONE;
}
return TTS_ERROR_INVALID_PARAMETER;
}
- int uid = client->uid;
+ int uid = tts_client_get_uid(client);
tts_client_set_mode(client, mode);
if (TTS_MODE_SCREEN_READER == mode) {
if (0 != __update_screen_reader_state()) {
return TTS_ERROR_INVALID_PARAMETER;
}
- SLOG(LOG_INFO, TAG_TTSC, "[INFO] tts_h(%p), tts_client(%p), uid(%d)", tts_client_get_handle(client), client, client->uid);
+ SLOG(LOG_INFO, TAG_TTSC, "[INFO] Start core_prepare. tts_h(%p), tts_client(%p)", tts_client_get_handle(client), client);
if (NULL == client->hello_timer) {
SLOG(LOG_ERROR, TAG_TTSC, "Register timer for __prepare_first_cb");
ecore_thread_main_loop_begin();
- client->hello_timer = ecore_timer_add(0.0, __prepare_first_cb, (void*)client->uid);
+ client->hello_timer = ecore_timer_add(0.0, __prepare_first_cb, (void*)tts_client_get_uid(client));
ecore_thread_main_loop_end();
} else {
LOGD("Client is already trying to prepare");
return TTS_ERROR_INVALID_PARAMETER;
}
- SLOG(LOG_INFO, TAG_TTSC, "[INFO] tts_h(%p), tts_client(%p), uid(%d)", tts_client_get_handle(client), client, client->uid);
+ SLOG(LOG_INFO, TAG_TTSC, "[INFO] Start core_prepare_sync. tts_h(%p), tts_client(%p), uid(%d)", tts_client_get_handle(client), client, tts_client_get_uid(client));
int cnt = 0;
while (EINA_TRUE == __prepare_sync_cb(client) && TTS_CONNECTION_RETRY_COUNT > cnt) {
cnt++;
}
- SLOG(LOG_DEBUG, TAG_TTSC, "@@@");
-
if (TTS_CONNECTION_RETRY_COUNT == cnt) {
SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to connect daemon");
return TTS_ERROR_OPERATION_FAILED;
}
+ SLOG(LOG_DEBUG, TAG_TTSC, "@@@");
return TTS_ERROR_NONE;
}
return TTS_ERROR_INVALID_PARAMETER;
}
- SLOG(LOG_INFO, TAG_TTSC, "[INFO] tts_h(%p), tts_client(%p), uid(%d)", tts_client_get_handle(client), client, client->uid);
+ int uid = tts_client_get_uid(client);
+ SLOG(LOG_INFO, TAG_TTSC, "[INFO] tts_h(%p), tts_client(%p), uid(%d)", tts_client_get_handle(client), client, uid);
if (client->hello_timer) {
ecore_timer_del(client->hello_timer);
client->hello_timer = NULL;
if (false == g_is_screen_reader_on && TTS_MODE_SCREEN_READER == mode) {
SLOG(LOG_WARN, TAG_TTSC, "[WARNING] Do not request finalize : is_screen_reader(%d) mode(%d)", g_is_screen_reader_on, mode);
- ret = tts_ipc_stop_listening(client->uid);
+ ret = tts_ipc_stop_listening(uid);
if (0 != ret) {
SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to remove match : %s", __tts_get_error_code(ret));
}
bool is_prepared = false;
do {
- ret = tts_ipc_request_finalize(client->uid);
+ ret = tts_ipc_request_finalize(uid);
if (0 != ret) {
//LCOV_EXCL_START
if (TTS_ERROR_INVALID_PARAMETER == ret && false == is_prepared) {
int tts_core_foreach_supported_voices(tts_client_s* client, const char* engine_id, tts_supported_voice_cb callback, void* user_data)
{
+ if (false == tts_client_is_valid_client(client)) {
+ SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] client is not valid");
+ return TTS_ERROR_INVALID_PARAMETER;
+ }
+
tts_client_set_supported_voice_cb(client, callback, user_data);
- int ret = tts_config_mgr_get_voice_list(engine_id, __supported_voice_cb, (void*)client->uid);
+ int ret = tts_config_mgr_get_voice_list(engine_id, __supported_voice_cb, (void*)tts_client_get_uid(client));
tts_client_set_supported_voice_cb(client, NULL, NULL);
if (0 != ret) {
return;
for (int nsec = 1; nsec <= MAXSLEEP; nsec <<= 1) {
- if (0 == tts_tidl_open_connection(client->uid)) {
+ if (0 == tts_tidl_open_connection(uid)) {
SLOG(LOG_DEBUG, TAG_TTSC, "Try to connect the service");
return;
}
SLOG(LOG_DEBUG, TAG_TTSC, ">>>>> TTS Hello");
/* register callback - needed to create new client before adding callback */
rpc_port_tts_notify_cb_h cb = rpc_port_tts_notify_cb_create(__notify_cb, false, NULL);
- if (0 != rpc_port_proxy_tts_invoke_register_cb(tts->rpc_h, client->pid, client->uid, cb)) {
+ if (0 != rpc_port_proxy_tts_invoke_register_cb(tts->rpc_h, client->pid, uid, cb)) {
SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Failed to invoke register");
return TTS_ERROR_OPERATION_FAILED;
}
return TTS_ERROR_OPERATION_FAILED;
}
- if (0 != rpc_port_proxy_tts_invoke_initialize(tts->rpc_h, client->pid, client->uid, &temp)) {
+ if (0 != rpc_port_proxy_tts_invoke_initialize(tts->rpc_h, client->pid, uid, &temp)) {
SLOG(LOG_ERROR, TAG_TTSC, ">>>> Request tts initialize : Fail to invoke message");
return TTS_ERROR_OPERATION_FAILED;
}
return TTS_ERROR_OPERATION_FAILED;
}
- if (0 != rpc_port_proxy_tts_invoke_finalize(tts->rpc_h, client->uid)) {
+ if (0 != rpc_port_proxy_tts_invoke_finalize(tts->rpc_h, uid)) {
SLOG(LOG_ERROR, TAG_TTSC, ">>>> Request tts initialize : Fail to invoke message");
return TTS_ERROR_OPERATION_FAILED;
}
return TTS_ERROR_OPERATION_FAILED;
}
- if (0 != rpc_port_proxy_tts_invoke_add_text(tts->rpc_h, client->uid, text, lang, vctype, speed, uttid, credential)) {
+ if (0 != rpc_port_proxy_tts_invoke_add_text(tts->rpc_h, uid, text, lang, vctype, speed, uttid, credential)) {
SLOG(LOG_ERROR, TAG_TTSC, ">>>> Request add text : Fail to invoke message");
return TTS_ERROR_OPERATION_FAILED;
}
return TTS_ERROR_OPERATION_FAILED;
}
- if (0 != rpc_port_proxy_tts_invoke_set_private(tts->rpc_h, client->uid, key, data)) {
+ if (0 != rpc_port_proxy_tts_invoke_set_private(tts->rpc_h, uid, key, data)) {
SLOG(LOG_ERROR, TAG_TTSC, ">>>> Request set private data : Fail to invoke message");
return TTS_ERROR_OPERATION_FAILED;
}
return TTS_ERROR_OPERATION_FAILED;
}
- if (0 != rpc_port_proxy_tts_invoke_get_private(tts->rpc_h, client->uid, key, &tmp)) {
+ if (0 != rpc_port_proxy_tts_invoke_get_private(tts->rpc_h, uid, key, &tmp)) {
SLOG(LOG_ERROR, TAG_TTSC, ">>>> Request get private data : Fail to invoke message");
return TTS_ERROR_OPERATION_FAILED;
}
return TTS_ERROR_OPERATION_FAILED;
}
- if (0 != rpc_port_proxy_tts_invoke_play(tts->rpc_h, client->uid, credential)) {
+ if (0 != rpc_port_proxy_tts_invoke_play(tts->rpc_h, uid, credential)) {
SLOG(LOG_ERROR, TAG_TTSC, ">>>> Request play : Fail to invoke message");
return TTS_ERROR_OPERATION_FAILED;
}
return TTS_ERROR_OPERATION_FAILED;
}
- if (0 != rpc_port_proxy_tts_invoke_stop(tts->rpc_h, client->uid)) {
+ if (0 != rpc_port_proxy_tts_invoke_stop(tts->rpc_h, uid)) {
SLOG(LOG_ERROR, TAG_TTSC, ">>>> Request stop : Fail to invoke message");
return TTS_ERROR_OPERATION_FAILED;
}
return TTS_ERROR_OPERATION_FAILED;
}
- if (0 != rpc_port_proxy_tts_invoke_pause(tts->rpc_h, client->uid)) {
+ if (0 != rpc_port_proxy_tts_invoke_pause(tts->rpc_h, uid)) {
SLOG(LOG_ERROR, TAG_TTSC, ">>>> Request pause : Fail to invoke message");
return TTS_ERROR_OPERATION_FAILED;
}
return TTS_ERROR_OPERATION_FAILED;
}
- if (0 != rpc_port_proxy_tts_invoke_play_pcm(tts->rpc_h, client->uid)) {
+ if (0 != rpc_port_proxy_tts_invoke_play_pcm(tts->rpc_h, uid)) {
SLOG(LOG_ERROR, TAG_TTSC, ">>>> Request play pcm : Fail to invoke message");
return TTS_ERROR_OPERATION_FAILED;
}
return TTS_ERROR_OPERATION_FAILED;
}
- if (0 != rpc_port_proxy_tts_invoke_stop_pcm(tts->rpc_h, client->uid)) {
+ if (0 != rpc_port_proxy_tts_invoke_stop_pcm(tts->rpc_h, uid)) {
SLOG(LOG_ERROR, TAG_TTSC, ">>>> Request pause pcm : Fail to invoke message");
return TTS_ERROR_OPERATION_FAILED;
}
return TTS_ERROR_OPERATION_FAILED;
}
- if (0 != rpc_port_proxy_tts_invoke_add_pcm(tts->rpc_h, client->uid, event, data, data_size, audio_type, rate)) {
+ if (0 != rpc_port_proxy_tts_invoke_add_pcm(tts->rpc_h, uid, event, data, data_size, audio_type, rate)) {
SLOG(LOG_ERROR, TAG_TTSC, ">>>> Request pause pcm : Fail to invoke message");
return TTS_ERROR_OPERATION_FAILED;
}