Class: Gio::DBusMessage

Inherits:
Object
  • Object
show all
Defined in:
(unknown)

Overview

A type for representing D-Bus messages that can be sent or received on a GDBus::Connection.

Instance Method Summary collapse

Instance Method Details

#arg0String

Convenience to get the first item in the body of message. message is not a string.

Returns:

  • (String)

    The string item or nil if the first item in the body of

#bodyGLib::Variant

Gets the body of a message. empty. Do not free, it is owned by message.

Returns:

  • (GLib::Variant)

    A #GVariant or nil if the body is

#body=(body) ⇒ nil

Sets the body message. As a side-effect the %G_DBUS_MESSAGE_HEADER_FIELD_SIGNATURE header field is set to the type string of body (or cleared if body is nil).

If body is floating, message assumes ownership of body.

Parameters:

  • body (GLib::Variant)

    Either nil or a #GVariant that is a tuple.

Returns:

  • (nil)

#byte_orderGio::DBusMessageByteOrder

Gets the byte order of message.

Returns:

#byte_order=(byte_order) ⇒ nil

Sets the byte order of message.

Parameters:

Returns:

  • (nil)

#copyGio::DBusMessage

Copies message. The copy is a deep copy and the returned GDBus::Message is completely identical except that it is guaranteed to not be locked.

This operation can fail if e.g. message contains file descriptors and the per-process or system-wide open files limit is reached.

Returns:

  • (Gio::DBusMessage)

    A new GDBus::Message or nil if error is set. Free with g_object_unref().

#destinationString

Convenience getter for the %G_DBUS_MESSAGE_HEADER_FIELD_DESTINATION header field.

Returns:

  • (String)

    The value.

#destination=(value) ⇒ nil

Convenience setter for the %G_DBUS_MESSAGE_HEADER_FIELD_DESTINATION header field.

Parameters:

  • value (String)

    The value to set.

Returns:

  • (nil)

#error_nameString

Convenience getter for the %G_DBUS_MESSAGE_HEADER_FIELD_ERROR_NAME header field.

Returns:

  • (String)

    The value.

#error_name=(value) ⇒ nil

Convenience setter for the %G_DBUS_MESSAGE_HEADER_FIELD_ERROR_NAME header field.

Parameters:

  • value (String)

    The value to set.

Returns:

  • (nil)

#flagsGio::DBusMessageFlags

Gets the flags for message.

Returns:

  • (Gio::DBusMessageFlags)

    Flags that are set (typically values from the GDBus::MessageFlags enumeration bitwise ORed together).

#flags=(flags) ⇒ nil

Sets the flags to set on message. enumeration bitwise ORed together).

