gi-gio-2.0.18: Gio bindings

CopyrightWill Thompson Iñaki García Etxebarria and Jonas Platte
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria (garetxe@gmail.com)
Safe HaskellNone
LanguageHaskell2010

GI.Gio.Objects.DBusMessage

Contents

Description

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

Since: 2.26

Synopsis

Exported types

newtype DBusMessage Source #

Memory-managed wrapper type.

class GObject o => IsDBusMessage o Source #

Type class for types which can be safely cast to DBusMessage, for instance with toDBusMessage.

toDBusMessage :: (MonadIO m, IsDBusMessage o) => o -> m DBusMessage Source #

Cast to DBusMessage, for types for which this is known to be safe. For general casts, use castTo.

Methods

bytesNeeded

dBusMessageBytesNeeded Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> ByteString

blob: A blob represent a binary D-Bus message.

-> m Int64

Returns: 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). (Can throw GError)

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

Since: 2.26

copy

dBusMessageCopy Source #

Arguments

:: (HasCallStack, MonadIO m, IsDBusMessage a) 
=> a

message: A DBusMessage.

-> m DBusMessage

Returns: A new DBusMessage or Nothing if error is set. Free with objectUnref. (Can throw GError)

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

Since: 2.26

getArg0

dBusMessageGetArg0 Source #

Arguments

:: (HasCallStack, MonadIO m, IsDBusMessage a) 
=> a

message: A DBusMessage.

-> m Text

Returns: The string item or Nothing if the first item in the body of message is not a string.

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

Since: 2.26

getBody

dBusMessageGetBody Source #

Arguments

:: (HasCallStack, MonadIO m, IsDBusMessage a) 
=> a

message: A DBusMessage.

-> m GVariant

Returns: A GVariant or Nothing if the body is empty. Do not free, it is owned by message.

Gets the body of a message.

Since: 2.26

getByteOrder

dBusMessageGetByteOrder Source #

Arguments

:: (HasCallStack, MonadIO m, IsDBusMessage a) 
=> a

message: A DBusMessage.

-> m DBusMessageByteOrder

Returns: The byte order.

Gets the byte order of message.

getDestination

dBusMessageGetDestination Source #

Arguments

:: (HasCallStack, MonadIO m, IsDBusMessage a) 
=> a

message: A DBusMessage.

-> m Text

Returns: The value.

Convenience getter for the DBusMessageHeaderFieldDestination header field.

Since: 2.26

getErrorName

dBusMessageGetErrorName Source #

Arguments

:: (HasCallStack, MonadIO m, IsDBusMessage a) 
=> a

message: A DBusMessage.

-> m Text

Returns: The value.

Convenience getter for the DBusMessageHeaderFieldErrorName header field.

Since: 2.26

getFlags

dBusMessageGetFlags Source #

Arguments

:: (HasCallStack, MonadIO m, IsDBusMessage a) 
=> a

message: A DBusMessage.

-> m [DBusMessageFlags]

Returns: Flags that are set (typically values from the DBusMessageFlags enumeration bitwise ORed together).

Gets the flags for message.

Since: 2.26

getHeader

dBusMessageGetHeader Source #

Arguments

:: (HasCallStack, MonadIO m, IsDBusMessage a) 
=> a

message: A DBusMessage.

-> DBusMessageHeaderField

headerField: A 8-bit unsigned integer (typically a value from the DBusMessageHeaderField enumeration)

-> m GVariant

Returns: A GVariant with the value if the header was found, Nothing otherwise. Do not free, it is owned by message.

Gets a header field on message.

Since: 2.26

getHeaderFields

dBusMessageGetHeaderFields Source #

Arguments

:: (HasCallStack, MonadIO m, IsDBusMessage a) 
=> a

message: A DBusMessage.

-> m ByteString

Returns: An array of header fields terminated by DBusMessageHeaderFieldInvalid. Each element is a guchar. Free with free.

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

Since: 2.26

getInterface

dBusMessageGetInterface Source #

Arguments

:: (HasCallStack, MonadIO m, IsDBusMessage a) 
=> a

message: A DBusMessage.

-> m Text

Returns: The value.

Convenience getter for the DBusMessageHeaderFieldInterface header field.

Since: 2.26

getLocked

