udbus-0.2.1: Small DBus implementation

Portabilityunknown
Stabilityexperimental
MaintainerVincent Hanquez <vincent@snarc.org>
Safe HaskellNone

Network.DBus

Contents

Description

 

Synopsis

handle connections to DBus

establishSource

Arguments

:: IO DBusContext

function to create a new dbus context (busGetSystem or busGetSession)

-> (DBusContext -> IO ())

function to authenticate to dbus

-> IO DBusConnection 

Establish a new connection to dbus, using the two functions to first establish a new context, and second to authenticate to the bus. this will automatically create a mainloop thread.

disconnect :: DBusConnection -> IO ()Source

Close dbus socket and stop mainloop thread.

data DBusConnection Source

opaque type representing a connection to DBus and a receiving dispatcher thread. maintain table to route message between handlers.

Types

type Signature = [Type]Source

A list of signature element

type SignatureElem = TypeSource

Deprecated: use Type instead

newtype BusName Source

Constructors

BusName 

Fields

unBusName :: String
 

newtype Member Source

Constructors

Member 

Fields

unMember :: String
 

standard way to interact with dbus

addMatch :: DBusConnection -> DBusMatchRules -> IO ()Source

Add a match rules which will cause to receive message that aren't directed to this connection but match this rule.

main loop creation

runMainLoop :: DBusContext -> IO DBusConnectionSource

run a main DBus loop which will create a new dispatcher handshake on the bus and wait for message to dispatch

runMainLoopCatchall :: (DBusMessage -> IO ()) -> DBusContext -> IO DBusConnectionSource

similar to runMainLoop but also give the ability to specify a catch-all-message callback for any message that are not handled by specific function.

interact with the connection

call :: DBusConnection -> BusName -> DBusCall -> IO DBusReturnSource

call a method on the DBus, and wait synchronously for the return value.

reply :: DBusMessageable a => DBusConnection -> a -> IO SerialSource

Send an arbitrary DBusMessageable message on the bus, using a new serial value. the serial value allocated is returned to the caller.

PS: completely misnamed.

registerPath :: DBusConnection -> ObjectPath -> DispatchTable Callback -> IO ()Source

Deprecated: use registerCall

unregisterPath :: DBusConnection -> ObjectPath -> IO ()Source

Deprecated: use unregisterCall

registerCall :: DBusConnection -> ObjectPath -> DispatchTable Callback -> IO ()Source

Register a method handler table for a specific object path

unregisterCall :: DBusConnection -> ObjectPath -> IO ()Source

Unregister all method handlers for a specific object path

registerSignal :: DBusConnection -> ObjectPath -> DispatchTable Signalback -> IO ()Source

Register a signal handler table for a specific object path

unregisterSignal :: DBusConnection -> ObjectPath -> IO ()Source

Unregister all signals handler for a specific object path

Types to interact with the dispatcher

type Signalback = BusName -> Signature -> Body -> IO ()Source

type Callback = Serial -> Signature -> Body -> IO ()Source

create a new context on system or session bus

busGetSystem :: IO DBusContextSource

create a new DBus context on system bus

busGetSession :: IO DBusContextSource

create a new DBus context on session bus

authenticate methods available

authenticate :: DBusContext -> ByteString -> IO ()Source

authenticate to DBus using a raw bytestring.

authenticateUID :: DBusContext -> Int -> IO ()Source

authenticate to DBus using a UID.

authenticateWithRealUID :: DBusContext -> IO ()Source

use the real user UID to authenticate to DBus.