call_sync


Description:

public Variant call_sync (string? bus_name, string object_path, string interface_name, string method_name, Variant? parameters, VariantType? reply_type, DBusCallFlags flags, int timeout_msec, Cancellable? cancellable = null) throws Error

Synchronously invokes the method_name method on the interface_name D-Bus interface on the remote object at object_path owned by bus_name.

If this is closed then the operation will fail with g_io_error_closed. If cancellable is canceled, the operation will fail with g_io_error_cancelled. If parameters contains a value not compatible with the D-Bus protocol, the operation fails with g_io_error_invalid_argument .

If reply_type is non-null then the reply will be checked for having this type and an error will be raised if it does not match. Said another way, if you give a reply_type then any non-null return value will be of this type.

If the parameters Variant is floating, it is consumed. This allows convenient 'inline' use of Variant, e.g.:

 g_dbus_connection_call_sync (connection,
"org.freedesktop.StringThings",
"/org/freedesktop/StringThings",
"org.freedesktop.StringThings",
"TwoStrings",
g_variant_new ("(ss)",
"Thing One",
"Thing Two"),
NULL,
G_DBUS_CALL_FLAGS_NONE,
-1,
NULL,
&error);

The calling thread is blocked until a reply is received. See call for the asynchronous version of this method.

Parameters:

this

a DBusConnection

bus_name

a unique or well-known bus name or null if this is not a message bus connection

object_path

path of remote object

interface_name

D-Bus interface to invoke method on

method_name

the name of the method to invoke

parameters

a Variant tuple with parameters for the method or null if not passing parameters

reply_type

the expected type of the reply, or null

flags

flags from the DBusCallFlags enumeration

timeout_msec

the timeout in milliseconds, -1 to use the default timeout or g_maxint for no timeout

cancellable

a Cancellable or null

Returns:

null if throws is set. Otherwise a Variant tuple with return values. Free with g_variant_unref.