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

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)? data, finalize finalize, freeze_notify : Nil freeze_notify, getv(names : Enumerable(String), values : Enumerable(_)) : Nil getv, 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)? qdata, ref_count : UInt32 ref_count, run_dispose : Nil run_dispose, set_data(key : String, data : Pointer(Void)?) : Nil set_data, set_property(property_name : String, value : _) : Nil set_property, steal_data(key : String) : Pointer(Void)? steal_data, steal_qdata(quark : UInt32) : Pointer(Void)? 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, 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

compat_control(what : UInt64, data : Pointer(Void)?) : 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

Constructor Detail

def self.new : self #

Creates a new empty #GDBusMessage.


def self.new(*, locked : Bool? = nil) #

def self.new_from_blob(blob : Enumerable(UInt8), 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.


def self.new_method_call(name : String?, path : String, interface_ : String?, method : String) : self #

Creates a new #GDBusMessage for a method call.


def self.new_signal(path : String, interface_ : String, signal : String) : self #

Creates a new #GDBusMessage for a signal emission.


Class Method Detail

def self.g_type : UInt64 #

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


Instance Method Detail

def arg0 : String? #

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


def body : GLib::Variant? #

Gets the body of a message.


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.


def byte_order : Gio::DBusMessageByteOrder #

Gets the byte order of @message.


def byte_order=(byte_order : Gio::DBusMessageByteOrder) : Nil #

Sets the byte order of @message.


def bytes_needed(blob : Enumerable(UInt8)) : Int64 #

def bytes_needed(*blob : UInt8) #

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.


def destination : String? #

Convenience getter for the %G_DBUS_MESSAGE_HEADER_FIELD_DESTINATION header field.


def destination=(value : String?) : Nil #

Convenience setter for the %G_DBUS_MESSAGE_HEADER_FIELD_DESTINATION header field.


def error_name : String? #

Convenience getter for the %G_DBUS_MESSAGE_HEADER_FIELD_ERROR_NAME header field.


def error_name=(value : String) : Nil #

Convenience setter for the %G_DBUS_MESSAGE_HEADER_FIELD_ERROR_NAME header field.


def flags : Gio::DBusMessageFlags #

Gets the flags for @message.


def flags=(flags : Gio::DBusMessageFlags) : Nil #

Sets the flags to set on @message.


def header(header_field : Gio::DBusMessageHeaderField) : GLib::Variant? #

Gets a header field on @message.

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


def header_fields : Enumerable(UInt8) #

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


def interface : String? #

Convenience getter for the %G_DBUS_MESSAGE_HEADER_FIELD_INTERFACE header field.


def interface=(value : String?) : Nil #

Convenience setter for the %G_DBUS_MESSAGE_HEADER_FIELD_INTERFACE header field.


def lock : Nil #

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


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.


def locked? : Bool #

def member : String? #

Convenience getter for the %G_DBUS_MESSAGE_HEADER_FIELD_MEMBER header field.


def member=(value : String?) : Nil #

Convenience setter for the %G_DBUS_MESSAGE_HEADER_FIELD_MEMBER header field.


def message_type : Gio::DBusMessageType #

Gets the type of @message.


def message_type=(type : Gio::DBusMessageType) : Nil #

Sets @message to be of @type.


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.


def new_method_reply : Gio::DBusMessage #

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


def num_unix_fds : UInt32 #

Convenience getter for the %G_DBUS_MESSAGE_HEADER_FIELD_NUM_UNIX_FDS header field.


def num_unix_fds=(value : UInt32) : Nil #

Convenience setter for the %G_DBUS_MESSAGE_HEADER_FIELD_NUM_UNIX_FDS header field.


def path : String? #

Convenience getter for the %G_DBUS_MESSAGE_HEADER_FIELD_PATH header field.


def path=(value : String?) : Nil #

Convenience setter for the %G_DBUS_MESSAGE_HEADER_FIELD_PATH header field.


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


def reply_serial : UInt32 #

Convenience getter for the %G_DBUS_MESSAGE_HEADER_FIELD_REPLY_SERIAL header field.


def reply_serial=(value : UInt32) : Nil #

Convenience setter for the %G_DBUS_MESSAGE_HEADER_FIELD_REPLY_SERIAL header field.


def sender : String? #

Convenience getter for the %G_DBUS_MESSAGE_HEADER_FIELD_SENDER header field.


def sender=(value : String?) : Nil #

Convenience setter for the %G_DBUS_MESSAGE_HEADER_FIELD_SENDER header field.


def serial : UInt32 #

Gets the serial for @message.


def serial=(serial : UInt32) : Nil #

Sets the serial for @message.


def set_header(header_field : Gio::DBusMessageHeaderField, value : _?) : Nil #

Sets a header field on @message.

If @value is floating, @message assumes ownership of @value.


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.


def signature=(value : String?) : Nil #

Convenience setter for the %G_DBUS_MESSAGE_HEADER_FIELD_SIGNATURE header field.


def to_blob(capabilities : Gio::DBusCapabilityFlags) : Enumerable(UInt8) #

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


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.


def unix_fd_list : Gio::UnixFDList? #

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


def unix_fd_list=(fd_list : Gio::UnixFDList?) : 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.