call


Description:

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

Asynchronously 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 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 the parameters Variant is floating, it is consumed. This allows convenient 'inline' use of Variant, e.g.:

 g_dbus_proxy_call (proxy,
"TwoStrings",
g_variant_new ("(ss)",
"Thing One",
"Thing Two"),
G_DBUS_CALL_FLAGS_NONE,
-1,
NULL,
(GAsyncReadyCallback) two_strings_done,
&data);

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.

This is an asynchronous method. When the operation is finished, callback will be invoked in the thread-default main context of the thread you are calling this method from. You can then call call.end to get the result of the operation. See call_sync for the synchronous version of this method.

If callback is null then the D-Bus method call message will be sent with the g_dbus_message_flags_no_reply_expected flag set.

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.

callback

A TaskReadyCallback to call when the request is satisfied or null if you don't care about the result of the method invocation.

user_data

The data to pass to callback.




2022 vala-language.org