Parameters:

  • flags (Gio::DBusMessageFlags)

    Flags for message that are set (typically values from the GDBus::MessageFlags

Returns:

  • (nil)

#get_header(header_field) ⇒ GLib::Variant

Gets a header field on message.

The caller is responsible for checking the type of the returned #GVariant matches what is expected. otherwise. Do not free, it is owned by message.

Parameters:

  • header_field (Gio::DBusMessageHeaderField)

    A 8-bit unsigned integer (typically a value from the GDBus::MessageHeaderField enumeration)

Returns:

  • (GLib::Variant)

    A #GVariant with the value if the header was found, nil

#header_fieldsArray<Integer>

Gets an array of all header fields on message that are set. terminated by %G_DBUS_MESSAGE_HEADER_FIELD_INVALID. Each element is a #guchar. Free with g_free().

Returns:

  • (Array<Integer>)

    An array of header fields

#interfaceString

Convenience getter for the %G_DBUS_MESSAGE_HEADER_FIELD_INTERFACE header field.

Returns:

  • (String)

    The value.

#interface=(value) ⇒ nil

Convenience setter for the %G_DBUS_MESSAGE_HEADER_FIELD_INTERFACE header field.

Parameters:

  • value (String)

    The value to set.

Returns:

  • (nil)

#locknil

If message is locked, does nothing. Otherwise locks the message.

Returns:

  • (nil)

#lockedTrueClass

Checks whether message is locked. To monitor changes to this value, conncet to the #GObject::notify signal to listen for changes on the GDBus::Message:locked property.

Returns:

  • (TrueClass)

    true if message is locked, false otherwise.

#locked=(locked) ⇒ TrueClass

Parameters:

  • locked (TrueClass)

Returns:

  • (TrueClass)

    locked

  • (TrueClass)

    locked

#locked?TrueClass

Returns locked.

Returns:

  • (TrueClass)

    locked

#memberString

Convenience getter for the %G_DBUS_MESSAGE_HEADER_FIELD_MEMBER header field.

Returns:

  • (String)

    The value.

#member=(value) ⇒ nil

Convenience setter for the %G_DBUS_MESSAGE_HEADER_FIELD_MEMBER header field.

Parameters:

  • value (String)

    The value to set.

Returns:

  • (nil)

#message_typeGio::DBusMessageType

Gets the type of message.

Returns:

  • (Gio::DBusMessageType)

    A 8-bit unsigned integer (typically a value from the GDBus::MessageType enumeration).

#message_type=(type) ⇒ nil

Sets message to be of type.

Parameters:

  • type (Gio::DBusMessageType)

    A 8-bit unsigned integer (typically a value from the GDBus::MessageType enumeration).

Returns:

  • (nil)

#newGio::DBusMessage

Creates a new empty GDBus::Message.

Returns:

#new_from_blob(blob, blob_len, capabilities) ⇒ Gio::DBusMessage

Creates a new GDBus::Message from the data stored at blob. The byte order that the message was in can be retrieved using g_dbus_message_get_byte_order().

If the blob cannot be parsed, contains invalid fields, or contains invalid headers, %G_IO_ERROR_INVALID_ARGUMENT will be returned. g_object_unref().

Parameters:

  • blob (Array<Integer>)

    A blob representing a binary D-Bus message.

  • blob_len (Integer)

    The length of blob.

  • capabilities (Gio::DBusCapabilityFlags)

    A GDBus::CapabilityFlags describing what protocol features are supported.

Returns:

#new_method_call(name, path, interface_, method) ⇒ Gio::DBusMessage

Creates a new GDBus::Message for a method call.

Parameters:

  • name (String)

    A valid D-Bus name or nil.

  • path (String)

    A valid object path.

  • interface_ (String)

    A valid D-Bus interface name or nil.

  • method (String)

    A valid method name.

Returns:

#new_method_error(error_name, error_message_format, array) ⇒ Gio::DBusMessage

Creates a new GDBus::Message that is an error reply to method_call_message.

Parameters:

  • error_name (String)

    A valid D-Bus error name.

  • error_message_format (String)

    The D-Bus error message in a printf() format.

  • array (Array)

    Arguments for error_message_format.

Returns:

#new_method_error_literal(error_name, error_message) ⇒ Gio::DBusMessage

Creates a new GDBus::Message that is an error reply to method_call_message.

Parameters:

  • error_name (String)

    A valid D-Bus error name.

  • error_message (String)

    The D-Bus error message.

Returns:

#new_method_error_valist(error_name, error_message_format, var_args) ⇒ Gio::DBusMessage

Like g_dbus_message_new_method_error() but intended for language bindings.

Parameters:

  • error_name (String)

    A valid D-Bus error name.

  • error_message_format (String)

    The D-Bus error message in a printf() format.

  • var_args (Gio::va_list)

    Arguments for error_message_format.

Returns:

#new_method_replyGio::DBusMessage

Creates a new GDBus::Message that is a reply to method_call_message.

Returns:

#new_signal(path, interface_, signal) ⇒ Gio::DBusMessage

Creates a new GDBus::Message for a signal emission.

Parameters:

  • path (String)

    A valid object path.

  • interface_ (String)

    A valid D-Bus interface name.

  • signal (String)

    A valid signal name.

Returns:

#num_unix_fdsInteger

Convenience getter for the %G_DBUS_MESSAGE_HEADER_FIELD_NUM_UNIX_FDS header field.

Returns:

  • (Integer)

    The value.

#num_unix_fds=(value) ⇒ nil

Convenience setter for the %G_DBUS_MESSAGE_HEADER_FIELD_NUM_UNIX_FDS header field.

Parameters:

  • value (Integer)

    The value to set.

Returns:

  • (nil)

#pathString

Convenience getter for the %G_DBUS_MESSAGE_HEADER_FIELD_PATH header field.

Returns:

  • (String)

    The value.

#path=(value) ⇒ nil

Convenience setter for the %G_DBUS_MESSAGE_HEADER_FIELD_PATH header field.

Parameters:

  • value (String)

    The value to set.

Returns:

  • (nil)

Produces a human-readable multi-line description of message.

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

]|

