I\'m trying to call WPA supplicant\'s DBus interface using Qt\'s QDBus class library. In particular, I\'m trying to use the \"Get\" property call to retrieve the \"Interface
My goal was to get the object path returned by GetInterface
method of fi.w1.wpa_supplicant1
interface.
@MatthewD's answer was really helpful to get me started with the experiment but unfortunately didnt work for me as required. I tried all posibilities. But at the end, somehow, I got my required result in a different and a rather shorter way.
What I did was:
- I had the interface:
QDBusInterface interface("fi.w1.wpa_supplicant1", "/fi/w1/wpa_supplicant1", "fi.w1.wpa_supplicant1", QDBusConnection::systemBus());
- Call the method and store message
QDBusMessage mesg = interface.call("GetInterface", "wlan0");
- Then get the first argument
QVariant var = mesg.arguments().at(0);
- Then get the object path
QDBusObjectPath objpath = var.value
- And finally
QString path_str = objpath.path();
Now you print the path as string:
printf("Object path: %s\n", path_str);