Esempio n. 1
0
int main()
{
	DBusGConnection* connection;
	DBusGProxy* proxy;
	DBusGProxy* proxy1 ;//=NULL;
	GError* error = NULL;
	
	pthread_t thr_id;
	void* thrPtr;
	
	char* iface = "Test.Proxy.Interface";
	char* iface1 = "Test.Proxy.Interface1";
	
	g_type_init();
	
	connection = dbus_g_bus_get(DBUS_BUS_SESSION, &error);
	if (connection == NULL)
		{
			std_log(LOG_FILENAME_LINE, "Failed to open connection to bus: %s\n",
		              error->message);
		  g_error_free (error);
		  create_xml(1);
		  return 1;
		}
	
	proxy = dbus_g_proxy_new_for_name(connection, "Test.Glib.Proxy.Interface", "/Test/Proxy/Interface", iface);
	proxy1 = dbus_g_proxy_new_for_name(connection, "Test.Glib.Proxy.Interface", "/Test/Proxy/Interface", iface1);
	
	if(strcmp(iface, dbus_g_proxy_get_interface(proxy)))
		{
		std_log(LOG_FILENAME_LINE, "Fail to check interface %s", iface);
		create_xml(1);
		return 1;
		}
	
	pthread_create(&thr_id, NULL, &set_iface, proxy);
	pthread_join(thr_id, &thrPtr);
	
	if(strcmp(iface1, dbus_g_proxy_get_interface(proxy)))
		{
		std_log(LOG_FILENAME_LINE, "Fail to check interface %s", iface1);
		create_xml(1);
		return 1;
		}
	if(!iface_flag)
		{
		std_log(LOG_FILENAME_LINE, "Something wrong happens in thread.");
		create_xml(1);
		return 1;
		}
	
	std_log(LOG_FILENAME_LINE, "Test Successful");
	create_xml(0);
	return 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);
}
Esempio n. 3
0
static void* set_iface(void* data)
	{
	const char* iface1 = "Test.Proxy.Interface1";
	DBusGProxy* proxy = (DBusGProxy* )data;
	
	dbus_g_proxy_set_interface(proxy, iface1); 
	
	if(strcmp(iface1, dbus_g_proxy_get_interface(proxy)))
		{
		std_log(LOG_FILENAME_LINE, "Fail to check interface %s", iface1);
		}
	iface_flag = 1;
	return NULL;
	}
Esempio n. 4
0
DBusGProxy *
nm_modem_get_proxy (NMModem *self,
					const char *interface)
{

	NMModemPrivate *priv = NM_MODEM_GET_PRIVATE (self);
	const char *current_iface;

	g_return_val_if_fail (NM_IS_MODEM (self), NULL);

	/* Default to the default interface. */
	if (interface == NULL)
		interface = MM_DBUS_INTERFACE_MODEM;

	if (interface && !strcmp (interface, DBUS_INTERFACE_PROPERTIES))
		return priv->props_proxy;

	current_iface = dbus_g_proxy_get_interface (priv->proxy);
	if (!current_iface || strcmp (current_iface, interface))
		dbus_g_proxy_set_interface (priv->proxy, interface);

	return priv->proxy;
}