2 * Copyright (c) 2011-2014 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.
15 #include "ttsd_main.h"
16 #include "ttsd_server.h"
17 #include "ttsd_dbus.h"
18 #include "ttsd_network.h"
21 #include <privilege-control.h>
23 #define CLIENT_CLEAN_UP_TIME 500
25 static Ecore_Timer* g_check_client_timer = NULL;
37 ttsd_mode_e ttsd_get_mode()
39 return TTSD_MODE_DEFAULT;
42 /* Main of TTS Daemon */
45 SLOG(LOG_DEBUG, get_tag(), " ");
46 SLOG(LOG_DEBUG, get_tag(), " ");
47 SLOG(LOG_DEBUG, get_tag(), "===== TTS DAEMON DEFAULT INITIALIZE");
50 SLOG(LOG_ERROR, get_tag(), "[Main ERROR] Fail ecore_init()");
55 /* daemon has root previlege */
56 perm_app_set_privilege("tts", NULL, NULL);
59 if (0 != ttsd_dbus_open_connection()) {
60 SLOG(LOG_ERROR, get_tag(), "[Main ERROR] Fail to open dbus connection");
64 if (0 != ttsd_initialize()) {
65 SLOG(LOG_ERROR, get_tag(), "[Main ERROR] Fail to initialize tts-daemon");
69 if (0 != ttsd_network_initialize()) {
70 SLOG(LOG_WARN, get_tag(), "[Main WARNING] Fail to initialize network");
73 g_check_client_timer = ecore_timer_add(CLIENT_CLEAN_UP_TIME, ttsd_cleanup_client, NULL);
74 if (NULL == g_check_client_timer) {
75 SLOG(LOG_WARN, get_tag(), "[Main Warning] Fail to create timer of client check");
78 SLOG(LOG_DEBUG, get_tag(), "[Main] tts-daemon start...");
79 SLOG(LOG_DEBUG, get_tag(), "=====");
80 SLOG(LOG_DEBUG, get_tag(), " ");
81 SLOG(LOG_DEBUG, get_tag(), " ");
83 ecore_main_loop_begin();
85 SLOG(LOG_DEBUG, get_tag(), "===== TTS DAEMON DEFAULT FINALIZE");
87 if (NULL != g_check_client_timer) {
88 ecore_timer_del(g_check_client_timer);
91 ttsd_dbus_close_connection();
93 ttsd_network_finalize();
99 SLOG(LOG_DEBUG, get_tag(), "=====");
100 SLOG(LOG_DEBUG, get_tag(), " ");
101 SLOG(LOG_DEBUG, get_tag(), " ");