DBUS_TYPE_VARIANT in dbus_message_append_args

Marcel Holtmann marcel at holtmann.org
Mon May 18 11:29:54 PDT 2009


Hi Marcel,

> how could I add an argument for an method-call of the type DBUS_TYPE_VARIANT?
> 
> The following is not working:
> 
> DBusMessage* dbusmessage;
> DBusMessage* dbusreply;
> dbusmessage = dbus_message_new_method_call("org.bluez",
>             defaultAdapter,
>             "org.bluez.Adapter",
>             "SetProperty");
> char* propertyname = "Name";
> dbus_message_append_args(dbusmessage, DBUS_TYPE_STRING, &propertyname, 
> DBUS_TYPE_VARIANT, &name, DBUS_TYPE_INVALID);
> dbusreply = dbus_connection_send_with_reply_and_block(dbuscon, dbusmessage, 
> reply_timeout, &dbuserror);

the variant is a container:

	dbus_message_iter_open_container(iter, DBUS_TYPE_VARIANT,
							signature, &value);
	dbus_message_iter_append_basic(&value, type, val);
	dbus_message_iter_close_container(iter, &value);

Regards

Marcel




More information about the dbus mailing list