class Gio::DBusMessage

Overview

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

Defined in:

lib/gi-crystal/src/auto/gio-2.0/d_bus_message.cr

Constructors

Class Method Summary

Instance Method Summary

Instance methods inherited from class GObject::Object

==(other : self) ==, bind_property(source_property : String, target : GObject::Object, target_property : String, flags : GObject::BindingFlags) : GObject::Binding bind_property, bind_property_full(source_property : String, target : GObject::Object, target_property : String, flags : GObject::BindingFlags, transform_to : GObject::Closure, transform_from : GObject::Closure) : GObject::Binding bind_property_full, data(key : String) : Pointer(Void) | Nil data, finalize finalize, freeze_notify : Nil freeze_notify, getv(names : Enumerable(String), values : Enumerable(_)) : Nil getv, hash(hasher) hash, notify(property_name : String) : Nil notify, notify_by_pspec(pspec : GObject::ParamSpec) : Nil notify_by_pspec, notify_signal notify_signal, property(property_name : String, value : _) : Nil property, qdata(quark : UInt32) : Pointer(Void) | Nil qdata, ref_count : UInt32 ref_count, run_dispose : Nil run_dispose, set_data(key : String, data : Pointer(Void) | Nil) : Nil set_data, set_property(property_name : String, value : _) : Nil set_property, steal_data(key : String) : Pointer(Void) | Nil steal_data, steal_qdata(quark : UInt32) : Pointer(Void) | Nil steal_qdata, thaw_notify : Nil thaw_notify, to_unsafe : Pointer(Void) to_unsafe, watch_closure(closure : GObject::Closure) : Nil watch_closure

Constructor methods inherited from class GObject::Object

cast(obj : GObject::Object) : self cast, new(pointer : Pointer(Void), transfer : GICrystal::Transfer)
new
new
, newv(object_type : UInt64, parameters : Enumerable(GObject::Parameter)) : self newv

Class methods inherited from class GObject::Object

cast?(obj : GObject::Object) : self | Nil cast?, compat_control(what : UInt64, data : Pointer(Void) | Nil) : UInt64 compat_control, g_type : UInt64 g_type, interface_find_property(g_iface : GObject::TypeInterface, property_name : String) : GObject::ParamSpec interface_find_property, interface_list_properties(g_iface : GObject::TypeInterface) : Enumerable(GObject::ParamSpec) interface_list_properties

Macros inherited from class GObject::Object

previous_vfunc(*args) previous_vfunc, previous_vfunc!(*args) previous_vfunc!, signal(signature) signal

Constructor Detail

def self.new : self #

Creates a new empty #GDBusMessage.


[View source]
def self.new(*, locked : Bool | Nil = nil) #

[View source]
def self.new_from_blob(blob : Bytes, capabilities : Gio::DBusCapabilityFlags) : self #

Creates a new #GDBusMessage 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.


[View source]
def self.new_method_call(name : String | Nil, path : String, interface_ : String | Nil, method : String) : self #

Creates a new #GDBusMessage for a method call.


[View source]
def self.new_signal(path : String, interface_ : String, signal : String) : self #

Creates a new #GDBusMessage for a signal emission.


[View source]

Class Method Detail

def self.g_type : UInt64 #

Returns the type id (GType) registered in GLib type system.


[View source]

Instance Method Detail

def ==(other : self) #
Description copied from class Reference

Returns true if this reference is the same as other. Invokes same?.


def arg0 : String | Nil #

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


[View source]
def body : GLib::Variant | Nil #

Gets the body of a message.


[View source]
def 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.


[View source]
def byte_order : Gio::DBusMessageByteOrder #

Gets the byte order of message.


[View source]
def byte_order=(byte_order : Gio::DBusMessageByteOrder) : Nil #

Sets the byte order of message.


[View source]
def bytes_needed(blob : Bytes) : Int64 #

[View source]
def bytes_needed(*blob : UInt8) #

[View source]
def copy : Gio::DBusMessage #

Copies message. 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. message contains file descriptors and the per-process or system-wide open files limit is reached.


[View source]
def destination : String | Nil #

Convenience getter for the %G_DBUS_MESSAGE_HEADER_FIELD_DESTINATION header field.


[View source]
def destination=(value : String | Nil) : Nil #

Convenience setter for the %G_DBUS_MESSAGE_HEADER_FIELD_DESTINATION header field.


[View source]
def error_name : String | Nil #

