Gio.DBusMessage¶
- Subclasses:
None
Methods¶
- Inherited:
- Structs:
class |
|
class |
|
class |
|
class |
|
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
Properties¶
Name |
Type |
Flags |
Short Description |
|---|---|---|---|
r |
Signals¶
- Inherited:
Fields¶
- Inherited:
Class Details¶
- class Gio.DBusMessage(**kwargs)¶
- Bases:
- Abstract:
No
A type for representing D-Bus messages that can be sent or received on a [class`Gio`.DBusConnection].
New in version 2.26.
- classmethod bytes_needed(blob)[source]¶
- Parameters:
blob (
bytes) – A blob representing a binary D-Bus message.- Raises:
- Returns:
Number of bytes needed or -1 if error is set (e.g. if blob contains invalid data or not enough data is available to determine the size).
- Return type:
Utility function to calculate how many bytes are needed to completely deserialize the D-Bus message stored at blob.
New in version 2.26.
- classmethod new()[source]¶
- Returns:
A
Gio.DBusMessage. Free withGObject.Object.unref().- Return type:
Creates a new empty
Gio.DBusMessage.New in version 2.26.
- classmethod new_from_blob(blob, capabilities)[source]¶
- Parameters:
blob (
bytes) – A blob representing a binary D-Bus message.capabilities (
Gio.DBusCapabilityFlags) – AGio.DBusCapabilityFlagsdescribing what protocol features are supported.
- Raises:
- Returns:
A new
Gio.DBusMessageorNoneif error is set. Free withGObject.Object.unref().- Return type:
Creates a new
Gio.DBusMessagefrom the data stored at blob. The byte order that the message was in can be retrieved usingGio.DBusMessage.get_byte_order().If the blob cannot be parsed, contains invalid fields, or contains invalid headers,
Gio.IOErrorEnum.INVALID_ARGUMENTwill be returned.New in version 2.26.
- classmethod new_method_call(name, path, interface_, method)[source]¶
- Parameters:
- Returns:
A
Gio.DBusMessage. Free withGObject.Object.unref().- Return type:
Creates a new
Gio.DBusMessagefor a method call.New in version 2.26.
- classmethod new_signal(path, interface_, signal)[source]¶
- Parameters:
- Returns:
A
Gio.DBusMessage. Free withGObject.Object.unref().- Return type:
Creates a new
Gio.DBusMessagefor a signal emission.New in version 2.26.
- copy()[source]¶
- Raises:
- Returns:
A new
Gio.DBusMessageorNoneif error is set. Free withGObject.Object.unref().- Return type:
Copies self. The copy is a deep copy and the returned
Gio.DBusMessageis completely identical except that it is guaranteed to not be locked.This operation can fail if e.g. self contains file descriptors and the per-process or system-wide open files limit is reached.
New in version 2.26.
- get_arg0()[source]¶
- Returns:
The string item or
Noneif the first item in the body of self is not a string.- Return type:
Convenience to get the first item in the body of self.
See [method`Gio`.DBusMessage.get_arg0_path] for returning object-path-typed arg0 values.
New in version 2.26.
- get_arg0_path()[source]¶
- Returns:
The object path item or
NULLif the first item in the body of self is not an object path.- Return type:
Convenience to get the first item in the body of self.
See [method`Gio`.DBusMessage.get_arg0] for returning string-typed arg0 values.
New in version 2.80.
- get_body()[source]¶
- Returns:
A
GLib.VariantorNoneif the body is empty. Do not free, it is owned by self.- Return type:
GLib.VariantorNone
Gets the body of a message.
New in version 2.26.
- get_destination()[source]¶
-
Convenience getter for the
Gio.DBusMessageHeaderField.DESTINATIONheader field.New in version 2.26.
- get_error_name()[source]¶
-
Convenience getter for the
Gio.DBusMessageHeaderField.ERROR_NAMEheader field.New in version 2.26.
- get_flags()[source]¶
- Returns:
Flags that are set (typically values from the
Gio.DBusMessageFlagsenumeration bitwise ORed together).- Return type:
Gets the flags for self.
New in version 2.26.
- get_header(header_field)[source]¶
- Parameters:
header_field (
Gio.DBusMessageHeaderField) – A 8-bit unsigned integer (typically a value from theGio.DBusMessageHeaderFieldenumeration)- Returns:
A
GLib.Variantwith the value if the header was found,Noneotherwise. Do not free, it is owned by self.- Return type:
GLib.VariantorNone
Gets a header field on self.
The caller is responsible for checking the type of the returned
GLib.Variantmatches what is expected.New in version 2.26.
- get_header_fields()[source]¶
- Returns:
An array of header fields terminated by
Gio.DBusMessageHeaderField.INVALID. Each element is a #guchar. Free withGLib.free().- Return type:
Gets an array of all header fields on self that are set.
New in version 2.26.
- get_interface()[source]¶
-
Convenience getter for the
Gio.DBusMessageHeaderField.INTERFACEheader field.New in version 2.26.
- get_locked()[source]¶
-
Checks whether self is locked. To monitor changes to this value, conncet to the
GObject.Object::notifysignal to listen for changes on theGio.DBusMessage:lockedproperty.New in version 2.26.
- get_member()[source]¶
-
Convenience getter for the
Gio.DBusMessageHeaderField.MEMBERheader field.New in version 2.26.
- get_message_type()[source]¶
- Returns:
A 8-bit unsigned integer (typically a value from the
Gio.DBusMessageTypeenumeration).- Return type:
Gets the type of self.
New in version 2.26.
- get_num_unix_fds()[source]¶
- Returns:
The value.
- Return type:
Convenience getter for the
Gio.DBusMessageHeaderField.NUM_UNIX_FDSheader field.New in version 2.26.
- get_path()[source]¶
-
Convenience getter for the
Gio.DBusMessageHeaderField.PATHheader field.New in version 2.26.
- get_reply_serial()[source]¶
- Returns:
The value.
- Return type:
Convenience getter for the
Gio.DBusMessageHeaderField.REPLY_SERIALheader field.New in version 2.26.
- get_sender()[source]¶
-
Convenience getter for the
Gio.DBusMessageHeaderField.SENDERheader field.New in version 2.26.
- get_serial()[source]¶
- Returns:
A #guint32.
- Return type:
Gets the serial for self.
New in version 2.26.
- get_signature()[source]¶
- Returns:
The value.
- Return type:
Convenience getter for the
Gio.DBusMessageHeaderField.SIGNATUREheader field.This will always be non-
None, but may be an empty string.New in version 2.26.
- get_unix_fd_list()[source]¶
- Returns:
A
Gio.UnixFDListorNoneif no file descriptors are associated. Do not free, this object is owned by self.- Return type:
Gets the UNIX file descriptors associated with self, if any.
This method is only available on UNIX.
The file descriptors normally correspond to %G_VARIANT_TYPE_HANDLE values in the body of the message. For example, if
GLib.Variant.get_handle() returns 5, that is intended to be a reference to the file descriptor that can be accessed byg_unix_fd_list_get (list, 5, ...).New in version 2.26.
- new_method_error_literal(error_name, error_message)[source]¶
- Parameters:
- Returns:
A
Gio.DBusMessage. Free withGObject.Object.unref().- Return type:
Creates a new
Gio.DBusMessagethat is an error reply to self.New in version 2.26.
- new_method_reply()[source]¶
- Returns:
Gio.DBusMessage. Free withGObject.Object.unref().- Return type:
Creates a new
Gio.DBusMessagethat is a reply to self.New in version 2.26.
- print_(indent)[source]¶
- Parameters:
indent (
int) – Indentation level.- Returns:
A string that should be freed with [func`GLib`.free].
- Return type:
Produces a human-readable multi-line description of self.
The contents of the description has no ABI guarantees, the contents and formatting is subject to change at any time. Typical output looks something like this: `` Flags: none Version: 0 Serial: 4 Headers:
path -> objectpath ‘/org/gtk/GDBus/TestObject’ interface -> ‘org.gtk.GDBus.TestInterface’ member -> ‘GimmeStdout’ destination -> ‘:1.146’
Body: () UNIX File Descriptors:
(none)
or¶
Flags: no-reply-expected Version: 0 Serial: 477 Headers:
reply-serial -> uint32 4 destination -> ‘:1.159’ sender -> ‘:1.146’ num-unix-fds -> uint32 1
Body: () UNIX File Descriptors:
fd 12: dev=0:10,mode=020620,ino=5,uid=500,gid=5,rdev=136:2,size=0,atime=1273085037,mtime=1273085851,ctime=1272982635
New in version 2.26.
- set_body(body)[source]¶
- Parameters:
body (
GLib.Variant) – EitherNoneor aGLib.Variantthat is a tuple.
Sets the body self. As a side-effect the
Gio.DBusMessageHeaderField.SIGNATUREheader field is set to the type string of body (or cleared if body isNone).If body is floating, self assumes ownership of body.
New in version 2.26.
- set_byte_order(byte_order)[source]¶
- Parameters:
byte_order (
Gio.DBusMessageByteOrder) – The byte order.
Sets the byte order of self.
- set_destination(value)[source]¶
-
Convenience setter for the
Gio.DBusMessageHeaderField.DESTINATIONheader field.New in version 2.26.
- set_error_name(value)[source]¶
- Parameters:
value (
str) – The value to set.
Convenience setter for the
Gio.DBusMessageHeaderField.ERROR_NAMEheader field.New in version 2.26.
- set_flags(flags)[source]¶
- Parameters:
flags (
Gio.DBusMessageFlags) – Flags for self that are set (typically values from theGio.DBusMessageFlagsenumeration bitwise ORed together).
Sets the flags to set on self.
New in version 2.26.
- set_header(header_field, value)[source]¶
- Parameters:
header_field (
Gio.DBusMessageHeaderField) – A 8-bit unsigned integer (typically a value from theGio.DBusMessageHeaderFieldenumeration)value (
GLib.VariantorNone) – AGLib.Variantto set the header field orNoneto clear the header field.
Sets a header field on self.
If value is floating, self assumes ownership of value.
New in version 2.26.
- set_interface(value)[source]¶
-
Convenience setter for the
Gio.DBusMessageHeaderField.INTERFACEheader field.New in version 2.26.
- set_member(value)[source]¶
-
Convenience setter for the
Gio.DBusMessageHeaderField.MEMBERheader field.New in version 2.26.
- set_message_type(type)[source]¶
- Parameters:
type (
Gio.DBusMessageType) – A 8-bit unsigned integer (typically a value from theGio.DBusMessageTypeenumeration).
Sets self to be of type.
New in version 2.26.
- set_num_unix_fds(value)[source]¶
- Parameters:
value (
int) – The value to set.
Convenience setter for the
Gio.DBusMessageHeaderField.NUM_UNIX_FDSheader field.New in version 2.26.
- set_path(value)[source]¶
-
Convenience setter for the
Gio.DBusMessageHeaderField.PATHheader field.New in version 2.26.
- set_reply_serial(value)[source]¶
- Parameters:
value (
int) – The value to set.
Convenience setter for the
Gio.DBusMessageHeaderField.REPLY_SERIALheader field.New in version 2.26.
- set_sender(value)[source]¶
-
Convenience setter for the
Gio.DBusMessageHeaderField.SENDERheader field.New in version 2.26.
- set_serial(serial)[source]¶
- Parameters:
serial (
int) – A #guint32, which must not be zero.
Sets the serial for self.
The D-Bus specification does not allow the serial to be zero.
New in version 2.26.
- set_signature(value)[source]¶
-
Convenience setter for the
Gio.DBusMessageHeaderField.SIGNATUREheader field.New in version 2.26.
- set_unix_fd_list(fd_list)[source]¶
- Parameters:
fd_list (
Gio.UnixFDListorNone) – AGio.UnixFDListorNone.
Sets the UNIX file descriptors associated with self. As a side-effect the
Gio.DBusMessageHeaderField.NUM_UNIX_FDSheader field is set to the number of fds in fd_list (or cleared if fd_list isNone).This method is only available on UNIX.
When designing D-Bus APIs that are intended to be interoperable, please note that non-GDBus implementations of D-Bus can usually only access file descriptors if they are referenced by a value of type %G_VARIANT_TYPE_HANDLE in the body of the message.
New in version 2.26.
- to_blob(capabilities)[source]¶
- Parameters:
capabilities (
Gio.DBusCapabilityFlags) – AGio.DBusCapabilityFlagsdescribing what protocol features are supported.- Raises:
- Returns:
A pointer to a valid binary D-Bus message of out_size bytes generated by self or
Noneif error is set. Free withGLib.free().- Return type:
Serializes self to a blob. The byte order returned by
Gio.DBusMessage.get_byte_order() will be used.New in version 2.26.
- to_gerror()[source]¶
- Raises:
- Returns:
- Return type:
If self is not of type
Gio.DBusMessageType.ERRORdoes nothing and returnsFalse.Otherwise this method encodes the error in self as a
GLib.Errorusing g_dbus_error_set_dbus_error() using the information in theGio.DBusMessageHeaderField.ERROR_NAMEheader field of self as well as the first string item in self's body.New in version 2.26.