call


Description:

public async Variant call (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

Asynchronously 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. Unless it’s g_variant_type_unit, the reply_type will be a tuple containing one or more values.

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

 g_dbus_connection_call (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,
(GAsyncReadyCallback) two_strings_done,
NULL);

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 function.

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 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 (which will be a tuple), 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

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