DBus-0.4: DBus bindings

DBus.Connection

Contents

Synopsis

Connection Basics

type Connection = ForeignPtr ConnectionTagSource

data BusType Source

Multiple buses may be active simultaneously on a single system. The BusType indicates which one to use.

Constructors

Session

The session bus is restricted to the user's current GNOME session.

System

This bus is system-wide.

Starter

The bus that started us, if any.

busGet :: BusType -> IO ConnectionSource

Connect to a standard bus.

busConnectionUnref :: Connection -> IO ()Source

Force the dereference of a connection. Note that this is usually not necessary since the connections are garbage collected automatically.

sendSource

Arguments

:: Connection 
-> Message 
-> Word32

Serial.

-> IO Word32

Returned serial.

Adds a Message to the outgoing message queue.

sendWithReplyAndBlockSource

Arguments

:: Connection 
-> Message 
-> Int

Timeout in milliseconds.

-> IO Message 

flush :: Connection -> IO ()Source

Block until all pending messages have been sent.

withConnection :: BusType -> (Connection -> IO a) -> IO aSource

Open a connection and run an IO action, ensuring it is properly closed when you're done.

Main Loop Management

readWriteDispatchSource

Arguments

:: Connection 
-> Int

Timeout, in milliseconds.

-> IO Bool 

Block until a message is read or written, then return True unless a disconnect message is received.

addFilterSource

Arguments

:: Connection 
-> (Message -> IO Bool)

A callback that returns True if the message has been handled.

-> IO () 

addMatchSource

Arguments

:: Connection 
-> Bool

Whether to block waiting for a response, allowing us to raise an exception if a response never comes.

-> String 
-> IO ()