gi-gio-2.0.38: Gio bindings
CopyrightWill Thompson and Iñaki García Etxebarria
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria
Safe HaskellNone
LanguageHaskell2010

GI.Gio.Objects.DBusMessage

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.

Instances

Instances details
Eq DBusMessage Source # 
Instance details

Defined in GI.Gio.Objects.DBusMessage

Methods

(==) :: DBusMessage -> DBusMessage -> Bool

(/=) :: DBusMessage -> DBusMessage -> Bool

GObject DBusMessage Source # 
Instance details

Defined in GI.Gio.Objects.DBusMessage

ManagedPtrNewtype DBusMessage Source # 
Instance details

Defined in GI.Gio.Objects.DBusMessage

TypedObject DBusMessage Source # 
Instance details

Defined in GI.Gio.Objects.DBusMessage

Methods

glibType :: IO GType #

HasParentTypes DBusMessage Source # 
Instance details

Defined in GI.Gio.Objects.DBusMessage

IsGValue (Maybe DBusMessage) Source #

Convert DBusMessage to and from GValue. See toGValue and fromGValue.

Instance details

Defined in GI.Gio.Objects.DBusMessage

Methods

gvalueGType_ :: IO GType #

gvalueSet_ :: Ptr GValue -> Maybe DBusMessage -> IO () #

gvalueGet_ :: Ptr GValue -> IO (Maybe DBusMessage) #

type ParentTypes DBusMessage Source # 
Instance details

Defined in GI.Gio.Objects.DBusMessage

type ParentTypes DBusMessage = '[Object]

class (GObject o, IsDescendantOf DBusMessage o) => IsDBusMessage o Source #

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

Instances

Instances details
(GObject o, IsDescendantOf DBusMessage o) => IsDBusMessage o Source # 
Instance details

Defined in GI.Gio.Objects.DBusMessage

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 representing a binary D-Bus message.

-> m Int32

Returns: Number of bytes needed or -1 if error is set (Can throw GError)

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

An error will be returned if blob contains invalid data, or if not enough data is available to determine the size.

Since: 2.26

copy

dBusMessageCopy Source #

Arguments

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

message: a D-Bus message

-> m DBusMessage

Returns: A new D-Bus message (Can throw GError)

Copies message with a deep copy.

The returned D-Bus message is completely identical to message except that it is guaranteed to not be locked.

This operation can fail if (for example) 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 D-Bus message

-> m (Maybe Text)

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

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

See dBusMessageGetArg0Path for returning object-path-typed arg0 values.

Since: 2.26

getArg0Path

dBusMessageGetArg0Path Source #

Arguments

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

message: a D-Bus message

-> m (Maybe Text)

Returns: The object path item, or NULL if the first item in the body of message is not an object path

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

See dBusMessageGetArg0 for returning string-typed arg0 values.

Since: 2.80

getBody

dBusMessageGetBody Source #

Arguments

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

message: a D-Bus message

-> m (Maybe GVariant)

Returns: A [typegLib.Variant], or NULL if the body is empty

Gets the body of a message.

Since: 2.26

getByteOrder

dBusMessageGetByteOrder Source #

Arguments

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

message: a D-Bus message

-> m DBusMessageByteOrder

Returns: The byte order

Gets the byte order of message.

getDestination

dBusMessageGetDestination Source #

Arguments

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

message: a D-Bus message