dBusMessageGetLocked Source #

Arguments

:: (HasCallStack, MonadIO m, IsDBusMessage a) 
=> a

message: A DBusMessage.

-> m Bool

Returns: True if message is locked, False otherwise.

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

Since: 2.26

getMember

dBusMessageGetMember Source #

Arguments

:: (HasCallStack, MonadIO m, IsDBusMessage a) 
=> a

message: A DBusMessage.

-> m Text

Returns: The value.

Convenience getter for the DBusMessageHeaderFieldMember header field.

Since: 2.26

getMessageType

dBusMessageGetMessageType Source #

Arguments

:: (HasCallStack, MonadIO m, IsDBusMessage a) 
=> a

message: A DBusMessage.

-> m DBusMessageType

Returns: A 8-bit unsigned integer (typically a value from the DBusMessageType enumeration).

Gets the type of message.

Since: 2.26

getNumUnixFds

dBusMessageGetNumUnixFds Source #

Arguments

:: (HasCallStack, MonadIO m, IsDBusMessage a) 
=> a

message: A DBusMessage.

-> m Word32

Returns: The value.

Convenience getter for the DBusMessageHeaderFieldNumUnixFds header field.

Since: 2.26

getPath

dBusMessageGetPath Source #

Arguments

:: (HasCallStack, MonadIO m, IsDBusMessage a) 
=> a

message: A DBusMessage.

-> m Text

Returns: The value.

Convenience getter for the DBusMessageHeaderFieldPath header field.

Since: 2.26

getReplySerial

dBusMessageGetReplySerial Source #

Arguments

:: (HasCallStack, MonadIO m, IsDBusMessage a) 
=> a

message: A DBusMessage.

-> m Word32

Returns: The value.

Convenience getter for the DBusMessageHeaderFieldReplySerial header field.

Since: 2.26

getSender

dBusMessageGetSender Source #

Arguments

:: (HasCallStack, MonadIO m, IsDBusMessage a) 
=> a

message: A DBusMessage.

-> m Text

Returns: The value.

Convenience getter for the DBusMessageHeaderFieldSender header field.

Since: 2.26

getSerial

dBusMessageGetSerial Source #

Arguments

:: (HasCallStack, MonadIO m, IsDBusMessage a) 
=> a

message: A DBusMessage.

-> m Word32

Returns: A guint32.

Gets the serial for message.

Since: 2.26

getSignature

dBusMessageGetSignature Source #

Arguments

:: (HasCallStack, MonadIO m, IsDBusMessage a) 
=> a

message: A DBusMessage.

-> m Text

Returns: The value.

Convenience getter for the DBusMessageHeaderFieldSignature header field.

Since: 2.26

getUnixFdList

dBusMessageGetUnixFdList Source #

Arguments

:: (HasCallStack, MonadIO m, IsDBusMessage a) 
=> a

message: A DBusMessage.

-> m UnixFDList

Returns: A UnixFDList or Nothing if no file descriptors are associated. Do not free, this object is owned by message.

Gets the UNIX file descriptors associated with message, if any.

This method is only available on UNIX.

Since: 2.26

lock

dBusMessageLock Source #

Arguments

:: (HasCallStack, MonadIO m, IsDBusMessage a) 
=> a

message: A DBusMessage.

-> m () 

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

Since: 2.26

new

dBusMessageNew Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> m DBusMessage

Returns: A DBusMessage. Free with objectUnref.

Creates a new empty DBusMessage.

Since: 2.26

newFromBlob

dBusMessageNewFromBlob Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> ByteString

blob: A blob represent a binary D-Bus message.

-> [DBusCapabilityFlags]

capabilities: A DBusCapabilityFlags describing what protocol features are supported.

-> m DBusMessage

Returns: A new DBusMessage or Nothing if error is set. Free with objectUnref. (Can throw GError)

Creates a new DBusMessage from the data stored at blob. The byte order that the message was in can be retrieved using dBusMessageGetByteOrder.

Since: 2.26

newMethodCall

dBusMessageNewMethodCall Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Maybe Text

name: A valid D-Bus name or Nothing.

-> Text

path: A valid object path.

-> Maybe Text

interface_: A valid D-Bus interface name or Nothing.

-> Text

method: A valid method name.

