2 * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd All Rights Reserved
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 * http://www.apache.org/licenses/LICENSE-2.0
7 * Unless required by applicable law or agreed to in writing, software
8 * distributed under the License is distributed on an "AS IS" BASIS,
9 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 * See the License for the specific language governing permissions and
11 * limitations under the License.
14 #include "ttsd_main.h"
15 #include "ttsd_server.h"
16 #include "ttsd_dbus.h"
17 #include "ttsd_network.h"
21 #define CLIENT_CLEAN_UP_TIME 500
23 static Ecore_Timer* g_check_client_timer = NULL;
30 ttsd_mode_e ttsd_get_mode()
32 return TTSD_MODE_SCREEN_READER;
35 /* Main of TTS Daemon */
38 SLOG(LOG_DEBUG, get_tag(), " ");
39 SLOG(LOG_DEBUG, get_tag(), " ");
40 SLOG(LOG_DEBUG, get_tag(), "===== TTS DAEMON SR INITIALIZE");
42 SLOG(LOG_ERROR, get_tag(), "[Main ERROR] fail ecore_init()");
46 if (0 != ttsd_initialize()) {
47 SLOG(LOG_ERROR, get_tag(), "[Main ERROR] fail to initialize tts-daemon-sr");
51 if (0 != ttsd_dbus_open_connection()) {
52 SLOG(LOG_ERROR, get_tag(), "[Main ERROR] fail to open dbus connection");
56 if (0 != ttsd_network_initialize()) {
57 SLOG(LOG_ERROR, get_tag(), "[Main ERROR] fail to initialize network \n");
61 g_check_client_timer = ecore_timer_add(CLIENT_CLEAN_UP_TIME, ttsd_cleanup_client, NULL);
62 if (NULL == g_check_client_timer) {
63 SLOG(LOG_WARN, get_tag(), "[Main Warning] Fail to create timer of client check");
66 SLOG(LOG_DEBUG, get_tag(), "[Main] tts-daemon-sr start...\n");
67 SLOG(LOG_DEBUG, get_tag(), "=====");
68 SLOG(LOG_DEBUG, get_tag(), " ");
69 SLOG(LOG_DEBUG, get_tag(), " ");
71 ecore_main_loop_begin();
73 SLOG(LOG_DEBUG, get_tag(), "===== TTS DAEMON SR FINALIZE");
75 if (NULL != g_check_client_timer) {
76 ecore_timer_del(g_check_client_timer);
79 ttsd_network_finalize();
81 ttsd_dbus_close_connection();
87 SLOG(LOG_DEBUG, get_tag(), "=====");
88 SLOG(LOG_DEBUG, get_tag(), " ");
89 SLOG(LOG_DEBUG, get_tag(), " ");