1.18 <GDBusMessage>

Class: <GDBusMessage>

It derives from <GObject>.

A type for representing D-Bus messages that can be sent or received on a <GDBusConnection>.

Properties

Property: dbus-message:locked self

Its value is a boolean.

It is read only.

Procedures

Procedure: dbus-message:bytes-needed blob ⇒ %return

Utility function to calculate how many bytes are needed to completely deserialize the D-Bus message stored at blob.

blob

Passed: a bytevector, or a list or vector, each an unsigned 8-bit integer.

A blob representing a binary D-Bus message.

%return

Returned: a 64-bit integer.

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).

blob-len

Not passed: guile-gi gives the length of blob.

The length of blob (must be at least 16).

Method: dbus-message:copy self ⇒ %return
Method: copy self ⇒ %return

Copies self. The copy is a deep copy and the returned <GDBusMessage> is 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.

self

Passed: a <GDBusMessage>.

A <GDBusMessage>.

%return

Returned: a <GDBusMessage>.

A new <GDBusMessage> or #f if error is set. Free with object:unref.

Method: dbus-message:get-arg0 self ⇒ %return
Method: get-arg0 self ⇒ %return

Convenience to get the first item in the body of self.

See dbus-message:get-arg0-path for returning object-path-typed arg0 values.

self

Passed: a <GDBusMessage>.

A <GDBusMessage>.

%return

Returned: a string, or #f.

The string item or #f if the first item in the body of self is not a string.

Method: dbus-message:get-arg0-path self ⇒ %return
Method: get-arg0-path self ⇒ %return

Convenience to get the first item in the body of self.

See dbus-message:get-arg0 for returning string-typed arg0 values.

self

Passed: a <GDBusMessage>.

A <GDBusMessage>.

%return

Returned: a string, or #f.

The object path item or NULL if the first item in the body of self is not an object path.

Method: dbus-message:get-body self ⇒ %return
Method: get-body self ⇒ %return

Gets the body of a message.

self

Passed: a <GDBusMessage>.

A <GDBusMessage>.

%return

Returned: a <GVariant>, or #f.

A <GVariant> or #f if the body is empty. Do not free, it is owned by self.

Method: dbus-message:get-byte-order self ⇒ %return
Method: get-byte-order self ⇒ %return

Gets the byte order of self.

self

Passed: a <GDBusMessage>.

A <GDBusMessage>.

%return

Returned: a <GDBusMessageByteOrder>.

The byte order.

Method: dbus-message:get-destination self ⇒ %return
Method: get-destination self ⇒ %return

Convenience getter for the destination header field.

self

Passed: a <GDBusMessage>.

A <GDBusMessage>.

%return

Returned: a string, or #f.

The value.

Method: dbus-message:get-error-name self ⇒ %return
Method: get-error-name self ⇒ %return

Convenience getter for the error-name header field.

self

Passed: a <GDBusMessage>.

A <GDBusMessage>.

%return

Returned: a string, or #f.

The value.

Method: dbus-message:get-flags self ⇒ %return
Method: get-flags self ⇒ %return

Gets the flags for self.

self

Passed: a <GDBusMessage>.

A <GDBusMessage>.

%return

Returned: a <GDBusMessageFlags>.

Flags that are set (typically values from the <GDBusMessageFlags> enumeration bitwise ORed together).

Method: dbus-message:get-header self header-field ⇒ %return
Method: get-header self header-field ⇒ %return

Gets a header field on self.

The caller is responsible for checking the type of the returned <GVariant> matches what is expected.

self

Passed: a <GDBusMessage>.

A <GDBusMessage>.

header-field

Passed: a <GDBusMessageHeaderField>, or one of its symbols.

A 8-bit unsigned integer (typically a value from the <GDBusMessageHeaderField> enumeration)

%return

Returned: a <GVariant>, or #f.

A <GVariant> with the value if the header was found, #f otherwise. Do not free, it is owned by self.

Method: dbus-message:get-header-fields self ⇒ %return
Method: get-header-fields self ⇒ %return

Gets an array of all header fields on self that are set.

self

Passed: a <GDBusMessage>.

A <GDBusMessage>.

%return

Returned: a bytevector.