-> m DBusMessage

Returns: A DBusMessage. Free with objectUnref.

Creates a new DBusMessage for a method call.

Since: 2.26

newMethodErrorLiteral

dBusMessageNewMethodErrorLiteral Source #

Arguments

:: (HasCallStack, MonadIO m, IsDBusMessage a) 
=> a

methodCallMessage: A message of type DBusMessageTypeMethodCall to create a reply message to.

-> Text

errorName: A valid D-Bus error name.

-> Text

errorMessage: The D-Bus error message.

-> m DBusMessage

Returns: A DBusMessage. Free with objectUnref.

Creates a new DBusMessage that is an error reply to methodCallMessage.

Since: 2.26

newMethodReply

dBusMessageNewMethodReply Source #

Arguments

:: (HasCallStack, MonadIO m, IsDBusMessage a) 
=> a

methodCallMessage: A message of type DBusMessageTypeMethodCall to create a reply message to.

-> m DBusMessage

Returns: DBusMessage. Free with objectUnref.

Creates a new DBusMessage that is a reply to methodCallMessage.

Since: 2.26

newSignal

dBusMessageNewSignal Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Text

path: A valid object path.

-> Text

interface_: A valid D-Bus interface name.

-> Text

signal: A valid signal name.

-> m DBusMessage

Returns: A DBusMessage. Free with objectUnref.

Creates a new DBusMessage for a signal emission.

Since: 2.26

print

dBusMessagePrint Source #

Arguments

:: (HasCallStack, MonadIO m, IsDBusMessage a) 
=> a

message: A DBusMessage.

-> Word32

indent: Indentation level.

-> m Text

Returns: A string that should be freed with free.

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

Since: 2.26

setBody

dBusMessageSetBody Source #

Arguments

:: (HasCallStack, MonadIO m, IsDBusMessage a) 
=> a

message: A DBusMessage.

-> GVariant

body: Either Nothing or a GVariant that is a tuple.

-> m () 

Sets the body message. As a side-effect the DBusMessageHeaderFieldSignature header field is set to the type string of body (or cleared if body is Nothing).

If body is floating, message assumes ownership of body.

Since: 2.26

setByteOrder

dBusMessageSetByteOrder Source #

Arguments

:: (HasCallStack, MonadIO m, IsDBusMessage a) 
=> a

message: A DBusMessage.

-> DBusMessageByteOrder

byteOrder: The byte order.

-> m () 

Sets the byte order of message.

setDestination

dBusMessageSetDestination Source #

Arguments

:: (HasCallStack, MonadIO m, IsDBusMessage a) 
=> a

message: A DBusMessage.

-> Text

value: The value to set.

-> m () 

Convenience setter for the DBusMessageHeaderFieldDestination header field.

Since: 2.26

setErrorName

dBusMessageSetErrorName Source #

Arguments

:: (HasCallStack, MonadIO m, IsDBusMessage a) 
=> a

message: A DBusMessage.

-> Text

value: The value to set.

-> m () 

Convenience setter for the DBusMessageHeaderFieldErrorName header field.

Since: 2.26

setFlags

dBusMessageSetFlags Source #

Arguments

:: (HasCallStack, MonadIO m, IsDBusMessage a) 
=> a

message: A DBusMessage.

-> [DBusMessageFlags]

flags: Flags for message that are set (typically values from the DBusMessageFlags enumeration bitwise ORed together).

-> m () 

Sets the flags to set on message.

Since: 2.26

setHeader

dBusMessageSetHeader Source #

Arguments

:: (HasCallStack, MonadIO m, IsDBusMessage a) 
=> a

message: A DBusMessage.

-> DBusMessageHeaderField

headerField: A 8-bit unsigned integer (typically a value from the DBusMessageHeaderField enumeration)

-> Maybe GVariant

value: A GVariant to set the header field or Nothing to clear the header field.

-> m () 

Sets a header field on message.

If value is floating, message assumes ownership of value.

Since: 2.26

setInterface

dBusMessageSetInterface Source #

Arguments

:: (HasCallStack, MonadIO m, IsDBusMessage a) 
=> a

message: A DBusMessage.

-> Text

value: The value to set.

-> m () 

Convenience setter for the DBusMessageHeaderFieldInterface header field.

