DBusConnection.call
void call(string busName, string objectPath, string interfaceName, string methodName, glib.variant.Variant parameters, glib.variant_type.VariantType replyType, gio.types.DBusCallFlags flags, int timeoutMsec, gio.cancellable.Cancellable cancellable = null, gio.types.AsyncReadyCallback callback = null)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.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 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 #GVariant is floating, it is consumed. This allows convenient 'inline' use of [glib.variant.Variant.new_], 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][g-main-context-push-thread-default] of the thread you are calling this method from. You can then call [gio.dbus_connection.DBusConnection.callFinish] to get the result of the operation. See [gio.dbus_connection.DBusConnection.callSync] for the synchronous version of this function.
If callback is null then the D-Bus method call message will be sent with the [gio.types.DBusMessageFlags.NoReplyExpected] flag set.
Parameters
busName | a unique or well-known bus name or null if connection is not a message bus connection |
objectPath | path of remote object |
interfaceName | D-Bus interface to invoke method on |
methodName | the name of the method to invoke |
parameters | a #GVariant tuple with parameters for the method or null if not passing parameters |
replyType | the expected type of the reply (which will be a tuple), or null |
flags | flags from the #GDBusCallFlags enumeration |
timeoutMsec | the timeout in milliseconds, -1 to use the default timeout or G_MAXINT for no timeout |
cancellable | a #GCancellable or null |
callback | a #GAsyncReadyCallback to call when the request is satisfied or null if you don't care about the result of the method invocation |