class Gio::DBusMessage
- Gio::DBusMessage
- GObject::Object
- Reference
- Object
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.crConstructors
-
.new : self
Creates a new empty #GDBusMessage.
- .new(*, locked : Bool | Nil = nil)
-
.new_from_blob(blob : Bytes, capabilities : Gio::DBusCapabilityFlags) : self
Creates a new #GDBusMessage from the data stored at blob.
-
.new_method_call(name : String | Nil, path : String, interface_ : String | Nil, method : String) : self
Creates a new #GDBusMessage for a method call.
-
.new_signal(path : String, interface_ : String, signal : String) : self
Creates a new #GDBusMessage for a signal emission.
Class Method Summary
-
.g_type : UInt64
Returns the type id (GType) registered in GLib type system.
Instance Method Summary
-
#==(other : self)
Returns
true
if this reference is the same as other. -
#arg0 : String | Nil
Convenience to get the first item in the body of message.
-
#body : GLib::Variant | Nil
Gets the body of a message.
-
#body=(body : _) : Nil
Sets the body message.
-
#byte_order : Gio::DBusMessageByteOrder
Gets the byte order of message.
-
#byte_order=(byte_order : Gio::DBusMessageByteOrder) : Nil
Sets the byte order of message.
- #bytes_needed(blob : Bytes) : Int64
- #bytes_needed(*blob : UInt8)
-
#copy : Gio::DBusMessage
Copies message.
-
#destination : String | Nil
Convenience getter for the %G_DBUS_MESSAGE_HEADER_FIELD_DESTINATION header field.
-
#destination=(value : String | Nil) : Nil
Convenience setter for the %G_DBUS_MESSAGE_HEADER_FIELD_DESTINATION header field.
-
#error_name : String | Nil
Convenience getter for the %G_DBUS_MESSAGE_HEADER_FIELD_ERROR_NAME header field.
-
#error_name=(value : String) : Nil
Convenience setter for the %G_DBUS_MESSAGE_HEADER_FIELD_ERROR_NAME header field.
-
#flags : Gio::DBusMessageFlags
Gets the flags for message.
-
#flags=(flags : Gio::DBusMessageFlags) : Nil
Sets the flags to set on message.
-
#hash(hasher)
See
Object#hash(hasher)
-
#header(header_field : Gio::DBusMessageHeaderField) : GLib::Variant | Nil
Gets a header field on message.
-
#header_fields : Bytes
Gets an array of all header fields on message that are set.
-
#interface : String | Nil
Convenience getter for the %G_DBUS_MESSAGE_HEADER_FIELD_INTERFACE header field.
-
#interface=(value : String | Nil) : Nil
Convenience setter for the %G_DBUS_MESSAGE_HEADER_FIELD_INTERFACE header field.
-
#lock : Nil
If message is locked, does nothing.
-
#locked : Bool
Checks whether message is locked.
- #locked? : Bool
-
#member : String | Nil
Convenience getter for the %G_DBUS_MESSAGE_HEADER_FIELD_MEMBER header field.
-
#member=(value : String | Nil) : Nil
Convenience setter for the %G_DBUS_MESSAGE_HEADER_FIELD_MEMBER header field.
-
#message_type : Gio::DBusMessageType
Gets the type of message.
-
#message_type=(type : Gio::DBusMessageType) : Nil
Sets message to be of type.
-
#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.
-
#new_method_reply : Gio::DBusMessage
Creates a new #GDBusMessage that is a reply to method_call_message.
-
#num_unix_fds : UInt32
Convenience getter for the %G_DBUS_MESSAGE_HEADER_FIELD_NUM_UNIX_FDS header field.
-
#num_unix_fds=(value : UInt32) : Nil
Convenience setter for the %G_DBUS_MESSAGE_HEADER_FIELD_NUM_UNIX_FDS header field.
-
#path : String | Nil
Convenience getter for the %G_DBUS_MESSAGE_HEADER_FIELD_PATH header field.
-
#path=(value : String | Nil) : Nil
Convenience setter for the %G_DBUS_MESSAGE_HEADER_FIELD_PATH header field.
-
#print(indent : UInt32) : String
Produces a human-readable multi-line description of message.
-
#reply_serial : UInt32
Convenience getter for the %G_DBUS_MESSAGE_HEADER_FIELD_REPLY_SERIAL header field.
-
#reply_serial=(value : UInt32) : Nil
Convenience setter for the %G_DBUS_MESSAGE_HEADER_FIELD_REPLY_SERIAL header field.
-
#sender : String | Nil
Convenience getter for the %G_DBUS_MESSAGE_HEADER_FIELD_SENDER header field.
-
#sender=(value : String | Nil) : Nil
Convenience setter for the %G_DBUS_MESSAGE_HEADER_FIELD_SENDER header field.
-
#serial : UInt32
Gets the serial for message.
-
#serial=(serial : UInt32) : Nil
Sets the serial for message.
-
#set_header(header_field : Gio::DBusMessageHeaderField, value : _ | Nil) : Nil
Sets a header field on message.
-
#signature : String
Convenience getter for the %G_DBUS_MESSAGE_HEADER_FIELD_SIGNATURE header field.
-
#signature=(value : String | Nil) : Nil
Convenience setter for the %G_DBUS_MESSAGE_HEADER_FIELD_SIGNATURE header field.
-
#to_blob(capabilities : Gio::DBusCapabilityFlags) : Bytes
Serializes message to a blob.
-
#to_gerror : Bool
If message is not of type %G_DBUS_MESSAGE_TYPE_ERROR does nothing and returns
false
. -
#unix_fd_list : Gio::UnixFDList | Nil
Gets the UNIX file descriptors associated with message, if any.
-
#unix_fd_list=(fd_list : Gio::UnixFDList | Nil) : Nil
Sets the UNIX file descriptors associated with message.
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
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.
Creates a new #GDBusMessage for a method call.
Creates a new #GDBusMessage for a signal emission.
Class Method Detail
Returns the type id (GType) registered in GLib type system.
Instance Method Detail
Returns true
if this reference is the same as other. Invokes same?
.
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.
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.
Convenience getter for the %G_DBUS_MESSAGE_HEADER_FIELD_DESTINATION header field.
Convenience setter for the %G_DBUS_MESSAGE_HEADER_FIELD_DESTINATION header field.
Convenience getter for the %G_DBUS_MESSAGE_HEADER_FIELD_ERROR_NAME header field.
Convenience setter for the %G_DBUS_MESSAGE_HEADER_FIELD_ERROR_NAME header field.
Gets a header field on message.
The caller is responsible for checking the type of the returned #GVariant matches what is expected.
Convenience getter for the %G_DBUS_MESSAGE_HEADER_FIELD_INTERFACE header field.
Convenience setter for the %G_DBUS_MESSAGE_HEADER_FIELD_INTERFACE header field.
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.
Convenience getter for the %G_DBUS_MESSAGE_HEADER_FIELD_MEMBER header field.
Convenience setter for the %G_DBUS_MESSAGE_HEADER_FIELD_MEMBER header field.
Creates a new #GDBusMessage that is an error reply to method_call_message.
Creates a new #GDBusMessage that is a reply to method_call_message.
Convenience getter for the %G_DBUS_MESSAGE_HEADER_FIELD_NUM_UNIX_FDS header field.
Convenience setter for the %G_DBUS_MESSAGE_HEADER_FIELD_NUM_UNIX_FDS header field.
Convenience getter for the %G_DBUS_MESSAGE_HEADER_FIELD_PATH header field.
Convenience setter for the %G_DBUS_MESSAGE_HEADER_FIELD_PATH header field.
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 ]|
Convenience getter for the %G_DBUS_MESSAGE_HEADER_FIELD_REPLY_SERIAL header field.
Convenience setter for the %G_DBUS_MESSAGE_HEADER_FIELD_REPLY_SERIAL header field.
Convenience getter for the %G_DBUS_MESSAGE_HEADER_FIELD_SENDER header field.
Convenience setter for the %G_DBUS_MESSAGE_HEADER_FIELD_SENDER header field.
Sets a header field on message.
If value is floating, message assumes ownership of value.
Convenience getter for the %G_DBUS_MESSAGE_HEADER_FIELD_SIGNATURE header field.
This will always be non-nil
, but may be an empty string.
Convenience setter for the %G_DBUS_MESSAGE_HEADER_FIELD_SIGNATURE header field.
Serializes message to a blob. The byte order returned by g_dbus_message_get_byte_order() will be used.
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.
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, ...)
.
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.