Since: 2.26

setMember

dBusMessageSetMember Source #

Arguments

:: (HasCallStack, MonadIO m, IsDBusMessage a) 
=> a

message: A DBusMessage.

-> Text

value: The value to set.

-> m () 

Convenience setter for the DBusMessageHeaderFieldMember header field.

Since: 2.26

setMessageType

dBusMessageSetMessageType Source #

Arguments

:: (HasCallStack, MonadIO m, IsDBusMessage a) 
=> a

message: A DBusMessage.

-> DBusMessageType

type: A 8-bit unsigned integer (typically a value from the DBusMessageType enumeration).

-> m () 

Sets message to be of type.

Since: 2.26

setNumUnixFds

dBusMessageSetNumUnixFds Source #

Arguments

:: (HasCallStack, MonadIO m, IsDBusMessage a) 
=> a

message: A DBusMessage.

-> Word32

value: The value to set.

-> m () 

Convenience setter for the DBusMessageHeaderFieldNumUnixFds header field.

Since: 2.26

setPath

dBusMessageSetPath Source #

Arguments

:: (HasCallStack, MonadIO m, IsDBusMessage a) 
=> a

message: A DBusMessage.

-> Text

value: The value to set.

-> m () 

Convenience setter for the DBusMessageHeaderFieldPath header field.

Since: 2.26

setReplySerial

dBusMessageSetReplySerial Source #

Arguments

:: (HasCallStack, MonadIO m, IsDBusMessage a) 
=> a

message: A DBusMessage.

-> Word32

value: The value to set.

-> m () 

Convenience setter for the DBusMessageHeaderFieldReplySerial header field.

Since: 2.26

setSender

dBusMessageSetSender Source #

Arguments

:: (HasCallStack, MonadIO m, IsDBusMessage a) 
=> a

message: A DBusMessage.

-> Text

value: The value to set.

-> m () 

Convenience setter for the DBusMessageHeaderFieldSender header field.

Since: 2.26

setSerial

dBusMessageSetSerial Source #

Arguments

:: (HasCallStack, MonadIO m, IsDBusMessage a) 
=> a

message: A DBusMessage.

-> Word32

serial: A guint32.

-> m () 

Sets the serial for message.

Since: 2.26

setSignature

dBusMessageSetSignature Source #

Arguments

:: (HasCallStack, MonadIO m, IsDBusMessage a) 
=> a

message: A DBusMessage.

-> Text

value: The value to set.

-> m () 

Convenience setter for the DBusMessageHeaderFieldSignature header field.

Since: 2.26

setUnixFdList

dBusMessageSetUnixFdList Source #

Arguments

:: (HasCallStack, MonadIO m, IsDBusMessage a, IsUnixFDList b) 
=> a

message: A DBusMessage.

-> Maybe b

fdList: A UnixFDList or Nothing.

-> m () 

Sets the UNIX file descriptors associated with message. As a side-effect the DBusMessageHeaderFieldNumUnixFds header field is set to the number of fds in fdList (or cleared if fdList is Nothing).

This method is only available on UNIX.

Since: 2.26

toBlob

dBusMessageToBlob Source #

Arguments

:: (HasCallStack, MonadIO m, IsDBusMessage a) 
=> a

message: A DBusMessage.

-> [DBusCapabilityFlags]

capabilities: A DBusCapabilityFlags describing what protocol features are supported.

-> m ByteString

Returns: A pointer to a valid binary D-Bus message of outSize bytes generated by message or Nothing if error is set. Free with free. (Can throw GError)

Serializes message to a blob. The byte order returned by dBusMessageGetByteOrder will be used.

Since: 2.26

toGerror

dBusMessageToGerror Source #

Arguments

:: (HasCallStack, MonadIO m, IsDBusMessage a) 
=> a

message: A DBusMessage.

-> m ()

(Can throw GError)

If message is not of type DBusMessageTypeError 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 DBusMessageHeaderFieldErrorName header field of message as well as the first string item in message's body.

Since: 2.26

Properties

locked

No description available in the introspection data.

getDBusMessageLocked :: (MonadIO m, IsDBusMessage o) => o -> m Bool Source #

Get the value of the “locked” property. When overloading is enabled, this is equivalent to

get dBusMessage #locked