case TTS_ERROR_OPERATION_FAILED: return "TTS_ERROR_OPERATION_FAILED";
case TTS_ERROR_AUDIO_POLICY_BLOCKED: return "TTS_ERROR_AUDIO_POLICY_BLOCKED";
case TTS_ERROR_NOT_SUPPORTED_FEATURE: return "TTS_ERROR_NOT_SUPPORTED_FEATURE";
+ case TTS_ERROR_SERVICE_RESET: return "TTS_ERROR_SERVICE_RESET";
default:
return "Invalid error code";
}
SLOG(LOG_WARN, TAG_TTSC, "No registered callback function of error ");
}
+ if (TTS_ERROR_SERVICE_RESET == reason) {
+ SLOG(LOG_WARN, TAG_TTSC, "[WARNING] Service Reset");
+
+ client->current_state = TTS_STATE_CREATED;
+ if (0 != tts_prepare(client->tts)) {
+ SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to prepare");
+ }
+ }
+
return 0;
}
DBUS_TYPE_INT32, &uid,
DBUS_TYPE_INT32, &uttid,
DBUS_TYPE_INT32, &reason,
- DBUS_TYPE_INT32, &err_msg,
+ DBUS_TYPE_STRING, &err_msg,
DBUS_TYPE_INVALID);
if (dbus_error_is_set(&err)) {
TTS_ERROR_ENGINE_NOT_FOUND = TIZEN_ERROR_TTS | 0x03, /**< No available engine */
TTS_ERROR_OPERATION_FAILED = TIZEN_ERROR_TTS | 0x04, /**< Operation failed */
TTS_ERROR_AUDIO_POLICY_BLOCKED = TIZEN_ERROR_TTS | 0x05, /**< Audio policy blocked */
- TTS_ERROR_NOT_SUPPORTED_FEATURE = TIZEN_ERROR_TTS | 0x06 /**< Not supported feature of current engine*/
+ TTS_ERROR_NOT_SUPPORTED_FEATURE = TIZEN_ERROR_TTS | 0x06, /**< Not supported feature of current engine*/
+ TTS_ERROR_SERVICE_RESET = TIZEN_ERROR_TTS | 0x07 /**< Service reset */
} tts_error_e;
/**
case TTSD_ERROR_OPERATION_FAILED: return "TTS_ERROR_OPERATION_FAILED";
case TTSD_ERROR_AUDIO_POLICY_BLOCKED: return "TTS_ERROR_AUDIO_POLICY_BLOCKED";
case TTSD_ERROR_NOT_SUPPORTED_FEATURE: return "TTSD_ERROR_NOT_SUPPORTED_FEATURE";
+ case TTSD_ERROR_SERVICE_RESET: return "TTSD_ERROR_SERVICE_RESET";
default:
return "Invalid error code";
}
DBUS_TYPE_INT32, &uid,
DBUS_TYPE_INT32, &uttid,
DBUS_TYPE_INT32, &reason,
- DBUS_TYPE_INT32, &err_msg,
+ DBUS_TYPE_STRING, &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), err_msg(%d)",
+ SLOG(LOG_DEBUG, get_tag(), "<<<< Send error message : uid(%d), reason(%s), uttid(%d), err_msg(%s)",
uid, __ttsd_get_error_code(reason), uttid, (NULL == err_msg) ? "NULL" : err_msg);
dbus_connection_flush(g_conn_sender);
}
TTSD_ERROR_ENGINE_NOT_FOUND = TIZEN_ERROR_TTS | 0x03, /**< No available engine */
TTSD_ERROR_OPERATION_FAILED = TIZEN_ERROR_TTS | 0x04, /**< Operation failed */
TTSD_ERROR_AUDIO_POLICY_BLOCKED = TIZEN_ERROR_TTS | 0x05, /**< Audio policy blocked */
- TTSD_ERROR_NOT_SUPPORTED_FEATURE = TIZEN_ERROR_TTS | 0x06 /**< Not supported feature of current engine*/
+ TTSD_ERROR_NOT_SUPPORTED_FEATURE = TIZEN_ERROR_TTS | 0x06, /**< Not supported feature of current engine*/
+ TTSD_ERROR_SERVICE_RESET = TIZEN_ERROR_TTS | 0x07 /**< Service reset */
} ttsd_error_e;
typedef enum {
/*
* Server APIs
*/
+static bool __send_reset_signal(int pid, int uid, app_state_e state, void* user_data)
+{
+ ttsdc_send_error_message(pid, uid, -1, TTSD_ERROR_SERVICE_RESET, "TTS service reset");
+ return true;
+}
+
+static void __sig_handler(int signo)
+{
+ /* restore signal handler */
+ signal(signo, SIG_DFL);
+
+ /* Send error signal via foreach clients */
+ ttsd_data_foreach_clients(__send_reset_signal, NULL);
+
+ /* invoke signal again */
+ raise(signo);
+}
+
+static void __register_sig_handler()
+{
+ signal(SIGSEGV, __sig_handler);
+ signal(SIGABRT, __sig_handler);
+ signal(SIGTERM, __sig_handler);
+ signal(SIGINT, __sig_handler);
+ signal(SIGQUIT, __sig_handler);
+}
int ttsd_initialize()
{
+ /* Register signal handler */
+ __register_sig_handler();
+
if (ttsd_config_initialize(__config_changed_cb)) {
SLOG(LOG_ERROR, get_tag(), "[Server WARNING] Fail to initialize config.");
}