![]() |
![]() |
![]() |
![]() |
dbus-glib comes with dbus-binding-tool, which can produce somewhat nice client- and server-side wrappers for a D-Bus interface. With GDBus, gdbus-codegen is used and like its counterpart, it also takes D-Bus Introspection XML as input:
If this XML is processed like this
1 2 3 4 5 6 |
gdbus-codegen --interface-prefix org.gtk.GDBus.Example.ObjectManager. \ --generate-c-code generated-code \ --c-namespace Example \ --c-generate-object-manager \ --generate-docbook generated-docs \ gdbus-example-objectmanager.xml |
then two files generated-code.h
and
generated-code.c
are
generated. Additionally, two XML files
generated-docs-org.gtk.GDBus.Example.ObjectManager.Animal
and
generated-docs-org.gtk.GDBus.Example.ObjectManager.Cat
with Docbook XML are generated. For an example of what the docs look
like see the Animal D-Bus interface documentation.
and
the Cat D-Bus interface documentation.
While the contents of generated-code.h
and
generated-code.c
are best described by the
gdbus-codegen manual
page, brief examples of how this generated code can be used can be found in
Example 3, “Server-side application using generated code”
and Example 4, “Client-side application using generated code”. Additionally, since
the generated code has 100% gtk-doc coverage, see
ExampleAnimal, ExampleCat, ExampleObject and
ExampleObjectManagerClient pages for documentation.