Gio.DBusConnection.prototype.call
function call(bus_name: String, object_path: String, interface_name: String, method_name: String, parameters: GLib.Variant, reply_type: GLib.VariantType, flags: Gio.DBusCallFlags, timeout_msec: Number(gint), cancellable: Gio.Cancellable, callback: Gio.AsyncReadyCallback): void { // Gjs wrapper for g_dbus_connection_call() }
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 connection is closed then the operation will fail with Gio.IOErrorEnum.closed. If cancellable is canceled, the operation will fail with Gio.IOErrorEnum.cancelled. If parameters contains a value not compatible with the D-Bus protocol, the operation fails with Gio.IOErrorEnum.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 GLib.Variant is floating, it is consumed. This allows convenient 'inline' use of GLib.Variant.new, e.g.: |[<!-- language="C" --> 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][g-main-context-push-thread-default] of the thread you are calling this method from. You can then call Gio.DBusConnection.prototype.call_finish to get the result of the operation. See Gio.DBusConnection.prototype.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 Gio.DBusMessageFlags.no_reply_expected flag set.
Since 2.26
- bus_name
a unique or well-known bus name or null if connection 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 GLib.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 Gio.DBusCallFlags enumeration
- timeout_msec
the timeout in milliseconds, -1 to use the default timeout or %G_MAXINT for no timeout
- cancellable
a Gio.Cancellable or null
- callback
a Gio.AsyncReadyCallback to call when the request is satisfied or null if you don't care about the result of the method invocation