DBusProxy.callSync

Synchronously invokes the method_name method on proxy.

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

If the #GDBusConnection associated with proxy is disconnected then the operation will fail with gio.types.IOErrorEnum.Closed. If cancellable is canceled, the operation will fail with gio.types.IOErrorEnum.Cancelled. If parameters contains a value not compatible with the D-Bus protocol, the operation fails with gio.types.IOErrorEnum.InvalidArgument.

If the parameters #GVariant is floating, it is consumed. This allows convenient 'inline' use of glib.variant.VariantG.new_, 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 gio.dbus_proxy.DBusProxy.call for the asynchronous version of this method.

If proxy has an expected interface (see #GDBusProxy:g-interface-info) and method_name is referenced by it, then the return value is checked against the return type.

Parameters

methodName string

Name of method to invoke.

parameters glib.variant.VariantG

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

flags gio.types.DBusCallFlags

Flags from the #GDBusCallFlags enumeration.

timeoutMsec int

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

cancellable gio.cancellable.Cancellable

A #GCancellable or null.

Return Value

Type: glib.variant.VariantG

null if error is set. Otherwise a #GVariant tuple with return values. Free with glib.variant.VariantG.unref.