static void on_proxy_acquired (GObject *object, GAsyncResult *res, NMBluez5Manager *self) { NMBluez5ManagerPrivate *priv = NM_BLUEZ5_MANAGER_GET_PRIVATE (self); GError *error = NULL; priv->proxy = g_dbus_proxy_new_for_bus_finish (res, &error); if (!priv->proxy) { nm_log_warn (LOGD_BT, "Couldn't acquire object manager proxy: %s", error->message); g_clear_error (&error); return; } g_signal_connect (priv->proxy, "notify::g-name-owner", G_CALLBACK (name_owner_changed_cb), self); /* Get already managed devices. */ g_dbus_proxy_call (priv->proxy, "GetManagedObjects", NULL, G_DBUS_CALL_FLAGS_NONE, -1, NULL, (GAsyncReadyCallback) get_managed_objects_cb, self); _nm_dbus_signal_connect (priv->proxy, "InterfacesAdded", G_VARIANT_TYPE ("(oa{sa{sv}})"), G_CALLBACK (object_manager_interfaces_added), self); _nm_dbus_signal_connect (priv->proxy, "InterfacesRemoved", G_VARIANT_TYPE ("(oas)"), G_CALLBACK (object_manager_interfaces_removed), self); }
static void nm_bluez4_manager_init (NMBluez4Manager *self) { NMBluez4ManagerPrivate *priv = NM_BLUEZ4_MANAGER_GET_PRIVATE (self); priv->proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM, G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES, NULL, BLUEZ_SERVICE, BLUEZ_MANAGER_PATH, BLUEZ4_MANAGER_INTERFACE, NULL, NULL); _nm_dbus_signal_connect (priv->proxy, "AdapterRemoved", G_VARIANT_TYPE ("(o)"), G_CALLBACK (adapter_removed), self); _nm_dbus_signal_connect (priv->proxy, "DefaultAdapterChanged", G_VARIANT_TYPE ("(o)"), G_CALLBACK (default_adapter_changed), self); g_signal_connect (priv->proxy, "notify::g-name-owner", G_CALLBACK (name_owner_changed_cb), self); query_default_adapter (self); }
static void on_proxy_acquired (GObject *object, GAsyncResult *res, NMSleepMonitor *self) { GError *error = NULL; char *owner; self->sd_proxy = g_dbus_proxy_new_for_bus_finish (res, &error); if (!self->sd_proxy) { nm_log_warn (LOGD_SUSPEND, "Failed to acquire logind proxy: %s", error->message); g_clear_error (&error); return; } g_signal_connect (self->sd_proxy, "notify::g-name-owner", G_CALLBACK (name_owner_cb), self); _nm_dbus_signal_connect (self->sd_proxy, "PrepareForSleep", G_VARIANT_TYPE ("(b)"), G_CALLBACK (prepare_for_sleep_cb), self); owner = g_dbus_proxy_get_name_owner (self->sd_proxy); if (owner) take_inhibitor (self); g_free (owner); }
static void on_iface_proxy_acquired (GDBusProxy *proxy, GAsyncResult *result, gpointer user_data) { NMSupplicantInterface *self; NMSupplicantInterfacePrivate *priv; gs_free_error GError *error = NULL; if (!g_async_initable_init_finish (G_ASYNC_INITABLE (proxy), result, &error)) { if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) { nm_log_warn (LOGD_SUPPLICANT, "Failed to acquire wpa_supplicant interface proxy: (%s)", error->message); set_state (NM_SUPPLICANT_INTERFACE (user_data), NM_SUPPLICANT_INTERFACE_STATE_DOWN); } return; } self = NM_SUPPLICANT_INTERFACE (user_data); priv = NM_SUPPLICANT_INTERFACE_GET_PRIVATE (self); _nm_dbus_signal_connect (priv->iface_proxy, "ScanDone", G_VARIANT_TYPE ("(b)"), G_CALLBACK (wpas_iface_scan_done), self); _nm_dbus_signal_connect (priv->iface_proxy, "BSSAdded", G_VARIANT_TYPE ("(oa{sv})"), G_CALLBACK (wpas_iface_bss_added), self); _nm_dbus_signal_connect (priv->iface_proxy, "BSSRemoved", G_VARIANT_TYPE ("(o)"), G_CALLBACK (wpas_iface_bss_removed), self); _nm_dbus_signal_connect (priv->iface_proxy, "NetworkRequest", G_VARIANT_TYPE ("(oss)"), G_CALLBACK (wpas_iface_network_request), self); /* Scan result aging parameters */ g_dbus_proxy_call (priv->iface_proxy, "org.freedesktop.DBus.Properties.Set", g_variant_new ("(ssv)", WPAS_DBUS_IFACE_INTERFACE, "BSSExpireAge", g_variant_new_uint32 (250)), G_DBUS_CALL_FLAGS_NONE, -1, priv->init_cancellable, NULL, NULL); g_dbus_proxy_call (priv->iface_proxy, "org.freedesktop.DBus.Properties.Set", g_variant_new ("(ssv)", WPAS_DBUS_IFACE_INTERFACE, "BSSExpireCount", g_variant_new_uint32 (2)), G_DBUS_CALL_FLAGS_NONE, -1, priv->init_cancellable, NULL, NULL); /* Check whether NetworkReply and AP mode are supported */ priv->ready_count = 1; g_dbus_proxy_call (priv->iface_proxy, "NetworkReply", g_variant_new ("(oss)", "/fff", "foobar", "foobar"), G_DBUS_CALL_FLAGS_NONE, -1, priv->init_cancellable, (GAsyncReadyCallback) iface_check_netreply_cb, self); if (priv->ap_support == AP_SUPPORT_UNKNOWN) { /* If the global supplicant capabilities property is not present, we can * fall back to checking whether the ProbeRequest method is supported. If * neither of these works we have no way of determining if AP mode is * supported or not. hostap 1.0 and earlier don't support either of these. */ priv->ready_count++; g_dbus_proxy_call (priv->iface_proxy, DBUS_INTERFACE_INTROSPECTABLE ".Introspect", NULL, G_DBUS_CALL_FLAGS_NONE, -1, priv->init_cancellable, (GAsyncReadyCallback) iface_check_ap_mode_cb, self); } }