How to properly type dbus dicts

Asked by Brent Miller

I'm trying to build a simple C++ app that can talk to NetworkManager via DBus, query the connection state, and add new wifi connections.

However, I seem to be running into an issue when querying information about a network connection which has a type of `a{sa{sv}}`. I've been using the `dbus-cppc` as a starting point and it says the return type of org.freedesktop.NetworkManager.Settings.Connection.GetSettings should be:
`typedef std::vector<std::pair<std::string, std::vector<std::pair<std::string, core::dbus::types::Variant>>>> ResultType;`

But I'm getting a runtime error when running my app:
terminate called after throwing an instance of 'std::runtime_error'
  what(): Mismatch between expected and actual type reported by iterator:
  Expected: string
  Actual: dictionary_entry

The ResultType provided looks correct to me, and I've searched around a but could't find any of the examples that have a type like this. What's the proper ResultType for a dict within a dict? A stripped down example of what I'm working with can be found here:
https://gist.github.com/brentalanmiller/e774b3bbb53e9f08f22a9fe05f95b0aa

Question information

Language:
English Edit question
Status:
Answered
For:
Ubuntu dbus-cpp Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
actionparsnip (andrew-woodhead666) said :
#1

May help
https://askubuntu.com/questions/185784/configuration-of-the-network-manager-via-dbus-how-to-set-the-ad-hoc-mode

You could send an email to the dbus developers. They may reply and help

Can you help with this problem?

Provide an answer of your own, or ask Brent Miller for more information if necessary.

To post a message you must log in.