static int g_feature_enabled = -1;
+static bool g_err_callback_status = false;
+
/* Function definition */
static Eina_Bool __tts_notify_state_changed(void *data);
static Eina_Bool __tts_notify_error(void *data);
return TTS_ERROR_NONE;
}
+int tts_get_error_message(tts_h tts, char** err_msg)
+{
+ if(0 != __tts_get_feature_enabled()) {
+ return TTS_ERROR_NOT_SUPPORTED;
+ }
+
+ if (NULL == tts || NULL == err_msg) {
+ SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] 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] Get state : A handle is not valid");
+ return TTS_ERROR_INVALID_PARAMETER;
+ }
+
+ if (NULL != client->err_msg) {
+ *err_msg = strdup(client->err_msg);
+ SLOG(LOG_DEBUG, TAG_TTSC, "[SUCCESS] Error msg (%s)", *err_msg);
+ } else {
+ SLOG(LOG_DEBUG, TAG_TTSC, "[SUCCESS] Error msg (NULL)");
+ }
+
+ SLOG(LOG_DEBUG, TAG_TTSC, "=====");
+ SLOG(LOG_DEBUG, TAG_TTSC, " ");
+
+ return TTS_ERROR_NONE;
+}
+
int tts_add_text(tts_h tts, const char* text, const char* language, int voice_type, int speed, int* utt_id)
{
if (0 != __tts_get_feature_enabled()) {
if (NULL != client->error_cb) {
SLOG(LOG_DEBUG, TAG_TTSC, "Call callback function of error");
tts_client_use_callback(client);
+ g_err_callback_status = true;
client->error_cb(client->tts, client->utt_id, client->reason, client->error_user_data);
+ g_err_callback_status = false;
tts_client_not_use_callback(client);
} else {
SLOG(LOG_WARN, TAG_TTSC, "No registered callback function of error ");
return EINA_FALSE;
}
-int __tts_cb_error(int uid, tts_error_e reason, int utt_id)
+int __tts_cb_error(int uid, tts_error_e reason, int utt_id, char* err_msg)
{
tts_client_s* client = tts_client_get_by_uid(uid);
client->utt_id = utt_id;
client->reason = reason;
+ if (NULL != client->err_msg) {
+ free(client->err_msg);
+ client->err_msg = NULL;
+ }
+ client->err_msg = strdup(err_msg);
/* call callback function */
if (NULL != client->error_cb) {
/* callback data */
int utt_id;
int reason;
+ char* err_msg;
/* connection */
Ecore_Timer* conn_timer;
static Ecore_Fd_Handler* g_dbus_fd_handler = NULL;
-extern int __tts_cb_error(int uid, tts_error_e reason, int utt_id);
+extern int __tts_cb_error(int uid, tts_error_e reason, int utt_id, char *err_msg);
extern int __tts_cb_set_state(int uid, int state);
int uid;
int uttid;
int reason;
+ char* err_msg;
dbus_message_get_args(msg, &err,
DBUS_TYPE_INT32, &uid,
DBUS_TYPE_INT32, &uttid,
DBUS_TYPE_INT32, &reason,
+ DBUS_TYPE_INT32, &err_msg,
DBUS_TYPE_INVALID);
if (dbus_error_is_set(&err)) {
SLOG(LOG_ERROR, TAG_TTSC, "<<<< Get Error message - Get arguments error (%s)", err.message);
dbus_error_free(&err);
- }
+ } else {
+ SLOG(LOG_ERROR, TAG_TTSC, "<<<< Get Error message : uid(%d), error(%d), uttid(%d), err_msg(%s)", uid, reason, uttid, (NULL == err_msg) ? "NULL" : err_msg);
+ __tts_cb_error(uid, reason, uttid, err_msg);
- if (0 == __tts_cb_error(uid, reason, uttid)) {
- SLOG(LOG_ERROR, TAG_TTSC, "<<<< Get Error message : uid(%d), error(%d), uttid(%d)", uid, reason, uttid);
}
} /* TTSD_SIGNAL_ERROR */
int tts_get_speed_range(tts_h tts, int* min, int* normal, int* max);
/**
+ * @brief Gets the current error message.
+ * @since_tizen 3.0
+ * @privlevel public
+ * @remarks This function should be called during an tts error callback. If not, the error as operation failure will be returned. \n
+ * If the function succeeds, @a err_msg must be released using free() when it is no longer required.
+ *
+ * @param[in] tts The TTS handle
+ * @param[out] err_msg The current error message
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #TTS_ERROR_NONE Successful
+ * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
+ * @retval #TTS_ERROR_OPERATION_FAILED Operation failure
+ *
+ * @see tts_set_error_cb()
+ * @see tts_unset_error_cb()
+*/
+int tts_get_error_message(tts_h tts, char** err_msg);
+
+/**
* @brief Adds a text to the queue.
* @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*
return ttsdc_send_message(pid, uid, state, TTSD_METHOD_SET_STATE);
}
-int ttsdc_send_error_message(int pid, int uid, int uttid, int reason)
+int ttsdc_send_error_message(int pid, int uid, int uttid, int reason, char* err_msg)
{
if (NULL == g_conn_sender) {
SLOG(LOG_ERROR, get_tag(), "[Dbus ERROR] Dbus connection is not available");
}
dbus_message_append_args(msg,
- DBUS_TYPE_INT32, &uid,
- DBUS_TYPE_INT32, &uttid,
- DBUS_TYPE_INT32, &reason,
+ DBUS_TYPE_INT32, &uid,
+ DBUS_TYPE_INT32, &uttid,
+ DBUS_TYPE_INT32, &reason,
+ DBUS_TYPE_INT32, &err_msg,
DBUS_TYPE_INVALID);
dbus_message_set_no_reply(msg, TRUE);
if (!dbus_connection_send(g_conn_sender, msg, NULL)) {
SLOG(LOG_ERROR, get_tag(), "[Dbus ERROR] <<<< error message : Out Of Memory !");
} else {
- SLOG(LOG_DEBUG, get_tag(), "<<<< Send error message : uid(%d), reason(%s), uttid(%d)",
- uid, __ttsd_get_error_code(reason), uttid);
+ SLOG(LOG_DEBUG, get_tag(), "<<<< Send error message : uid(%d), reason(%s), uttid(%d), err_msg(%d)",
+ uid, __ttsd_get_error_code(reason), uttid, (NULL == err_msg) ? "NULL" : err_msg);
dbus_connection_flush(g_conn_sender);
}
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_error_message(int pid, int uid, int uttid, int reason, char* err_msg);
int ttsdc_send_set_state_message(int pid, int uid, int state);