gdbus-codegen Tool

Thanks to gdbus-codegen tool  used to generate code for one or more D-Bus interfaces , Dbus programming is made very easy . It creates a wrapper on top of the current Dbus binding in C code using the glib library by generating the .c and the .h files by taking the dbus introspection or the xml.

Example of generating a codegen files is shown pictorially below

Usage

gdbus-codegen –interface-prefix org.project.Prefix –generate-c-code outfiles xmlfiles

Ex:gdbus-codegen –interface-prefix My.sample –generate-c-code samplegencode My.Sample.Service.xml

This command can be used both on the client side as well as the server side to generate the helper .c and .h which contains the server side as well as the client side function definition as well as declarations.

Installation in debain linux

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install libglib2.0-0
sudo apt-get install libglib2.0-dev

References:

https://developer.gnome.org/gio/stable/gdbus-codegen.html

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.