Discussion:
sdbus-c++, an open source C++ library on top of sd-bus
(too old to reply)
Stanislav Angelovic
2017-12-14 11:09:02 UTC
Permalink
Raw Message
Hi all,

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);
concatenator->registerMethod("concatenate").onInterface(interfaceName).implementedAs(&concatenate);

Example of invoking a method:
concatenator->callMethod("concatenate").onInterface(interfaceName).withArguments(numbers, separator).storeResultsTo(concatenatedString);

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
Howto: https://github.com/Kistler-Group/sdbus-cpp/blob/master/doc/using-sdbus-c%2B%2B.md

There is surely a lot that can be added/improved in the library. Ideas, contributions, improvements are welcome :-)

Best regards,
Stanislav.
Zbigniew Jędrzejewski-Szmek
2017-12-15 12:46:05 UTC
Permalink
Raw Message
On Thu, Dec 14, 2017 at 11:09:02AM +0000, Stanislav Angelovic wrote:
> Hi all,
>
> 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.

Cool. I added a link in
https://www.freedesktop.org/wiki/Software/systemd/#relatedpackages

Zbyszek
Loading...