Using a struct[enum] as an sdbusplus D-Bus method arg?

Matt Spinler mspinler at
Thu Jan 9 06:32:49 AEDT 2020


I'm designing a phosphor-dbus-interfaces D-Bus method where I think the 
ideal interface has YAML like:

- name : CreateStuff
     - name: Data
       type: array[struct[enum[self.Types], uint32]]

But that doesn't compile using an enum in the struct, and fails because 
sdbus++ creates code like:


     // Uses enum<self.Types>
     std::vector<std::tuple<enum<self.Types>, uint8_t>> data{};;
     auto o = static_cast<Create*>(context);

What I'm trying to do is a valid D-Bus definition, correct? Or should I 
just use a string instead
of an enum?

It doesn't seem very straightforward to fix, as the vector that gets 
passed to o->createStuff()
is a std::vector<std::tuple<Types, uint32_t>>, but the vector passed to is a
std::vector<std::tuple<std::string, uint32_t>>.

Any thoughts?


More information about the openbmc mailing list