- data Client
- connectSystem :: IO Client
- connectSession :: IO Client
- connectStarter :: IO Client
- disconnect :: Client -> IO ()
- emit :: Client -> ObjectPath -> InterfaceName -> MemberName -> [Variant] -> IO ()
- data Proxy
- proxy :: Client -> BusName -> ObjectPath -> IO Proxy
- call :: Proxy -> InterfaceName -> MemberName -> [Variant] -> IO [Variant]
- listen :: Proxy -> InterfaceName -> MemberName -> (BusName -> Signal -> IO ()) -> IO ()
- data RequestNameFlag
- data RequestNameReply
- = PrimaryOwner
- | InQueue
- | Exists
- | AlreadyOwner
- data ReleaseNameReply
- = Released
- | NonExistent
- | NotOwner
- requestName :: Client -> BusName -> [RequestNameFlag] -> IO RequestNameReply
- releaseName :: Client -> BusName -> IO ReleaseNameReply
- data Method
- class AutoSignature a
- class AutoReply fun
- method :: (AutoSignature fun, AutoReply fun) => InterfaceName -> MemberName -> fun -> Method
- export :: Client -> ObjectPath -> [Method] -> IO ()
- throwError :: ErrorName -> Text -> [Variant] -> IO a
- module DBus.Types
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.
emit :: Client -> ObjectPath -> InterfaceName -> MemberName -> [Variant] -> IO ()Source
Proxies
call :: Proxy -> InterfaceName -> MemberName -> [Variant] -> IO [Variant]Source
Name reservation
requestName :: Client -> BusName -> [RequestNameFlag] -> IO RequestNameReplySource
releaseName :: Client -> BusName -> IO ReleaseNameReplySource
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.
AutoSignature (IO ()) | |
IsValue a => AutoSignature (IO a) | |
(IsValue a, AutoSignature fun) => AutoSignature (a -> fun) |
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.
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