Gio.DBusMessage¶
| Subclasses: | None |
|---|
Methods¶
| Inherited: | GObject.Object (37) |
|---|---|
| Structs: | GObject.ObjectClass (5) |
Virtual Methods¶
| Inherited: | GObject.Object (7) |
|---|
Signals¶
| Inherited: | GObject.Object (1) |
|---|
Fields¶
| Inherited: | GObject.Object (1) |
|---|
Class Details¶
-
class
Gio.DBusMessage(**kwargs)¶ Bases: GObject.ObjectAbstract: No A type for representing D-Bus messages that can be sent or received on a
Gio.DBusConnection.New in version 2.26.
-
classmethod
bytes_needed(blob)[source]¶ Parameters: blob ( bytes) – A blob representing a binary D-Bus message.Raises: GLib.ErrorReturns: 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: intUtility 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: Gio.DBusMessageCreates 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.
- blob (
-
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: GLib.ErrorReturns: A new Gio.DBusMessageorNoneif error is set. Free withGObject.Object.unref().Return type: Gio.DBusMessageCopies 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: strConvenience to get the first item in the body of self.
New in version 2.26.
-
get_body()[source]¶ Returns: A GLib.VariantorNoneif the body is empty. Do not free, it is owned by self.Return type: GLib.VariantGets the body of a message.
New in version 2.26.
-
get_byte_order()[source]¶ Returns: The byte order. Return type: Gio.DBusMessageByteOrderGets the byte order of self.
-
get_destination()[source]¶ Returns: The value. Return type: strConvenience getter for the
Gio.DBusMessageHeaderField.DESTINATIONheader field.New in version 2.26.
-
get_error_name()[source]¶ Returns: The value. Return type: strConvenience 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: Gio.DBusMessageFlagsGets 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.VariantorNoneGets 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: bytesGets an array of all header fields on self that are set.
New in version 2.26.
-
get_interface()[source]¶ Returns: The value. Return type: strConvenience getter for the
Gio.DBusMessageHeaderField.INTERFACEheader field.New in version 2.26.
-
get_locked()[source]¶ Returns: Trueif self is locked,Falseotherwise.Return type: boolChecks 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]¶ Returns: The value. Return type: strConvenience 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: Gio.DBusMessageTypeGets the type of self.
New in version 2.26.
-
get_num_unix_fds()[source]¶ Returns: The value. Return type: intConvenience getter for the
Gio.DBusMessageHeaderField.NUM_UNIX_FDSheader field.New in version 2.26.
-
get_path()[source]¶ Returns: The value. Return type: strConvenience getter for the
Gio.DBusMessageHeaderField.PATHheader field.New in version 2.26.
-
get_reply_serial()[source]¶ Returns: The value. Return type: intConvenience getter for the
Gio.DBusMessageHeaderField.REPLY_SERIALheader field.New in version 2.26.
-
get_sender()[source]¶ Returns: The value. Return type: strConvenience getter for the
Gio.DBusMessageHeaderField.SENDERheader field.New in version 2.26.
-
get_serial()[source]¶ Returns: A #guint32. Return type: intGets the serial for self.
New in version 2.26.
-
get_signature()[source]¶ Returns: The value. Return type: strConvenience getter for the
Gio.DBusMessageHeaderField.SIGNATUREheader field.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: Gio.UnixFDListGets the UNIX file descriptors associated with self, if any.
This method is only available on UNIX.
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: Gio.DBusMessageCreates 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 GLib.free().Return type: strProduces 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]¶ Parameters: value ( str) – The value to set.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.
- header_field (
-
set_interface(value)[source]¶ Parameters: value ( str) – The value to set.Convenience setter for the
Gio.DBusMessageHeaderField.INTERFACEheader field.New in version 2.26.
-
set_member(value)[source]¶ Parameters: value ( str) – The value to set.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]¶ Parameters: value ( str) – The value to set.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]¶ Parameters: value ( str) – The value to set.Convenience setter for the
Gio.DBusMessageHeaderField.SENDERheader field.New in version 2.26.
-
set_serial(serial)[source]¶ Parameters: serial ( int) – A #guint32.Sets the serial for self.
New in version 2.26.
-
set_signature(value)[source]¶ Parameters: value ( str) – The value to set.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.
New in version 2.26.
-
to_blob(capabilities)[source]¶ Parameters: capabilities ( Gio.DBusCapabilityFlags) – AGio.DBusCapabilityFlagsdescribing what protocol features are supported.Raises: GLib.ErrorReturns: 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: bytesSerializes 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: GLib.ErrorReturns: Trueif error was set,Falseotherwise.Return type: boolIf 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.
-
classmethod