#include "stte.h"
-#define CLIENT_CLEAN_UP_TIME 500
-
-static Ecore_Timer* g_check_client_timer = NULL;
-
int stte_main(int argc, char**argv, stte_request_callback_s *callback)
{
SLOG(LOG_DEBUG, TAG_STTD, "===== Start engine");
+ int ret = STTE_ERROR_NONE;
+
if (!ecore_init()) {
SLOG(LOG_ERROR, TAG_STTD, "[ERROR] Fail to initialize Ecore");
- return EXIT_FAILURE;
+ return STTE_ERROR_OPERATION_FAILED;
}
if (0 != sttd_dbus_open_connection()) {
SLOG(LOG_ERROR, TAG_STTD, "[ERROR] Fail to open connection");
- return EXIT_FAILURE;
+ ecore_shutdown();
+ return STTE_ERROR_OPERATION_FAILED;
}
- if (0 != sttd_initialize(callback)) {
+ ret = sttd_initialize(callback);
+ if (0 != ret) {
SLOG(LOG_ERROR, TAG_STTD, "[ERROR] Fail to initialize stt-service");
- return EXIT_FAILURE;
+ sttd_dbus_close_connection();
+ ecore_shutdown();
+ return ret;
}
stt_network_initialize();
- g_check_client_timer = ecore_timer_add(CLIENT_CLEAN_UP_TIME, sttd_cleanup_client, NULL);
- if (NULL == g_check_client_timer) {
- SLOG(LOG_WARN, TAG_STTD, "[Main Warning] Fail to create timer of client check");
- }
-
SLOG(LOG_DEBUG, TAG_STTD, "[Main] stt-service start...");
SLOG(LOG_DEBUG, TAG_STTD, "=====");
SLOG(LOG_DEBUG, TAG_STTD, " ");
SLOG(LOG_DEBUG, TAG_STTD, " ");
- return 0;
+ return STTE_ERROR_NONE;
}
int stte_send_result(stte_result_event_e event, const char* type, const char** result, int result_count,
int stte_send_error(stte_error_e error, const char* msg)
{
- if (NULL == msg) {
- SLOG(LOG_ERROR, TAG_STTD, "[Server ERROR] Invalid parameter");
- }
-
int ret = STTE_ERROR_NONE;
ret = stt_engine_send_error(error, msg);
if (0 != ret) {