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;
static int __pkgmgr_status_cb(uid_t target_uid, int req_id, const char *type, const char *pkgname, const char *key, const char *val, const void *pmsg, void *data)
{
+ // type (the type of the pkgname)
SLOG(LOG_INFO, TAG_TTSC, "[INFO] pkgmgr status cb is invoked. pkgname(%s), type(%s), key(%s), val(%s)", pkgname, type, key, val);
+ if (NULL == g_engine_name) {
+ SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] engine name is NULL");
+ return 0;
+ }
+
if (0 != strncmp(g_engine_name, pkgname, strlen(g_engine_name))) {
SLOG(LOG_DEBUG, TAG_TTSC, "[WARN] this is not tts engine");
return 0;
} else {
- if (key && 0 == strncmp(key, "start", strlen(key))) {
+ if (key) {
+ if (0 == strncmp(key, "start", strlen(key))) {
if (NULL != g_pkgmgr_status) {
free(g_pkgmgr_status);
g_pkgmgr_status = NULL;
g_engine_update_status = 1;
}
}
- } else if (key && 0 == strncmp(g_pkgmgr_status, "install", strlen(g_pkgmgr_status)) && 0 == strncmp(key, "end", strlen(key))) {
+ } else if (0 == strncmp(key, "end", strlen(key)) && val && 0 == strncmp(val, "ok", strlen(val))) {
+ if (g_pkgmgr_status) {
+ if (0 == strncmp(g_pkgmgr_status, "install", strlen(g_pkgmgr_status)) || 0 == strncmp(g_pkgmgr_status, "update", strlen(g_pkgmgr_status))) {
SLOG(LOG_ERROR, TAG_TTSC, "[INFO] finish to install");
g_engine_update_status = 0;
+
+ free(g_pkgmgr_status);
+ g_pkgmgr_status = NULL;
+ }
+ }
+ }
}
}
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 = TTS_ERROR_ENGINE_NOT_FOUND;
client->utt_id = -1;
- ecore_timer_add(0, __tts_notify_error, (void*)client->tts);
+ if (NULL != g_notify_error_timer) {
+ ecore_timer_del(g_notify_error_timer);
+ g_notify_error_timer = NULL;
+ }
+ g_notify_error_timer = ecore_timer_add(0, __tts_notify_error, (void*)client->tts);
+
if (client->conn_timer) {
ecore_timer_del(client->conn_timer);
client->conn_timer = NULL;
client->reason = TTS_ERROR_PERMISSION_DENIED;
client->utt_id = -1;
- ecore_timer_add(0, __tts_notify_error, (void*)client->tts);
+ if (NULL != g_notify_error_timer) {
+ ecore_timer_del(g_notify_error_timer);
+ g_notify_error_timer = NULL;
+ }
+ g_notify_error_timer = ecore_timer_add(0, __tts_notify_error, (void*)client->tts);
+
if (client->conn_timer) {
ecore_timer_del(client->conn_timer);
client->conn_timer = NULL;
client->reason = TTS_ERROR_ENGINE_NOT_FOUND;
client->utt_id = -1;
- ecore_timer_add(0, __tts_notify_error, (void*)client->tts);
+ if (NULL != g_notify_error_timer) {
+ ecore_timer_del(g_notify_error_timer);
+ g_notify_error_timer = NULL;
+ }
+ g_notify_error_timer = ecore_timer_add(0, __tts_notify_error, (void*)client->tts);
+
return TTS_ERROR_OPERATION_FAILED;
} else if (TTS_ERROR_PERMISSION_DENIED == ret) {
client->reason = TTS_ERROR_PERMISSION_DENIED;
client->utt_id = -1;
- ecore_timer_add(0, __tts_notify_error, (void*)client->tts);
+ if (NULL != g_notify_error_timer) {
+ ecore_timer_del(g_notify_error_timer);
+ g_notify_error_timer = NULL;
+ }
+ g_notify_error_timer = ecore_timer_add(0, __tts_notify_error, (void*)client->tts);
+
return TTS_ERROR_PERMISSION_DENIED;
} else if (TTS_ERROR_NONE != ret) {
client->before_state = client->current_state;
client->current_state = TTS_STATE_READY;
- ecore_timer_add(0.0, __tts_notify_state_changed, client->tts);
+ if (NULL != g_check_state_timer) {
+ ecore_timer_del(g_check_state_timer);
+ g_check_state_timer = NULL;
+ }
+ g_check_state_timer = ecore_timer_add(0.0, __tts_notify_state_changed, client->tts);
SLOG(LOG_DEBUG, TAG_TTSC, "@@@");
return TTS_ERROR_NONE;
client->reason = ret;
client->utt_id = -1;
- ecore_timer_add(0, __tts_notify_error, client->tts);
+ if (NULL != g_notify_error_timer) {
+ ecore_timer_del(g_notify_error_timer);
+ g_notify_error_timer = NULL;
+ }
+ g_notify_error_timer = ecore_timer_add(0, __tts_notify_error, client->tts);
return;
}
client->reason = ret;
client->utt_id = -1;
- ecore_timer_add(0, __tts_notify_error, client->tts);
+ if (NULL != g_notify_error_timer) {
+ ecore_timer_del(g_notify_error_timer);
+ g_notify_error_timer = NULL;
+ }
+ g_notify_error_timer = ecore_timer_add(0, __tts_notify_error, client->tts);
return;
}
client->reason = ret;
client->utt_id = -1;
- ecore_timer_add(0, __tts_notify_error, client->tts);
+ if (NULL != g_notify_error_timer) {
+ ecore_timer_del(g_notify_error_timer);
+ g_notify_error_timer = NULL;
+ }
+ g_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;
}
SLOG(LOG_WARN, TAG_TTSC, "No registered callback function of error ");
}
+ g_notify_error_timer = NULL;
+
return EINA_FALSE;
}
/* call callback function */
if (NULL != data->error_cb) {
- ecore_timer_add(0, __tts_notify_error, data->tts);
+ if (NULL != g_notify_error_timer) {
+ ecore_timer_del(g_notify_error_timer);
+ g_notify_error_timer = NULL;
+ }
+ g_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) {
- ecore_timer_add(0, __tts_notify_error, client->tts);
+ if (NULL != g_notify_error_timer) {
+ ecore_timer_del(g_notify_error_timer);
+ g_notify_error_timer = NULL;
+ }
+ g_notify_error_timer = ecore_timer_add(0, __tts_notify_error, client->tts);
} else {
SLOG(LOG_WARN, TAG_TTSC, "No registered callback function of error ");
}