dbus-1.4.1: A client library for the D-Bus IPC system.

Safe Haskell | None
Language | Haskell2010

DBus.Internal.Message

Synopsis

- class Message a where
  - messageTypeCode :: a -> Word8
  - messageHeaderFields :: a -> [HeaderField]
  - messageBody :: a -> [Variant]
  - messageFlags :: a -> Word8
- data UnknownMessage = UnknownMessage {
  - unknownMessageType :: Word8
  - unknownMessageSender :: Maybe BusName
  - unknownMessageBody :: [Variant]
  }
- data MethodCall = MethodCall {
  - methodCallPath :: ObjectPath
  - methodCallInterface :: Maybe InterfaceName
  - methodCallMember :: MemberName
  - methodCallSender :: Maybe BusName
  - methodCallDestination :: Maybe BusName
  - methodCallReplyExpected :: Bool
  - methodCallAutoStart :: Bool
  - methodCallBody :: [Variant]
  }
- data MethodReturn = MethodReturn {
  - methodReturnSerial :: Serial
  - methodReturnSender :: Maybe BusName
  - methodReturnDestination :: Maybe BusName
  - methodReturnBody :: [Variant]
  }
- data MethodError = MethodError {
  - methodErrorName :: ErrorName
  - methodErrorSerial :: Serial
  - methodErrorSender :: Maybe BusName
  - methodErrorDestination :: Maybe BusName
  - methodErrorBody :: [Variant]
  }
- methodErrorMessage :: MethodError -> String
- data Signal = Signal {
  - signalPath :: ObjectPath
  - signalInterface :: InterfaceName
  - signalMember :: MemberName
  - signalSender :: Maybe BusName
  - signalDestination :: Maybe BusName
  - signalBody :: [Variant]
  }
- data ReceivedMessage
  - = ReceivedMethodCall Serial MethodCall
  - | ReceivedMethodReturn Serial MethodReturn
  - | ReceivedMethodError Serial MethodError
  - | ReceivedSignal Serial Signal
  - | ReceivedUnknown Serial UnknownMessage
- data HeaderField
  - = HeaderPath ObjectPath
  - | HeaderInterface InterfaceName
  - | HeaderMember MemberName
  - | HeaderErrorName ErrorName
  - | HeaderReplySerial Serial
  - | HeaderDestination BusName
  - | HeaderSender BusName
  - | HeaderSignature Signature
  - | HeaderUnixFds Word32
- setMethodCallFlags :: MethodCall -> Word8 -> MethodCall

# Documentation

class Message a where Source #

Minimal complete definition

messageTypeCode, messageHeaderFields, messageBody

Methods

messageTypeCode :: a -> Word8 Source #

messageHeaderFields :: a -> [HeaderField] Source #

messageBody :: a -> [Variant] Source #

messageFlags :: a -> Word8 Source #

#### Instances

Instances details

Message MethodCall Source # |
Instance details Defined in DBus.Internal.Message Methods messageTypeCode :: MethodCall -> Word8 Source # messageHeaderFields :: MethodCall -> [HeaderField] Source # messageBody :: MethodCall -> [Variant] Source # messageFlags :: MethodCall -> Word8 Source #
Message MethodError Source # |
Instance details Defined in DBus.Internal.Message Methods messageTypeCode :: MethodError -> Word8 Source # messageHeaderFields :: MethodError -> [HeaderField] Source # messageBody :: MethodError -> [Variant] Source # messageFlags :: MethodError -> Word8 Source #
Message MethodReturn Source # |
Instance details Defined in DBus.Internal.Message Methods messageTypeCode :: MethodReturn -> Word8 Source # messageHeaderFields :: MethodReturn -> [HeaderField] Source # messageBody :: MethodReturn -> [Variant] Source # messageFlags :: MethodReturn -> Word8 Source #
Message Signal Source # |
Instance details Defined in DBus.Internal.Message Methods messageTypeCode :: Signal -> Word8 Source # messageHeaderFields :: Signal -> [HeaderField] Source # messageBody :: Signal -> [Variant] Source # messageFlags :: Signal -> Word8 Source #

data UnknownMessage Source #

Constructors

UnknownMessage |

Fields

- unknownMessageType :: Word8
- unknownMessageSender :: Maybe BusName
- unknownMessageBody :: [Variant]

#### Instances

Instances details

Show UnknownMessage Source # |
Instance details Defined in DBus.Internal.Message Methods showsPrec :: Int -> UnknownMessage -> ShowS Source # show :: UnknownMessage -> String Source # showList :: [UnknownMessage] -> ShowS Source #
Eq UnknownMessage Source # |
Instance details Defined in DBus.Internal.Message Methods (==) :: UnknownMessage -> UnknownMessage -> Bool Source # (/=) :: UnknownMessage -> UnknownMessage -> Bool Source #

