Add the map agent g_bus_own_name skeleton 43/18243/1
authorWu Zheng <wu.zheng@intel.com>
Wed, 19 Mar 2014 11:10:15 +0000 (07:10 -0400)
committerWu Zheng <wu.zheng@intel.com>
Wed, 19 Mar 2014 11:10:15 +0000 (07:10 -0400)
Change-Id: I0255fc64aa306e6de0a6bd27382c920f786532f3
Signed-off-by: Wu Zheng <wu.zheng@intel.com>
src/map_agent.c

index 92a5126..0893560 100644 (file)
 #include "bluez.h"
 #include "vertical.h"
 
+#define BT_MAP_AGENT_NAME "org.bluez.map_agent"
+#define BT_MAP_AGENT_INTERFACE "org.bluez.MapAgent"
+#define BT_MAP_AGENT_OBJECT_PATH "/org/bluez/map_agent"
+
+GDBusConnection *conn;
+guint bus_id;
+
+static GDBusNodeInfo *introspection_data;
+
+static const gchar introspection_xml[] =
+       "<node>"
+       "</node>";
+
+static void bus_acquired(GDBusConnection *connection,
+                               const gchar *name,
+                               gpointer user_data)
+{
+       DBG("");
+
+       conn = connection;
+}
+
+static void name_acquired(GDBusConnection *connection,
+                               const gchar *name,
+                               gpointer user_data)
+{
+       DBG("");
+}
+
+static void name_lost(GDBusConnection *connection,
+                               const gchar *name,
+                               gpointer user_data)
+{
+       DBG("Name Lost");
+
+       bus_id = 0;
+}
+
 void bt_map_agent_init(void)
 {
        DBG("");
+
+       introspection_data =
+               g_dbus_node_info_new_for_xml(introspection_xml, NULL);
+
+       if (conn == NULL)
+               bus_id = g_bus_own_name(G_BUS_TYPE_SYSTEM,
+                       BT_MAP_AGENT_NAME,
+                       G_BUS_NAME_OWNER_FLAGS_NONE,
+                       bus_acquired,
+                       name_acquired,
+                       name_lost,
+                       NULL,
+                       NULL);
 }
 
 void bt_map_agent_deinit(void)