DBus

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

Safe Haskell | None
Language | Haskell98

DBus

Contents

- Messages
  - Method calls
  - Method returns
  - Method errors
  - Signals
  - Received messages
- Variants
- Signatures
- Object paths
- Names
  - Interface names
  - Member names
  - Error names
  - Bus names
- Non-native containers
  - Structures
  - Arrays
  - Dictionaries
- Addresses
- Message marshaling
  - Marshal
  - Unmarshal
  - Message serials
- D-Bus UUIDs

Description

Basic types, useful to every D-Bus application.

Authors of client applications should import DBus.Client, which provides an easy RPC-oriented interface to D-Bus methods and signals.

Synopsis

- class Message a
- data MethodCall
- methodCall :: ObjectPath -> InterfaceName -> MemberName -> MethodCall
- methodCallPath :: MethodCall -> ObjectPath
- methodCallInterface :: MethodCall -> Maybe InterfaceName
- methodCallMember :: MethodCall -> MemberName
- methodCallSender :: MethodCall -> Maybe BusName
- methodCallDestination :: MethodCall -> Maybe BusName
- methodCallAutoStart :: MethodCall -> Bool
- methodCallReplyExpected :: MethodCall -> Bool
- methodCallBody :: MethodCall -> [Variant]
- data MethodReturn
- methodReturn :: Serial -> MethodReturn
- methodReturnSerial :: MethodReturn -> Serial
- methodReturnSender :: MethodReturn -> Maybe BusName
- methodReturnDestination :: MethodReturn -> Maybe BusName
- methodReturnBody :: MethodReturn -> [Variant]
- data MethodError
- methodError :: Serial -> ErrorName -> MethodError
- methodErrorName :: MethodError -> ErrorName
- methodErrorSerial :: MethodError -> Serial
- methodErrorSender :: MethodError -> Maybe BusName
- methodErrorDestination :: MethodError -> Maybe BusName
- methodErrorBody :: MethodError -> [Variant]
- methodErrorMessage :: MethodError -> String
- data Signal
- signal :: ObjectPath -> InterfaceName -> MemberName -> Signal
- signalPath :: Signal -> ObjectPath
- signalMember :: Signal -> MemberName
- signalInterface :: Signal -> InterfaceName
- signalSender :: Signal -> Maybe BusName
- signalDestination :: Signal -> Maybe BusName
- signalBody :: Signal -> [Variant]
- data ReceivedMessage
  - = ReceivedMethodCall Serial MethodCall
  - | ReceivedMethodReturn Serial MethodReturn
  - | ReceivedMethodError Serial MethodError
  - | ReceivedSignal Serial Signal
- receivedMessageSerial :: ReceivedMessage -> Serial
- receivedMessageSender :: ReceivedMessage -> Maybe BusName
- receivedMessageBody :: ReceivedMessage -> [Variant]
- data Variant
- class IsVariant a where
  - toVariant :: a -> Variant
  - fromVariant :: Variant -> Maybe a
- variantType :: Variant -> Type
- class IsValue a => IsAtom a
- class IsVariant a => IsValue a
- typeOf :: IsValue a => a -> Type
- data Signature
- data Type
  - = TypeBoolean
  - | TypeWord8
  - | TypeWord16
  - | TypeWord32
  - | TypeWord64
  - | TypeInt16
  - | TypeInt32
  - | TypeInt64
  - | TypeDouble
  - | TypeUnixFd
  - | TypeString
  - | TypeSignature
  - | TypeObjectPath
  - | TypeVariant
  - | TypeArray Type
  - | TypeDictionary Type Type
  - | TypeStructure [Type]
- signature :: [Type] -> Maybe Signature
- signature_ :: [Type] -> Signature
- signatureTypes :: Signature -> [Type]
- formatSignature :: Signature -> String
- parseSignature :: String -> Maybe Signature
- data ObjectPath
- objectPath_ :: String -> ObjectPath
- formatObjectPath :: ObjectPath -> String
- parseObjectPath :: String -> Maybe ObjectPath
- data InterfaceName
- interfaceName_ :: String -> InterfaceName
- formatInterfaceName :: InterfaceName -> String
- parseInterfaceName :: String -> Maybe InterfaceName
- data MemberName
- memberName_ :: String -> MemberName
- formatMemberName :: MemberName -> String
- parseMemberName :: String -> Maybe MemberName
- data ErrorName
- errorName_ :: String -> ErrorName
- formatErrorName :: ErrorName -> String
- parseErrorName :: String -> Maybe ErrorName
- data BusName
- busName_ :: String -> BusName
- formatBusName :: BusName -> String
- parseBusName :: String -> Maybe BusName
- data Structure
- structureItems :: Structure -> [Variant]
- data Array
- arrayItems :: Array -> [Variant]
- data Dictionary
- dictionaryItems :: Dictionary -> [(Variant, Variant)]
- data Address
- addressMethod :: Address -> String
- addressParameters :: Address -> Map String String
- address :: String -> Map String String -> Maybe Address
- formatAddress :: Address -> String
- formatAddresses :: [Address] -> String
- parseAddress :: String -> Maybe Address
- parseAddresses :: String -> Maybe [Address]
- getSystemAddress :: IO (Maybe Address)
- getSessionAddress :: IO (Maybe Address)
- getStarterAddress :: IO (Maybe Address)
- data Endianness
  - = LittleEndian
  - | BigEndian
- marshal :: Message msg => Endianness -> Serial -> msg -> Either MarshalError ByteString
- data MarshalError
- marshalErrorMessage :: MarshalError -> String
- unmarshal :: ByteString -> Either UnmarshalError ReceivedMessage
- data UnmarshalError
- unmarshalErrorMessage :: UnmarshalError -> String
- data Serial
- serialValue :: Serial -> Word32
- firstSerial :: Serial
- nextSerial :: Serial -> Serial
- data UUID
- formatUUID :: UUID -> String
- randomUUID :: IO UUID

# Messages

class Message a #

Minimal complete definition

messageTypeCode, messageHeaderFields, messageBody

Instances

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

## Method calls

data MethodCall #

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.

Instances

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

methodCall :: ObjectPath -> InterfaceName -> MemberName -> MethodCall #

Construct a new `MethodCall` for the given object, interface, and method.

