bidirectional messages implemented, updated the example code
[profile/ivi/message-port.git] / daemon / main.c
1 #include <glib.h>
2 #include "common/log.h"
3 #include "dbus-server.h"
4
5 static gboolean
6 _on_unix_signal (gpointer data)
7 {
8     g_main_loop_quit ((GMainLoop*)data);
9
10     return FALSE;
11 }
12
13 int main (int argc, char *argv[])
14 {
15     GMainLoop *main_loop = NULL;
16     MsgPortDbusServer *server = NULL;
17
18 #if !GLIB_CHECK_VERSION (2, 36, 0)
19     g_type_init (&argc, &argv);
20 #endif
21
22     main_loop = g_main_loop_new (NULL, FALSE);
23
24     server = msgport_dbus_server_new();
25
26     DBG ("server started at : %s", msgport_dbus_server_get_address (server));
27
28     g_unix_signal_add (SIGTERM, _on_unix_signal, main_loop);
29     g_unix_signal_add (SIGINT, _on_unix_signal, main_loop);
30
31     g_main_loop_run (main_loop);
32
33     g_object_unref (server);
34     g_main_loop_unref (main_loop);
35
36     DBG("Clean close");
37 }