Copyright | Will Thompson Iñaki García Etxebarria and Jonas Platte |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria |
Safe Haskell | None |
Language | Haskell2010 |
- Exported types
- Methods
- Overloaded methods
- addFilter
- call
- callFinish
- callSync
- callWithUnixFdList
- callWithUnixFdListFinish
- callWithUnixFdListSync
- close
- closeFinish
- closeSync
- emitSignal
- exportActionGroup
- exportMenuModel
- flush
- flushFinish
- flushSync
- getCapabilities
- getExitOnClose
- getFlags
- getGuid
- getLastSerial
- getPeerCredentials
- getStream
- getUniqueName
- isClosed
- new
- newFinish
- newForAddress
- newForAddressFinish
- newForAddressSync
- newSync
- registerObject
- registerSubtree
- removeFilter
- sendMessage
- sendMessageWithReply
- sendMessageWithReplyFinish
- sendMessageWithReplySync
- setExitOnClose
- signalSubscribe
- signalUnsubscribe
- startMessageProcessing
- unexportActionGroup
- unexportMenuModel
- unregisterObject
- unregisterSubtree
- Properties
- Signals
The DBusConnection
type is used for D-Bus connections to remote
peers such as a message buses. It is a low-level API that offers a
lot of flexibility. For instance, it lets you establish a connection
over any transport that can by represented as an IOStream
.
This class is rarely used directly in D-Bus clients. If you are writing
a D-Bus client, it is often easier to use the g_bus_own_name()
,
g_bus_watch_name()
or dBusProxyNewForBus
APIs.
As an exception to the usual GLib rule that a particular object must not
be used by two threads at the same time, DBusConnection
's methods may be
called from any thread. This is so that busGet
and busGetSync
can safely return the same DBusConnection
when called from any thread.
Most of the ways to obtain a DBusConnection
automatically initialize it
(i.e. connect to D-Bus): for instance, dBusConnectionNew
and
busGet
, and the synchronous versions of those methods, give you an
initialized connection. Language bindings for GIO should use
g_initable_new()
or g_async_initable_new_async()
, which also initialize the
connection.
If you construct an uninitialized DBusConnection
, such as via
g_object_new()
, you must initialize it via initableInit
or
asyncInitableInitAsync
before using its methods or properties.
Calling methods or accessing properties on a DBusConnection
that has not
completed initialization successfully is considered to be invalid, and leads
to undefined behaviour. In particular, if initialization fails with a
GError
, the only valid thing you can do with that DBusConnection
is to
free it with objectUnref
.
Here is an example for a D-Bus server: gdbus-example-server.c
Here is an example for exporting a subtree: gdbus-example-subtree.c
Here is an example for passing UNIX file descriptors: gdbus-unix-fd-client.c
Here is an example for exporting a Object
:
gdbus-example-export.c
Since: 2.26
Synopsis
- newtype DBusConnection = DBusConnection (ManagedPtr DBusConnection)
- class (GObject o, IsDescendantOf DBusConnection o) => IsDBusConnection o
- toDBusConnection :: (MonadIO m, IsDBusConnection o) => o -> m DBusConnection
- noDBusConnection :: Maybe DBusConnection
- dBusConnectionAddFilter :: (HasCallStack, MonadIO m, IsDBusConnection a) => a -> DBusMessageFilterFunction -> m Word32
- dBusConnectionCall :: (HasCallStack, MonadIO m, IsDBusConnection a, IsCancellable b) => a -> Maybe Text -> Text -> Text -> Text -> Maybe GVariant -> Maybe VariantType -> [DBusCallFlags] -> Int32 -> Maybe b -> Maybe AsyncReadyCallback -> m ()
- dBusConnectionCallFinish :: (HasCallStack, MonadIO m, IsDBusConnection a, IsAsyncResult b) => a -> b -> m GVariant
- dBusConnectionCallSync :: (HasCallStack, MonadIO m, IsDBusConnection a, IsCancellable b) => a -> Maybe Text -> Text -> Text -> Text -> Maybe GVariant -> Maybe VariantType -> [DBusCallFlags] -> Int32 -> Maybe b -> m GVariant
- dBusConnectionCallWithUnixFdList :: (HasCallStack, MonadIO m, IsDBusConnection a, IsUnixFDList b, IsCancellable c) => a -> Maybe Text -> Text -> Text -> Text -> Maybe GVariant -> Maybe VariantType -> [DBusCallFlags] -> Int32 -> Maybe b -> Maybe c -> Maybe AsyncReadyCallback -> m ()
- dBusConnectionCallWithUnixFdListFinish :: (HasCallStack, MonadIO m, IsDBusConnection a, IsAsyncResult b) => a -> b -> m (GVariant, UnixFDList)
- dBusConnectionCallWithUnixFdListSync :: (HasCallStack, MonadIO m, IsDBusConnection a, IsUnixFDList b, IsCancellable c) => a -> Maybe Text -> Text -> Text -> Text -> Maybe GVariant -> Maybe VariantType -> [DBusCallFlags] -> Int32 -> Maybe b -> Maybe c -> m (GVariant, UnixFDList)
- dBusConnectionClose :: (HasCallStack, MonadIO m, IsDBusConnection a, IsCancellable b) => a -> Maybe b -> Maybe AsyncReadyCallback -> m ()
- dBusConnectionCloseFinish :: (HasCallStack, MonadIO m, IsDBusConnection a, IsAsyncResult b) => a -> b -> m ()
- dBusConnectionCloseSync :: (HasCallStack, MonadIO m, IsDBusConnection a, IsCancellable b) => a -> Maybe b -> m ()
- dBusConnectionEmitSignal :: (HasCallStack, MonadIO m, IsDBusConnection a) => a -> Maybe Text -> Text -> Text -> Text -> Maybe GVariant -> m ()
- dBusConnectionExportActionGroup :: (HasCallStack, MonadIO m, IsDBusConnection a, IsActionGroup b) => a -> Text -> b -> m Word32
- dBusConnectionExportMenuModel :: (HasCallStack, MonadIO m, IsDBusConnection a, IsMenuModel b) => a -> Text -> b -> m Word32
- dBusConnectionFlush :: (HasCallStack, MonadIO m, IsDBusConnection a, IsCancellable b) => a -> Maybe b -> Maybe AsyncReadyCallback -> m ()
- dBusConnectionFlushFinish :: (HasCallStack, MonadIO m, IsDBusConnection a, IsAsyncResult b) => a -> b -> m ()
- dBusConnectionFlushSync :: (HasCallStack, MonadIO m, IsDBusConnection a, IsCancellable b) => a -> Maybe b -> m ()
- dBusConnectionGetCapabilities :: (HasCallStack, MonadIO m, IsDBusConnection a) => a -> m [DBusCapabilityFlags]
- dBusConnectionGetExitOnClose :: (HasCallStack, MonadIO m, IsDBusConnection a) => a -> m Bool
- dBusConnectionGetFlags :: (HasCallStack, MonadIO m, IsDBusConnection a) => a -> m [DBusConnectionFlags]
- dBusConnectionGetGuid :: (HasCallStack, MonadIO m, IsDBusConnection a) => a -> m Text
- dBusConnectionGetLastSerial :: (HasCallStack, MonadIO m, IsDBusConnection a) => a -> m Word32
- dBusConnectionGetPeerCredentials :: (HasCallStack, MonadIO m, IsDBusConnection a) => a -> m (Maybe Credentials)
- dBusConnectionGetStream :: (HasCallStack, MonadIO m, IsDBusConnection a) => a -> m IOStream
- dBusConnectionGetUniqueName :: (HasCallStack, MonadIO m, IsDBusConnection a) => a -> m (Maybe Text)
- dBusConnectionIsClosed :: (HasCallStack, MonadIO m, IsDBusConnection a) => a -> m Bool
- dBusConnectionNew :: (HasCallStack, MonadIO m, IsIOStream a, IsDBusAuthObserver b, IsCancellable c) => a -> Maybe Text -> [DBusConnectionFlags] -> Maybe b -> Maybe c -> Maybe AsyncReadyCallback -> m ()
- dBusConnectionNewFinish :: (HasCallStack, MonadIO m, IsAsyncResult a) => a -> m DBusConnection
- dBusConnectionNewForAddress :: (HasCallStack, MonadIO m, IsDBusAuthObserver a, IsCancellable b) => Text -> [DBusConnectionFlags] -> Maybe a -> Maybe b -> Maybe AsyncReadyCallback -> m ()
- dBusConnectionNewForAddressFinish :: (HasCallStack, MonadIO m, IsAsyncResult a) => a -> m DBusConnection
- dBusConnectionNewForAddressSync :: (HasCallStack, MonadIO m, IsDBusAuthObserver a, IsCancellable b) => Text -> [DBusConnectionFlags] -> Maybe a -> Maybe b -> m DBusConnection
- dBusConnectionNewSync :: (HasCallStack, MonadIO m, IsIOStream a, IsDBusAuthObserver b, IsCancellable c) => a -> Maybe Text -> [DBusConnectionFlags] -> Maybe b -> Maybe c -> m DBusConnection
- dBusConnectionRegisterObject :: (HasCallStack, MonadIO m, IsDBusConnection a) => a -> Text -> DBusInterfaceInfo -> Maybe (GClosure b) -> Maybe (GClosure c) -> Maybe (GClosure d) -> m Word32
- dBusConnectionRegisterSubtree :: (HasCallStack, MonadIO m, IsDBusConnection a) => a -> Text -> DBusSubtreeVTable -> [DBusSubtreeFlags] -> Ptr () -> DestroyNotify -> m Word32
- dBusConnectionRemoveFilter :: (HasCallStack, MonadIO m, IsDBusConnection a) => a -> Word32 -> m ()
- dBusConnectionSendMessage :: (HasCallStack, MonadIO m, IsDBusConnection a, IsDBusMessage b) => a -> b -> [DBusSendMessageFlags] -> m Word32
- dBusConnectionSendMessageWithReply :: (HasCallStack, MonadIO m, IsDBusConnection a, IsDBusMessage b, IsCancellable c) => a -> b -> [DBusSendMessageFlags] -> Int32 -> Maybe c -> Maybe AsyncReadyCallback -> m Word32
- dBusConnectionSendMessageWithReplyFinish :: (HasCallStack, MonadIO m, IsDBusConnection a, IsAsyncResult b) => a -> b -> m DBusMessage
- dBusConnectionSendMessageWithReplySync :: (HasCallStack, MonadIO m, IsDBusConnection a, IsDBusMessage b, IsCancellable c) => a -> b -> [DBusSendMessageFlags] -> Int32 -> Maybe c -> m (DBusMessage, Word32)
- dBusConnectionSetExitOnClose :: (HasCallStack, MonadIO m, IsDBusConnection a) => a -> Bool -> m ()
- dBusConnectionSignalSubscribe :: (HasCallStack, MonadIO m, IsDBusConnection a) => a -> Maybe Text -> Maybe Text -> Maybe Text -> Maybe Text -> Maybe Text -> [DBusSignalFlags] -> DBusSignalCallback -> m Word32
- dBusConnectionSignalUnsubscribe :: (HasCallStack, MonadIO m, IsDBusConnection a) => a -> Word32 -> m ()
- dBusConnectionStartMessageProcessing :: (HasCallStack, MonadIO m, IsDBusConnection a) => a -> m ()
- dBusConnectionUnexportActionGroup :: (HasCallStack, MonadIO m, IsDBusConnection a) => a -> Word32 -> m ()
- dBusConnectionUnexportMenuModel :: (HasCallStack, MonadIO m, IsDBusConnection a) => a -> Word32 -> m ()
- dBusConnectionUnregisterObject :: (HasCallStack, MonadIO m, IsDBusConnection a) => a -> Word32 -> m Bool
- dBusConnectionUnregisterSubtree :: (HasCallStack, MonadIO m, IsDBusConnection a) => a -> Word32 -> m Bool
- constructDBusConnectionAddress :: IsDBusConnection o => Text -> IO (GValueConstruct o)
- constructDBusConnectionAuthenticationObserver :: (IsDBusConnection o, IsDBusAuthObserver a) => a -> IO (GValueConstruct o)
- getDBusConnectionCapabilities :: (MonadIO m, IsDBusConnection o) => o -> m [DBusCapabilityFlags]
- getDBusConnectionClosed :: (MonadIO m, IsDBusConnection o) => o -> m Bool
- constructDBusConnectionExitOnClose :: IsDBusConnection o => Bool -> IO (GValueConstruct o)
- getDBusConnectionExitOnClose :: (MonadIO m, IsDBusConnection o) => o -> m Bool
- setDBusConnectionExitOnClose :: (MonadIO m, IsDBusConnection o) => o -> Bool -> m ()
- constructDBusConnectionFlags :: IsDBusConnection o => [DBusConnectionFlags] -> IO (GValueConstruct o)
- getDBusConnectionFlags :: (MonadIO m, IsDBusConnection o) => o -> m [DBusConnectionFlags]
- constructDBusConnectionGuid :: IsDBusConnection o => Text -> IO (GValueConstruct o)
- getDBusConnectionGuid :: (MonadIO m, IsDBusConnection o) => o -> m Text
- constructDBusConnectionStream :: (IsDBusConnection o, IsIOStream a) => a -> IO (GValueConstruct o)
- getDBusConnectionStream :: (MonadIO m, IsDBusConnection o) => o -> m IOStream
- getDBusConnectionUniqueName :: (MonadIO m, IsDBusConnection o) => o -> m (Maybe Text)
- type C_DBusConnectionClosedCallback = Ptr () -> CInt -> Ptr GError -> Ptr () -> IO ()
- type DBusConnectionClosedCallback = Bool -> Maybe GError -> IO ()
- afterDBusConnectionClosed :: (IsDBusConnection a, MonadIO m) => a -> DBusConnectionClosedCallback -> m SignalHandlerId
- genClosure_DBusConnectionClosed :: MonadIO m => DBusConnectionClosedCallback -> m (GClosure C_DBusConnectionClosedCallback)
- mk_DBusConnectionClosedCallback :: C_DBusConnectionClosedCallback -> IO (FunPtr C_DBusConnectionClosedCallback)
- noDBusConnectionClosedCallback :: Maybe DBusConnectionClosedCallback
- onDBusConnectionClosed :: (IsDBusConnection a, MonadIO m) => a -> DBusConnectionClosedCallback -> m SignalHandlerId
- wrap_DBusConnectionClosedCallback :: DBusConnectionClosedCallback -> C_DBusConnectionClosedCallback
Exported types
newtype DBusConnection Source #
Memory-managed wrapper type.
Instances
Eq DBusConnection Source # | |
Defined in GI.Gio.Objects.DBusConnection (==) :: DBusConnection -> DBusConnection -> Bool # (/=) :: DBusConnection -> DBusConnection -> Bool # | |
GObject DBusConnection Source # | |
Defined in GI.Gio.Objects.DBusConnection gobjectType :: IO GType # | |
IsGValue DBusConnection Source # | Convert |
Defined in GI.Gio.Objects.DBusConnection toGValue :: DBusConnection -> IO GValue # fromGValue :: GValue -> IO DBusConnection # | |
HasParentTypes DBusConnection Source # | |
Defined in GI.Gio.Objects.DBusConnection | |
type ParentTypes DBusConnection Source # | |
Defined in GI.Gio.Objects.DBusConnection |
class (GObject o, IsDescendantOf DBusConnection o) => IsDBusConnection o Source #
Type class for types which can be safely cast to DBusConnection
, for instance with toDBusConnection
.
Instances
(GObject o, IsDescendantOf DBusConnection o) => IsDBusConnection o Source # | |
Defined in GI.Gio.Objects.DBusConnection |
toDBusConnection :: (MonadIO m, IsDBusConnection o) => o -> m DBusConnection Source #
Cast to DBusConnection
, for types for which this is known to be safe. For general casts, use castTo
.
noDBusConnection :: Maybe DBusConnection Source #
A convenience alias for Nothing
:: Maybe
DBusConnection
.
Methods
Overloaded methods
addFilter
dBusConnectionAddFilter Source #
:: (HasCallStack, MonadIO m, IsDBusConnection a) | |
=> a |
|
-> DBusMessageFilterFunction |
|
-> m Word32 | Returns: a filter identifier that can be used with
|
Adds a message filter. Filters are handlers that are run on all incoming and outgoing messages, prior to standard dispatch. Filters are run in the order that they were added. The same handler can be added as a filter more than once, in which case it will be run more than once. Filters added during a filter callback won't be run on the message being processed. Filter functions are allowed to modify and even drop messages.
Note that filters are run in a dedicated message handling thread so
they can't block and, generally, can't do anything but signal a
worker thread. Also note that filters are rarely needed - use API
such as dBusConnectionSendMessageWithReply
,
dBusConnectionSignalSubscribe
or dBusConnectionCall
instead.
If a filter consumes an incoming message the message is not
dispatched anywhere else - not even the standard dispatch machinery
(that API such as dBusConnectionSignalSubscribe
and
dBusConnectionSendMessageWithReply
relies on) will see the
message. Similarly, if a filter consumes an outgoing message, the
message will not be sent to the other peer.
If userDataFreeFunc
is non-Nothing
, it will be called (in the
thread-default main context of the thread you are calling this
method from) at some point after userData
is no longer
needed. (It is not guaranteed to be called synchronously when the
filter is removed, and may be called after connection
has been
destroyed.)
Since: 2.26
call
:: (HasCallStack, MonadIO m, IsDBusConnection a, IsCancellable b) | |
=> a |
|
-> Maybe Text |
|
-> Text |
|
-> Text |
|
-> Text |
|
-> Maybe GVariant |
|
-> Maybe VariantType |
|
-> [DBusCallFlags] |
|
-> Int32 |
|
-> Maybe b |
|
-> Maybe AsyncReadyCallback |
|
-> m () |
Asynchronously invokes the methodName
method on the
interfaceName
D-Bus interface on the remote object at
objectPath
owned by busName
.
If connection
is closed then the operation will fail with
IOErrorEnumClosed
. If cancellable
is canceled, the operation will
fail with IOErrorEnumCancelled
. If parameters
contains a value
not compatible with the D-Bus protocol, the operation fails with
IOErrorEnumInvalidArgument
.
If replyType
is non-Nothing
then the reply will be checked for having this type and an
error will be raised if it does not match. Said another way, if you give a replyType
then any non-Nothing
return value will be of this type. Unless it’s
G_VARIANT_TYPE_UNIT
, the replyType
will be a tuple containing one or more
values.
If the parameters
GVariant
is floating, it is consumed. This allows
convenient 'inline' use of g_variant_new()
, e.g.:
C code
g_dbus_connection_call (connection, "org.freedesktop.StringThings", "/org/freedesktop/StringThings", "org.freedesktop.StringThings", "TwoStrings", g_variant_new ("(ss)", "Thing One", "Thing Two"), NULL, G_DBUS_CALL_FLAGS_NONE, -1, NULL, (GAsyncReadyCallback) two_strings_done, NULL);
This is an asynchronous method. When the operation is finished,
callback
will be invoked in the
[thread-default main context][g-main-context-push-thread-default]
of the thread you are calling this method from. You can then call
dBusConnectionCallFinish
to get the result of the operation.
See dBusConnectionCallSync
for the synchronous version of this
function.
If callback
is Nothing
then the D-Bus method call message will be sent with
the DBusMessageFlagsNoReplyExpected
flag set.
Since: 2.26
callFinish
dBusConnectionCallFinish Source #
:: (HasCallStack, MonadIO m, IsDBusConnection a, IsAsyncResult b) | |
=> a |
|
-> b |
|
-> m GVariant | Returns: |
Finishes an operation started with dBusConnectionCall
.
Since: 2.26
callSync
dBusConnectionCallSync Source #
:: (HasCallStack, MonadIO m, IsDBusConnection a, IsCancellable b) | |
=> a |
|
-> Maybe Text |
|
-> Text |
|
-> Text |
|
-> Text |
|
-> Maybe GVariant |
|
-> Maybe VariantType |
|
-> [DBusCallFlags] |
|
-> Int32 |
|
-> Maybe b |
|
-> m GVariant | Returns: |
Synchronously invokes the methodName
method on the
interfaceName
D-Bus interface on the remote object at
objectPath
owned by busName
.
If connection
is closed then the operation will fail with
IOErrorEnumClosed
. If cancellable
is canceled, the
operation will fail with IOErrorEnumCancelled
. If parameters
contains a value not compatible with the D-Bus protocol, the operation
fails with IOErrorEnumInvalidArgument
.
If replyType
is non-Nothing
then the reply will be checked for having
this type and an error will be raised if it does not match. Said
another way, if you give a replyType
then any non-Nothing
return
value will be of this type.
If the parameters
GVariant
is floating, it is consumed.
This allows convenient 'inline' use of g_variant_new()
, e.g.:
C code
g_dbus_connection_call_sync (connection, "org.freedesktop.StringThings", "/org/freedesktop/StringThings", "org.freedesktop.StringThings", "TwoStrings", g_variant_new ("(ss)", "Thing One", "Thing Two"), NULL, G_DBUS_CALL_FLAGS_NONE, -1, NULL, &error);
The calling thread is blocked until a reply is received. See
dBusConnectionCall
for the asynchronous version of
this method.
Since: 2.26
callWithUnixFdList
dBusConnectionCallWithUnixFdList Source #
:: (HasCallStack, MonadIO m, IsDBusConnection a, IsUnixFDList b, IsCancellable c) | |
=> a |
|
-> Maybe Text |
|
-> Text |
|
-> Text |
|
-> Text |
|
-> Maybe GVariant |
|
-> Maybe VariantType |
|
-> [DBusCallFlags] |
|
-> Int32 |
|
-> Maybe b |
|
-> Maybe c |
|
-> Maybe AsyncReadyCallback |
|
-> m () |
Like dBusConnectionCall
but also takes a UnixFDList
object.
This method is only available on UNIX.
Since: 2.30
callWithUnixFdListFinish
dBusConnectionCallWithUnixFdListFinish Source #
:: (HasCallStack, MonadIO m, IsDBusConnection a, IsAsyncResult b) | |
=> a |
|
-> b |
|
-> m (GVariant, UnixFDList) | Returns: |
Finishes an operation started with dBusConnectionCallWithUnixFdList
.
Since: 2.30
callWithUnixFdListSync
dBusConnectionCallWithUnixFdListSync Source #
:: (HasCallStack, MonadIO m, IsDBusConnection a, IsUnixFDList b, IsCancellable c) | |
=> a |
|
-> Maybe Text |
|
-> Text |
|
-> Text |
|
-> Text |
|
-> Maybe GVariant |
|
-> Maybe VariantType |
|
-> [DBusCallFlags] |
|
-> Int32 |
|
-> Maybe b |
|
-> Maybe c |
|
-> m (GVariant, UnixFDList) | Returns: |
Like dBusConnectionCallSync
but also takes and returns UnixFDList
objects.
This method is only available on UNIX.
Since: 2.30
close
:: (HasCallStack, MonadIO m, IsDBusConnection a, IsCancellable b) | |
=> a |
|
-> Maybe b |
|
-> Maybe AsyncReadyCallback |
|
-> m () |
Closes connection
. Note that this never causes the process to
exit (this might only happen if the other end of a shared message
bus connection disconnects, see DBusConnection
:exit-on-close
).
Once the connection is closed, operations such as sending a message
will return with the error IOErrorEnumClosed
. Closing a connection
will not automatically flush the connection so queued messages may
be lost. Use dBusConnectionFlush
if you need such guarantees.
If connection
is already closed, this method fails with
IOErrorEnumClosed
.
When connection
has been closed, the closed
signal is emitted in the
[thread-default main context][g-main-context-push-thread-default]
of the thread that connection
was constructed in.
This is an asynchronous method. When the operation is finished,
callback
will be invoked in the
[thread-default main context][g-main-context-push-thread-default]
of the thread you are calling this method from. You can
then call dBusConnectionCloseFinish
to get the result of the
operation. See dBusConnectionCloseSync
for the synchronous
version.
Since: 2.26
closeFinish
dBusConnectionCloseFinish Source #
:: (HasCallStack, MonadIO m, IsDBusConnection a, IsAsyncResult b) | |
=> a |
|
-> b |
|
-> m () | (Can throw |
Finishes an operation started with dBusConnectionClose
.
Since: 2.26
closeSync
dBusConnectionCloseSync Source #
:: (HasCallStack, MonadIO m, IsDBusConnection a, IsCancellable b) | |
=> a |
|
-> Maybe b |
|
-> m () | (Can throw |
Synchronously closes connection
. The calling thread is blocked
until this is done. See dBusConnectionClose
for the
asynchronous version of this method and more details about what it
does.
Since: 2.26
emitSignal
dBusConnectionEmitSignal Source #
:: (HasCallStack, MonadIO m, IsDBusConnection a) | |
=> a |
|
-> Maybe Text |
|
-> Text |
|
-> Text |
|
-> Text |
|
-> Maybe GVariant |
|
-> m () | (Can throw |
Emits a signal.
If the parameters GVariant is floating, it is consumed.
This can only fail if parameters
is not compatible with the D-Bus protocol
(IOErrorEnumInvalidArgument
), or if connection
has been closed
(IOErrorEnumClosed
).
Since: 2.26
exportActionGroup
dBusConnectionExportActionGroup Source #
:: (HasCallStack, MonadIO m, IsDBusConnection a, IsActionGroup b) | |
=> a |
|
-> Text |
|
-> b |
|
-> m Word32 | Returns: the ID of the export (never zero), or 0 in case of failure (Can throw |
Exports actionGroup
on connection
at objectPath
.
The implemented D-Bus API should be considered private. It is subject to change in the future.
A given object path can only have one action group exported on it.
If this constraint is violated, the export will fail and 0 will be
returned (with error
set accordingly).
You can unexport the action group using
dBusConnectionUnexportActionGroup
with the return value of
this function.
The thread default main context is taken at the time of this call. All incoming action activations and state change requests are reported from this context. Any changes on the action group that cause it to emit signals must also come from this same context. Since incoming action activations and state change requests are rather likely to cause changes on the action group, this effectively limits a given action group to being exported from only one main context.
Since: 2.32
exportMenuModel
dBusConnectionExportMenuModel Source #
:: (HasCallStack, MonadIO m, IsDBusConnection a, IsMenuModel b) | |
=> a |
|
-> Text |
|
-> b |
|
-> m Word32 | Returns: the ID of the export (never zero), or 0 in case of failure (Can throw |
Exports menu
on connection
at objectPath
.
The implemented D-Bus API should be considered private. It is subject to change in the future.
An object path can only have one menu model exported on it. If this
constraint is violated, the export will fail and 0 will be
returned (with error
set accordingly).
You can unexport the menu model using
dBusConnectionUnexportMenuModel
with the return value of
this function.
Since: 2.32
flush
:: (HasCallStack, MonadIO m, IsDBusConnection a, IsCancellable b) | |
=> a |
|
-> Maybe b |
|
-> Maybe AsyncReadyCallback |
|
-> m () |
Asynchronously flushes connection
, that is, writes all queued
outgoing message to the transport and then flushes the transport
(using outputStreamFlushAsync
). This is useful in programs
that wants to emit a D-Bus signal and then exit immediately. Without
flushing the connection, there is no guaranteed that the message has
been sent to the networking buffers in the OS kernel.
This is an asynchronous method. When the operation is finished,
callback
will be invoked in the
[thread-default main context][g-main-context-push-thread-default]
of the thread you are calling this method from. You can
then call dBusConnectionFlushFinish
to get the result of the
operation. See dBusConnectionFlushSync
for the synchronous
version.
Since: 2.26
flushFinish
dBusConnectionFlushFinish Source #
:: (HasCallStack, MonadIO m, IsDBusConnection a, IsAsyncResult b) | |
=> a |
|
-> b |
|
-> m () | (Can throw |
Finishes an operation started with dBusConnectionFlush
.
Since: 2.26
flushSync
dBusConnectionFlushSync Source #
:: (HasCallStack, MonadIO m, IsDBusConnection a, IsCancellable b) | |
=> a |
|
-> Maybe b |
|
-> m () | (Can throw |
Synchronously flushes connection
. The calling thread is blocked
until this is done. See dBusConnectionFlush
for the
asynchronous version of this method and more details about what it
does.
Since: 2.26
getCapabilities
dBusConnectionGetCapabilities Source #
:: (HasCallStack, MonadIO m, IsDBusConnection a) | |
=> a |
|
-> m [DBusCapabilityFlags] | Returns: zero or more flags from the |
Gets the capabilities negotiated with the remote peer
Since: 2.26
getExitOnClose
dBusConnectionGetExitOnClose Source #
:: (HasCallStack, MonadIO m, IsDBusConnection a) | |
=> a |
|
-> m Bool | Returns: whether the process is terminated when |
Gets whether the process is terminated when connection
is
closed by the remote peer. See
DBusConnection
:exit-on-close
for more details.
Since: 2.26
getFlags
dBusConnectionGetFlags Source #
:: (HasCallStack, MonadIO m, IsDBusConnection a) | |
=> a |
|
-> m [DBusConnectionFlags] | Returns: zero or more flags from the |
Gets the flags used to construct this connection
Since: 2.60
getGuid
dBusConnectionGetGuid Source #
:: (HasCallStack, MonadIO m, IsDBusConnection a) | |
=> a |
|
-> m Text | Returns: The GUID. Do not free this string, it is owned by
|
The GUID of the peer performing the role of server when
authenticating. See DBusConnection
:guid
for more details.
Since: 2.26
getLastSerial
dBusConnectionGetLastSerial Source #
:: (HasCallStack, MonadIO m, IsDBusConnection a) | |
=> a |
|
-> m Word32 | Returns: the last used serial or zero when no message has been sent within the current thread |
Retrieves the last serial number assigned to a DBusMessage
on
the current thread. This includes messages sent via both low-level
API such as dBusConnectionSendMessage
as well as
high-level API such as dBusConnectionEmitSignal
,
dBusConnectionCall
or dBusProxyCall
.
Since: 2.34
getPeerCredentials
dBusConnectionGetPeerCredentials Source #
:: (HasCallStack, MonadIO m, IsDBusConnection a) | |
=> a |
|
-> m (Maybe Credentials) | Returns: a |
Gets the credentials of the authenticated peer. This will always
return Nothing
unless connection
acted as a server
(e.g. DBusConnectionFlagsAuthenticationServer
was passed)
when set up and the client passed credentials as part of the
authentication process.
In a message bus setup, the message bus is always the server and
each application is a client. So this method will always return
Nothing
for message bus clients.
Since: 2.26
getStream
dBusConnectionGetStream Source #
:: (HasCallStack, MonadIO m, IsDBusConnection a) | |
=> a |
|
-> m IOStream | Returns: the stream used for IO |
Gets the underlying stream used for IO.
While the DBusConnection
is active, it will interact with this
stream from a worker thread, so it is not safe to interact with
the stream directly.
Since: 2.26
getUniqueName
dBusConnectionGetUniqueName Source #
:: (HasCallStack, MonadIO m, IsDBusConnection a) | |
=> a |
|
-> m (Maybe Text) | Returns: the unique name or |
Gets the unique name of connection
as assigned by the message
bus. This can also be used to figure out if connection
is a
message bus connection.
Since: 2.26
isClosed
dBusConnectionIsClosed Source #
:: (HasCallStack, MonadIO m, IsDBusConnection a) | |
=> a |
|
-> m Bool |
Gets whether connection
is closed.
Since: 2.26
new
:: (HasCallStack, MonadIO m, IsIOStream a, IsDBusAuthObserver b, IsCancellable c) | |
=> a |
|
-> Maybe Text |
|
-> [DBusConnectionFlags] |
|
-> Maybe b |
|
-> Maybe c |
|
-> Maybe AsyncReadyCallback |
|
-> m () |
Asynchronously sets up a D-Bus connection for exchanging D-Bus messages
with the end represented by stream
.
If stream
is a SocketConnection
, then the corresponding Socket
will be put into non-blocking mode.
The D-Bus connection will interact with stream
from a worker thread.
As a result, the caller should not interact with stream
after this
method has been called, except by calling objectUnref
on it.
If observer
is not Nothing
it may be used to control the
authentication process.
When the operation is finished, callback
will be invoked. You can
then call dBusConnectionNewFinish
to get the result of the
operation.
This is a asynchronous failable constructor. See
dBusConnectionNewSync
for the synchronous
version.
Since: 2.26
newFinish
dBusConnectionNewFinish Source #
:: (HasCallStack, MonadIO m, IsAsyncResult a) | |
=> a |
|
-> m DBusConnection | Returns: a |
Finishes an operation started with dBusConnectionNew
.
Since: 2.26
newForAddress
dBusConnectionNewForAddress Source #
:: (HasCallStack, MonadIO m, IsDBusAuthObserver a, IsCancellable b) | |
=> Text |
|
-> [DBusConnectionFlags] |
|
-> Maybe a |
|
-> Maybe b |
|
-> Maybe AsyncReadyCallback |
|
-> m () |
Asynchronously connects and sets up a D-Bus client connection for
exchanging D-Bus messages with an endpoint specified by address
which must be in the
D-Bus address format.
This constructor can only be used to initiate client-side
connections - use dBusConnectionNew
if you need to act as the
server. In particular, flags
cannot contain the
DBusConnectionFlagsAuthenticationServer
or
DBusConnectionFlagsAuthenticationAllowAnonymous
flags.
When the operation is finished, callback
will be invoked. You can
then call dBusConnectionNewFinish
to get the result of the
operation.
If observer
is not Nothing
it may be used to control the
authentication process.
This is a asynchronous failable constructor. See
dBusConnectionNewForAddressSync
for the synchronous
version.
Since: 2.26
newForAddressFinish
dBusConnectionNewForAddressFinish Source #
:: (HasCallStack, MonadIO m, IsAsyncResult a) | |
=> a |
|
-> m DBusConnection | Returns: a |
Finishes an operation started with dBusConnectionNewForAddress
.
Since: 2.26
newForAddressSync
dBusConnectionNewForAddressSync Source #
:: (HasCallStack, MonadIO m, IsDBusAuthObserver a, IsCancellable b) | |
=> Text |
|
-> [DBusConnectionFlags] |
|
-> Maybe a |
|
-> Maybe b |
|
-> m DBusConnection | Returns: a |
Synchronously connects and sets up a D-Bus client connection for
exchanging D-Bus messages with an endpoint specified by address
which must be in the
D-Bus address format.
This constructor can only be used to initiate client-side
connections - use dBusConnectionNewSync
if you need to act
as the server. In particular, flags
cannot contain the
DBusConnectionFlagsAuthenticationServer
or
DBusConnectionFlagsAuthenticationAllowAnonymous
flags.
This is a synchronous failable constructor. See
dBusConnectionNewForAddress
for the asynchronous version.
If observer
is not Nothing
it may be used to control the
authentication process.
Since: 2.26
newSync
dBusConnectionNewSync Source #
:: (HasCallStack, MonadIO m, IsIOStream a, IsDBusAuthObserver b, IsCancellable c) | |
=> a |
|
-> Maybe Text |
|
-> [DBusConnectionFlags] |
|
-> Maybe b |
|
-> Maybe c |
|
-> m DBusConnection | Returns: a |
Synchronously sets up a D-Bus connection for exchanging D-Bus messages
with the end represented by stream
.
If stream
is a SocketConnection
, then the corresponding Socket
will be put into non-blocking mode.
The D-Bus connection will interact with stream
from a worker thread.
As a result, the caller should not interact with stream
after this
method has been called, except by calling objectUnref
on it.
If observer
is not Nothing
it may be used to control the
authentication process.
This is a synchronous failable constructor. See
dBusConnectionNew
for the asynchronous version.
Since: 2.26
registerObject
dBusConnectionRegisterObject Source #
:: (HasCallStack, MonadIO m, IsDBusConnection a) | |
=> a |
|
-> Text |
|
-> DBusInterfaceInfo |
|
-> Maybe (GClosure b) |
|
-> Maybe (GClosure c) |
|
-> Maybe (GClosure d) |
|
-> m Word32 | Returns: 0 if |
Version of g_dbus_connection_register_object()
using closures instead of a
DBusInterfaceVTable
for easier binding in other languages.
Since: 2.46
registerSubtree
dBusConnectionRegisterSubtree Source #
:: (HasCallStack, MonadIO m, IsDBusConnection a) | |
=> a |
|
-> Text |
|
-> DBusSubtreeVTable |
|
-> [DBusSubtreeFlags] |
|
-> Ptr () |
|
-> DestroyNotify |
|
-> m Word32 | Returns: 0 if |
Registers a whole subtree of dynamic objects.
The enumerate
and introspection
functions in vtable
are used to
convey, to remote callers, what nodes exist in the subtree rooted
by objectPath
.
When handling remote calls into any node in the subtree, first the
enumerate
function is used to check if the node exists. If the node exists
or the G_DBUS_SUBTREE_FLAGS_DISPATCH_TO_UNENUMERATED_NODES
flag is set
the introspection
function is used to check if the node supports the
requested method. If so, the dispatch
function is used to determine
where to dispatch the call. The collected DBusInterfaceVTable
and
gpointer
will be used to call into the interface vtable for processing
the request.
All calls into user-provided code will be invoked in the [thread-default main context][g-main-context-push-thread-default] of the thread you are calling this method from.
If an existing subtree is already registered at objectPath
or
then error
is set to G_IO_ERROR_EXISTS
.
Note that it is valid to register regular objects (using
g_dbus_connection_register_object()
) in a subtree registered with
dBusConnectionRegisterSubtree
- if so, the subtree handler
is tried as the last resort. One way to think about a subtree
handler is to consider it a fallback handler for object paths not
registered via g_dbus_connection_register_object()
or other bindings.
Note that vtable
will be copied so you cannot change it after
registration.
See this [server][gdbus-subtree-server] for an example of how to use this method.
Since: 2.26
removeFilter
dBusConnectionRemoveFilter Source #
:: (HasCallStack, MonadIO m, IsDBusConnection a) | |
=> a |
|
-> Word32 |
|
-> m () |
Removes a filter.
Note that since filters run in a different thread, there is a race
condition where it is possible that the filter will be running even
after calling dBusConnectionRemoveFilter
, so you cannot just
free data that the filter might be using. Instead, you should pass
a DestroyNotify
to dBusConnectionAddFilter
, which will be
called when it is guaranteed that the data is no longer needed.
Since: 2.26
sendMessage
dBusConnectionSendMessage Source #
:: (HasCallStack, MonadIO m, IsDBusConnection a, IsDBusMessage b) | |
=> a |
|
-> b |
|
-> [DBusSendMessageFlags] |
|
-> m Word32 | (Can throw |
Asynchronously sends message
to the peer represented by connection
.
Unless flags
contain the
DBusSendMessageFlagsPreserveSerial
flag, the serial number
will be assigned by connection
and set on message
via
dBusMessageSetSerial
. If outSerial
is not Nothing
, then the
serial number used will be written to this location prior to
submitting the message to the underlying transport.
If connection
is closed then the operation will fail with
IOErrorEnumClosed
. If message
is not well-formed,
the operation fails with IOErrorEnumInvalidArgument
.
See this [server][gdbus-server] and [client][gdbus-unix-fd-client] for an example of how to use this low-level API to send and receive UNIX file descriptors.
Note that message
must be unlocked, unless flags
contain the
DBusSendMessageFlagsPreserveSerial
flag.
Since: 2.26
sendMessageWithReply
dBusConnectionSendMessageWithReply Source #
:: (HasCallStack, MonadIO m, IsDBusConnection a, IsDBusMessage b, IsCancellable c) | |
=> a |
|
-> b |
|
-> [DBusSendMessageFlags] |
|
-> Int32 |
|
-> Maybe c |
|
-> Maybe AsyncReadyCallback |
|
-> m Word32 |
Asynchronously sends message
to the peer represented by connection
.
Unless flags
contain the
DBusSendMessageFlagsPreserveSerial
flag, the serial number
will be assigned by connection
and set on message
via
dBusMessageSetSerial
. If outSerial
is not Nothing
, then the
serial number used will be written to this location prior to
submitting the message to the underlying transport.
If connection
is closed then the operation will fail with
IOErrorEnumClosed
. If cancellable
is canceled, the operation will
fail with IOErrorEnumCancelled
. If message
is not well-formed,
the operation fails with IOErrorEnumInvalidArgument
.
This is an asynchronous method. When the operation is finished, callback
will be invoked in the
[thread-default main context][g-main-context-push-thread-default]
of the thread you are calling this method from. You can then call
dBusConnectionSendMessageWithReplyFinish
to get the result of the operation.
See dBusConnectionSendMessageWithReplySync
for the synchronous version.
Note that message
must be unlocked, unless flags
contain the
DBusSendMessageFlagsPreserveSerial
flag.
See this [server][gdbus-server] and [client][gdbus-unix-fd-client] for an example of how to use this low-level API to send and receive UNIX file descriptors.
Since: 2.26
sendMessageWithReplyFinish
dBusConnectionSendMessageWithReplyFinish Source #
:: (HasCallStack, MonadIO m, IsDBusConnection a, IsAsyncResult b) | |
=> a |
|
-> b |
|
-> m DBusMessage | Returns: a locked |
Finishes an operation started with dBusConnectionSendMessageWithReply
.
Note that error
is only set if a local in-process error
occurred. That is to say that the returned DBusMessage
object may
be of type DBusMessageTypeError
. Use
dBusMessageToGerror
to transcode this to a GError
.
See this [server][gdbus-server] and [client][gdbus-unix-fd-client] for an example of how to use this low-level API to send and receive UNIX file descriptors.
Since: 2.26
sendMessageWithReplySync
dBusConnectionSendMessageWithReplySync Source #
:: (HasCallStack, MonadIO m, IsDBusConnection a, IsDBusMessage b, IsCancellable c) | |
=> a |
|
-> b |
|
-> [DBusSendMessageFlags] |
|
-> Int32 |
|
-> Maybe c |
|
-> m (DBusMessage, Word32) | Returns: a locked |
Synchronously sends message
to the peer represented by connection
and blocks the calling thread until a reply is received or the
timeout is reached. See dBusConnectionSendMessageWithReply
for the asynchronous version of this method.
Unless flags
contain the
DBusSendMessageFlagsPreserveSerial
flag, the serial number
will be assigned by connection
and set on message
via
dBusMessageSetSerial
. If outSerial
is not Nothing
, then the
serial number used will be written to this location prior to
submitting the message to the underlying transport.
If connection
is closed then the operation will fail with
IOErrorEnumClosed
. If cancellable
is canceled, the operation will
fail with IOErrorEnumCancelled
. If message
is not well-formed,
the operation fails with IOErrorEnumInvalidArgument
.
Note that error
is only set if a local in-process error
occurred. That is to say that the returned DBusMessage
object may
be of type DBusMessageTypeError
. Use
dBusMessageToGerror
to transcode this to a GError
.
See this [server][gdbus-server] and [client][gdbus-unix-fd-client] for an example of how to use this low-level API to send and receive UNIX file descriptors.
Note that message
must be unlocked, unless flags
contain the
DBusSendMessageFlagsPreserveSerial
flag.
Since: 2.26
setExitOnClose
dBusConnectionSetExitOnClose Source #
:: (HasCallStack, MonadIO m, IsDBusConnection a) | |
=> a |
|
-> Bool |
|
-> m () |
Sets whether the process should be terminated when connection
is
closed by the remote peer. See DBusConnection
:exit-on-close
for
more details.
Note that this function should be used with care. Most modern UNIX
desktops tie the notion of a user session the session bus, and expect
all of a users applications to quit when their bus connection goes away.
If you are setting exitOnClose
to False
for the shared session
bus connection, you should make sure that your application exits
when the user session ends.
Since: 2.26
signalSubscribe
dBusConnectionSignalSubscribe Source #
:: (HasCallStack, MonadIO m, IsDBusConnection a) | |
=> a |
|
-> Maybe Text |
|
-> Maybe Text |
|
-> Maybe Text |
|
-> Maybe Text |
|
-> Maybe Text |
|
-> [DBusSignalFlags] |
|
-> DBusSignalCallback |
|
-> m Word32 | Returns: a subscription identifier that can be used with |
Subscribes to signals on connection
and invokes callback
with a whenever
the signal is received. Note that callback
will be invoked in the
[thread-default main context][g-main-context-push-thread-default]
of the thread you are calling this method from.
If connection
is not a message bus connection, sender
must be
Nothing
.
If sender
is a well-known name note that callback
is invoked with
the unique name for the owner of sender
, not the well-known name
as one would expect. This is because the message bus rewrites the
name. As such, to avoid certain race conditions, users should be
tracking the name owner of the well-known name and use that when
processing the received signal.
If one of DBusSignalFlagsMatchArg0Namespace
or
DBusSignalFlagsMatchArg0Path
are given, arg0
is
interpreted as part of a namespace or path. The first argument
of a signal is matched against that part as specified by D-Bus.
If userDataFreeFunc
is non-Nothing
, it will be called (in the
thread-default main context of the thread you are calling this
method from) at some point after userData
is no longer
needed. (It is not guaranteed to be called synchronously when the
signal is unsubscribed from, and may be called after connection
has been destroyed.)
The returned subscription identifier is an opaque value which is guaranteed to never be zero.
This function can never fail.
Since: 2.26
signalUnsubscribe
dBusConnectionSignalUnsubscribe Source #
:: (HasCallStack, MonadIO m, IsDBusConnection a) | |
=> a |
|
-> Word32 |
|
-> m () |
Unsubscribes from signals.
Since: 2.26
startMessageProcessing
dBusConnectionStartMessageProcessing Source #
:: (HasCallStack, MonadIO m, IsDBusConnection a) | |
=> a |
|
-> m () |
If connection
was created with
DBusConnectionFlagsDelayMessageProcessing
, this method
starts processing messages. Does nothing on if connection
wasn't
created with this flag or if the method has already been called.
Since: 2.26
unexportActionGroup
dBusConnectionUnexportActionGroup Source #
:: (HasCallStack, MonadIO m, IsDBusConnection a) | |
=> a |
|
-> Word32 |
|
-> m () |
Reverses the effect of a previous call to
dBusConnectionExportActionGroup
.
It is an error to call this function with an ID that wasn't returned
from dBusConnectionExportActionGroup
or to call it with the
same ID more than once.
Since: 2.32
unexportMenuModel
dBusConnectionUnexportMenuModel Source #
:: (HasCallStack, MonadIO m, IsDBusConnection a) | |
=> a |
|
-> Word32 |
|
-> m () |
Reverses the effect of a previous call to
dBusConnectionExportMenuModel
.
It is an error to call this function with an ID that wasn't returned
from dBusConnectionExportMenuModel
or to call it with the
same ID more than once.
Since: 2.32
unregisterObject
dBusConnectionUnregisterObject Source #
:: (HasCallStack, MonadIO m, IsDBusConnection a) | |
=> a |
|
-> Word32 |
|
-> m Bool | Returns: |
Unregisters an object.
Since: 2.26
unregisterSubtree
dBusConnectionUnregisterSubtree Source #
:: (HasCallStack, MonadIO m, IsDBusConnection a) | |
=> a |
|
-> Word32 |
|
-> m Bool | Returns: |
Unregisters a subtree.
Since: 2.26
Properties
address
A D-Bus address specifying potential endpoints that can be used when establishing the connection.
Since: 2.26
constructDBusConnectionAddress :: IsDBusConnection o => Text -> IO (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “address
” property. This is rarely needed directly, but it is used by new
.
authenticationObserver
A DBusAuthObserver
object to assist in the authentication process or Nothing
.
Since: 2.26
constructDBusConnectionAuthenticationObserver :: (IsDBusConnection o, IsDBusAuthObserver a) => a -> IO (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “authentication-observer
” property. This is rarely needed directly, but it is used by new
.
capabilities
Flags from the DBusCapabilityFlags
enumeration
representing connection features negotiated with the other peer.
Since: 2.26
getDBusConnectionCapabilities :: (MonadIO m, IsDBusConnection o) => o -> m [DBusCapabilityFlags] Source #
Get the value of the “capabilities
” property.
When overloading is enabled, this is equivalent to
get
dBusConnection #capabilities
closed
A boolean specifying whether the connection has been closed.
Since: 2.26
getDBusConnectionClosed :: (MonadIO m, IsDBusConnection o) => o -> m Bool Source #
Get the value of the “closed
” property.
When overloading is enabled, this is equivalent to
get
dBusConnection #closed
exitOnClose
A boolean specifying whether the process will be terminated (by
calling raise(SIGTERM)
) if the connection is closed by the
remote peer.
Note that DBusConnection
objects returned by busGetFinish
and busGetSync
will (usually) have this property set to True
.
Since: 2.26
constructDBusConnectionExitOnClose :: IsDBusConnection o => Bool -> IO (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “exit-on-close
” property. This is rarely needed directly, but it is used by new
.
getDBusConnectionExitOnClose :: (MonadIO m, IsDBusConnection o) => o -> m Bool Source #
Get the value of the “exit-on-close
” property.
When overloading is enabled, this is equivalent to
get
dBusConnection #exitOnClose
setDBusConnectionExitOnClose :: (MonadIO m, IsDBusConnection o) => o -> Bool -> m () Source #
Set the value of the “exit-on-close
” property.
When overloading is enabled, this is equivalent to
set
dBusConnection [ #exitOnClose:=
value ]
flags
Flags from the DBusConnectionFlags
enumeration.
Since: 2.26
constructDBusConnectionFlags :: IsDBusConnection o => [DBusConnectionFlags] -> IO (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “flags
” property. This is rarely needed directly, but it is used by new
.
getDBusConnectionFlags :: (MonadIO m, IsDBusConnection o) => o -> m [DBusConnectionFlags] Source #
Get the value of the “flags
” property.
When overloading is enabled, this is equivalent to
get
dBusConnection #flags
guid
The GUID of the peer performing the role of server when authenticating.
If you are constructing a DBusConnection
and pass
DBusConnectionFlagsAuthenticationServer
in the
DBusConnection
:flags
property then you MUST also set this
property to a valid guid.
If you are constructing a DBusConnection
and pass
DBusConnectionFlagsAuthenticationClient
in the
DBusConnection
:flags
property you will be able to read the GUID
of the other peer here after the connection has been successfully
initialized.
Since: 2.26
constructDBusConnectionGuid :: IsDBusConnection o => Text -> IO (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “guid
” property. This is rarely needed directly, but it is used by new
.
getDBusConnectionGuid :: (MonadIO m, IsDBusConnection o) => o -> m Text Source #
Get the value of the “guid
” property.
When overloading is enabled, this is equivalent to
get
dBusConnection #guid
stream
The underlying IOStream
used for I/O.
If this is passed on construction and is a SocketConnection
,
then the corresponding Socket
will be put into non-blocking mode.
While the DBusConnection
is active, it will interact with this
stream from a worker thread, so it is not safe to interact with
the stream directly.
Since: 2.26
constructDBusConnectionStream :: (IsDBusConnection o, IsIOStream a) => a -> IO (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “stream
” property. This is rarely needed directly, but it is used by new
.
getDBusConnectionStream :: (MonadIO m, IsDBusConnection o) => o -> m IOStream Source #
Get the value of the “stream
” property.
When overloading is enabled, this is equivalent to
get
dBusConnection #stream
uniqueName
The unique name as assigned by the message bus or Nothing
if the
connection is not open or not a message bus connection.
Since: 2.26
getDBusConnectionUniqueName :: (MonadIO m, IsDBusConnection o) => o -> m (Maybe Text) Source #
Get the value of the “unique-name
” property.
When overloading is enabled, this is equivalent to
get
dBusConnection #uniqueName
Signals
closed
type C_DBusConnectionClosedCallback = Ptr () -> CInt -> Ptr GError -> Ptr () -> IO () Source #
Type for the callback on the (unwrapped) C side.
type DBusConnectionClosedCallback Source #
= Bool |
|
-> Maybe GError |
|
-> IO () |
Emitted when the connection is closed.
The cause of this event can be
- If
dBusConnectionClose
is called. In this caseremotePeerVanished
is set toFalse
anderror
isNothing
. - If the remote peer closes the connection. In this case
remotePeerVanished
is set toTrue
anderror
is set. - If the remote peer sends invalid or malformed data. In this
case
remotePeerVanished
is set toFalse
anderror
is set.
Upon receiving this signal, you should give up your reference to
connection
. You are guaranteed that this signal is emitted only
once.
Since: 2.26
afterDBusConnectionClosed :: (IsDBusConnection a, MonadIO m) => a -> DBusConnectionClosedCallback -> m SignalHandlerId Source #
Connect a signal handler for the closed signal, to be run after the default handler. When overloading is enabled, this is equivalent to
after
dBusConnection #closed callback
genClosure_DBusConnectionClosed :: MonadIO m => DBusConnectionClosedCallback -> m (GClosure C_DBusConnectionClosedCallback) Source #
Wrap the callback into a GClosure
.
mk_DBusConnectionClosedCallback :: C_DBusConnectionClosedCallback -> IO (FunPtr C_DBusConnectionClosedCallback) Source #
Generate a function pointer callable from C code, from a C_DBusConnectionClosedCallback
.
noDBusConnectionClosedCallback :: Maybe DBusConnectionClosedCallback Source #
A convenience synonym for
.Nothing
:: Maybe
DBusConnectionClosedCallback
onDBusConnectionClosed :: (IsDBusConnection a, MonadIO m) => a -> DBusConnectionClosedCallback -> m SignalHandlerId Source #
Connect a signal handler for the closed signal, to be run before the default handler. When overloading is enabled, this is equivalent to
on
dBusConnection #closed callback