An array of header fields terminated by invalid. Each element is a guchar. Free with byte-array:free.

Method: dbus-message:get-interface self ⇒ %return
Method: get-interface self ⇒ %return

Convenience getter for the interface header field.

self

Passed: a <GDBusMessage>.

A <GDBusMessage>.

%return

Returned: a string, or #f.

The value.

Method: dbus-message:get-locked? self ⇒ %return
Method: get-locked? self ⇒ %return

Checks whether self is locked. To monitor changes to this value, connect to the object:notify signal to listen for changes on the dbus-message:locked property.

self

Passed: a <GDBusMessage>.

A <GDBusMessage>.

%return

Returned: a boolean.

#t if self is locked, #f otherwise.

Method: dbus-message:get-member self ⇒ %return
Method: get-member self ⇒ %return

Convenience getter for the member header field.

self

Passed: a <GDBusMessage>.

A <GDBusMessage>.

%return

Returned: a string, or #f.

The value.

Method: dbus-message:get-message-type self ⇒ %return
Method: get-message-type self ⇒ %return

Gets the type of self.

self

Passed: a <GDBusMessage>.

A <GDBusMessage>.

%return

Returned: a <GDBusMessageType>.

A 8-bit unsigned integer (typically a value from the <GDBusMessageType> enumeration).

Method: dbus-message:get-num-unix-fds self ⇒ %return
Method: get-num-unix-fds self ⇒ %return

Convenience getter for the num-unix-fds header field.

self

Passed: a <GDBusMessage>.

A <GDBusMessage>.

%return

Returned: an unsigned 32-bit integer.

The value.

Method: dbus-message:get-path self ⇒ %return
Method: get-path self ⇒ %return

Convenience getter for the path header field.

self

Passed: a <GDBusMessage>.

A <GDBusMessage>.

%return

Returned: a string, or #f.

The value.

Method: dbus-message:get-reply-serial self ⇒ %return
Method: get-reply-serial self ⇒ %return

Convenience getter for the reply-serial header field.

self

Passed: a <GDBusMessage>.

A <GDBusMessage>.

%return

Returned: an unsigned 32-bit integer.

The value.

Method: dbus-message:get-sender self ⇒ %return
Method: get-sender self ⇒ %return

Convenience getter for the sender header field.

self

Passed: a <GDBusMessage>.

A <GDBusMessage>.

%return

Returned: a string, or #f.

The value.

Method: dbus-message:get-serial self ⇒ %return
Method: get-serial self ⇒ %return

Gets the serial for self.

self

Passed: a <GDBusMessage>.

A <GDBusMessage>.

%return

Returned: an unsigned 32-bit integer.

A guint32.

Method: dbus-message:get-signature self ⇒ %return
Method: get-signature self ⇒ %return

Convenience getter for the signature header field.

This will always be non-#f, but may be an empty string.

self

Passed: a <GDBusMessage>.

A <GDBusMessage>.

%return

Returned: a string.

The value.

Method: dbus-message:get-unix-fd-list self ⇒ %return
Method: get-unix-fd-list self ⇒ %return

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 variant:get-handle returns 5, that is intended to be a reference to the file descriptor that can be accessed by g_unix_fd_list_get (list, 5, ...).

self

Passed: a <GDBusMessage>.

A <GDBusMessage>.

%return

Returned: a <GUnixFDList>, or #f.

A <GUnixFDList> or #f if no file descriptors are associated. Do not free, this object is owned by self.

Method: dbus-message:lock self
Method: lock self

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

self

Passed: a <GDBusMessage>.

A <GDBusMessage>.

Procedure: dbus-message:new ⇒ %return

Creates a new empty <GDBusMessage>.

%return

Returned: a <GDBusMessage>.

A <GDBusMessage>. Free with object:unref.

Procedure: dbus-message:new-from-blob blob capabilities ⇒ %return

Creates a new <GDBusMessage> from the data stored at blob. The byte order that the message was in can be retrieved using dbus-message:get-byte-order.

If the blob cannot be parsed, contains invalid fields, or contains invalid headers, invalid-argument will be returned.

blob

Passed: a bytevector, or a list or vector, each an unsigned 8-bit integer.

A blob representing a binary D-Bus message.