Use fields such as `methodCallDestination` and `methodCallBody` to populate a `MethodCall`.

    {-# LANGUAGE OverloadedStrings #-}

    methodCall "/" "org.example.Math" "Add"
        { methodCallDestination = Just "org.example.Calculator"
        , methodCallBody = [toVariant (1 :: Int32), toVariant (2 :: Int32)]
        }

methodCallPath :: MethodCall -> 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 :: MethodCall -> 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 :: MethodCall -> MemberName #

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

methodCallSender :: MethodCall -> 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 :: MethodCall -> 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`.

methodCallAutoStart :: MethodCall -> Bool #

Set whether the bus should auto-start the remote

Defaults to `True`.

methodCallReplyExpected :: MethodCall -> Bool #

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

Defaults to `True`.

methodCallBody :: MethodCall -> [Variant] #

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

Defaults to `[]`.

## Method returns

data MethodReturn #

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

Instances

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

methodReturn :: Serial -> MethodReturn #

Construct a new `MethodReturn`, in reply to a method call with the given serial.

Use fields such as `methodReturnBody` to populate a `MethodReturn`.

methodReturnSerial :: MethodReturn -> Serial #

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

methodReturnSender :: MethodReturn -> 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 :: MethodReturn -> 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 :: MethodReturn -> [Variant] #

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

Defaults to `[]`.

## Method errors

data MethodError #

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

Instances

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

methodError :: Serial -> ErrorName -> MethodError #

Construct a new `MethodError`, in reply to a method call with the given serial.

Use fields such as `methodErrorBody` to populate a `MethodError`.

methodErrorName :: MethodError -> ErrorName #

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

methodErrorSerial :: MethodError -> Serial #

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

methodErrorSender :: MethodError -> 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 :: MethodError -> 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 :: MethodError -> [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.

methodErrorMessage :: MethodError -> String #

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

## Signals

data Signal #

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

Instances

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

signal :: ObjectPath -> InterfaceName -> MemberName -> Signal #

Construct a new `Signal` for the given object, interface, and signal name.

Use fields such as `signalBody` to populate a `Signal`.

signalPath :: Signal -> ObjectPath #

The path of the object that emitted this signal.

signalMember :: Signal -> MemberName #

The name of this signal.

signalInterface :: Signal -> InterfaceName #

The interface that this signal belongs to.

signalSender :: Signal -> 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 :: Signal -> 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 :: Signal -> [Variant] #

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

Defaults to `[]`.

## Received messages

data ReceivedMessage #

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 |

Instances

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

receivedMessageSerial :: ReceivedMessage -> Serial #

No matter what sort of message was received, get its serial.

receivedMessageSender :: ReceivedMessage -> Maybe BusName #

No matter what sort of message was received, get its sender (if provided).

receivedMessageBody :: ReceivedMessage -> [Variant] #

No matter what sort of message was received, get its body (if provided).

# Variants

data Variant #

Variants may contain any other built-in D-Bus value. Besides representing native `VARIANT` values, they allow type-safe storage and inspection of D-Bus collections.

Instances

Eq Variant # |
Instance details Defined in DBus.Internal.Types Methods (==) :: Variant -> Variant -> Bool # (/=) :: Variant -> Variant -> Bool #
Show Variant # |
Instance details Defined in DBus.Internal.Types Methods showsPrec :: Int -> Variant -> ShowS # show :: Variant -> String # showList :: [Variant] -> ShowS #
IsValue Variant # |
Instance details Defined in DBus.Internal.Types Methods typeOf :: Variant -> Type # toValue :: Variant -> Value # fromValue :: Value -> Maybe Variant #
IsVariant Variant # |
Instance details Defined in DBus.Internal.Types Methods toVariant :: Variant -> Variant # fromVariant :: Variant -> Maybe Variant #

class IsVariant a where #

Methods

toVariant :: a -> Variant #

fromVariant :: Variant -> Maybe a #

Instances

IsVariant Bool # |
Instance details Defined in DBus.Internal.Types Methods toVariant :: Bool -> Variant # fromVariant :: Variant -> Maybe Bool #
IsVariant Double # |
Instance details Defined in DBus.Internal.Types Methods toVariant :: Double -> Variant # fromVariant :: Variant -> Maybe Double #
IsVariant Int16 # |
Instance details Defined in DBus.Internal.Types Methods toVariant :: Int16 -> Variant # fromVariant :: Variant -> Maybe Int16 #
IsVariant Int32 # |
Instance details Defined in DBus.Internal.Types Methods toVariant :: Int32 -> Variant # fromVariant :: Variant -> Maybe Int32 #
IsVariant Int64 # |
Instance details Defined in DBus.Internal.Types Methods toVariant :: Int64 -> Variant # fromVariant :: Variant -> Maybe Int64 #
IsVariant Word8 # |
Instance details Defined in DBus.Internal.Types Methods toVariant :: Word8 -> Variant # fromVariant :: Variant -> Maybe Word8 #
IsVariant Word16 # |
Instance details Defined in DBus.Internal.Types Methods toVariant :: Word16 -> Variant # fromVariant :: Variant -> Maybe Word16 #
IsVariant Word32 # |
Instance details Defined in DBus.Internal.Types Methods toVariant :: Word32 -> Variant # fromVariant :: Variant -> Maybe Word32 #
IsVariant Word64 # |
Instance details Defined in DBus.Internal.Types Methods toVariant :: Word64 -> Variant # fromVariant :: Variant -> Maybe Word64 #
IsVariant Fd # |
Instance details Defined in DBus.Internal.Types Methods toVariant :: Fd -> Variant # fromVariant :: Variant -> Maybe Fd #
IsVariant String # |
Instance details Defined in DBus.Internal.Types Methods toVariant :: String -> Variant # fromVariant :: Variant -> Maybe String #
IsVariant ByteString # |
Instance details Defined in DBus.Internal.Types Methods toVariant :: ByteString -> Variant # fromVariant :: Variant -> Maybe ByteString #
IsVariant ByteString # |
Instance details Defined in DBus.Internal.Types Methods toVariant :: ByteString -> Variant # fromVariant :: Variant -> Maybe ByteString #
IsVariant Text # |
Instance details Defined in DBus.Internal.Types Methods toVariant :: Text -> Variant # fromVariant :: Variant -> Maybe Text #
IsVariant Text # |
Instance details Defined in DBus.Internal.Types Methods toVariant :: Text -> Variant # fromVariant :: Variant -> Maybe Text #
IsVariant Serial # |
Instance details Defined in DBus.Internal.Types Methods toVariant :: Serial -> Variant # fromVariant :: Variant -> Maybe Serial #
IsVariant Dictionary # |
Instance details Defined in DBus.Internal.Types Methods toVariant :: Dictionary -> Variant # fromVariant :: Variant -> Maybe Dictionary #
IsVariant Array # |
Instance details Defined in DBus.Internal.Types Methods toVariant :: Array -> Variant # fromVariant :: Variant -> Maybe Array #
IsVariant Structure # |
Instance details Defined in DBus.Internal.Types Methods toVariant :: Structure -> Variant # fromVariant :: Variant -> Maybe Structure #
IsVariant BusName # |
Instance details Defined in DBus.Internal.Types Methods toVariant :: BusName -> Variant # fromVariant :: Variant -> Maybe BusName #
IsVariant ErrorName # |
Instance details Defined in DBus.Internal.Types Methods toVariant :: ErrorName -> Variant # fromVariant :: Variant -> Maybe ErrorName #
IsVariant MemberName # |
Instance details Defined in DBus.Internal.Types Methods toVariant :: MemberName -> Variant # fromVariant :: Variant -> Maybe MemberName #
IsVariant InterfaceName # |
Instance details Defined in DBus.Internal.Types Methods toVariant :: InterfaceName -> Variant # fromVariant :: Variant -> Maybe InterfaceName #
IsVariant ObjectPath # |
Instance details Defined in DBus.Internal.Types Methods toVariant :: ObjectPath -> Variant # fromVariant :: Variant -> Maybe ObjectPath #
IsVariant Variant # |
Instance details Defined in DBus.Internal.Types Methods toVariant :: Variant -> Variant # fromVariant :: Variant -> Maybe Variant #
IsVariant Signature # |
Instance details Defined in DBus.Internal.Types Methods toVariant :: Signature -> Variant # fromVariant :: Variant -> Maybe Signature #
IsValue a => IsVariant [a] # |
Instance details Defined in DBus.Internal.Types Methods toVariant :: [a] -> Variant # fromVariant :: Variant -> Maybe [a] #
IsValue a => IsVariant (Vector a) # |
Instance details Defined in DBus.Internal.Types Methods toVariant :: Vector a -> Variant # fromVariant :: Variant -> Maybe (Vector a) #
(IsVariant a1, IsVariant a2) => IsVariant (a1, a2) # |
Instance details Defined in DBus.Internal.Types Methods toVariant :: (a1, a2) -> Variant # fromVariant :: Variant -> Maybe (a1, a2) #
(Ord k, IsAtom k, IsValue v) => IsVariant (Map k v) # |
Instance details Defined in DBus.Internal.Types Methods toVariant :: Map k v -> Variant # fromVariant :: Variant -> Maybe (Map k v) #
(IsVariant a1, IsVariant a2, IsVariant a3) => IsVariant (a1, a2, a3) # |
Instance details Defined in DBus.Internal.Types Methods toVariant :: (a1, a2, a3) -> Variant # fromVariant :: Variant -> Maybe (a1, a2, a3) #
(IsVariant a1, IsVariant a2, IsVariant a3, IsVariant a4) => IsVariant (a1, a2, a3, a4) # |
Instance details Defined in DBus.Internal.Types Methods toVariant :: (a1, a2, a3, a4) -> Variant # fromVariant :: Variant -> Maybe (a1, a2, a3, a4) #
(IsVariant a1, IsVariant a2, IsVariant a3, IsVariant a4, IsVariant a5) => IsVariant (a1, a2, a3, a4, a5) # |
Instance details Defined in DBus.Internal.Types Methods toVariant :: (a1, a2, a3, a4, a5) -> Variant # fromVariant :: Variant -> Maybe (a1, a2, a3, a4, a5) #
(IsVariant a1, IsVariant a2, IsVariant a3, IsVariant a4, IsVariant a5, IsVariant a6) => IsVariant (a1, a2, a3, a4, a5, a6) # |
Instance details Defined in DBus.Internal.Types Methods toVariant :: (a1, a2, a3, a4, a5, a6) -> Variant # fromVariant :: Variant -> Maybe (a1, a2, a3, a4, a5, a6) #
(IsVariant a1, IsVariant a2, IsVariant a3, IsVariant a4, IsVariant a5, IsVariant a6, IsVariant a7) => IsVariant (a1, a2, a3, a4, a5, a6, a7) # |
Instance details Defined in DBus.Internal.Types Methods toVariant :: (a1, a2, a3, a4, a5, a6, a7) -> Variant # fromVariant :: Variant -> Maybe (a1, a2, a3, a4, a5, a6, a7) #
(IsVariant a1, IsVariant a2, IsVariant a3, IsVariant a4, IsVariant a5, IsVariant a6, IsVariant a7, IsVariant a8) => IsVariant (a1, a2, a3, a4, a5, a6, a7, a8) # |
Instance details Defined in DBus.Internal.Types Methods toVariant :: (a1, a2, a3, a4, a5, a6, a7, a8) -> Variant # fromVariant :: Variant -> Maybe (a1, a2, a3, a4, a5, a6, a7, a8) #
(IsVariant a1, IsVariant a2, IsVariant a3, IsVariant a4, IsVariant a5, IsVariant a6, IsVariant a7, IsVariant a8, IsVariant a9) => IsVariant (a1, a2, a3, a4, a5, a6, a7, a8, a9) # |
Instance details Defined in DBus.Internal.Types Methods toVariant :: (a1, a2, a3, a4, a5, a6, a7, a8, a9) -> Variant # fromVariant :: Variant -> Maybe (a1, a2, a3, a4, a5, a6, a7, a8, a9) #
(IsVariant a1, IsVariant a2, IsVariant a3, IsVariant a4, IsVariant a5, IsVariant a6, IsVariant a7, IsVariant a8, IsVariant a9, IsVariant a10) => IsVariant (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) # |
Instance details Defined in DBus.Internal.Types Methods toVariant :: (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) -> Variant # fromVariant :: Variant -> Maybe (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) #
(IsVariant a1, IsVariant a2, IsVariant a3, IsVariant a4, IsVariant a5, IsVariant a6, IsVariant a7, IsVariant a8, IsVariant a9, IsVariant a10, IsVariant a11) => IsVariant (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11) # |
Instance details Defined in DBus.Internal.Types Methods toVariant :: (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11) -> Variant # fromVariant :: Variant -> Maybe (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11) #
(IsVariant a1, IsVariant a2, IsVariant a3, IsVariant a4, IsVariant a5, IsVariant a6, IsVariant a7, IsVariant a8, IsVariant a9, IsVariant a10, IsVariant a11, IsVariant a12) => IsVariant (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12) # |
Instance details Defined in DBus.Internal.Types Methods toVariant :: (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12) -> Variant # fromVariant :: Variant -> Maybe (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12) #
(IsVariant a1, IsVariant a2, IsVariant a3, IsVariant a4, IsVariant a5, IsVariant a6, IsVariant a7, IsVariant a8, IsVariant a9, IsVariant a10, IsVariant a11, IsVariant a12, IsVariant a13) => IsVariant (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13) # |
Instance details Defined in DBus.Internal.Types Methods toVariant :: (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13) -> Variant # fromVariant :: Variant -> Maybe (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13) #
(IsVariant a1, IsVariant a2, IsVariant a3, IsVariant a4, IsVariant a5, IsVariant a6, IsVariant a7, IsVariant a8, IsVariant a9, IsVariant a10, IsVariant a11, IsVariant a12, IsVariant a13, IsVariant a14) => IsVariant (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14) # |
Instance details Defined in DBus.Internal.Types Methods toVariant :: (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14) -> Variant # fromVariant :: Variant -> Maybe (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14) #
(IsVariant a1, IsVariant a2, IsVariant a3, IsVariant a4, IsVariant a5, IsVariant a6, IsVariant a7, IsVariant a8, IsVariant a9, IsVariant a10, IsVariant a11, IsVariant a12, IsVariant a13, IsVariant a14, IsVariant a15) => IsVariant (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15) # |
Instance details Defined in DBus.Internal.Types Methods toVariant :: (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15) -> Variant # fromVariant :: Variant -> Maybe (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15) #

variantType :: Variant -> Type #

Every variant is strongly-typed; that is, the type of its contained value is known at all times. This function retrieves that type, so that the correct cast can be used to retrieve the value.

class IsValue a => IsAtom a #

Atomic types can be used as keys to dictionaries.

Users may not provide new instances of `IsAtom` because this could allow dictionaries to be created with invalid keys.

Minimal complete definition

toAtom, fromAtom

Instances

IsAtom Bool # |
Instance details Defined in DBus.Internal.Types Methods toAtom :: Bool -> Atom # fromAtom :: Atom -> Maybe Bool #
IsAtom Double # |
Instance details Defined in DBus.Internal.Types Methods toAtom :: Double -> Atom # fromAtom :: Atom -> Maybe Double #
IsAtom Int16 # |
Instance details Defined in DBus.Internal.Types Methods toAtom :: Int16 -> Atom # fromAtom :: Atom -> Maybe Int16 #
IsAtom Int32 # |
Instance details Defined in DBus.Internal.Types Methods toAtom :: Int32 -> Atom # fromAtom :: Atom -> Maybe Int32 #
IsAtom Int64 # |
Instance details Defined in DBus.Internal.Types Methods toAtom :: Int64 -> Atom # fromAtom :: Atom -> Maybe Int64 #
IsAtom Word8 # |
Instance details Defined in DBus.Internal.Types Methods toAtom :: Word8 -> Atom # fromAtom :: Atom -> Maybe Word8 #
IsAtom Word16 # |
Instance details Defined in DBus.Internal.Types Methods toAtom :: Word16 -> Atom # fromAtom :: Atom -> Maybe Word16 #
IsAtom Word32 # |
Instance details Defined in DBus.Internal.Types Methods toAtom :: Word32 -> Atom # fromAtom :: Atom -> Maybe Word32 #
IsAtom Word64 # |
Instance details Defined in DBus.Internal.Types Methods toAtom :: Word64 -> Atom # fromAtom :: Atom -> Maybe Word64 #
IsAtom Fd # |
Instance details Defined in DBus.Internal.Types Methods toAtom :: Fd -> Atom # fromAtom :: Atom -> Maybe Fd #
IsAtom String # |
Instance details Defined in DBus.Internal.Types Methods toAtom :: String -> Atom # fromAtom :: Atom -> Maybe String #
IsAtom Text # |
Instance details Defined in DBus.Internal.Types Methods toAtom :: Text -> Atom # fromAtom :: Atom -> Maybe Text #
IsAtom Text # |
Instance details Defined in DBus.Internal.Types Methods toAtom :: Text -> Atom # fromAtom :: Atom -> Maybe Text #
IsAtom ObjectPath # |
Instance details Defined in DBus.Internal.Types Methods toAtom :: ObjectPath -> Atom # fromAtom :: Atom -> Maybe ObjectPath #
IsAtom Signature # |
Instance details Defined in DBus.Internal.Types Methods toAtom :: Signature -> Atom # fromAtom :: Atom -> Maybe Signature #

class IsVariant a => IsValue a #

Value types can be used as items in containers, such as lists or dictionaries.

Users may not provide new instances of `IsValue` because this could allow containers to be created with items of heterogenous types.

Minimal complete definition

typeOf, toValue, fromValue

Instances

IsValue Bool # |
Instance details Defined in DBus.Internal.Types Methods typeOf :: Bool -> Type # toValue :: Bool -> Value # fromValue :: Value -> Maybe Bool #
IsValue Double # |
Instance details Defined in DBus.Internal.Types Methods typeOf :: Double -> Type # toValue :: Double -> Value # fromValue :: Value -> Maybe Double #
IsValue Int16 # |
Instance details Defined in DBus.Internal.Types Methods typeOf :: Int16 -> Type # toValue :: Int16 -> Value # fromValue :: Value -> Maybe Int16 #
IsValue Int32 # |
Instance details Defined in DBus.Internal.Types Methods typeOf :: Int32 -> Type # toValue :: Int32 -> Value # fromValue :: Value -> Maybe Int32 #
IsValue Int64 # |
Instance details Defined in DBus.Internal.Types Methods typeOf :: Int64 -> Type # toValue :: Int64 -> Value # fromValue :: Value -> Maybe Int64 #
IsValue Word8 # |
Instance details Defined in DBus.Internal.Types Methods typeOf :: Word8 -> Type # toValue :: Word8 -> Value # fromValue :: Value -> Maybe Word8 #
IsValue Word16 # |
Instance details Defined in DBus.Internal.Types Methods typeOf :: Word16 -> Type # toValue :: Word16 -> Value # fromValue :: Value -> Maybe Word16 #
IsValue Word32 # |
Instance details Defined in DBus.Internal.Types Methods typeOf :: Word32 -> Type # toValue :: Word32 -> Value # fromValue :: Value -> Maybe Word32 #
IsValue Word64 # |
Instance details Defined in DBus.Internal.Types Methods typeOf :: Word64 -> Type # toValue :: Word64 -> Value # fromValue :: Value -> Maybe Word64 #
IsValue Fd # |
Instance details Defined in DBus.Internal.Types Methods typeOf :: Fd -> Type # toValue :: Fd -> Value # fromValue :: Value -> Maybe Fd #
IsValue String # |
Instance details Defined in DBus.Internal.Types Methods typeOf :: String -> Type # toValue :: String -> Value # fromValue :: Value -> Maybe String #
IsValue ByteString # |
Instance details Defined in DBus.Internal.Types Methods typeOf :: ByteString -> Type # toValue :: ByteString -> Value # fromValue :: Value -> Maybe ByteString #
IsValue ByteString # |
Instance details Defined in DBus.Internal.Types Methods typeOf :: ByteString -> Type # toValue :: ByteString -> Value # fromValue :: Value -> Maybe ByteString #
IsValue Text # |
Instance details Defined in DBus.Internal.Types Methods typeOf :: Text -> Type # toValue :: Text -> Value # fromValue :: Value -> Maybe Text #
IsValue Text # |
Instance details Defined in DBus.Internal.Types Methods typeOf :: Text -> Type # toValue :: Text -> Value # fromValue :: Value -> Maybe Text #
IsValue ObjectPath # |
Instance details Defined in DBus.Internal.Types Methods typeOf :: ObjectPath -> Type # toValue :: ObjectPath -> Value # fromValue :: Value -> Maybe ObjectPath #
IsValue Variant # |
Instance details Defined in DBus.Internal.Types Methods typeOf :: Variant -> Type # toValue :: Variant -> Value # fromValue :: Value -> Maybe Variant #
IsValue Signature # |
Instance details Defined in DBus.Internal.Types Methods typeOf :: Signature -> Type # toValue :: Signature -> Value # fromValue :: Value -> Maybe Signature #
IsValue a => IsValue [a] # |
Instance details Defined in DBus.Internal.Types Methods typeOf :: [a] -> Type # toValue :: [a] -> Value # fromValue :: Value -> Maybe [a] #
IsValue a => IsValue (Vector a) # |
Instance details Defined in DBus.Internal.Types Methods typeOf :: Vector a -> Type # toValue :: Vector a -> Value # fromValue :: Value -> Maybe (Vector a) #
(IsValue a1, IsValue a2) => IsValue (a1, a2) # |
Instance details Defined in DBus.Internal.Types Methods typeOf :: (a1, a2) -> Type # toValue :: (a1, a2) -> Value # fromValue :: Value -> Maybe (a1, a2) #
(Ord k, IsAtom k, IsValue v) => IsValue (Map k v) # |
Instance details Defined in DBus.Internal.Types Methods typeOf :: Map k v -> Type # toValue :: Map k v -> Value # fromValue :: Value -> Maybe (Map k v) #
(IsValue a1, IsValue a2, IsValue a3) => IsValue (a1, a2, a3) # |
Instance details Defined in DBus.Internal.Types Methods typeOf :: (a1, a2, a3) -> Type # toValue :: (a1, a2, a3) -> Value # fromValue :: Value -> Maybe (a1, a2, a3) #
(IsValue a1, IsValue a2, IsValue a3, IsValue a4) => IsValue (a1, a2, a3, a4) # |
Instance details Defined in DBus.Internal.Types Methods typeOf :: (a1, a2, a3, a4) -> Type # toValue :: (a1, a2, a3, a4) -> Value # fromValue :: Value -> Maybe (a1, a2, a3, a4) #
(IsValue a1, IsValue a2, IsValue a3, IsValue a4, IsValue a5) => IsValue (a1, a2, a3, a4, a5) # |
Instance details Defined in DBus.Internal.Types Methods typeOf :: (a1, a2, a3, a4, a5) -> Type # toValue :: (a1, a2, a3, a4, a5) -> Value # fromValue :: Value -> Maybe (a1, a2, a3, a4, a5) #
(IsValue a1, IsValue a2, IsValue a3, IsValue a4, IsValue a5, IsValue a6) => IsValue (a1, a2, a3, a4, a5, a6) # |
Instance details Defined in DBus.Internal.Types Methods typeOf :: (a1, a2, a3, a4, a5, a6) -> Type # toValue :: (a1, a2, a3, a4, a5, a6) -> Value # fromValue :: Value -> Maybe (a1, a2, a3, a4, a5, a6) #
(IsValue a1, IsValue a2, IsValue a3, IsValue a4, IsValue a5, IsValue a6, IsValue a7) => IsValue (a1, a2, a3, a4, a5, a6, a7) # |
Instance details Defined in DBus.Internal.Types Methods typeOf :: (a1, a2, a3, a4, a5, a6, a7) -> Type # toValue :: (a1, a2, a3, a4, a5, a6, a7) -> Value # fromValue :: Value -> Maybe (a1, a2, a3, a4, a5, a6, a7) #
(IsValue a1, IsValue a2, IsValue a3, IsValue a4, IsValue a5, IsValue a6, IsValue a7, IsValue a8) => IsValue (a1, a2, a3, a4, a5, a6, a7, a8) # |
Instance details Defined in DBus.Internal.Types Methods typeOf :: (a1, a2, a3, a4, a5, a6, a7, a8) -> Type # toValue :: (a1, a2, a3, a4, a5, a6, a7, a8) -> Value # fromValue :: Value -> Maybe (a1, a2, a3, a4, a5, a6, a7, a8) #
(IsValue a1, IsValue a2, IsValue a3, IsValue a4, IsValue a5, IsValue a6, IsValue a7, IsValue a8, IsValue a9) => IsValue (a1, a2, a3, a4, a5, a6, a7, a8, a9) # |
Instance details Defined in DBus.Internal.Types Methods typeOf :: (a1, a2, a3, a4, a5, a6, a7, a8, a9) -> Type # toValue :: (a1, a2, a3, a4, a5, a6, a7, a8, a9) -> Value # fromValue :: Value -> Maybe (a1, a2, a3, a4, a5, a6, a7, a8, a9) #
(IsValue a1, IsValue a2, IsValue a3, IsValue a4, IsValue a5, IsValue a6, IsValue a7, IsValue a8, IsValue a9, IsValue a10) => IsValue (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) # |
Instance details Defined in DBus.Internal.Types Methods typeOf :: (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) -> Type # toValue :: (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) -> Value # fromValue :: Value -> Maybe (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) #
(IsValue a1, IsValue a2, IsValue a3, IsValue a4, IsValue a5, IsValue a6, IsValue a7, IsValue a8, IsValue a9, IsValue a10, IsValue a11) => IsValue (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11) # |
Instance details Defined in DBus.Internal.Types Methods typeOf :: (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11) -> Type # toValue :: (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11) -> Value # fromValue :: Value -> Maybe (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11) #
(IsValue a1, IsValue a2, IsValue a3, IsValue a4, IsValue a5, IsValue a6, IsValue a7, IsValue a8, IsValue a9, IsValue a10, IsValue a11, IsValue a12) => IsValue (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12) # |
Instance details Defined in DBus.Internal.Types Methods typeOf :: (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12) -> Type # toValue :: (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12) -> Value # fromValue :: Value -> Maybe (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12) #
(IsValue a1, IsValue a2, IsValue a3, IsValue a4, IsValue a5, IsValue a6, IsValue a7, IsValue a8, IsValue a9, IsValue a10, IsValue a11, IsValue a12, IsValue a13) => IsValue (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13) # |
Instance details Defined in DBus.Internal.Types Methods typeOf :: (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13) -> Type # toValue :: (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13) -> Value # fromValue :: Value -> Maybe (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13) #
(IsValue a1, IsValue a2, IsValue a3, IsValue a4, IsValue a5, IsValue a6, IsValue a7, IsValue a8, IsValue a9, IsValue a10, IsValue a11, IsValue a12, IsValue a13, IsValue a14) => IsValue (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14) # |
Instance details Defined in DBus.Internal.Types Methods typeOf :: (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14) -> Type # toValue :: (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14) -> Value # fromValue :: Value -> Maybe (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14) #
(IsValue a1, IsValue a2, IsValue a3, IsValue a4, IsValue a5, IsValue a6, IsValue a7, IsValue a8, IsValue a9, IsValue a10, IsValue a11, IsValue a12, IsValue a13, IsValue a14, IsValue a15) => IsValue (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15) # |
Instance details Defined in DBus.Internal.Types Methods typeOf :: (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15) -> Type # toValue :: (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15) -> Value # fromValue :: Value -> Maybe (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15) #

typeOf :: IsValue a => a -> Type #

Get the D-Bus type corresponding to the given Haskell value. The value may be `undefined`.

# Signatures

data Signature #

A signature is a list of D-Bus types, obeying some basic rules of validity.

The rules of signature validity are complex: see http://dbus.freedesktop.org/doc/dbus-specification.html#message-protocol-signatures for details.

Instances

Eq Signature # |
Instance details Defined in DBus.Internal.Types Methods (==) :: Signature -> Signature -> Bool # (/=) :: Signature -> Signature -> Bool #
Ord Signature # |
Instance details Defined in DBus.Internal.Types Methods compare :: Signature -> Signature -> Ordering # (<) :: Signature -> Signature -> Bool # (<=) :: Signature -> Signature -> Bool # (>) :: Signature -> Signature -> Bool # (>=) :: Signature -> Signature -> Bool # max :: Signature -> Signature -> Signature # min :: Signature -> Signature -> Signature #
Show Signature # |
Instance details Defined in DBus.Internal.Types Methods showsPrec :: Int -> Signature -> ShowS # show :: Signature -> String # showList :: [Signature] -> ShowS #
IsString Signature # |
Instance details Defined in DBus.Internal.Types Methods fromString :: String -> Signature #
IsAtom Signature # |
Instance details Defined in DBus.Internal.Types Methods toAtom :: Signature -> Atom # fromAtom :: Atom -> Maybe Signature #
IsValue Signature # |
Instance details Defined in DBus.Internal.Types Methods typeOf :: Signature -> Type # toValue :: Signature -> Value # fromValue :: Value -> Maybe Signature #
IsVariant Signature # |
Instance details Defined in DBus.Internal.Types Methods toVariant :: Signature -> Variant # fromVariant :: Variant -> Maybe Signature #

data Type #

Constructors

TypeBoolean |
TypeWord8 |
TypeWord16 |
TypeWord32 |
TypeWord64 |
TypeInt16 |
TypeInt32 |
TypeInt64 |
TypeDouble |
TypeUnixFd |
TypeString |
TypeSignature |
TypeObjectPath |
TypeVariant |
TypeArray Type |
TypeDictionary Type Type |
TypeStructure [Type] |

Instances

Eq Type # |
Instance details Defined in DBus.Internal.Types Methods (==) :: Type -> Type -> Bool # (/=) :: Type -> Type -> Bool #
Ord Type # |
Instance details Defined in DBus.Internal.Types Methods compare :: Type -> Type -> Ordering # (<) :: Type -> Type -> Bool # (<=) :: Type -> Type -> Bool # (>) :: Type -> Type -> Bool # (>=) :: Type -> Type -> Bool # max :: Type -> Type -> Type # min :: Type -> Type -> Type #
Show Type # |
Instance details Defined in DBus.Internal.Types Methods showsPrec :: Int -> Type -> ShowS # show :: Type -> String # showList :: [Type] -> ShowS #

signature :: [Type] -> Maybe Signature #

Convert a list of types into a valid signature.

Returns `Nothing` if the given types are not a valid signature.

signature_ :: [Type] -> Signature #

Convert a list of types into a valid signature.

Throws an exception if the given types are not a valid signature.

signatureTypes :: Signature -> [Type] #

Get the list of types in a signature. The inverse of `signature`.

formatSignature :: Signature -> String #

Convert a signature into a signature string. The inverse of `parseSignature`.

parseSignature :: String -> Maybe Signature #

Parse a signature string into a valid signature.

Returns `Nothing` if the given string is not a valid signature.

# Object paths

data ObjectPath #

Object paths are special strings, used to identify a particular object exported from a D-Bus application.

Object paths must begin with a slash, and consist of alphanumeric characters separated by slashes.

See http://dbus.freedesktop.org/doc/dbus-specification.html#message-protocol-marshaling-object-path for details.

Instances

Eq ObjectPath # |
Instance details Defined in DBus.Internal.Types Methods (==) :: ObjectPath -> ObjectPath -> Bool # (/=) :: ObjectPath -> ObjectPath -> Bool #
Ord ObjectPath # |
Instance details Defined in DBus.Internal.Types Methods compare :: ObjectPath -> ObjectPath -> Ordering # (<) :: ObjectPath -> ObjectPath -> Bool # (<=) :: ObjectPath -> ObjectPath -> Bool # (>) :: ObjectPath -> ObjectPath -> Bool # (>=) :: ObjectPath -> ObjectPath -> Bool # max :: ObjectPath -> ObjectPath -> ObjectPath # min :: ObjectPath -> ObjectPath -> ObjectPath #
Show ObjectPath # |
Instance details Defined in DBus.Internal.Types Methods showsPrec :: Int -> ObjectPath -> ShowS # show :: ObjectPath -> String # showList :: [ObjectPath] -> ShowS #
IsString ObjectPath # |
Instance details Defined in DBus.Internal.Types Methods fromString :: String -> ObjectPath #
IsAtom ObjectPath # |
Instance details Defined in DBus.Internal.Types Methods toAtom :: ObjectPath -> Atom # fromAtom :: Atom -> Maybe ObjectPath #
IsValue ObjectPath # |
Instance details Defined in DBus.Internal.Types Methods typeOf :: ObjectPath -> Type # toValue :: ObjectPath -> Value # fromValue :: Value -> Maybe ObjectPath #
IsVariant ObjectPath # |
Instance details Defined in DBus.Internal.Types Methods toVariant :: ObjectPath -> Variant # fromVariant :: Variant -> Maybe ObjectPath #

objectPath_ :: String -> ObjectPath #

formatObjectPath :: ObjectPath -> String #

parseObjectPath :: String -> Maybe ObjectPath #

# Names

## Interface names

data InterfaceName #

Interfaces are used to group a set of methods and signals within an exported object. Interface names consist of alphanumeric characters separated by periods.

See http://dbus.freedesktop.org/doc/dbus-specification.html#message-protocol-names-interface for details.

Instances

Eq InterfaceName # |
Instance details Defined in DBus.Internal.Types Methods (==) :: InterfaceName -> InterfaceName -> Bool # (/=) :: InterfaceName -> InterfaceName -> Bool #
Ord InterfaceName # |
Instance details Defined in DBus.Internal.Types Methods compare :: InterfaceName -> InterfaceName -> Ordering # (<) :: InterfaceName -> InterfaceName -> Bool # (<=) :: InterfaceName -> InterfaceName -> Bool # (>) :: InterfaceName -> InterfaceName -> Bool # (>=) :: InterfaceName -> InterfaceName -> Bool # max :: InterfaceName -> InterfaceName -> InterfaceName # min :: InterfaceName -> InterfaceName -> InterfaceName #
Show InterfaceName # |
Instance details Defined in DBus.Internal.Types Methods showsPrec :: Int -> InterfaceName -> ShowS # show :: InterfaceName -> String # showList :: [InterfaceName] -> ShowS #
IsString InterfaceName # |
Instance details Defined in DBus.Internal.Types Methods fromString :: String -> InterfaceName #
IsVariant InterfaceName # |
Instance details Defined in DBus.Internal.Types Methods toVariant :: InterfaceName -> Variant # fromVariant :: Variant -> Maybe InterfaceName #

interfaceName_ :: String -> InterfaceName #

formatInterfaceName :: InterfaceName -> String #

parseInterfaceName :: String -> Maybe InterfaceName #

## Member names

data MemberName #

Member names are used to identify a single method or signal within an interface. Method names consist of alphanumeric characters.

See http://dbus.freedesktop.org/doc/dbus-specification.html#message-protocol-names-member for details.

Instances

Eq MemberName # |
Instance details Defined in DBus.Internal.Types Methods (==) :: MemberName -> MemberName -> Bool # (/=) :: MemberName -> MemberName -> Bool #
Ord MemberName # |
Instance details Defined in DBus.Internal.Types Methods compare :: MemberName -> MemberName -> Ordering # (<) :: MemberName -> MemberName -> Bool # (<=) :: MemberName -> MemberName -> Bool # (>) :: MemberName -> MemberName -> Bool # (>=) :: MemberName -> MemberName -> Bool # max :: MemberName -> MemberName -> MemberName # min :: MemberName -> MemberName -> MemberName #
Show MemberName # |
Instance details Defined in DBus.Internal.Types Methods showsPrec :: Int -> MemberName -> ShowS # show :: MemberName -> String # showList :: [MemberName] -> ShowS #
IsString MemberName # |
Instance details Defined in DBus.Internal.Types Methods fromString :: String -> MemberName #
IsVariant MemberName # |
Instance details Defined in DBus.Internal.Types Methods toVariant :: MemberName -> Variant # fromVariant :: Variant -> Maybe MemberName #

memberName_ :: String -> MemberName #

formatMemberName :: MemberName -> String #

parseMemberName :: String -> Maybe MemberName #

## Error names

data ErrorName #

Error names are used to identify which type of error was returned from a method call. Error names consist of alphanumeric characters separated by periods.

See http://dbus.freedesktop.org/doc/dbus-specification.html#message-protocol-names-error for details.

Instances

Eq ErrorName # |
Instance details Defined in DBus.Internal.Types Methods (==) :: ErrorName -> ErrorName -> Bool # (/=) :: ErrorName -> ErrorName -> Bool #
Ord ErrorName # |
Instance details Defined in DBus.Internal.Types Methods compare :: ErrorName -> ErrorName -> Ordering # (<) :: ErrorName -> ErrorName -> Bool # (<=) :: ErrorName -> ErrorName -> Bool # (>) :: ErrorName -> ErrorName -> Bool # (>=) :: ErrorName -> ErrorName -> Bool # max :: ErrorName -> ErrorName -> ErrorName # min :: ErrorName -> ErrorName -> ErrorName #
Show ErrorName # |
Instance details Defined in DBus.Internal.Types Methods showsPrec :: Int -> ErrorName -> ShowS # show :: ErrorName -> String # showList :: [ErrorName] -> ShowS #
IsString ErrorName # |
Instance details Defined in DBus.Internal.Types Methods fromString :: String -> ErrorName #
IsVariant ErrorName # |
Instance details Defined in DBus.Internal.Types Methods toVariant :: ErrorName -> Variant # fromVariant :: Variant -> Maybe ErrorName #

errorName_ :: String -> ErrorName #

formatErrorName :: ErrorName -> String #

parseErrorName :: String -> Maybe ErrorName #

## Bus names

data BusName #

Bus names are used to identify particular clients on the message bus. A bus name may be either unique or well-known, where unique names start with a colon. Bus names consist of alphanumeric characters separated by periods.

See http://dbus.freedesktop.org/doc/dbus-specification.html#message-protocol-names-bus for details.

Instances

Eq BusName # |
Instance details Defined in DBus.Internal.Types Methods (==) :: BusName -> BusName -> Bool # (/=) :: BusName -> BusName -> Bool #
Ord BusName # |
Instance details Defined in DBus.Internal.Types Methods compare :: BusName -> BusName -> Ordering # (<) :: BusName -> BusName -> Bool # (<=) :: BusName -> BusName -> Bool # (>) :: BusName -> BusName -> Bool # (>=) :: BusName -> BusName -> Bool # max :: BusName -> BusName -> BusName # min :: BusName -> BusName -> BusName #
Show BusName # |
Instance details Defined in DBus.Internal.Types Methods showsPrec :: Int -> BusName -> ShowS # show :: BusName -> String # showList :: [BusName] -> ShowS #
IsString BusName # |
Instance details Defined in DBus.Internal.Types Methods fromString :: String -> BusName #
IsVariant BusName # |
Instance details Defined in DBus.Internal.Types Methods toVariant :: BusName -> Variant # fromVariant :: Variant -> Maybe BusName #

busName_ :: String -> BusName #

formatBusName :: BusName -> String #

parseBusName :: String -> Maybe BusName #

# Non-native containers

## Structures

data Structure #

A D-Bus Structure is a container type similar to Haskell tuples, storing values of any type that is convertable to `IsVariant`. A Structure may contain up to 255 values.

Most users can use the `IsVariant` instance for tuples to extract the values of a structure. This type is for very large structures, which may be awkward to work with as tuples.

Instances

Eq Structure # |
Instance details Defined in DBus.Internal.Types Methods (==) :: Structure -> Structure -> Bool # (/=) :: Structure -> Structure -> Bool #
Show Structure # |
Instance details Defined in DBus.Internal.Types Methods showsPrec :: Int -> Structure -> ShowS # show :: Structure -> String # showList :: [Structure] -> ShowS #
IsVariant Structure # |
Instance details Defined in DBus.Internal.Types Methods toVariant :: Structure -> Variant # fromVariant :: Variant -> Maybe Structure #

structureItems :: Structure -> [Variant] #

## Arrays

data Array #

A D-Bus Array is a container type similar to Haskell lists, storing zero or more values of a single D-Bus type.

Most users can use the `IsVariant` instance for lists or vectors to extract the values of an array. This type is for advanced use cases, where the user wants to convert array values to Haskell types that are not instances of `IsValue`.

Instances

Eq Array # |
Instance details Defined in DBus.Internal.Types Methods (==) :: Array -> Array -> Bool # (/=) :: Array -> Array -> Bool #
Show Array # |
Instance details Defined in DBus.Internal.Types Methods showsPrec :: Int -> Array -> ShowS # show :: Array -> String # showList :: [Array] -> ShowS #
IsVariant Array # |
Instance details Defined in DBus.Internal.Types Methods toVariant :: Array -> Variant # fromVariant :: Variant -> Maybe Array #

arrayItems :: Array -> [Variant] #

## Dictionaries

data Dictionary #

A D-Bus Dictionary is a container type similar to Haskell maps, storing zero or more associations between keys and values.

Most users can use the `IsVariant` instance for maps to extract the values of a dictionary. This type is for advanced use cases, where the user wants to convert dictionary items to Haskell types that are not instances of `IsValue`.

Instances

Eq Dictionary # |
Instance details Defined in DBus.Internal.Types Methods (==) :: Dictionary -> Dictionary -> Bool # (/=) :: Dictionary -> Dictionary -> Bool #
Show Dictionary # |
Instance details Defined in DBus.Internal.Types Methods showsPrec :: Int -> Dictionary -> ShowS # show :: Dictionary -> String # showList :: [Dictionary] -> ShowS #
IsVariant Dictionary # |
Instance details Defined in DBus.Internal.Types Methods toVariant :: Dictionary -> Variant # fromVariant :: Variant -> Maybe Dictionary #

dictionaryItems :: Dictionary -> [(Variant, Variant)] #

# Addresses

data Address #

When a D-Bus server must listen for connections, or a client must connect to a server, the listening socket's configuration is specified with an address. An address contains the method, which determines the protocol and transport mechanism, and parameters, which provide additional method-specific information about the address.

Instances

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

addressMethod :: Address -> String #

addressParameters :: Address -> Map String String #

address :: String -> Map String String -> Maybe Address #

Try to convert a method string and parameter map to an `Address`.

Returns `Nothing` if the method or parameters are invalid.

formatAddress :: Address -> String #

Convert an address to a string in the format expected by `parseAddress`.

formatAddresses :: [Address] -> String #

Convert a list of addresses to a string in the format expected by `parseAddresses`.

parseAddress :: String -> Maybe Address #

Try to parse a string containing one valid address.

An address string is in the format `method:key1=val1,key2=val2`. There are some limitations on the characters allowed within methods and parameters; see the D-Bus specification for full details.

parseAddresses :: String -> Maybe [Address] #

Try to parse a string containing one or more valid addresses.

Addresses are separated by semicolons. See `parseAddress` for the format of addresses.

getSystemAddress :: IO (Maybe Address) #

Returns the address in the environment variable `DBUS_SYSTEM_BUS_ADDRESS`, or `unix:path=/var/run/dbus/system_bus_socket` if `DBUS_SYSTEM_BUS_ADDRESS` is not set.

Returns `Nothing` if `DBUS_SYSTEM_BUS_ADDRESS` contains an invalid address.

getSessionAddress :: IO (Maybe Address) #

Returns the address in the environment variable `DBUS_SESSION_BUS_ADDRESS`, which must be set.

Returns `Nothing` if `DBUS_SYSTEM_BUS_ADDRESS` is unset or contains an invalid address.

getStarterAddress :: IO (Maybe Address) #

Returns the address in the environment variable `DBUS_STARTER_ADDRESS`, which must be set.

Returns `Nothing` if `DBUS_STARTER_ADDRESS` is unset or contains an invalid address.

# Message marshaling

data Endianness #

Constructors

LittleEndian |
BigEndian |

Instances

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

## Marshal

marshal :: Message msg => Endianness -> Serial -> msg -> Either MarshalError ByteString #

Convert a `Message` into a `ByteString`. Although unusual, it is possible for marshaling to fail; if this occurs, an error will be returned instead.

data MarshalError #

Instances

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

marshalErrorMessage :: MarshalError -> String #

## Unmarshal

unmarshal :: ByteString -> Either UnmarshalError ReceivedMessage #

Parse a `ByteString` into a `ReceivedMessage`. The result can be inspected to see what type of message was parsed. Unknown message types can still be parsed successfully, as long as they otherwise conform to the D-Bus standard.

data UnmarshalError #

Instances

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

unmarshalErrorMessage :: UnmarshalError -> String #

## Message serials

data Serial #

A value used to uniquely identify a particular message within a session. Serials are 32-bit unsigned integers, and eventually wrap.

Instances

Eq Serial # |
Instance details Defined in DBus.Internal.Types Methods (==) :: Serial -> Serial -> Bool # (/=) :: Serial -> Serial -> Bool #
Ord Serial # |
Instance details Defined in DBus.Internal.Types Methods compare :: Serial -> Serial -> Ordering # (<) :: Serial -> Serial -> Bool # (<=) :: Serial -> Serial -> Bool # (>) :: Serial -> Serial -> Bool # (>=) :: Serial -> Serial -> Bool # max :: Serial -> Serial -> Serial # min :: Serial -> Serial -> Serial #
Show Serial # |
Instance details Defined in DBus.Internal.Types Methods showsPrec :: Int -> Serial -> ShowS # show :: Serial -> String # showList :: [Serial] -> ShowS #
IsVariant Serial # |
Instance details Defined in DBus.Internal.Types Methods toVariant :: Serial -> Variant # fromVariant :: Variant -> Maybe Serial #

serialValue :: Serial -> Word32 #

firstSerial :: Serial #

Get the first serial in the sequence.

nextSerial :: Serial -> Serial #

Get the next serial in the sequence. This may wrap around to `firstSerial`.

# D-Bus UUIDs

data UUID #

A D-Bus UUID is 128 bits of data, usually randomly generated. They are used for identifying unique server instances to clients.

Older versions of the D-Bus spec also called these values GUIDs.

D-Bus UUIDs are not the same as the RFC-standardized UUIDs or GUIDs.

Instances

Eq UUID # |
Instance details Defined in DBus Methods (==) :: UUID -> UUID -> Bool # (/=) :: UUID -> UUID -> Bool #
Ord UUID # |
Instance details Defined in DBus Methods compare :: UUID -> UUID -> Ordering # (<) :: UUID -> UUID -> Bool # (<=) :: UUID -> UUID -> Bool # (>) :: UUID -> UUID -> Bool # (>=) :: UUID -> UUID -> Bool # max :: UUID -> UUID -> UUID # min :: UUID -> UUID -> UUID #
Show UUID # |
Instance details Defined in DBus Methods showsPrec :: Int -> UUID -> ShowS # show :: UUID -> String # showList :: [UUID] -> ShowS #

formatUUID :: UUID -> String #

Format a D-Bus UUID as hex-encoded ASCII.

randomUUID :: IO UUID #

Generate a random D-Bus UUID. This value is suitable for use in a randomly-allocated address, or as a listener's socket address `"guid"` parameter.