- dbus_message_iter_get_basic (&iter, &path);
- if (path != NULL) {
- DBusConnection *conn;
- DBusMessage *adapterMsg = dbus_message_new_method_call("org.bluez", path,
- "org.bluez.Adapter",
- "GetProperties");
- DBusPendingCall *call = NULL;
-
- conn = dbus_bus_get (DBUS_BUS_SYSTEM, NULL);
-
- if (conn && dbus_connection_send_with_reply(conn, adapterMsg, &call, -1) ) {
- g_debug ("Getting the properties");
- dbus_pending_call_set_notify(call, get_properties_cb, NULL, NULL);
- dbus_pending_call_block(call);
- dbus_pending_call_unref(call);
- }
- } else {
- g_warning ("Failed to get the default bluetooth adapter");
+ adapterMsg = dbus_message_new_method_call ("org.bluez", path,
+ "org.bluez.Adapter",
+ "GetProperties");
+
+ dbus_error_init (&error);
+ msg = dbus_connection_send_with_reply_and_block (conn, adapterMsg, -1, &error);
+ if (msg) {
+ g_debug ("Getting the properties");
+ get_properties_cb (msg);
+ dbus_message_unref (msg);