call_sync


Description:

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

Synchronously invokes the method_name method on this.

If method_name contains any dots, then name is split into interface and method name parts. This allows using this for invoking methods on other interfaces.

If the DBusConnection associated with this is disconnected 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 the parameters Variant is floating, it is consumed. This allows convenient 'inline' use of Variant, e.g.:

 g_dbus_proxy_call_sync (proxy,
"TwoStrings",
g_variant_new ("(ss)",
"Thing One",
"Thing Two"),
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.

If this has an expected interface (see g_interface_info) and method_name is referenced by it, then the return value is checked against the return type.

Parameters:

this

A DBusProxy.

method_name

Name of method to invoke.

parameters

A Variant tuple with parameters for the signal or null if not passing parameters.

flags

Flags from the DBusCallFlags enumeration.

timeout_msec

The timeout in milliseconds (with g_maxint meaning "infinite") or -1 to use the proxy default timeout.

cancellable

A Cancellable or null.

Returns:

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




2022 vala-language.org