<?xml version="1.0" encoding="UTF-8" ?> <node name="/com/example/MyObject"> <interface name="com.example.MyObject"> <method name="ManyArgs"> <arg type="u" name="x" direction="in" /> <arg type="s" name="str" direction="in" /> <arg type="d" name="trouble" direction="in" /> <arg type="d" name="d_ret" direction="out" /> <arg type="s" name="str_ret" direction="out" /> </method> </interface> </node>
dbus-binding-tool supports annotations in the XML format to further control how the bindings are generated.
<method name "FooMethod"> [...] <annotation name="org.freedesktop.DBus.GLib.NoReply" value="yes"/> [...] </method>
This annotation is used to specify the C symbol names for the various types (interface, method, etc.), if it differs from the name D-Bus generates.
<interface name="com.example.MyObject"> <annotation name="org.freedesktop.DBus.GLib.CSymbol" value="my_object"/> [...] <method name "ManyArgs"> <annotation name="org.freedesktop.DBus.GLib.CSymbol" value="my_object_many_args"/> [...] </method> </interface>
This annotation marks the method implementation as an asynchronous function, which does not return a response straight away but will send the response at some later point to complete the call. This is used to implement non-blocking services where method calls can take time.
When a method is asynchronous, the function prototype is different. It is required that the function conform to the following rules:
The function must return a value of type gboolean; TRUE on success, and FALSE otherwise.
The first parameter is a pointer to an instance of the object.
Following the object instance pointer are the method input values.
The final parameter must be a (DBusGMethodInvocation *). This is used when sending the response message back to the client, by calling dbus_g_method_return or dbus_g_method_return_error.
<method name "FooMethod"> [...] <annotation name="org.freedesktop.DBus.GLib.Async" value="yes"/> [...] </method>
This attribute can only be applied to "out" <arg> nodes, and specifies that the parameter is not being copied when returned. For example, this turns a 's' argument from a (char **) to a (const char **), and results in the argument not being freed by D-Bus after the message is sent. For example:
<arg type="u" name="x" direction="out"> <annotation name="org.freedesktop.DBus.GLib.Const" value=""/> </arg>
This attribute can only be applied to "out" <arg> nodes, and alters the expected function signature. It currently can be set to two values: "" or "error". The argument marked with this attribute is not returned via a pointer argument, but by the function's return value. If the attribute's value is the empty string, the (GError *) argument is also omitted so there is no standard way to return an error value. This is very useful for interfacing with existing code, as it is possible to match existing APIs. If the attribute's value is "error", then the final argument is a (GError *) as usual. For example:
<arg type="u" name="x" direction="out"> <annotation name="org.freedesktop.DBus.GLib.ReturnVal" value=""/> </arg>
Overwrite the output file if it already exists with a newer timestamp than the source files.
Display usage information.
If set, then unsupported signatures for <method> parameters are ignored.
If the value is "glib-client", then client bindings are generated. If the value is "glib-server", then server bindings are generated. If the value is "pretty", then the output is in a more human readable format.
Specify the output file.
Functions in the generated output are prefixed with the symbol-prefix value.
Display the version number of the dbus-binding-tool command.
A list of one or more input D-Bus Introspection XML files to include in the generated output.
Executable for the D-Bus Binding Tool application.
dbus-glib receives minimal maintenance and security fixes for the benefit of projects like Telepathy and NetworkManager that still rely on it, but should not be used in new projects (and existing projects should try to move away from it, too). Please use GDBus, part of GLib since 2.26.
gdbus-codegen(1) is the GDBus replacement for dbus-binding-tool.
|8 Oct 2018||dbus-glib 0.112|