[systemd-devel] bus: suggestion for reading "trough" variants
Peeters Simon
peeters.simon at gmail.com
Mon Apr 8 07:22:59 PDT 2013
hey,
While experimenting a bit with the really nice api of libsystemd-bus
(seriously, I love it), I came across an idea that would probably make
using the library even easier.
The idea is to be able to read "trough" a variant using sd_bus_message_read()
f.ex you get a message with signature "sv" with the variant being
supposed to be an other string (since it is a reply to a request
requesting a string).
now one has to:
1. read the first string
2. enter the variant
3. read the second string
4. exit the variant
what I would like to be able to do is something like this:
sd_bus_message_read(m, "sv+s", &first, &second);
which will error out if the variant does not contain a string.
of course the "+" can be decided to be something else, I also thought
of using "[" and "]" around the inner signature, but the basic idea
stays the same.
One of the biggest uses would probably be for reading properties,
since org.freedesktop.DBus.Properties.Get() always returns a variant,
but the reader knows which type it is supposed to be.
Anyways, thanks for the library (a welcome change from libdbus)
Simon
More information about the systemd-devel
mailing list