dbus-core-0.9.2: Low-level D-Bus protocol implementation

DBus.Client.Simple

Contents

Synopsis

Clients

connectSystem :: IO ClientSource

Connect to the bus specified in the environment variable DBUS_SYSTEM_BUS_ADDRESS, or to unix:path=/var/run/dbus/system_bus_socket if DBUS_SYSTEM_BUS_ADDRESS is not set.

connectSession :: IO ClientSource

Connect to the bus specified in the environment variable DBUS_SESSION_BUS_ADDRESS, which must be set.

connectStarter :: IO ClientSource

Connect to the bus specified in the environment variable DBUS_STARTER_ADDRESS, which must be set.

disconnect :: Client -> IO ()Source

Stop a Client’s callback thread and close its underlying socket.

Proxies

Name reservation

Exporting objects

class AutoSignature a Source

Used to automatically generate method signatures for introspection documents. To support automatic signatures, a method#8217;s parameters and return value must all be instances of IsValue.

This class maps Haskell idioms to D‐Bus; it is therefore unable to generate some signatures. In particular, it does not support methods which accept/return a single structure, or single‐element structures. It also cannot generate signatures for methods with parameters or return values which are only instances of IsVariant. For these cases, please use method.

To match common Haskell use, if the return value is a tuple, it will be converted to a list of return values.

Instances

AutoSignature (IO ()) 
IsValue a => AutoSignature (IO a) 
(IsValue a, AutoSignature fun) => AutoSignature (a -> fun) 

class AutoReply fun Source

Used to automatically generate a Reply from a return value. See AutoSignature for some caveats about supported signatures.

To match common Haskell use, if the return value is a tuple, it will be converted to a list of return values.

Instances

AutoReply (IO ()) 
IsVariant a => AutoReply (IO a) 
(IsVariant a, AutoReply fun) => AutoReply (a -> fun) 

method :: (AutoSignature fun, AutoReply fun) => InterfaceName -> MemberName -> fun -> MethodSource

Prepare a Haskell function for export. This automatically detects the function#8217;s type signature; see AutoSignature and AutoReply.

To manage the type signature and marshaling yourself, use method instead.

export :: Client -> ObjectPath -> [Method] -> IO ()Source

Export the given functions under the given ObjectPath and InterfaceName. The functions may accept/return any types that are instances of IsValue; see AutoSignature.

sayHello :: Text -> IO Text
sayHello name = return (concat ["Hello ", name, "!"])

export client "/hello_world"
    [ method "com.example.HelloWorld" "Hello" sayHello
    ]

throwError :: ErrorName -> Text -> [Variant] -> IO aSource

Normally, any exceptions raised while executing a method will be given the generic "org.freedesktop.DBus.Error.Failed" name. throwError allows the programmer to specify an error name, and provide additional information to the remote application. You may use this instead of throwIO to abort a method call.

Re-exported modules

module DBus.Types