static void __bluetooth_network_disconnect_request_cb(DBusGProxy *proxy, DBusGProxyCall *call,
						    gpointer user_data)
{
	GError *g_error = NULL;
	DBusGConnection *conn = NULL;
	int result = BLUETOOTH_ERROR_NONE;

	conn = (DBusGConnection *) user_data;

	dbus_g_proxy_end_call(proxy, call, &g_error, G_TYPE_INVALID);

	g_object_unref(proxy);
	dbus_g_connection_unref(conn);

	if (g_error != NULL) {
		DBG("Network Client disconnection Dbus Call Error: %s\n", g_error->message);
		g_error_free(g_error);
		result = BLUETOOTH_ERROR_INTERNAL;
	} else {
		DBG("Network Client disconnection Dbus Call is done\n");
	}

	_bluetooth_internal_event_cb(BLUETOOTH_EVENT_NETWORK_DISCONNECTED,
					result, NULL);

}
コード例 #2
0
static void
add_or_change_cb (DBusGProxy *proxy, DBusGProxyCall *call_id, gpointer user_data)
{
	CBInfo *info = user_data;
	GError *error = NULL;
	char *zone = NULL;

	if (!dbus_g_proxy_end_call (proxy, call_id, &error,
	                            G_TYPE_STRING, &zone,
	                            G_TYPE_INVALID)) {
		g_assert (error);
		if (g_strcmp0 (error->message, "ZONE_ALREADY_SET") != 0) {
			nm_log_warn (LOGD_FIREWALL, "(%s) firewall zone add/change failed [%u]: (%d) %s",
			             info->iface, info->id, error->code, error->message);
		} else {
			nm_log_dbg (LOGD_FIREWALL, "(%s) firewall zone add/change failed [%u]: (%d) %s",
			            info->iface, info->id, error->code, error->message);
		}
	} else {
		nm_log_dbg (LOGD_FIREWALL, "(%s) firewall zone add/change succeeded [%u]",
		            info->iface, info->id);
	}

	if (info->callback)
		info->callback (error, info->user_data);

	info->completed = TRUE;
	g_free (zone);
	g_clear_error (&error);
}
コード例 #3
0
static void
get_device_state_cb (DBusGProxy     *proxy,
                     DBusGProxyCall *call,
                     void           *user_data)
{
        GValue value = {0,};
        GError *error = NULL;
        NMDevice *nm_device = (NMDevice *) user_data;

        if (!dbus_g_proxy_end_call (proxy,
                                    call,
                                    &error,
                                    G_TYPE_VALUE, &value,
                                    G_TYPE_INVALID)) {
                g_warning ("Error reading property: %s\n", error->message);

                g_error_free (error);
                return;
        }

        NMDeviceState state = g_value_get_uint (&value);

        if (state == NM_DEVICE_STATE_ACTIVATED) {
                dbus_g_proxy_begin_call (nm_device->prop_proxy,
                                         "Get",
                                         get_device_interface_cb,
                                         nm_device,
                                         NULL,
                                         G_TYPE_STRING, DEVICE_INTERFACE,
                                         G_TYPE_STRING, "Interface",
                                         G_TYPE_INVALID);
        }

        g_value_unset (&value);
}
コード例 #4
0
ファイル: geoclue-gsmloc-mm.c プロジェクト: Aktrisa/geoclue
static void
loc_props_cb (DBusGProxy *proxy, DBusGProxyCall *call, gpointer user_data)
{
	GError *error = NULL;
	GHashTable *props = NULL;
	Modem *modem = user_data;

	if (!dbus_g_proxy_end_call (proxy, call, &error,
	                            DBUS_TYPE_G_MAP_OF_VARIANT, &props,
	                            G_TYPE_INVALID)) {
		g_warning ("%s: failed to get location interface properties: (%d) %s",
		           __func__,
		           error ? error->code : -1,
		           error && error->message ? error->message : "(unknown)");
		g_clear_error (&error);
		return;
	}

	modem_properties_changed (modem->loc_proxy, MM_DBUS_LOC_INTERFACE, props, modem);
	g_hash_table_destroy (props);

	/* Now that we know the device supports location services, get basic
	 * modem properties and start grabbing location info.
	 */
	dbus_g_proxy_begin_call (modem->props_proxy, "GetAll",
	                         modem_props_cb, modem, NULL,
	                         G_TYPE_STRING, MM_DBUS_MODEM_INTERFACE, G_TYPE_INVALID);
}
コード例 #5
0
static void
set_time_notify (DBusGProxy     *proxy,
		 DBusGProxyCall *call,
		 void           *user_data)
{
	SetTimeCallbackData *data = user_data;
	GError *error = NULL;

	if (dbus_g_proxy_end_call (proxy, call, &error, G_TYPE_INVALID)) {
		if (data->callback) 
			data->callback (data->data, NULL);
	}
	else {
		if (error->domain == DBUS_GERROR &&
		    error->code == DBUS_GERROR_NO_REPLY) {
			/* these errors happen because dbus doesn't
			 * use monotonic clocks
			 */	
			g_warning ("ignoring no-reply error when setting time");
			g_error_free (error);
			if (data->callback)
				data->callback (data->data, NULL);
		}
		else {
			if (data->callback)
				data->callback (data->data, error);
			else
				g_error_free (error);
		}		
	}
}
コード例 #6
0
ファイル: nm-modem-gsm.c プロジェクト: T100012/NetworkManager
static void
stage1_enable_done (DBusGProxy *proxy, DBusGProxyCall *call_id, gpointer user_data)
{
	NMModemGsm *self = NM_MODEM_GSM (user_data);
	NMDeviceStateReason reason;
	GError *error = NULL;

	if (dbus_g_proxy_end_call (proxy, call_id, &error, G_TYPE_INVALID))
		do_connect (self);
	else {
		nm_log_warn (LOGD_MB, "GSM modem enable failed: (%d) %s",
		             error ? error->code : -1,
		             error && error->message ? error->message : "(unknown)");

		if (dbus_g_error_has_name (error, MM_MODEM_ERROR_SIM_PIN))
			handle_enable_pin_required (self);
		else {
			/* try to translate the error reason */
			reason = translate_mm_error (error);
			if (reason == NM_DEVICE_STATE_REASON_UNKNOWN)
				reason = NM_DEVICE_STATE_REASON_MODEM_INIT_FAILED;
			g_signal_emit_by_name (self, NM_MODEM_PREPARE_RESULT, FALSE, reason);
		}

		g_error_free (error);
	}
}
コード例 #7
0
static void
get_timezone_notify (DBusGProxy     *proxy,
		     DBusGProxyCall *call,
		     void           *user_data)
{
	GError *error = NULL;
	gboolean retval;
	gchar *string = NULL;
	GetTimezoneData *data = user_data;

	retval = dbus_g_proxy_end_call (proxy, call, &error,
					G_TYPE_STRING, &string,
					G_TYPE_INVALID);

	if (data->callback) {
		if (!retval) {
			data->callback (data->data, NULL, error);
			g_error_free (error);
		}
		else {
			data->callback (data->data, string, NULL);
			g_free (string);
		}
	}
}
コード例 #8
0
static void
set_ap_scan_cb (DBusGProxy *proxy, DBusGProxyCall *call_id, gpointer user_data)
{
	NMSupplicantInfo *info = (NMSupplicantInfo *) user_data;
	NMSupplicantInterfacePrivate *priv = NM_SUPPLICANT_INTERFACE_GET_PRIVATE (info->interface);
	GError *err = NULL;
	DBusGProxyCall *call;
	GHashTable *config_hash;

	if (!dbus_g_proxy_end_call (proxy, call_id, &err, G_TYPE_INVALID)) {
		nm_log_warn (LOGD_SUPPLICANT, "Couldn't send AP scan mode to the supplicant interface: %s.",
		             err->message);
		emit_error_helper (info->interface, err);
		g_error_free (err);
		return;
	}

	nm_log_info (LOGD_SUPPLICANT, "Config: set interface ap_scan to %d",
	             nm_supplicant_config_get_ap_scan (priv->cfg));

	info = nm_supplicant_info_new (info->interface, priv->iface_proxy, info->store);
	config_hash = nm_supplicant_config_get_hash (priv->cfg);
	call = dbus_g_proxy_begin_call (priv->iface_proxy, "AddNetwork",
	                                add_network_cb,
	                                info,
	                                nm_supplicant_info_destroy,
	                                DBUS_TYPE_G_MAP_OF_VARIANT, config_hash,
	                                G_TYPE_INVALID);
	g_hash_table_destroy (config_hash);
	nm_supplicant_info_set_call (info, call);
}
コード例 #9
0
static void
serving_system_reply (DBusGProxy *proxy, DBusGProxyCall *call, gpointer user_data)
{
	CdmaDeviceInfo *info = user_data;
	GError *error = NULL;
	GValueArray *array = NULL;
	guint32 new_sid = 0;
	GValue *value;

	if (dbus_g_proxy_end_call (proxy, call, &error,
	                           SERVING_SYSTEM_TYPE, &array,
	                           G_TYPE_INVALID)) {
		if (array->n_values == 3) {
			value = g_value_array_get_nth (array, 2);
			if (G_VALUE_HOLDS_UINT (value))
				new_sid = g_value_get_uint (value);
		}

		g_value_array_free (array);
	}

	if (new_sid != info->sid) {
		info->sid = new_sid;
		g_free (info->provider_name);
		info->provider_name = mobile_helper_parse_3gpp2_operator_name (&(info->mobile_providers_database), info->sid);
	}

	g_clear_error (&error);
}
コード例 #10
0
static void
scan_results_cb (DBusGProxy *proxy, DBusGProxyCall *call_id, gpointer user_data)
{
	GError *err = NULL;
	GPtrArray *array = NULL;

	if (!dbus_g_proxy_end_call (proxy, call_id, &err,
	                            DBUS_TYPE_G_ARRAY_OF_OBJECT_PATH, &array,
	                            G_TYPE_INVALID)) {
		nm_log_warn (LOGD_SUPPLICANT, "could not get scan results: %s.", err->message);
		g_error_free (err);
	} else {
		int i;
		NMSupplicantInfo *info = (NMSupplicantInfo *) user_data;

		/* Notify listeners of the result of the scan */
		g_signal_emit (info->interface,
		               nm_supplicant_interface_signals[SCAN_RESULTS],
		               0,
		               array->len);

		/* Fire off a "properties" call for each returned BSSID */
		for (i = 0; i < array->len; i++) {
			char *op = g_ptr_array_index (array, i);

			request_bssid_properties (info->interface, op);
			g_free (op);
		}

		g_ptr_array_free (array, TRUE);
	}
}
コード例 #11
0
static void
reply_to_stop_dtmf (DBusGProxy *proxy,
                    DBusGProxyCall *call,
                    void *_request)
{
  DEBUG ("enter");

  ModemRequest *request = _request;
  ModemCall *self = modem_request_object (request);
  ModemCallReply *callback = modem_request_callback (request);
  gpointer user_data = modem_request_user_data (request);
  char *stopped;
  GError *error = NULL;

  if (dbus_g_proxy_end_call (proxy, call, &error,
          G_TYPE_STRING, &stopped,
          G_TYPE_INVALID))
    {
      g_free (stopped);
    }
  else
    {
      modem_error_fix (&error);
      DEBUG ("got " GERROR_MSG_FMT, GERROR_MSG_CODE (error));
    }

  if (callback)
    callback (self, request, error, user_data);

  g_clear_error (&error);
}
コード例 #12
0
static void
set_network_cb (DBusGProxy *proxy, DBusGProxyCall *call_id, gpointer user_data)
{
	NMSupplicantInfo *info = (NMSupplicantInfo *) user_data;
	NMSupplicantInterfacePrivate *priv = NM_SUPPLICANT_INTERFACE_GET_PRIVATE (info->interface);
	GError *err = NULL;
	guint tmp;

	if (!dbus_g_proxy_end_call (proxy, call_id, &err, G_TYPE_UINT, &tmp, G_TYPE_INVALID)) {
		nm_log_warn (LOGD_SUPPLICANT, "Couldn't set network config: %s.", err->message);
		emit_error_helper (info->interface, err);
		g_error_free (err);
	} else {
		DBusGProxyCall *call;

		info = nm_supplicant_info_new (info->interface, priv->iface_proxy, priv->assoc_pcalls);
		call = dbus_g_proxy_begin_call (priv->iface_proxy, "selectNetwork",
		                                select_network_cb,
		                                info,
		                                nm_supplicant_info_destroy,
		                                DBUS_TYPE_G_OBJECT_PATH, dbus_g_proxy_get_path (proxy),
		                                G_TYPE_INVALID);
		nm_supplicant_info_set_call (info, call);
	}
}
コード例 #13
0
ファイル: epris-client.c プロジェクト: Vinzgore/epris
static void __epris_dbus_proxy_get_all_reply_cb (DBusGProxy* proxy, DBusGProxyCall* call, void* user_data) {
	GError* error;
	GHashTable* props;
	error = NULL;
	dbus_g_proxy_end_call (proxy, call, &error, dbus_g_type_get_map ("GHashTable", G_TYPE_STRING, G_TYPE_VALUE), &props, G_TYPE_INVALID);
	_epris_dbus_proxy_get_all_reply (user_data, props, error);
}
コード例 #14
0
static void
query_cb (DBusGProxy         *proxy,
          DBusGProxyCall     *call,
          GSimpleAsyncResult *result)
{
  GPtrArray *strv_array;
  GError *error = NULL;

  if (dbus_g_proxy_end_call (proxy,
                             call,
                             &error,
                             TYPE_STRV_ARRAY, &strv_array,
                             G_TYPE_INVALID))
    {
      GStrv filenames;
      guint i;

      filenames = g_new0 (char*, strv_array->len + 1);

      for (i = 0; i < strv_array->len; i++)
        {
          GStrv data = g_ptr_array_index (strv_array, i);

          filenames[i] = g_strdup (data[0]);

          g_strfreev (data);
        }

      g_ptr_array_free (strv_array, TRUE);

      g_simple_async_result_set_op_res_gpointer (result,
                                                 filenames,
                                                 (GDestroyNotify) g_strfreev);
    }
コード例 #15
0
ファイル: nm-modem-gsm.c プロジェクト: T100012/NetworkManager
static void
stage1_prepare_done (DBusGProxy *proxy, DBusGProxyCall *call, gpointer user_data)
{
	NMModemGsm *self = NM_MODEM_GSM (user_data);
	NMModemGsmPrivate *priv = NM_MODEM_GSM_GET_PRIVATE (self);
	GError *error = NULL;

	priv->call = NULL;

	if (priv->connect_properties) {
		g_hash_table_destroy (priv->connect_properties);
		priv->connect_properties = NULL;
	}

	if (dbus_g_proxy_end_call (proxy, call, &error, G_TYPE_INVALID))
		g_signal_emit_by_name (self, NM_MODEM_PREPARE_RESULT, TRUE, NM_DEVICE_STATE_REASON_NONE);
	else {
		if (dbus_g_error_has_name (error, MM_MODEM_ERROR_SIM_PIN))
			ask_for_pin (self, FALSE);
		else if (dbus_g_error_has_name (error, MM_MODEM_ERROR_SIM_WRONG))
			ask_for_pin (self, TRUE);
		else {
			nm_log_warn (LOGD_MB, "GSM connection failed: (%d) %s",
			             error ? error->code : -1,
			             error && error->message ? error->message : "(unknown)");

			g_signal_emit_by_name (self, NM_MODEM_PREPARE_RESULT, FALSE, translate_mm_error (error));
		}

		g_error_free (error);
	}
}
コード例 #16
0
static void
get_all_cb  (DBusGProxy *proxy,
             DBusGProxyCall *call,
             gpointer user_data)
{
	NMRemoteSettings *self = NM_REMOTE_SETTINGS (user_data);
	GHashTable *props = NULL;
	GError *error = NULL;

	if (!dbus_g_proxy_end_call (proxy, call, &error,
	                            DBUS_TYPE_G_MAP_OF_VARIANT, &props,
	                            G_TYPE_INVALID)) {
		/* Don't warn when the call times out because the settings service can't
		 * be activated or whatever.
		 */
		if (!(error->domain == DBUS_GERROR && error->code == DBUS_GERROR_NO_REPLY)) {
			g_warning ("%s: couldn't retrieve system settings properties: (%d) %s.",
			           __func__,
			           error ? error->code : -1,
			           (error && error->message) ? error->message : "(unknown)");
		}
		g_clear_error (&error);
		return;
	}

	properties_changed_cb (NULL, props, self);
	g_hash_table_destroy (props);
}
コード例 #17
0
ファイル: nm-modem-gsm.c プロジェクト: T100012/NetworkManager
static void
stage1_pin_done (DBusGProxy *proxy, DBusGProxyCall *call_id, gpointer user_data)
{
	NMModemGsm *self = NM_MODEM_GSM (user_data);
	NMModemGsmPrivate *priv = NM_MODEM_GSM_GET_PRIVATE (self);
	NMDeviceStateReason reason;
	GError *error = NULL;

	if (dbus_g_proxy_end_call (proxy, call_id, &error, G_TYPE_INVALID)) {
		/* Success; try to enable the modem again.  Wait a few seconds to ensure
		 * that ModemManager is ready for the enable right after the unlock.
		 */
		if (priv->enable_delay_id == 0)
			priv->enable_delay_id = g_timeout_add_seconds (4, (GSourceFunc) do_enable, self);
	} else {
		nm_log_warn (LOGD_MB, "GSM PIN unlock failed: (%d) %s",
		             error ? error->code : -1,
		             error && error->message ? error->message : "(unknown)");

		/* try to translate the error reason */
		reason = translate_mm_error (error);
		if (reason == NM_DEVICE_STATE_REASON_UNKNOWN)
			reason = NM_DEVICE_STATE_REASON_MODEM_INIT_FAILED;

		g_signal_emit_by_name (self, NM_MODEM_PREPARE_RESULT, FALSE, reason);
		g_error_free (error);
	}
}
コード例 #18
0
static void
enumerate_devices_done (DBusGProxy *proxy, DBusGProxyCall *call_id, gpointer data)
{
	NMModemManager *manager = NM_MODEM_MANAGER (data);
	GPtrArray *modems;
	GError *error = NULL;

	if (!dbus_g_proxy_end_call (proxy, call_id, &error,
								dbus_g_type_get_collection ("GPtrArray", DBUS_TYPE_G_OBJECT_PATH), &modems,
								G_TYPE_INVALID)) {
		nm_log_warn (LOGD_MB, "could not get modem list: %s", error->message);
		g_error_free (error);
	} else {
		int i;

		for (i = 0; i < modems->len; i++) {
			char *path = (char *) g_ptr_array_index (modems, i);

			create_modem (manager, path);
			g_free (path);
		}

		g_ptr_array_free (modems, TRUE);
	}
}
コード例 #19
0
static void _on_got_playing_status (DBusGProxy *proxy, DBusGProxyCall *call_id, GldiModuleInstance *myApplet)
{
	cd_debug ("=== %s ()", __func__);
	CD_APPLET_ENTER;
	s_pGetStatusCall = NULL;
	
	gchar *cStatus = NULL;
	GValue v = G_VALUE_INIT;
	GError *erreur = NULL;
	dbus_g_proxy_end_call (proxy,
		call_id,
		&erreur,
		G_TYPE_VALUE, &v,
		G_TYPE_INVALID);
	if (erreur != NULL)
	{
		cd_warning ("couldn't get MPRIS status (%s)\n", erreur->message);
		g_error_free (erreur);
	}
	else
	{
		if (G_VALUE_HOLDS_STRING (&v))
		{
			cStatus = (gchar*)g_value_get_string (&v);
			myData.iPlayingStatus = _extract_status (cStatus);
			g_free (cStatus);  // since we don't destroy the value, we destroy its content.
		}
	}
	
	cd_mpris2_getSongInfos_async ();
	
	CD_APPLET_LEAVE ();
}
コード例 #20
0
static void _dvb_plugin_factory_start_service_cb_cb (DBusGProxy* proxy, DBusGProxyCall* call, void* user_data) {
	GError* error;
	guint32 status;
	error = NULL;
	dbus_g_proxy_end_call (proxy, call, &error, G_TYPE_UINT, &status, G_TYPE_INVALID);
	dvb_plugin_factory_start_service_cb (user_data, status, error);
}
コード例 #21
0
static void
uninhibit_cb (DBusGProxy *proxy,
	      DBusGProxyCall *call_id,
	      RBGPMPlugin *plugin)
{
	GError *error = NULL;

	dbus_g_proxy_end_call (proxy,
			       call_id,
			       &error,
			       G_TYPE_INVALID);
	if (error != NULL) {
		if (!ignore_error (error)) {
			g_warning ("Failed to invoke %s.Inhibit: %s",
				   dbus_g_proxy_get_interface (proxy),
				   error->message);
		} else {
			rb_debug ("uninhibit failed: %s", error->message);
		}
		g_error_free (error);
	} else {
		rb_debug ("uninhibited");
		plugin->cookie = 0;
	}

	g_object_unref (plugin);
}
コード例 #22
0
ファイル: cm-manager.c プロジェクト: bchriste/gconnman
static void
manager_get_properties_call_notify (DBusGProxy *proxy,
                                    DBusGProxyCall *call,
                                    gpointer data)
{
  CmManager *manager = data;
  GError *error = NULL;
  GHashTable *properties = NULL;

  if (!dbus_g_proxy_end_call (
        proxy, call, &error,
        /* OUT values */
        dbus_g_type_get_map ("GHashTable", G_TYPE_STRING, G_TYPE_VALUE),
        &properties, G_TYPE_INVALID))
  {
    g_debug ("Error calling dbus_g_proxy_end_call in %s: %s\n",
             __FUNCTION__, error->message);
    g_error_free (error);
    return;
  }

  g_hash_table_foreach (properties, (GHFunc)manager_update_property, manager);
  g_hash_table_unref (properties);
  manager_emit_updated (manager);
}
コード例 #23
0
ファイル: geoclue-gsmloc-mm.c プロジェクト: Aktrisa/geoclue
static void
enumerate_modems_cb (DBusGProxy *proxy, DBusGProxyCall *call, gpointer user_data)
{
	GPtrArray *modems;
	GError *error = NULL;
	int i;

	if (!dbus_g_proxy_end_call (proxy, call, &error,
	                            dbus_g_type_get_collection ("GPtrArray", DBUS_TYPE_G_OBJECT_PATH), &modems,
	                            G_TYPE_INVALID)) {
		g_warning ("%s: failed to enumerate modems: (%d) %s",
		           __func__,
		           error ? error->code : -1,
		           error && error->message ? error->message : "(unknown)");
		g_clear_error (&error);
		return;
	}

	for (i = 0; i < modems->len; i++) {
		char *path = g_ptr_array_index (modems, i);

		modem_added (NULL, path, GEOCLUE_GSMLOC_MM (user_data));
		g_free (path);
	}
	g_ptr_array_free (modems, TRUE);
}
コード例 #24
0
static void
static_stage3_done (DBusGProxy *proxy, DBusGProxyCall *call, gpointer user_data)
{
	NMModem *self = NM_MODEM (user_data);
	NMModemPrivate *priv = NM_MODEM_GET_PRIVATE (self);
	GValueArray *ret_array = NULL;
	GError *error = NULL;
	NMIP4Config *config = NULL;

	priv->call = NULL;

	if (dbus_g_proxy_end_call (proxy, call, &error,
							   G_TYPE_VALUE_ARRAY, &ret_array,
							   G_TYPE_INVALID)) {
		NMIP4Address *addr;
		int i;

		config = nm_ip4_config_new ();

		addr = nm_ip4_address_new ();
		nm_ip4_address_set_address (addr, g_value_get_uint (g_value_array_get_nth (ret_array, 0)));
		nm_ip4_address_set_prefix (addr, 32);
		nm_ip4_config_take_address (config, addr);

		for (i = 0; i < ret_array->n_values; i++) {
			GValue *value = g_value_array_get_nth (ret_array, i);

			nm_ip4_config_add_nameserver (config, g_value_get_uint (value));
		}
		g_value_array_free (ret_array);
	}

	g_signal_emit (self, signals[IP4_CONFIG_RESULT], 0, NULL, config, error);
	g_clear_error (&error);
}
コード例 #25
0
static void
dun_connect_cb (DBusGProxy *proxy,
                DBusGProxyCall *call,
                void *user_data)
{
	NmaBtDevice *self = NMA_BT_DEVICE (user_data);
	NmaBtDevicePrivate *priv = NMA_BT_DEVICE_GET_PRIVATE (self);
	GError *error = NULL;
	char *device;

	g_message ("%s: processing Connect reply", __func__);

	if (!dbus_g_proxy_end_call (proxy, call, &error,
	                            G_TYPE_STRING, &device,
	                            G_TYPE_INVALID)) {
		dun_error (self, __func__, error, _("failed to connect to the phone."));
		g_clear_error (&error);
		goto out;
	}

	if (!device || !strlen (device)) {
		dun_error (self, __func__, NULL, _("failed to connect to the phone."));
		g_free (device);
		goto out;
	}

	g_free (priv->rfcomm_iface);
	priv->rfcomm_iface = device;
	g_message ("%s: new rfcomm interface '%s'", __func__, device);

out:
	g_message ("%s: finished", __func__);
}
コード例 #26
0
ファイル: bt-widget.c プロジェクト: amedee/barcode-utils
static void
dun_connect_cb (DBusGProxy *proxy,
                DBusGProxyCall *call,
                void *user_data)
{
	PluginInfo *info = user_data;
	GError *error = NULL;
	char *device;

	g_message ("%s: processing Connect reply", __func__);

	if (!dbus_g_proxy_end_call (proxy, call, &error,
	                            G_TYPE_STRING, &device,
	                            G_TYPE_INVALID)) {
		dun_error (info, __func__, error, _("failed to connect to the phone."));
		g_clear_error (&error);
		goto out;
	}

	if (!device || !strlen (device)) {
		dun_error (info, __func__, NULL, _("failed to connect to the phone."));
		g_free (device);
		goto out;
	}

	info->rfcomm_iface = device;
	g_message ("%s: new rfcomm interface '%s'", __func__, device);

out:
	g_message ("%s: finished", __func__);
}
コード例 #27
0
static void
remove_cb (DBusGProxy *proxy, DBusGProxyCall *call_id, gpointer user_data)
{
	CBInfo *info = user_data;
	GError *error = NULL;
	char * zone = NULL;

	if (!dbus_g_proxy_end_call (proxy, call_id, &error,
	                            G_TYPE_STRING, &zone,
	                            G_TYPE_INVALID)) {
		g_assert (error);
		/* ignore UNKNOWN_INTERFACE errors */
		if (error->message && !strstr (error->message, "UNKNOWN_INTERFACE")) {
			nm_log_warn (LOGD_FIREWALL, "(%s) firewall zone remove failed [%u]: (%d) %s",
			             info->iface, info->id, error->code, error->message);
		} else {
			nm_log_dbg (LOGD_FIREWALL, "(%s) firewall zone remove failed [%u]: (%d) %s",
			            info->iface, info->id, error->code, error->message);
		}
	} else {
		nm_log_dbg (LOGD_FIREWALL, "(%s) firewall zone remove succeeded [%u]",
		            info->iface, info->id);
	}

	info->completed = TRUE;
	g_free (zone);
	g_clear_error (&error);
}
コード例 #28
0
ファイル: cm-service.c プロジェクト: bchriste/gconnman
static void
service_get_properties_call_notify (DBusGProxy *proxy,
				   DBusGProxyCall *call,
				   gpointer data)
{
  CmService *service = data;
  GError *error = NULL;
  GHashTable *properties = NULL;
  gint count;

  if (!dbus_g_proxy_end_call (
	proxy, call, &error,
	/* OUT values */
	dbus_g_type_get_map ("GHashTable", G_TYPE_STRING, G_TYPE_VALUE),
	&properties, G_TYPE_INVALID))
  {
    g_debug ("Error calling dbus_g_proxy_end_call in %s on %s: %s\n",
             __FUNCTION__, cm_service_get_name (service), error->message);
    g_error_free (error);
    return;
  }

  count = g_hash_table_size (properties);

  g_hash_table_foreach (properties, (GHFunc)service_update_property, service);
  g_hash_table_unref (properties);
  service_emit_updated (service);
}
コード例 #29
0
static void
get_devices_cb (DBusGProxy     *proxy,
                DBusGProxyCall *call,
                void           *user_data)
{
        GPtrArray *device_paths;
        GError *error = NULL;

        if (!dbus_g_proxy_end_call (proxy,
                                    call,
                                    &error,
                                    DBUS_TYPE_G_ARRAY_OF_OBJECT_PATH,
                                    &device_paths,
                                    G_TYPE_INVALID)) {
                g_warning ("Error fetching list of devices: %s\n",
                           error->message);

                g_error_free (error);
                return;
        }

        g_ptr_array_foreach (device_paths,
                             (GFunc) add_device_from_path,
                             user_data);

        g_ptr_array_foreach (device_paths, (GFunc) g_free, NULL);
        g_ptr_array_free (device_paths, TRUE);
}
static void
reply_to_send_message (DBusGProxy *proxy,
                       DBusGProxyCall *call,
                       void *_request)
{
  ModemRequest *request = _request;
  ModemSMSService *self = modem_request_object (request);
  ModemSMSServiceSendReply *callback = modem_request_callback (request);
  gpointer user_data = modem_request_user_data (request);
  char const *message_path = NULL;

  GError *error = NULL;

  if (dbus_g_proxy_end_call (proxy, call, &error,
          DBUS_TYPE_G_OBJECT_PATH, &message_path,
          G_TYPE_INVALID))
    {
      char const *destination;

      destination = modem_request_get_data (request, "destination");
    }

  callback (self, request, message_path, error, user_data);

  g_clear_error (&error);
}