data MethodCall Source #

A method call is a request to run some procedure exported by the remote process. Procedures are identified by an (object_path, interface_name, method_name) tuple.

Constructors

MethodCall |

Fields

- methodCallPath :: ObjectPath

  The object path of the method call. Conceptually, object paths act like a procedural language's pointers. Each object referenced by a path is a collection of procedures.

- methodCallInterface :: Maybe InterfaceName

  The interface of the method call. Each object may implement any number of interfaces. Each method is part of at least one interface.

  In certain cases, this may be `Nothing`, but most users should set it to a value.

- methodCallMember :: MemberName

  The method name of the method call. Method names are unique within an interface, but might not be unique within an object.

- methodCallSender :: Maybe BusName

  The name of the application that sent this call.

  Most users will just leave this empty, because the bus overwrites the sender for security reasons. Setting the sender manually is used for peer-peer connections.

  Defaults to `Nothing`.

- methodCallDestination :: Maybe BusName

  The name of the application to send the call to.

  Most users should set this. If a message with no destination is sent to the bus, the bus will behave as if the destination was set to `org.freedesktop.DBus`. For peer-peer connections, the destination can be empty because there is only one peer.

  Defaults to `Nothing`.

- methodCallReplyExpected :: Bool

  Set whether a reply is expected. This can save network and cpu resources by inhibiting unnecessary replies.

  Defaults to `True`.

- methodCallAutoStart :: Bool

  Set whether the bus should auto-start the remote

  Defaults to `True`.

- methodCallBody :: [Variant]

  The arguments to the method call. See `toVariant`.

  Defaults to `[]`.

#### Instances

Instances details

Message MethodCall Source # |
Instance details Defined in DBus.Internal.Message Methods messageTypeCode :: MethodCall -> Word8 Source # messageHeaderFields :: MethodCall -> [HeaderField] Source # messageBody :: MethodCall -> [Variant] Source # messageFlags :: MethodCall -> Word8 Source #
Show MethodCall Source # |
Instance details Defined in DBus.Internal.Message Methods showsPrec :: Int -> MethodCall -> ShowS Source # show :: MethodCall -> String Source # showList :: [MethodCall] -> ShowS Source #
Eq MethodCall Source # |
Instance details Defined in DBus.Internal.Message Methods (==) :: MethodCall -> MethodCall -> Bool Source # (/=) :: MethodCall -> MethodCall -> Bool Source #

data MethodReturn Source #

A method return is a reply to a method call, indicating that the call succeeded.

Constructors

MethodReturn |

Fields

- methodReturnSerial :: Serial

  The serial of the original method call. This lets the original caller match up this reply to the pending call.

- methodReturnSender :: Maybe BusName

  The name of the application that is returning from a call.

  Most users will just leave this empty, because the bus overwrites the sender for security reasons. Setting the sender manually is used for peer-peer connections.

  Defaults to `Nothing`.

- methodReturnDestination :: Maybe BusName

  The name of the application that initiated the call.

  Most users should set this. If a message with no destination is sent to the bus, the bus will behave as if the destination was set to `org.freedesktop.DBus`. For peer-peer connections, the destination can be empty because there is only one peer.

  Defaults to `Nothing`.

- methodReturnBody :: [Variant]

  Values returned from the method call. See `toVariant`.

  Defaults to `[]`.

#### Instances

Instances details

Message MethodReturn Source # |
Instance details Defined in DBus.Internal.Message Methods messageTypeCode :: MethodReturn -> Word8 Source # messageHeaderFields :: MethodReturn -> [HeaderField] Source # messageBody :: MethodReturn -> [Variant] Source # messageFlags :: MethodReturn -> Word8 Source #
Show MethodReturn Source # |
Instance details Defined in DBus.Internal.Message Methods showsPrec :: Int -> MethodReturn -> ShowS Source # show :: MethodReturn -> String Source # showList :: [MethodReturn] -> ShowS Source #
Eq MethodReturn Source # |
Instance details Defined in DBus.Internal.Message Methods (==) :: MethodReturn -> MethodReturn -> Bool Source # (/=) :: MethodReturn -> MethodReturn -> Bool Source #

data MethodError Source #

A method error is a reply to a method call, indicating that the call received an error and did not succeed.

Constructors

MethodError |

Fields

- methodErrorName :: ErrorName

  The name of the error type. Names are used so clients can handle certain classes of error differently from others.

- methodErrorSerial :: Serial

  The serial of the original method call. This lets the original caller match up this reply to the pending call.

- methodErrorSender :: Maybe BusName

  The name of the application that is returning from a call.

  Most users will just leave this empty, because the bus overwrites the sender for security reasons. Setting the sender manually is used for peer-peer connections.

  Defaults to `Nothing`.

