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

Matt Spinler mspinler at linux.ibm.com
Thu Jan 9 06:32:49 AEDT 2020


Hi,

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

- name : CreateStuff
   parameters:
     - 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:

server.cpp:

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



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 
m.read() is a
std::vector<std::tuple<std::string, uint32_t>>.

Any thoughts?

Thanks!





More information about the openbmc mailing list