capabilities

Passed: a <GDBusCapabilityFlags>, or a list of its symbols, or one of them.

A <GDBusCapabilityFlags> describing what protocol features are supported.

%return

Returned: a <GDBusMessage>.

A new <GDBusMessage> or #f if error is set. Free with object:unref.

blob-len

Not passed: guile-gi gives the length of blob.

The length of blob.

Procedure: dbus-message:new-method-call name path interface- method ⇒ %return

Creates a new <GDBusMessage> for a method call.

name

Passed: a string, or #f.

A valid D-Bus name or #f.

path

Passed: a string.

A valid object path.

interface-

Passed: a string, or #f.

A valid D-Bus interface name or #f.

method

Passed: a string.

A valid method name.

%return

Returned: a <GDBusMessage>.

A <GDBusMessage>. Free with object:unref.

Method: dbus-message:new-method-error-literal self error-name error-message ⇒ %return
Method: new-method-error-literal self error-name error-message ⇒ %return

Creates a new <GDBusMessage> that is an error reply to self.

self

Passed: a <GDBusMessage>.

A message of type method-call to create a reply message to.

error-name

Passed: a string.

A valid D-Bus error name.

error-message

Passed: a string.

The D-Bus error message.

%return

Returned: a <GDBusMessage>.

A <GDBusMessage>. Free with object:unref.

Method: dbus-message:new-method-reply self ⇒ %return
Method: new-method-reply self ⇒ %return

Creates a new <GDBusMessage> that is a reply to self.

self

Passed: a <GDBusMessage>.

A message of type method-call to create a reply message to.

%return

Returned: a <GDBusMessage>.

<GDBusMessage>. Free with object:unref.

Procedure: dbus-message:new-signal path interface- signal ⇒ %return

Creates a new <GDBusMessage> for a signal emission.

path

Passed: a string.

A valid object path.

interface-

Passed: a string.

A valid D-Bus interface name.

signal

Passed: a string.

A valid signal name.

%return

Returned: a <GDBusMessage>.

A <GDBusMessage>. Free with object:unref.

Method: dbus-message:print self indent ⇒ %return
Method: print self indent ⇒ %return

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
self

Passed: a <GDBusMessage>.

A <GDBusMessage>.

indent

Passed: an unsigned 32-bit integer.

Indentation level.

%return

Returned: a string.

A string that should be freed with byte-array:free.

Method: dbus-message:set-body self body
Method: set-body self body