- methodErrorDestination :: Maybe BusName

  The name of the application that initiated the call.

  Most users should set this. If a message with no destination is sent to the bus, the bus will behave as if the destination was set to `org.freedesktop.DBus`. For peer-peer connections, the destination can be empty because there is only one peer.

  Defaults to `Nothing`.

- methodErrorBody :: [Variant]

  Additional information about the error. By convention, if the error body contains any items, the first item should be a string describing the error.

#### Instances

Instances details

Message MethodError Source # |
Instance details Defined in DBus.Internal.Message Methods messageTypeCode :: MethodError -> Word8 Source # messageHeaderFields :: MethodError -> [HeaderField] Source # messageBody :: MethodError -> [Variant] Source # messageFlags :: MethodError -> Word8 Source #
Show MethodError Source # |
Instance details Defined in DBus.Internal.Message Methods showsPrec :: Int -> MethodError -> ShowS Source # show :: MethodError -> String Source # showList :: [MethodError] -> ShowS Source #
Eq MethodError Source # |
Instance details Defined in DBus.Internal.Message Methods (==) :: MethodError -> MethodError -> Bool Source # (/=) :: MethodError -> MethodError -> Bool Source #

methodErrorMessage :: MethodError -> String Source #

Get a human-readable description of the error, by returning the first item in the error body if it's a string.

data Signal Source #

Signals are broadcast by applications to notify other clients of some event.

Constructors

Signal |

Fields

- signalPath :: ObjectPath

  The path of the object that emitted this signal.

- signalInterface :: InterfaceName

  The interface that this signal belongs to.

- signalMember :: MemberName

  The name of this signal.

- signalSender :: Maybe BusName

  The name of the application that emitted this signal.

  Most users will just leave this empty, because the bus overwrites the sender for security reasons. Setting the sender manually is used for peer-peer connections.

  Defaults to `Nothing`.

- signalDestination :: Maybe BusName

  The name of the application to emit the signal to. If `Nothing`, the signal is sent to any application that has registered an appropriate match rule.

  Defaults to `Nothing`.

- signalBody :: [Variant]

  Additional information about the signal, such as the new value or the time.

  Defaults to `[]`.

#### Instances

Instances details

Message Signal Source # |
Instance details Defined in DBus.Internal.Message Methods messageTypeCode :: Signal -> Word8 Source # messageHeaderFields :: Signal -> [HeaderField] Source # messageBody :: Signal -> [Variant] Source # messageFlags :: Signal -> Word8 Source #
Show Signal Source # |
Instance details Defined in DBus.Internal.Message Methods showsPrec :: Int -> Signal -> ShowS Source # show :: Signal -> String Source # showList :: [Signal] -> ShowS Source #
Eq Signal Source # |
Instance details Defined in DBus.Internal.Message Methods (==) :: Signal -> Signal -> Bool Source # (/=) :: Signal -> Signal -> Bool Source #

data ReceivedMessage Source #

Not an actual message type, but a wrapper around messages received from the bus. Each value contains the message's `Serial`.

If casing against these constructors, always include a default case to handle messages of an unknown type. New message types may be added to the D-Bus specification, and applications should handle them gracefully by either ignoring or logging them.

Constructors

ReceivedMethodCall Serial MethodCall |
ReceivedMethodReturn Serial MethodReturn |
ReceivedMethodError Serial MethodError |
ReceivedSignal Serial Signal |
ReceivedUnknown Serial UnknownMessage |

#### Instances

Instances details

Show ReceivedMessage Source # |
Instance details Defined in DBus.Internal.Message Methods showsPrec :: Int -> ReceivedMessage -> ShowS Source # show :: ReceivedMessage -> String Source # showList :: [ReceivedMessage] -> ShowS Source #
Eq ReceivedMessage Source # |
Instance details Defined in DBus.Internal.Message Methods (==) :: ReceivedMessage -> ReceivedMessage -> Bool Source # (/=) :: ReceivedMessage -> ReceivedMessage -> Bool Source #

data HeaderField Source #

Constructors

HeaderPath ObjectPath |
HeaderInterface InterfaceName |
HeaderMember MemberName |
HeaderErrorName ErrorName |
HeaderReplySerial Serial |
HeaderDestination BusName |
HeaderSender BusName |
HeaderSignature Signature |
HeaderUnixFds Word32 |

#### Instances

Instances details

Show HeaderField Source # |
Instance details Defined in DBus.Internal.Message Methods showsPrec :: Int -> HeaderField -> ShowS Source # show :: HeaderField -> String Source # showList :: [HeaderField] -> ShowS Source #
Eq HeaderField Source # |
Instance details Defined in DBus.Internal.Message Methods (==) :: HeaderField -> HeaderField -> Bool Source # (/=) :: HeaderField -> HeaderField -> Bool Source #

setMethodCallFlags :: MethodCall -> Word8 -> MethodCall Source #