Convenience getter for the %G_DBUS_MESSAGE_HEADER_FIELD_ERROR_NAME header field.


[View source]
def error_name=(value : String) : Nil #

Convenience setter for the %G_DBUS_MESSAGE_HEADER_FIELD_ERROR_NAME header field.


[View source]
def flags : Gio::DBusMessageFlags #

Gets the flags for message.


[View source]
def flags=(flags : Gio::DBusMessageFlags) : Nil #

Sets the flags to set on message.


[View source]
def hash(hasher) #
Description copied from class Reference

See Object#hash(hasher)


def header(header_field : Gio::DBusMessageHeaderField) : GLib::Variant | Nil #

Gets a header field on message.

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


[View source]
def header_fields : Bytes #

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


[View source]
def interface : String | Nil #

Convenience getter for the %G_DBUS_MESSAGE_HEADER_FIELD_INTERFACE header field.


[View source]
def interface=(value : String | Nil) : Nil #

Convenience setter for the %G_DBUS_MESSAGE_HEADER_FIELD_INTERFACE header field.


[View source]
def lock : Nil #

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


[View source]
def locked : Bool #

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


[View source]
def locked? : Bool #

[View source]
def member : String | Nil #

Convenience getter for the %G_DBUS_MESSAGE_HEADER_FIELD_MEMBER header field.


[View source]
def member=(value : String | Nil) : Nil #

Convenience setter for the %G_DBUS_MESSAGE_HEADER_FIELD_MEMBER header field.


[View source]
def message_type : Gio::DBusMessageType #

Gets the type of message.


[View source]
def message_type=(type : Gio::DBusMessageType) : Nil #

Sets message to be of type.


[View source]
def new_method_error_literal(error_name : String, error_message : String) : Gio::DBusMessage #

Creates a new #GDBusMessage that is an error reply to method_call_message.


[View source]
def new_method_reply : Gio::DBusMessage #

Creates a new #GDBusMessage that is a reply to method_call_message.


[View source]
def num_unix_fds : UInt32 #

Convenience getter for the %G_DBUS_MESSAGE_HEADER_FIELD_NUM_UNIX_FDS header field.


[View source]
def num_unix_fds=(value : UInt32) : Nil #

Convenience setter for the %G_DBUS_MESSAGE_HEADER_FIELD_NUM_UNIX_FDS header field.


[View source]
def path : String | Nil #

Convenience getter for the %G_DBUS_MESSAGE_HEADER_FIELD_PATH header field.


[View source]
def path=(value : String | Nil) : Nil #

Convenience setter for the %G_DBUS_MESSAGE_HEADER_FIELD_PATH header field.


[View source]
def print(indent : UInt32) : String #

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 ]|


[View source]
def reply_serial : UInt32 #

Convenience getter for the %G_DBUS_MESSAGE_HEADER_FIELD_REPLY_SERIAL header field.


[View source]
def reply_serial=(value : UInt32) : Nil #

Convenience setter for the %G_DBUS_MESSAGE_HEADER_FIELD_REPLY_SERIAL header field.


[View source]
def sender : String | Nil #

Convenience getter for the %G_DBUS_MESSAGE_HEADER_FIELD_SENDER header field.


[View source]
def sender=(value : String | Nil) : Nil #

Convenience setter for the %G_DBUS_MESSAGE_HEADER_FIELD_SENDER header field.


[View source]
def serial : UInt32 #

Gets the serial for message.


[View source]
def serial=(serial : UInt32) : Nil #

Sets the serial for message.


[View source]
def set_header(header_field : Gio::DBusMessageHeaderField, value : _ | Nil) : Nil #

Sets a header field on message.

If value is floating, message assumes ownership of value.


[View source]
def signature : String #

Convenience getter for the %G_DBUS_MESSAGE_HEADER_FIELD_SIGNATURE header field.

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


[View source]
def signature=(value : String | Nil) : Nil #

Convenience setter for the %G_DBUS_MESSAGE_HEADER_FIELD_SIGNATURE header field.


[View source]
def to_blob(capabilities : Gio::DBusCapabilityFlags) : Bytes #

Serializes message to a blob. The byte order returned by g_dbus_message_get_byte_order() will be used.


[View source]
def to_gerror : Bool #

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.


[View source]
def unix_fd_list : Gio::UnixFDList | Nil #

Gets the UNIX file descriptors associated with message, 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 g_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, ...).


[View source]
def unix_fd_list=(fd_list : Gio::UnixFDList | Nil) : 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.

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.


[View source]