-> m (Maybe 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 D-Bus message

-> m (Maybe 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 D-Bus message

-> m [DBusMessageFlags]

Returns: Flags that are set (typically values from the [flagsgio.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 D-Bus message

-> DBusMessageHeaderField

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

-> m (Maybe GVariant)

Returns: A [typegLib.Variant] with the value, or NULL if the header was not found

Gets a header field on message.

The caller is responsible for checking the type of the returned [typegLib.Variant] matches what is expected.

Since: 2.26

getHeaderFields

dBusMessageGetHeaderFields Source #

Arguments

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

message: a D-Bus message

-> m ByteString

Returns: An array of header fields terminated by DBusMessageHeaderFieldInvalid

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

Each element in the array is an unsigned char.

Since: 2.26

getInterface

dBusMessageGetInterface Source #

Arguments

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

message: a D-Bus message

-> m (Maybe 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 D-Bus message

-> m Bool

Returns: true if message is locked, false otherwise

Checks whether message is locked.

To monitor changes to this value, connect 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 D-Bus message

-> m (Maybe 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 D-Bus message

-> 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 D-Bus message

-> 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 D-Bus message

-> m (Maybe 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 D-Bus message

-> 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 D-Bus message

-> m (Maybe 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 D-Bus message

-> m Word32

Returns: The serial number, which should not be zero

Gets the serial for message.

Since: 2.26

getSignature

dBusMessageGetSignature Source #

Arguments

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

message: a D-Bus message

-> m Text

Returns: The value

Convenience getter for the [enumgio.DBusMessageHeaderField.SIGNATURE header field.

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

Since: 2.26

getUnixFdList

dBusMessageGetUnixFdList Source #

Arguments

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

message: a D-Bus message

-> m (Maybe UnixFDList)

Returns: A UnixFDList or NULL if no file descriptors are associated

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

Since: 2.26

lock

dBusMessageLock Source #

Arguments

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

message: a D-Bus message

-> m () 

Locks the message.

If message is locked already, this does nothing.

Since: 2.26

new

dBusMessageNew Source #

Arguments

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

Returns: The D-Bus message

Creates a new empty D-Bus message.

Since: 2.26

newFromBlob

dBusMessageNewFromBlob Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> ByteString

blob: a blob representing a binary D-Bus message

-> [DBusCapabilityFlags]

capabilities: flags describing what protocol features are supported

-> m DBusMessage

Returns: The D-Bus message (Can throw GError)

Creates a new D-Bus message from the data stored at blob.

You must have previously called dBusMessageBytesNeeded on blob, and ensure that blob is at least as long as the return value from that function indicates. In particular, that means that blob must be at least 16 bytes long (but will typically be much longer).

The byte order that the message was in can be retrieved using dBusMessageGetByteOrder.

If the blob cannot be parsed, contains invalid fields, or contains invalid headers, [errorgio.IOErrorEnum.INVALID_ARGUMENT] will be returned.

Since: 2.26

newMethodCall

dBusMessageNewMethodCall Source #

Arguments

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

name: a valid D-Bus name, or NULL if no destination is needed

-> Text

path: a valid object path

-> Maybe Text

interface_: a valid D-Bus interface name, or NULL if none is needed

-> Text

method: a valid method name

-> m DBusMessage

Returns: The D-Bus message

Creates a new D-Bus message 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: The D-Bus message

Creates a new D-Bus message 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: The D-Bus message

Creates a new D-Bus message 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: The D-Bus message

Creates a new D-Bus message for a signal emission.

Since: 2.26

print

dBusMessagePrint Source #

Arguments

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

message: a D-Bus message

-> Word32

indent: indentation level

-> m Text

Returns: Human readable description of message

Produces a human-readable multi-line description of message.

The contents and formatting are subject to change at any time and no ABI guarantees are given. 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 D-Bus message

-> GVariant

body: a [typegLib.Variant] containing a tuple, or NULL if no body is needed

-> m () 

Sets the body of message.

As a side-effect the DBusMessageHeaderFieldSignature 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.

Since: 2.26

setByteOrder

dBusMessageSetByteOrder Source #

Arguments

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

message: a D-Bus message

-> DBusMessageByteOrder

byteOrder: the byte order

-> m () 

Sets the byte order of message.

setDestination

dBusMessageSetDestination Source #

Arguments

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

message: a D-Bus message

-> Maybe 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) 
=> Maybe a

message: a D-Bus message

-> Maybe 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 D-Bus message

-> [DBusMessageFlags]

flags: flags for message that are set (typically values from the [flagsgio.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 D-Bus message

-> DBusMessageHeaderField

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

-> Maybe GVariant

value: a [typegLib.Variant] to set the header field, or NULL 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 D-Bus message

-> Maybe 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 D-Bus message

-> Maybe 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 D-Bus message

-> 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 D-Bus message

-> 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 D-Bus message

-> Maybe 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 D-Bus message

-> 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 D-Bus message

-> Maybe 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 D-Bus message

-> Word32

serial: a serial number, which must not be zero

-> m () 

Sets the serial for message.

The D-Bus specification does not allow the serial to be zero.

Since: 2.26

setSignature

dBusMessageSetSignature Source #

Arguments

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

message: a D-Bus message

-> Maybe 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 D-Bus message

-> Maybe b

fdList: A UnixFDList, or NULL to clear

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

Since: 2.26

toGerror

dBusMessageToGerror Source #

Arguments

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

message: a D-Bus message

-> m ()

(Can throw GError)

Encodes the error in message as a [typegLib.Error].

If message is of type DBusMessageTypeError, this function calls DBusError.set_dbus_error() using the information in the DBusMessageHeaderFieldErrorName header field of message as well as the first string item in message’s body.

If message is not of type DBusMessageTypeError, this function does nothing and returns false.

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