Copyright | Will Thompson and Iñaki García Etxebarria |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria |
Safe Haskell | None |
Language | Haskell2010 |
GI.Gio.Objects.DBusMethodInvocation
Description
Instances of the GDBusMethodInvocation
class are used when
handling D-Bus method calls. It provides a way to asynchronously
return results and errors.
The normal way to obtain a GDBusMethodInvocation
object is to receive
it as an argument to the handle_method_call()
function in a
[typegio
.DBusInterfaceVTable] that was passed to
dBusConnectionRegisterObject
.
Since: 2.26
Synopsis
- newtype DBusMethodInvocation = DBusMethodInvocation (ManagedPtr DBusMethodInvocation)
- class (GObject o, IsDescendantOf DBusMethodInvocation o) => IsDBusMethodInvocation o
- toDBusMethodInvocation :: (MonadIO m, IsDBusMethodInvocation o) => o -> m DBusMethodInvocation
- type family ResolveDBusMethodInvocationMethod (t :: Symbol) o where ...
- data DBusMethodInvocationGetConnectionMethodInfo
- dBusMethodInvocationGetConnection :: (HasCallStack, MonadIO m, IsDBusMethodInvocation a) => a -> m DBusConnection
- data DBusMethodInvocationGetInterfaceNameMethodInfo
- dBusMethodInvocationGetInterfaceName :: (HasCallStack, MonadIO m, IsDBusMethodInvocation a) => a -> m (Maybe Text)
- data DBusMethodInvocationGetMessageMethodInfo
- dBusMethodInvocationGetMessage :: (HasCallStack, MonadIO m, IsDBusMethodInvocation a) => a -> m DBusMessage
- data DBusMethodInvocationGetMethodInfoMethodInfo
- dBusMethodInvocationGetMethodInfo :: (HasCallStack, MonadIO m, IsDBusMethodInvocation a) => a -> m (Maybe DBusMethodInfo)
- data DBusMethodInvocationGetMethodNameMethodInfo
- dBusMethodInvocationGetMethodName :: (HasCallStack, MonadIO m, IsDBusMethodInvocation a) => a -> m Text
- data DBusMethodInvocationGetObjectPathMethodInfo
- dBusMethodInvocationGetObjectPath :: (HasCallStack, MonadIO m, IsDBusMethodInvocation a) => a -> m Text
- data DBusMethodInvocationGetParametersMethodInfo
- dBusMethodInvocationGetParameters :: (HasCallStack, MonadIO m, IsDBusMethodInvocation a) => a -> m GVariant
- data DBusMethodInvocationGetPropertyInfoMethodInfo
- dBusMethodInvocationGetPropertyInfo :: (HasCallStack, MonadIO m, IsDBusMethodInvocation a) => a -> m (Maybe DBusPropertyInfo)
- data DBusMethodInvocationGetSenderMethodInfo
- dBusMethodInvocationGetSender :: (HasCallStack, MonadIO m, IsDBusMethodInvocation a) => a -> m (Maybe Text)
- data DBusMethodInvocationReturnDbusErrorMethodInfo
- dBusMethodInvocationReturnDbusError :: (HasCallStack, MonadIO m, IsDBusMethodInvocation a) => a -> Text -> Text -> m ()
- data DBusMethodInvocationReturnErrorLiteralMethodInfo
- dBusMethodInvocationReturnErrorLiteral :: (HasCallStack, MonadIO m, IsDBusMethodInvocation a) => a -> Word32 -> Int32 -> Text -> m ()
- data DBusMethodInvocationReturnGerrorMethodInfo
- dBusMethodInvocationReturnGerror :: (HasCallStack, MonadIO m, IsDBusMethodInvocation a) => a -> GError -> m ()
- data DBusMethodInvocationReturnValueMethodInfo
- dBusMethodInvocationReturnValue :: (HasCallStack, MonadIO m, IsDBusMethodInvocation a) => a -> Maybe GVariant -> m ()
- data DBusMethodInvocationReturnValueWithUnixFdListMethodInfo
- dBusMethodInvocationReturnValueWithUnixFdList :: (HasCallStack, MonadIO m, IsDBusMethodInvocation a, IsUnixFDList b) => a -> Maybe GVariant -> Maybe b -> m ()
Exported types
newtype DBusMethodInvocation Source #
Memory-managed wrapper type.
Constructors
DBusMethodInvocation (ManagedPtr DBusMethodInvocation) |
Instances
class (GObject o, IsDescendantOf DBusMethodInvocation o) => IsDBusMethodInvocation o Source #
Type class for types which can be safely cast to DBusMethodInvocation
, for instance with toDBusMethodInvocation
.
Instances
(GObject o, IsDescendantOf DBusMethodInvocation o) => IsDBusMethodInvocation o Source # | |
Defined in GI.Gio.Objects.DBusMethodInvocation |
toDBusMethodInvocation :: (MonadIO m, IsDBusMethodInvocation o) => o -> m DBusMethodInvocation Source #
Cast to DBusMethodInvocation
, for types for which this is known to be safe. For general casts, use castTo
.
Methods
Click to display all available methods, including inherited ones
Methods
bindProperty, bindPropertyFull, forceFloating, freezeNotify, getv, isFloating, notify, notifyByPspec, ref, refSink, returnDbusError, returnErrorLiteral, returnGerror, returnValue, returnValueWithUnixFdList, runDispose, stealData, stealQdata, thawNotify, unref, watchClosure.
Getters
getConnection, getData, getInterfaceName, getMessage, getMethodInfo, getMethodName, getObjectPath, getParameters, getProperty, getPropertyInfo, getQdata, getSender.
Setters
type family ResolveDBusMethodInvocationMethod (t :: Symbol) o where ... Source #
Equations
getConnection
data DBusMethodInvocationGetConnectionMethodInfo Source #
Instances
(signature ~ m DBusConnection, MonadIO m, IsDBusMethodInvocation a) => OverloadedMethod DBusMethodInvocationGetConnectionMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.DBusMethodInvocation Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo DBusMethodInvocationGetConnectionMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.DBusMethodInvocation Methods |
dBusMethodInvocationGetConnection Source #
Arguments
:: (HasCallStack, MonadIO m, IsDBusMethodInvocation a) | |
=> a |
|
-> m DBusConnection | Returns: A |
Gets the DBusConnection
the method was invoked on.
Since: 2.26
getInterfaceName
data DBusMethodInvocationGetInterfaceNameMethodInfo Source #
Instances
(signature ~ m (Maybe Text), MonadIO m, IsDBusMethodInvocation a) => OverloadedMethod DBusMethodInvocationGetInterfaceNameMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.DBusMethodInvocation Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo DBusMethodInvocationGetInterfaceNameMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.DBusMethodInvocation Methods |
dBusMethodInvocationGetInterfaceName Source #
Arguments
:: (HasCallStack, MonadIO m, IsDBusMethodInvocation a) | |
=> a |
|
-> m (Maybe Text) | Returns: A string. Do not free, it is owned by |
Gets the name of the D-Bus interface the method was invoked on.
This can be NULL
if it was not specified by the sender. See
[callbackgio
.DBusInterfaceMethodCallFunc] or the
D-Bus Specification
for details on when this can happen and how it should be handled.
If this method call is a property Get, Set or GetAll call that has
been redirected to the method call handler then
"org.freedesktop.DBus.Properties" will be returned. See
DBusInterfaceVTable
for more information.
Since: 2.26
getMessage
data DBusMethodInvocationGetMessageMethodInfo Source #
Instances
(signature ~ m DBusMessage, MonadIO m, IsDBusMethodInvocation a) => OverloadedMethod DBusMethodInvocationGetMessageMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.DBusMethodInvocation Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo DBusMethodInvocationGetMessageMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.DBusMethodInvocation Methods |
dBusMethodInvocationGetMessage Source #
Arguments
:: (HasCallStack, MonadIO m, IsDBusMethodInvocation a) | |
=> a |
|
-> m DBusMessage | Returns: |
Gets the DBusMessage
for the method invocation. This is useful if
you need to use low-level protocol features, such as UNIX file
descriptor passing, that cannot be properly expressed in the
GVariant
API.
See this [server][classgio
.DBusConnectionan
-example-d-bus-server]
and [client][classgio
.DBusConnectionan
-example-for-file-descriptor-passing]
for an example of how to use this low-level API to send and receive
UNIX file descriptors.
Since: 2.26
getMethodInfo
data DBusMethodInvocationGetMethodInfoMethodInfo Source #
Instances
(signature ~ m (Maybe DBusMethodInfo), MonadIO m, IsDBusMethodInvocation a) => OverloadedMethod DBusMethodInvocationGetMethodInfoMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.DBusMethodInvocation Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo DBusMethodInvocationGetMethodInfoMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.DBusMethodInvocation Methods |
dBusMethodInvocationGetMethodInfo Source #
Arguments
:: (HasCallStack, MonadIO m, IsDBusMethodInvocation a) | |
=> a |
|
-> m (Maybe DBusMethodInfo) | Returns: A |
Gets information about the method call, if any.
If this method invocation is a property Get, Set or GetAll call that
has been redirected to the method call handler then Nothing
will be
returned. See dBusMethodInvocationGetPropertyInfo
and
DBusInterfaceVTable
for more information.
Since: 2.26
getMethodName
data DBusMethodInvocationGetMethodNameMethodInfo Source #
Instances
(signature ~ m Text, MonadIO m, IsDBusMethodInvocation a) => OverloadedMethod DBusMethodInvocationGetMethodNameMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.DBusMethodInvocation Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo DBusMethodInvocationGetMethodNameMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.DBusMethodInvocation Methods |
dBusMethodInvocationGetMethodName Source #
Arguments
:: (HasCallStack, MonadIO m, IsDBusMethodInvocation a) | |
=> a |
|
-> m Text | Returns: A string. Do not free, it is owned by |
Gets the name of the method that was invoked.
Since: 2.26
getObjectPath
data DBusMethodInvocationGetObjectPathMethodInfo Source #
Instances
(signature ~ m Text, MonadIO m, IsDBusMethodInvocation a) => OverloadedMethod DBusMethodInvocationGetObjectPathMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.DBusMethodInvocation Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo DBusMethodInvocationGetObjectPathMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.DBusMethodInvocation Methods |
dBusMethodInvocationGetObjectPath Source #
Arguments
:: (HasCallStack, MonadIO m, IsDBusMethodInvocation a) | |
=> a |
|
-> m Text | Returns: A string. Do not free, it is owned by |
Gets the object path the method was invoked on.
Since: 2.26
getParameters
data DBusMethodInvocationGetParametersMethodInfo Source #
Instances
(signature ~ m GVariant, MonadIO m, IsDBusMethodInvocation a) => OverloadedMethod DBusMethodInvocationGetParametersMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.DBusMethodInvocation Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo DBusMethodInvocationGetParametersMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.DBusMethodInvocation Methods |
dBusMethodInvocationGetParameters Source #
Arguments
:: (HasCallStack, MonadIO m, IsDBusMethodInvocation a) | |
=> a |
|
-> m GVariant | Returns: A |
Gets the parameters of the method invocation. If there are no input parameters then this will return a GVariant with 0 children rather than NULL.
Since: 2.26
getPropertyInfo
data DBusMethodInvocationGetPropertyInfoMethodInfo Source #
Instances
(signature ~ m (Maybe DBusPropertyInfo), MonadIO m, IsDBusMethodInvocation a) => OverloadedMethod DBusMethodInvocationGetPropertyInfoMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.DBusMethodInvocation Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo DBusMethodInvocationGetPropertyInfoMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.DBusMethodInvocation Methods |
dBusMethodInvocationGetPropertyInfo Source #
Arguments
:: (HasCallStack, MonadIO m, IsDBusMethodInvocation a) | |
=> a |
|
-> m (Maybe DBusPropertyInfo) | Returns: a |
Gets information about the property that this method call is for, if any.
This will only be set in the case of an invocation in response to a
property Get or Set call that has been directed to the method call
handler for an object on account of its property_get()
or
property_set()
vtable pointers being unset.
See DBusInterfaceVTable
for more information.
If the call was GetAll, Nothing
will be returned.
Since: 2.38
getSender
data DBusMethodInvocationGetSenderMethodInfo Source #
Instances
(signature ~ m (Maybe Text), MonadIO m, IsDBusMethodInvocation a) => OverloadedMethod DBusMethodInvocationGetSenderMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.DBusMethodInvocation Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo DBusMethodInvocationGetSenderMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.DBusMethodInvocation Methods |
dBusMethodInvocationGetSender Source #
Arguments
:: (HasCallStack, MonadIO m, IsDBusMethodInvocation a) | |
=> a |
|
-> m (Maybe Text) | Returns: A string. Do not free, it is owned by |
Gets the bus name that invoked the method.
This can return Nothing
if not specified by the caller, e.g. on peer-to-peer
connections.
Since: 2.26
returnDbusError
data DBusMethodInvocationReturnDbusErrorMethodInfo Source #
Instances
(signature ~ (Text -> Text -> m ()), MonadIO m, IsDBusMethodInvocation a) => OverloadedMethod DBusMethodInvocationReturnDbusErrorMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.DBusMethodInvocation Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo DBusMethodInvocationReturnDbusErrorMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.DBusMethodInvocation Methods |
dBusMethodInvocationReturnDbusError Source #
Arguments
:: (HasCallStack, MonadIO m, IsDBusMethodInvocation a) | |
=> a |
|
-> Text |
|
-> Text |
|
-> m () |
Finishes handling a D-Bus method call by returning an error.
This method will take ownership of invocation
. See
DBusInterfaceVTable
for more information about the ownership of
invocation
.
Since: 2.26
returnErrorLiteral
data DBusMethodInvocationReturnErrorLiteralMethodInfo Source #
Instances
(signature ~ (Word32 -> Int32 -> Text -> m ()), MonadIO m, IsDBusMethodInvocation a) => OverloadedMethod DBusMethodInvocationReturnErrorLiteralMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.DBusMethodInvocation Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo DBusMethodInvocationReturnErrorLiteralMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.DBusMethodInvocation Methods |
dBusMethodInvocationReturnErrorLiteral Source #
Arguments
:: (HasCallStack, MonadIO m, IsDBusMethodInvocation a) | |
=> a |
|
-> Word32 |
|
-> Int32 |
|
-> Text |
|
-> m () |
Like g_dbus_method_invocation_return_error()
but without printf()
-style formatting.
This method will take ownership of invocation
. See
DBusInterfaceVTable
for more information about the ownership of
invocation
.
Since: 2.26
returnGerror
data DBusMethodInvocationReturnGerrorMethodInfo Source #
Instances
(signature ~ (GError -> m ()), MonadIO m, IsDBusMethodInvocation a) => OverloadedMethod DBusMethodInvocationReturnGerrorMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.DBusMethodInvocation Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo DBusMethodInvocationReturnGerrorMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.DBusMethodInvocation Methods |
dBusMethodInvocationReturnGerror Source #
Arguments
:: (HasCallStack, MonadIO m, IsDBusMethodInvocation a) | |
=> a |
|
-> GError |
|
-> m () |
Like g_dbus_method_invocation_return_error()
but takes a GError
instead of the error domain, error code and message.
This method will take ownership of invocation
. See
DBusInterfaceVTable
for more information about the ownership of
invocation
.
Since: 2.26
returnValue
data DBusMethodInvocationReturnValueMethodInfo Source #
Instances
(signature ~ (Maybe GVariant -> m ()), MonadIO m, IsDBusMethodInvocation a) => OverloadedMethod DBusMethodInvocationReturnValueMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.DBusMethodInvocation Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo DBusMethodInvocationReturnValueMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.DBusMethodInvocation Methods |
dBusMethodInvocationReturnValue Source #
Arguments
:: (HasCallStack, MonadIO m, IsDBusMethodInvocation a) | |
=> a |
|
-> Maybe GVariant |
|
-> m () |
Finishes handling a D-Bus method call by returning parameters
.
If the parameters
GVariant is floating, it is consumed.
It is an error if parameters
is not of the right format: it must be a tuple
containing the out-parameters of the D-Bus method. Even if the method has a
single out-parameter, it must be contained in a tuple. If the method has no
out-parameters, parameters
may be Nothing
or an empty tuple.
C code
GDBusMethodInvocation *invocation = some_invocation; g_autofree gchar *result_string = NULL; g_autoptr (GError) error = NULL; result_string = calculate_result (&error); if (error != NULL) g_dbus_method_invocation_return_gerror (invocation, error); else g_dbus_method_invocation_return_value (invocation, g_variant_new ("(s)", result_string)); // Do not free @invocation here; returning a value does that
This method will take ownership of invocation
. See
DBusInterfaceVTable
for more information about the ownership of
invocation
.
Since 2.48, if the method call requested for a reply not to be sent
then this call will sink parameters
and free invocation
, but
otherwise do nothing (as per the recommendations of the D-Bus
specification).
Since: 2.26
returnValueWithUnixFdList
data DBusMethodInvocationReturnValueWithUnixFdListMethodInfo Source #
Instances
(signature ~ (Maybe GVariant -> Maybe b -> m ()), MonadIO m, IsDBusMethodInvocation a, IsUnixFDList b) => OverloadedMethod DBusMethodInvocationReturnValueWithUnixFdListMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.DBusMethodInvocation Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo DBusMethodInvocationReturnValueWithUnixFdListMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.DBusMethodInvocation Methods |
dBusMethodInvocationReturnValueWithUnixFdList Source #
Arguments
:: (HasCallStack, MonadIO m, IsDBusMethodInvocation a, IsUnixFDList b) | |
=> a |
|
-> Maybe GVariant |
|
-> Maybe b |
|
-> m () |
Like dBusMethodInvocationReturnValue
but also takes a UnixFDList
.
This method is only available on UNIX.
This method will take ownership of invocation
. See
DBusInterfaceVTable
for more information about the ownership of
invocation
.
Since: 2.30