static int g_max_text_size = -1;
-static Ecore_Timer* g_check_state_timer = NULL;
-static Ecore_Timer* g_notify_error_timer = NULL;
-
/* for repetition */
static char* g_language = NULL;
thread_count = ecore_thread_active_get();
}
+ /* Delete state timer before destroying handle */
+ if (NULL != client->notify_state_timer) {
+ ecore_timer_del(client->notify_state_timer);
+ client->notify_state_timer = NULL;
+ }
+ /* Delete error timer before destroying handle */
+ if (NULL != client->notify_error_timer) {
+ ecore_timer_del(client->notify_error_timer);
+ client->notify_error_timer = NULL;
+ }
+
/* Free resources */
tts_client_destroy(tts);
g_language = NULL;
}
- /* Delete state timer before destroying handle */
- if (NULL != g_check_state_timer) {
- ecore_timer_del(g_check_state_timer);
- g_check_state_timer = NULL;
- }
- /* Delete error timer before destroying handle */
- if (NULL != g_notify_error_timer) {
- ecore_timer_del(g_notify_error_timer);
- g_notify_error_timer = NULL;
- }
tts = NULL;
client->reason = ret;
client->utt_id = -1;
- if (NULL != g_notify_error_timer) {
- ecore_timer_del(g_notify_error_timer);
- g_notify_error_timer = NULL;
+ if (NULL != client->notify_error_timer) {
+ ecore_timer_del(client->notify_error_timer);
}
- g_notify_error_timer = ecore_timer_add(0, __tts_notify_error, client->tts);
+ client->notify_error_timer = ecore_timer_add(0, __tts_notify_error, client->tts);
return;
}
client->reason = ret;
client->utt_id = -1;
- if (NULL != g_notify_error_timer) {
- ecore_timer_del(g_notify_error_timer);
- g_notify_error_timer = NULL;
+ if (NULL != client->notify_error_timer) {
+ ecore_timer_del(client->notify_error_timer);
}
- g_notify_error_timer = ecore_timer_add(0, __tts_notify_error, client->tts);
+ client->notify_error_timer = ecore_timer_add(0, __tts_notify_error, client->tts);
return;
}
client->reason = ret;
client->utt_id = -1;
- if (NULL != g_notify_error_timer) {
- ecore_timer_del(g_notify_error_timer);
- g_notify_error_timer = NULL;
+ if (NULL != client->notify_error_timer) {
+ ecore_timer_del(client->notify_error_timer);
}
- g_notify_error_timer = ecore_timer_add(0, __tts_notify_error, client->tts);
+ client->notify_error_timer = ecore_timer_add(0, __tts_notify_error, client->tts);
return;
}
/* check handle */
if (NULL == client) {
SLOG(LOG_WARN, TAG_TTSC, "Fail to notify error msg : A handle is not valid");
- g_notify_error_timer = NULL;
return EINA_FALSE;
}
tts_core_notify_error(client, client->utt_id, client->reason);
- g_notify_error_timer = NULL;
+ client->notify_error_timer = NULL;
return EINA_FALSE;
}
/* call callback function */
if (NULL != data->error_cb) {
- if (NULL != g_notify_error_timer) {
- ecore_timer_del(g_notify_error_timer);
- g_notify_error_timer = NULL;
+ if (NULL != data->notify_error_timer) {
+ ecore_timer_del(data->notify_error_timer);
}
- g_notify_error_timer = ecore_timer_add(0, __tts_notify_error, data->tts);
+ data->notify_error_timer = ecore_timer_add(0, __tts_notify_error, data->tts);
} else {
SLOG(LOG_WARN, TAG_TTSC, "No registered callback function of error ");
}
/* call callback function */
if (NULL != client->error_cb) {
- if (NULL != g_notify_error_timer) {
- ecore_timer_del(g_notify_error_timer);
- g_notify_error_timer = NULL;
+ if (NULL != client->notify_error_timer) {
+ ecore_timer_del(client->notify_error_timer);
}
- g_notify_error_timer = ecore_timer_add(0, __tts_notify_error, client->tts);
+ client->notify_error_timer = ecore_timer_add(0, __tts_notify_error, client->tts);
} else {
SLOG(LOG_WARN, TAG_TTSC, "No registered callback function of error ");
}
/* check handle */
if (NULL == client) {
SLOG(LOG_WARN, TAG_TTSC, "Fail to notify state changed : A handle is not valid");
- g_check_state_timer = NULL;
return EINA_FALSE;
}
tts_core_notify_state_changed(client, client->before_state, client->current_state);
- g_check_state_timer = NULL;
-
+ client->notify_state_timer = NULL;
return EINA_FALSE;
}
}
if (NULL != client->state_changed_cb) {
- if (NULL != g_check_state_timer) {
- ecore_timer_del(g_check_state_timer);
- g_check_state_timer = NULL;
+ if (NULL != client->notify_state_timer) {
+ ecore_timer_del(client->notify_state_timer);
}
- g_check_state_timer = ecore_timer_add(0, __tts_notify_state_changed, client->tts);
+ client->notify_state_timer = ecore_timer_add(0, __tts_notify_state_changed, client->tts);
} else {
SLOG(LOG_WARN, TAG_TTSC, "[WARNING] State changed callback is null");
}
client->state_changed_cb = NULL;
client->state_changed_user_data = NULL;
- if (NULL != g_check_state_timer) {
- ecore_timer_del(g_check_state_timer);
- g_check_state_timer = NULL;
+ if (NULL != client->notify_state_timer) {
+ ecore_timer_del(client->notify_state_timer);
+ client->notify_state_timer = NULL;
}
SLOG(LOG_DEBUG, TAG_TTSC, "[SUCCESS] Unset state changed cb");
client->error_cb = NULL;
client->error_user_data = NULL;
+ if (NULL != client->notify_error_timer) {
+ ecore_timer_del(client->notify_error_timer);
+ client->notify_error_timer = NULL;
+ }
+
SLOG(LOG_DEBUG, TAG_TTSC, "[SUCCESS] Unset error cb");
return 0;