Parameters:

  • indent (Integer)

    Indentation level.

Returns:

  • (String)

    A string that should be freed with g_free().

#reply_serialInteger

Convenience getter for the %G_DBUS_MESSAGE_HEADER_FIELD_REPLY_SERIAL header field.

Returns:

  • (Integer)

    The value.

#reply_serial=(value) ⇒ nil

Convenience setter for the %G_DBUS_MESSAGE_HEADER_FIELD_REPLY_SERIAL header field.

Parameters:

  • value (Integer)

    The value to set.

Returns:

  • (nil)

#senderString

Convenience getter for the %G_DBUS_MESSAGE_HEADER_FIELD_SENDER header field.

Returns:

  • (String)

    The value.

#sender=(value) ⇒ nil

Convenience setter for the %G_DBUS_MESSAGE_HEADER_FIELD_SENDER header field.

Parameters:

  • value (String)

    The value to set.

Returns:

  • (nil)

#serialInteger

Gets the serial for message.

Returns:

  • (Integer)

    A #guint32.

#serial=(serial) ⇒ nil

Sets the serial for message.

Parameters:

  • serial (Integer)

    A #guint32.

Returns:

  • (nil)

#set_header(header_field, value) ⇒ nil

Sets a header field on message.

If value is floating, message assumes ownership of value.

Parameters:

  • header_field (Gio::DBusMessageHeaderField)

    A 8-bit unsigned integer (typically a value from the GDBus::MessageHeaderField enumeration)

  • value (GLib::Variant)

    A #GVariant to set the header field or nil to clear the header field.

Returns:

  • (nil)

#signatureString

Convenience getter for the %G_DBUS_MESSAGE_HEADER_FIELD_SIGNATURE header field.

Returns:

  • (String)

    The value.

#signature=(value) ⇒ nil

Convenience setter for the %G_DBUS_MESSAGE_HEADER_FIELD_SIGNATURE header field.

Parameters:

  • value (String)

    The value to set.

Returns:

  • (nil)

#to_blob(out_size, capabilities) ⇒ Array<Integer>

Serializes message to a blob. The byte order returned by g_dbus_message_get_byte_order() will be used. valid binary D-Bus message of out_size bytes generated by message or nil if error is set. Free with g_free().

Parameters:

  • out_size (Integer)

    Return location for size of generated blob.

  • capabilities (Gio::DBusCapabilityFlags)

    A GDBus::CapabilityFlags describing what protocol features are supported.

Returns:

  • (Array<Integer>)

    A pointer to a

#to_gerrorTrueClass

If message is not of type %G_DBUS_MESSAGE_TYPE_ERROR does nothing and returns false.

Otherwise this method encodes the error in message as a #GError using g_dbus_error_set_dbus_error() using the information in the %G_DBUS_MESSAGE_HEADER_FIELD_ERROR_NAME header field of message as well as the first string item in message’s body.

Returns:

  • (TrueClass)

    true if error was set, false otherwise.

#unix_fd_listGio::UnixFDList

Gets the UNIX file descriptors associated with message, if any.

This method is only available on UNIX. associated. Do not free, this object is owned by message.

Returns:

#unix_fd_list=(fd_list) ⇒ nil

Sets the UNIX file descriptors associated with message. As a side-effect the %G_DBUS_MESSAGE_HEADER_FIELD_NUM_UNIX_FDS header field is set to the number of fds in fd_list (or cleared if fd_list is nil).

This method is only available on UNIX.

Parameters:

Returns:

  • (nil)