summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2006-08-21 01:04:49 +0000
committerMarcel Holtmann <marcel@holtmann.org>2006-08-21 01:04:49 +0000
commit954b4f2bef5d4432dad3675a5c2c88f09d0b8fd0 (patch)
tree310f4abb016fd4894ee3d6682fc8acb491b93ed7
parentff826ed6480f6922c57bb2155e8dd479fc5ae034 (diff)
Add basic mainloop functions
-rw-r--r--daemon/Makefile.am4
-rw-r--r--daemon/main.c26
2 files changed, 22 insertions, 8 deletions
diff --git a/daemon/Makefile.am b/daemon/Makefile.am
index 12ff263b..5dcc90d6 100644
--- a/daemon/Makefile.am
+++ b/daemon/Makefile.am
@@ -3,9 +3,9 @@ noinst_PROGRAMS = bluetoothd
bluetoothd_SOURCES = main.c
-bluetoothd_LDADD = @DBUS_LIBS@ @BLUEZ_LIBS@ $(top_builddir)/common/libhelper.a
+bluetoothd_LDADD = @GLIB_LIBS@ @BLUEZ_LIBS@ $(top_builddir)/common/libhelper.a
-AM_CFLAGS = @BLUEZ_CFLAGS@ @DBUS_CFLAGS@
+AM_CFLAGS = @BLUEZ_CFLAGS@ @GLIB_CFLAGS@
INCLUDES = -I$(top_srcdir)/common
diff --git a/daemon/main.c b/daemon/main.c
index f23a1471..6ce8ef81 100644
--- a/daemon/main.c
+++ b/daemon/main.c
@@ -27,15 +27,29 @@
#include <stdio.h>
#include <errno.h>
-#include <sys/socket.h>
+#include <stdlib.h>
-#include <bluetooth/bluetooth.h>
-#include <bluetooth/hci.h>
-#include <bluetooth/hci_lib.h>
-
-#include <dbus/dbus.h>
+#include <dbus/dbus-glib.h>
int main(int argc, char *argv[])
{
+ GMainLoop *mainloop;
+ DBusGConnection *conn;
+ GError *error = NULL;
+
+ g_type_init();
+
+ mainloop = g_main_loop_new(NULL, FALSE);
+
+ conn = dbus_g_bus_get(DBUS_BUS_SYSTEM, &error);
+ if (error != NULL) {
+ g_printerr("Connecting to system bus failed: %s\n",
+ error->message);
+ g_error_free(error);
+ exit(EXIT_FAILURE);
+ }
+
+ g_main_loop_run(mainloop);
+
return 0;
}