xref: /openbmc/sdbusplus/README.md (revision aa71a3ed)
1# sdbusplus
2
3sdbusplus is a library and a tool for generating C++ bindings to dbus.
4
5## How to use tools/sdbus++
6
7The path of your file will be the interface name. For example, for an interface
8`xyz.openbmc_project.control.Chassis`, you would create the following file:
9`xyz/openbmc_project/control/Chassis.interface.yaml`. Similary, for errors, you
10would create `xyz/openbmc_project/control/Chassis.errors.yaml`.
11
12Generating all the files:
13```
14root_dir=$(readlink -f ../phosphor-dbus-interfaces)
15desired_interface=xyz.openbmc_project.control.Chassis
16file_prefix=chassis_interface
17file_exp_prefix=chassis_interface_exceptions
18outdir=../phosphor-chassis-control/generated
19
20# Server bindings
21python tools/sdbus++ --templatedir=tools/sdbusplus/templates --rootdir=$root_dir interface server-header $desired_interface > $outdir/$file_prefix.hpp
22python tools/sdbus++ --templatedir=tools/sdbusplus/templates --rootdir=$root_dir interface server-cpp $desired_interface > $outdir/$file_prefix.cpp
23
24# Exception bindings
25python tools/sdbus++ --templatedir=tools/sdbusplus/templates --rootdir=$root_dir error exception-header $desired_interface > $outdir/$file_exp_prefix.hpp
26python tools/sdbus++ --templatedir=tools/sdbusplus/templates --rootdir=$root_dir error exception-cpp $desired_interface > $outdir/$file_exp_prefix.cpp
27
28# Docs
29python tools/sdbus++ --templatedir=tools/sdbusplus/templates --rootdir=$root_dir interface markdown $desired_interface > $outdir/$file_prefix.md
30python tools/sdbus++ --templatedir=tools/sdbusplus/templates --rootdir=$root_dir error markdown $desired_interface > $outdir/$file_exp_prefix.md
31```
32