Package ch.bailu.gtk.gio
Class DBusMessage
java.lang.Object
ch.bailu.gtk.type.Type
ch.bailu.gtk.type.Pointer
ch.bailu.gtk.gobject.Object
ch.bailu.gtk.gio.DBusMessage
- All Implemented Interfaces:
PointerInterface
A type for representing D-Bus messages that can be sent or received
on a #GDBusConnection.
on a #GDBusConnection.
-
Nested Class Summary
Nested classes/interfaces inherited from class ch.bailu.gtk.gobject.Object
Object.OnBindingTransformFunc, Object.OnDestroyNotify, Object.OnDuplicateFunc, Object.OnNotify, Object.OnToggleNotify, Object.OnWeakNotify -
Field Summary
Fields inherited from class ch.bailu.gtk.gobject.Object
SIGNAL_ON_NOTIFY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncopy()Copies @message.getArg0()Convenience to get the first item in the body of @message.getBody()Gets the body of a message.intGets the byte order of @message.static ClassHandlerConvenience getter for the %G_DBUS_MESSAGE_HEADER_FIELD_DESTINATION header field.Convenience getter for the %G_DBUS_MESSAGE_HEADER_FIELD_ERROR_NAME header field.intgetFlags()Gets the flags for @message.getHeader(int header_field) Gets a header field on @message.static intConvenience getter for the %G_DBUS_MESSAGE_HEADER_FIELD_INTERFACE header field.booleanChecks whether @message is locked.Convenience getter for the %G_DBUS_MESSAGE_HEADER_FIELD_MEMBER header field.intGets the type of @message.intConvenience getter for the %G_DBUS_MESSAGE_HEADER_FIELD_NUM_UNIX_FDS header field.static longstatic TypeSystem.TypeSizegetPath()Convenience getter for the %G_DBUS_MESSAGE_HEADER_FIELD_PATH header field.intConvenience getter for the %G_DBUS_MESSAGE_HEADER_FIELD_REPLY_SERIAL header field.Convenience getter for the %G_DBUS_MESSAGE_HEADER_FIELD_SENDER header field.intGets the serial for @message.Convenience getter for the %G_DBUS_MESSAGE_HEADER_FIELD_SIGNATURE header field.static longstatic TypeSystem.TypeSizeGets the UNIX file descriptors associated with @message, if any.voidlock()If @message is locked, does nothing.static DBusMessagenewMethodCallDBusMessage(Str name, Str path, Str interface_, Str method) Creates a new #GDBusMessage for a method call.static DBusMessagenewMethodCallDBusMessage(String name, String path, String interface_, String method) Creates a new #GDBusMessage for a method call.newMethodError(Str error_name, Str error_message_format, Object... _elipse) Creates a new #GDBusMessage that is an error reply to @method_call_message.newMethodError(String error_name, String error_message_format, Object... _elipse) Creates a new #GDBusMessage that is an error reply to @method_call_message.newMethodErrorLiteral(Str error_name, Str error_message) Creates a new #GDBusMessage that is an error reply to @method_call_message.newMethodErrorLiteral(String error_name, String error_message) 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.static DBusMessagenewSignalDBusMessage(Str path, Str interface_, Str signal) Creates a new #GDBusMessage for a signal emission.static DBusMessagenewSignalDBusMessage(String path, String interface_, String signal) Creates a new #GDBusMessage for a signal emission.print(int indent) Produces a human-readable multi-line description of @message.voidSets the body @message.voidsetByteOrder(int byte_order) Sets the byte order of @message.voidsetDestination(Str value) Convenience setter for the %G_DBUS_MESSAGE_HEADER_FIELD_DESTINATION header field.voidsetDestination(String value) Convenience setter for the %G_DBUS_MESSAGE_HEADER_FIELD_DESTINATION header field.voidsetErrorName(Str value) Convenience setter for the %G_DBUS_MESSAGE_HEADER_FIELD_ERROR_NAME header field.voidsetErrorName(String value) Convenience setter for the %G_DBUS_MESSAGE_HEADER_FIELD_ERROR_NAME header field.voidsetFlags(int flags) Sets the flags to set on @message.voidSets a header field on @message.voidsetInterface(Str value) Convenience setter for the %G_DBUS_MESSAGE_HEADER_FIELD_INTERFACE header field.voidsetInterface(String value) Convenience setter for the %G_DBUS_MESSAGE_HEADER_FIELD_INTERFACE header field.voidConvenience setter for the %G_DBUS_MESSAGE_HEADER_FIELD_MEMBER header field.voidConvenience setter for the %G_DBUS_MESSAGE_HEADER_FIELD_MEMBER header field.voidsetMessageType(int type) Sets @message to be of @type.voidsetNumUnixFds(int value) Convenience setter for the %G_DBUS_MESSAGE_HEADER_FIELD_NUM_UNIX_FDS header field.voidConvenience setter for the %G_DBUS_MESSAGE_HEADER_FIELD_PATH header field.voidConvenience setter for the %G_DBUS_MESSAGE_HEADER_FIELD_PATH header field.voidsetReplySerial(int value) Convenience setter for the %G_DBUS_MESSAGE_HEADER_FIELD_REPLY_SERIAL header field.voidConvenience setter for the %G_DBUS_MESSAGE_HEADER_FIELD_SENDER header field.voidConvenience setter for the %G_DBUS_MESSAGE_HEADER_FIELD_SENDER header field.voidsetSerial(int serial) Sets the serial for @message.voidsetSignature(Str value) Convenience setter for the %G_DBUS_MESSAGE_HEADER_FIELD_SIGNATURE header field.voidsetSignature(String value) Convenience setter for the %G_DBUS_MESSAGE_HEADER_FIELD_SIGNATURE header field.voidsetUnixFdList(UnixFDList fd_list) Sets the UNIX file descriptors associated with @message.booleantoGerror()If @message is not of type %G_DBUS_MESSAGE_TYPE_ERROR does
nothing and returns %FALSE.Methods inherited from class ch.bailu.gtk.gobject.Object
addToggleRef, bindProperty, bindProperty, bindPropertyFull, bindPropertyFull, bindPropertyWithClosures, bindPropertyWithClosures, compatControl, connect, connect, disconnect, disconnect, dupData, dupData, dupQdata, forceFloating, freezeNotify, get, get, getData, getData, getProperty, getProperty, getQdata, interfaceFindProperty, interfaceInstallProperty, isFloating, notify, notify, notifyByPspec, onNotify, ref, refSink, removeToggleRef, replaceData, replaceData, replaceQdata, runDispose, set, set, setData, setData, setDataFull, setDataFull, setProperty, setProperty, setQdata, setQdataFull, stealData, stealData, stealQdata, takeRef, thawNotify, unref, watchClosure, weakRef, weakUnrefMethods inherited from class ch.bailu.gtk.type.Pointer
asCPointer, cast, connectSignal, disconnectSignals, disconnectSignals, equals, hashCode, throwIfNull, throwNullPointerException, toString, unregisterCallbacks, unregisterCallbacksMethods inherited from class ch.bailu.gtk.type.Type
asCPointer, asCPointer, asCPointerNotNull, asJnaPointer, asJnaPointer, asPointer, asPointer, cast, cast, throwIfNullMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface ch.bailu.gtk.type.PointerInterface
asCPointerNotNull, asJnaPointer, asPointer, isNotNull, isNull
-
Constructor Details
-
DBusMessage
-
DBusMessage
public DBusMessage()Creates a new empty #GDBusMessage.
-
-
Method Details
-
getClassHandler
-
newMethodCallDBusMessage
public static DBusMessage newMethodCallDBusMessage(@Nullable Str name, @Nonnull Str path, @Nullable Str interface_, @Nonnull Str method) Creates a new #GDBusMessage for a method call.- Parameters:
name- A valid D-Bus name or %NULL.path- A valid object path.interface_- A valid D-Bus interface name or %NULL.method- A valid method name.- Returns:
- A #GDBusMessage. Free with g_object_unref().
-
newMethodCallDBusMessage
public static DBusMessage newMethodCallDBusMessage(String name, String path, String interface_, String method) Creates a new #GDBusMessage for a method call.- Parameters:
name- A valid D-Bus name or %NULL.path- A valid object path.interface_- A valid D-Bus interface name or %NULL.method- A valid method name.- Returns:
- A #GDBusMessage. Free with g_object_unref().
-
newSignalDBusMessage
public static DBusMessage newSignalDBusMessage(@Nonnull Str path, @Nonnull Str interface_, @Nonnull Str signal) Creates a new #GDBusMessage for a signal emission.- Parameters:
path- A valid object path.interface_- A valid D-Bus interface name.signal- A valid signal name.- Returns:
- A #GDBusMessage. Free with g_object_unref().
-
newSignalDBusMessage
Creates a new #GDBusMessage for a signal emission.- Parameters:
path- A valid object path.interface_- A valid D-Bus interface name.signal- A valid signal name.- Returns:
- A #GDBusMessage. Free with g_object_unref().
-
copy
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.- Returns:
- A new #GDBusMessage or %NULL if @error is set. Free with g_object_unref().
- Throws:
AllocationError
-
getArg0
Convenience to get the first item in the body of @message.- Returns:
- The string item or %NULL if the first item in the body of @message is not a string.
-
getBody
Gets the body of a message.- Returns:
- A #GVariant or %NULL if the body is empty. Do not free, it is owned by @message.
-
getByteOrder
public int getByteOrder()Gets the byte order of @message.- Returns:
- The byte order.
-
getDestination
Convenience getter for the %G_DBUS_MESSAGE_HEADER_FIELD_DESTINATION header field.- Returns:
- The value.
-
getErrorName
Convenience getter for the %G_DBUS_MESSAGE_HEADER_FIELD_ERROR_NAME header field.- Returns:
- The value.
-
getFlags
public int getFlags()Gets the flags for @message.- Returns:
- Flags that are set (typically values from the #GDBusMessageFlags enumeration bitwise ORed together).
-
getHeader
Gets a header field on @message.
The caller is responsible for checking the type of the returned #GVariant
matches what is expected.- Parameters:
header_field- A 8-bit unsigned integer (typically a value from the #GDBusMessageHeaderField enumeration)- Returns:
- A #GVariant with the value if the header was found, %NULL otherwise. Do not free, it is owned by @message.
-
getInterface
Convenience getter for the %G_DBUS_MESSAGE_HEADER_FIELD_INTERFACE header field.- Returns:
- The value.
-
getLocked
public boolean getLocked()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.- Returns:
- %TRUE if @message is locked, %FALSE otherwise.
-
getMember
Convenience getter for the %G_DBUS_MESSAGE_HEADER_FIELD_MEMBER header field.- Returns:
- The value.
-
getMessageType
public int getMessageType()Gets the type of @message.- Returns:
- A 8-bit unsigned integer (typically a value from the #GDBusMessageType enumeration).
-
getNumUnixFds
public int getNumUnixFds()Convenience getter for the %G_DBUS_MESSAGE_HEADER_FIELD_NUM_UNIX_FDS header field.- Returns:
- The value.
-
getPath
Convenience getter for the %G_DBUS_MESSAGE_HEADER_FIELD_PATH header field.- Returns:
- The value.
-
getReplySerial
public int getReplySerial()Convenience getter for the %G_DBUS_MESSAGE_HEADER_FIELD_REPLY_SERIAL header field.- Returns:
- The value.
-
getSender
Convenience getter for the %G_DBUS_MESSAGE_HEADER_FIELD_SENDER header field.- Returns:
- The value.
-
getSerial
public int getSerial()Gets the serial for @message.- Returns:
- A #guint32.
-
getSignature
Convenience getter for the %G_DBUS_MESSAGE_HEADER_FIELD_SIGNATURE header field.
This will always be non-%NULL, but may be an empty string.- Returns:
- The value.
-
getUnixFdList
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, ...)`.- Returns:
- A #GUnixFDList or %NULL if no file descriptors are associated. Do not free, this object is owned by @message.
-
lock
public void lock()If @message is locked, does nothing. Otherwise locks the message. -
newMethodError
public DBusMessage newMethodError(@Nonnull Str error_name, @Nonnull Str error_message_format, Object... _elipse) Creates a new #GDBusMessage that is an error reply to @method_call_message.- Parameters:
error_name- A valid D-Bus error name.error_message_format- The D-Bus error message in a printf() format._elipse- Arguments for @error_message_format.- Returns:
- A #GDBusMessage. Free with g_object_unref().
-
newMethodError
public DBusMessage newMethodError(String error_name, String error_message_format, Object... _elipse) Creates a new #GDBusMessage that is an error reply to @method_call_message.- Parameters:
error_name- A valid D-Bus error name.error_message_format- The D-Bus error message in a printf() format._elipse- Arguments for @error_message_format.- Returns:
- A #GDBusMessage. Free with g_object_unref().
-
newMethodErrorLiteral
Creates a new #GDBusMessage that is an error reply to @method_call_message.- Parameters:
error_name- A valid D-Bus error name.error_message- The D-Bus error message.- Returns:
- A #GDBusMessage. Free with g_object_unref().
-
newMethodErrorLiteral
Creates a new #GDBusMessage that is an error reply to @method_call_message.- Parameters:
error_name- A valid D-Bus error name.error_message- The D-Bus error message.- Returns:
- A #GDBusMessage. Free with g_object_unref().
-
newMethodReply
Creates a new #GDBusMessage that is a reply to @method_call_message.- Returns:
- #GDBusMessage. Free with g_object_unref().
-
print
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)
orFlags: 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- Indentation level.- Returns:
- A string that should be freed with g_free().
-
setBody
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 %NULL).
If @body is floating, @message assumes ownership of @body.- Parameters:
body- Either %NULL or a #GVariant that is a tuple.
-
setByteOrder
public void setByteOrder(int byte_order) Sets the byte order of @message.- Parameters:
byte_order- The byte order.
-
setDestination
Convenience setter for the %G_DBUS_MESSAGE_HEADER_FIELD_DESTINATION header field.- Parameters:
value- The value to set.
-
setDestination
Convenience setter for the %G_DBUS_MESSAGE_HEADER_FIELD_DESTINATION header field.- Parameters:
value- The value to set.
-
setErrorName
Convenience setter for the %G_DBUS_MESSAGE_HEADER_FIELD_ERROR_NAME header field.- Parameters:
value- The value to set.
-
setErrorName
Convenience setter for the %G_DBUS_MESSAGE_HEADER_FIELD_ERROR_NAME header field.- Parameters:
value- The value to set.
-
setFlags
public void setFlags(int flags) Sets the flags to set on @message.- Parameters:
flags- Flags for @message that are set (typically values from the #GDBusMessageFlags enumeration bitwise ORed together).
-
setHeader
Sets a header field on @message.
If @value is floating, @message assumes ownership of @value.- Parameters:
header_field- A 8-bit unsigned integer (typically a value from the #GDBusMessageHeaderField enumeration)value- A #GVariant to set the header field or %NULL to clear the header field.
-
setInterface
Convenience setter for the %G_DBUS_MESSAGE_HEADER_FIELD_INTERFACE header field.- Parameters:
value- The value to set.
-
setInterface
Convenience setter for the %G_DBUS_MESSAGE_HEADER_FIELD_INTERFACE header field.- Parameters:
value- The value to set.
-
setMember
Convenience setter for the %G_DBUS_MESSAGE_HEADER_FIELD_MEMBER header field.- Parameters:
value- The value to set.
-
setMember
Convenience setter for the %G_DBUS_MESSAGE_HEADER_FIELD_MEMBER header field.- Parameters:
value- The value to set.
-
setMessageType
public void setMessageType(int type) Sets @message to be of @type.- Parameters:
type- A 8-bit unsigned integer (typically a value from the #GDBusMessageType enumeration).
-
setNumUnixFds
public void setNumUnixFds(int value) Convenience setter for the %G_DBUS_MESSAGE_HEADER_FIELD_NUM_UNIX_FDS header field.- Parameters:
value- The value to set.
-
setPath
Convenience setter for the %G_DBUS_MESSAGE_HEADER_FIELD_PATH header field.- Parameters:
value- The value to set.
-
setPath
Convenience setter for the %G_DBUS_MESSAGE_HEADER_FIELD_PATH header field.- Parameters:
value- The value to set.
-
setReplySerial
public void setReplySerial(int value) Convenience setter for the %G_DBUS_MESSAGE_HEADER_FIELD_REPLY_SERIAL header field.- Parameters:
value- The value to set.
-
setSender
Convenience setter for the %G_DBUS_MESSAGE_HEADER_FIELD_SENDER header field.- Parameters:
value- The value to set.
-
setSender
Convenience setter for the %G_DBUS_MESSAGE_HEADER_FIELD_SENDER header field.- Parameters:
value- The value to set.
-
setSerial
public void setSerial(int serial) Sets the serial for @message.- Parameters:
serial- A #guint32.
-
setSignature
Convenience setter for the %G_DBUS_MESSAGE_HEADER_FIELD_SIGNATURE header field.- Parameters:
value- The value to set.
-
setSignature
Convenience setter for the %G_DBUS_MESSAGE_HEADER_FIELD_SIGNATURE header field.- Parameters:
value- The value to set.
-
setUnixFdList
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 %NULL).
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.- Parameters:
fd_list- A #GUnixFDList or %NULL.
-
toGerror
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:
- %TRUE if @error was set, %FALSE otherwise.
- Throws:
AllocationError
-
getTypeID
public static long getTypeID() -
getParentTypeID
public static long getParentTypeID() -
getTypeSize
-
getParentTypeSize
-
getInstanceSize
public static int getInstanceSize()
-