dbus-client-0.3: D-Bus client libraries





data Client Source

Clients are opaque handles to an open connection and other internal state.

mkClient :: (Connection, BusName) -> IO ClientSource

Create a new Client from an open connection and bus name. The weird

Sending messages

call :: Client -> MethodCall -> (Error -> IO ()) -> (MethodReturn -> IO ()) -> IO ()Source

Perform an asynchronous method call. One of the provided computations will be performed depending on what message type the destination sends back.

callBlocking :: Client -> MethodCall -> IO (Either Error MethodReturn)Source

Similar to call, except that it waits for the reply and returns it in the current IO thread.

callBlocking_ :: Client -> MethodCall -> IO MethodReturnSource

Similar to callBlocking, except that an exception is raised if the destination sends back an error.

Emitting signals

Name reservation

requestName :: Client -> BusName -> [RequestNameFlag] -> IO RequestNameReplySource

A client can request a "well-known" name from the bus. This allows messages sent to that name to be received by the client, without senders being aware of which application is actually handling requests.

A name may be requested for any client, using the given flags. The bus's reply will be returned, or an exception raised if the reply was invalid.

releaseName :: Client -> BusName -> IO ReleaseNameReplySource

Clients may also release names they've requested.

Receiving signals

onSignal :: Client -> MatchRule -> (BusName -> Signal -> IO ()) -> IO ()Source

Perform some computation every time this client receives a matching signal.

Remote objects and proxies

callProxy :: Client -> Proxy -> MemberName -> [Flag] -> [Variant] -> (Error -> IO ()) -> (MethodReturn -> IO ()) -> IO ()Source

As call, except that the proxy's information is used to build the message.

callProxyBlocking :: Client -> Proxy -> MemberName -> [Flag] -> [Variant] -> IO (Either Error MethodReturn)Source

As callBlocking, except that the proxy's information is used to build the message.

callProxyBlocking_ :: Client -> Proxy -> MemberName -> [Flag] -> [Variant] -> IO MethodReturnSource

As callBlocking_, except that the proxy's information is used to build the message.

Exporting local objects

export :: Client -> ObjectPath -> LocalObject -> IO ()Source

Export a set of interfaces on the bus. Whenever a method call is received which matches the object's path, interface, and member name, one of its members will be called.

Exported objects automatically implement the org.freedesktop.DBus.Introspectable interface.

Responding to method calls

replyReturn :: MethodCall -> [Variant] -> IO ()Source

Send a successful return reply for a method call.

replyError :: MethodCall -> ErrorName -> [Variant] -> IO ()Source

Send an error reply for a method call.