2017-12-14 11:09:02 UTC
I would like to let you know that sdbus-c++, our in-house C++ binding for sd-bus library, has been published open-source at https://github.com/Kistler-Group/sdbus-cpp in hope that it will be useful.
Currently, the binding does not cover the entire sd-bus API; it covers the core, most widely used functionality - D-Bus methods, signals, properties. It supports serialization/deserialization of all D-Bus types.
The library offers two levels of its API:
* the basic layer, which is a simple wrapper layer on top of sd-bus, but using native C++ approach (e.g. serialization/deserialization of data from messages, support for STL containers...).
* the convenience layer, building on top of the basic layer, which aims at alleviating users from unnecessary details and enables them to write shorter, safer, and more expressive code. It abstracts away the concept of messages, and utilizes C++ type system to automatically deduce and build all necessary information.
Example of exporting a method:
std::string concatenate(const std::vector<int> numbers, const std::string& separator);
Example of invoking a method:
sdbus-c++ also ships with stub code generator, which can generate adaptor and proxy stub classes, analogously to the generator in e.g. dbus-c++ library.
The library needs a C++17-capable compiler (std::uncaught_exceptions is used) and sd-bus API of systemd v236 (which will hopefully be released very soon).
Readme file: https://github.com/Kistler-Group/sdbus-cpp/blob/master/README.md
There is surely a lot that can be added/improved in the library. Ideas, contributions, improvements are welcome :-)