Remove logs in request_hello
[platform/core/uifw/stt.git] / server / sttd_main.c
1 /*
2 *  Copyright (c) 2011-2016 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.
12 */
13
14 #include <Ecore.h>
15
16 #include "stt_defs.h"
17 #include "stt_network.h"
18 #include "sttd_dbus.h"
19 #include "sttd_main.h"
20 #include "sttd_server.h"
21
22
23 #define CLIENT_CLEAN_UP_TIME 500
24
25 static Ecore_Timer* g_check_client_timer = NULL;
26
27 int main(int argc, char** argv)
28 {
29         SLOG(LOG_DEBUG, TAG_STTD, "  ");
30         SLOG(LOG_DEBUG, TAG_STTD, "  ");
31         SLOG(LOG_DEBUG, TAG_STTD, "===== STT Daemon Initialize");
32
33         if (!ecore_init()) {
34                 SLOG(LOG_ERROR, TAG_STTD, "[ERROR] Fail to initialize Ecore");
35                 return EXIT_FAILURE;
36         }
37
38         if (0 != sttd_dbus_open_connection()) {
39                 SLOG(LOG_ERROR, TAG_STTD, "[ERROR] Fail to open connection");
40                 return EXIT_FAILURE;
41         }
42
43         if (0 != sttd_initialize()) {
44                 SLOG(LOG_ERROR, TAG_STTD, "[ERROR] Fail to initialize stt-daemon");
45                 return EXIT_FAILURE;
46         }
47
48         stt_network_initialize();
49
50         g_check_client_timer = ecore_timer_add(CLIENT_CLEAN_UP_TIME, sttd_cleanup_client, NULL);
51         if (NULL == g_check_client_timer) {
52                 SLOG(LOG_WARN, TAG_STTD, "[Main Warning] Fail to create timer of client check");
53         }
54
55         SLOG(LOG_DEBUG, TAG_STTD, "[Main] stt-daemon start...");
56
57         SLOG(LOG_DEBUG, TAG_STTD, "=====");
58         SLOG(LOG_DEBUG, TAG_STTD, "  ");
59         SLOG(LOG_DEBUG, TAG_STTD, "  ");
60
61         ecore_main_loop_begin();
62
63         SLOG(LOG_DEBUG, TAG_STTD, "===== STT Daemon Finalize");
64
65         if (NULL != g_check_client_timer) {
66                 ecore_timer_del(g_check_client_timer);
67         }
68
69         sttd_dbus_close_connection();
70
71         stt_network_finalize();
72
73         sttd_finalize();
74
75         ecore_shutdown();
76
77         SLOG(LOG_DEBUG, TAG_STTD, "=====");
78         SLOG(LOG_DEBUG, TAG_STTD, "  ");
79         SLOG(LOG_DEBUG, TAG_STTD, "  ");
80
81         return 0;
82 }
83
84
85