Sets the body self. As a side-effect the signature header field is set to the type string of body (or cleared if body is #f).

If body is floating, self assumes ownership of body.

self

Passed: a <GDBusMessage>.

A <GDBusMessage>.

body

Passed: a <GVariant>.

Either #f or a <GVariant> that is a tuple.

Method: dbus-message:set-byte-order self byte-order
Method: set-byte-order self byte-order

Sets the byte order of self.

self

Passed: a <GDBusMessage>.

A <GDBusMessage>.

byte-order

Passed: a <GDBusMessageByteOrder>, or one of its symbols.

The byte order.

Method: dbus-message:set-destination self [value]
Method: set-destination self [value]

Convenience setter for the destination header field.

self

Passed: a <GDBusMessage>.

A <GDBusMessage>.

value

Passed, or left out: a string, or #f.

The value to set.

Method: dbus-message:set-error-name self value
Method: set-error-name self value

Convenience setter for the error-name header field.

self

Passed: a <GDBusMessage>.

A <GDBusMessage>.

value

Passed: a string.

The value to set.

Method: dbus-message:set-flags self flags
Method: set-flags self flags

Sets the flags to set on self.

self

Passed: a <GDBusMessage>.

A <GDBusMessage>.

flags

Passed: a <GDBusMessageFlags>, or a list of its symbols, or one of them.

Flags for self that are set (typically values from the <GDBusMessageFlags> enumeration bitwise ORed together).

Method: dbus-message:set-header self header-field [value]
Method: set-header self header-field [value]

Sets a header field on self.

If value is floating, self assumes ownership of value.

self

Passed: a <GDBusMessage>.

A <GDBusMessage>.

header-field

Passed: a <GDBusMessageHeaderField>, or one of its symbols.

A 8-bit unsigned integer (typically a value from the <GDBusMessageHeaderField> enumeration)

value

Passed, or left out: a <GVariant>, or #f.

A <GVariant> to set the header field or #f to clear the header field.

Method: dbus-message:set-interface self [value]
Method: set-interface self [value]

Convenience setter for the interface header field.

self

Passed: a <GDBusMessage>.

A <GDBusMessage>.

value

Passed, or left out: a string, or #f.

The value to set.

Method: dbus-message:set-member self [value]
Method: set-member self [value]

Convenience setter for the member header field.

self

Passed: a <GDBusMessage>.

A <GDBusMessage>.

value

Passed, or left out: a string, or #f.

The value to set.

Method: dbus-message:set-message-type self type
Method: set-message-type self type

Sets self to be of type.

self

Passed: a <GDBusMessage>.

A <GDBusMessage>.

type

Passed: a <GDBusMessageType>, or one of its symbols.

A 8-bit unsigned integer (typically a value from the <GDBusMessageType> enumeration).

Method: dbus-message:set-num-unix-fds self value
Method: set-num-unix-fds self value

Convenience setter for the num-unix-fds header field.

self

Passed: a <GDBusMessage>.

A <GDBusMessage>.

value

Passed: an unsigned 32-bit integer.

The value to set.

Method: dbus-message:set-path self [value]
Method: set-path self [value]

Convenience setter for the path header field.

self

Passed: a <GDBusMessage>.

A <GDBusMessage>.

value

Passed, or left out: a string, or #f.

The value to set.

Method: dbus-message:set-reply-serial self value
Method: set-reply-serial self value

Convenience setter for the reply-serial header field.

self

Passed: a <GDBusMessage>.

A <GDBusMessage>.

value

Passed: an unsigned 32-bit integer.

The value to set.

Method: dbus-message:set-sender self [value]
Method: set-sender self [value]

Convenience setter for the sender header field.

self

Passed: a <GDBusMessage>.

A <GDBusMessage>.

value

Passed, or left out: a string, or #f.

The value to set.

Method: dbus-message:set-serial self serial
Method: set-serial self serial

Sets the serial for self.

The D-Bus specification does not allow the serial to be zero.

self

Passed: a <GDBusMessage>.

A <GDBusMessage>.

serial

Passed: an unsigned 32-bit integer.

A guint32, which must not be zero.

Method: dbus-message:set-signature self [value]
Method: set-signature self [value]

Convenience setter for the signature header field.

self

Passed: a <GDBusMessage>.

A <GDBusMessage>.

value

Passed, or left out: a string, or #f.

The value to set.

Method: dbus-message:set-unix-fd-list self [fd-list]
Method: set-unix-fd-list self [fd-list]

Sets the UNIX file descriptors associated with self. As a side-effect the num-unix-fds header field is set to the number of fds in fd-list (or cleared if fd-list is #f).

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.

self

Passed: a <GDBusMessage>.

A <GDBusMessage>.

fd-list

Passed, or left out: a <GUnixFDList>, or #f.

A <GUnixFDList> or #f.

Method: dbus-message:to-blob self capabilities ⇒ %return
Method: to-blob self capabilities ⇒ %return

Serializes self to a blob. The byte order returned by dbus-message:get-byte-order will be used.

self

Passed: a <GDBusMessage>.

A <GDBusMessage>.

capabilities

Passed: a <GDBusCapabilityFlags>, or a list of its symbols, or one of them.

A <GDBusCapabilityFlags> describing what protocol features are supported.

%return

Returned: a bytevector.

A pointer to a valid binary D-Bus message of out-size bytes generated by self or #f if error is set. Free with byte-array:free.

out-size

Not returned: it is the length of %return.

Return location for size of generated blob.

Method: dbus-message:to-gerror? self ⇒ %return
Method: to-gerror? self ⇒ %return

If self is not of type error does nothing and returns #f.

Otherwise this method encodes the error in self as a <GError> using g_dbus_error_set_dbus_error() using the information in the error-name header field of self as well as the first string item in self’s body.

self

Passed: a <GDBusMessage>.

A <GDBusMessage>.

%return

Returned: a boolean.

#t if error was set, #f otherwise.