[Interest] QTDbus, Connman & Parameters conversion

LongChair . longchair at hotmail.com
Mon Mar 16 08:43:51 CET 2015


Hello,
I have been looking in a way to provide with my app some wifi connection manager which would allow the following functionality :F1 - Enable/disable wifi adaptersF2 - List wifi networksF3 - connect to a network specifying the Wifi Key
to be noticed that i need this functionality on a linux which has connman.
While doing some research about it, i found 2 possible ways :1 - Use QtNetworkAccessManager & qtbearer API2 - Use Dbus communication with connman
But I couldn't make it thru with either of those
1 - Using QNAM & QtBearer API 
That Api allows me to list networks properly (F2), but i didn't find a proper way to do F1 & F3. Did I overlook something ? 

2 - Using Dbus API with connman
Again looking at the docs, there seem to be different ways to do this :2.1 - Using qt qdbusxml2cpp tool to make a proper cpp class that i can use in the project2.2 - Using the raw API being helped by qtdbusviewer
I first tried 2.1 :
but i hit very quickly the question : where do i get the xml file from. Several threads I saw were mentionning introspection and all i found was gdbus that allows to output some xml file from a dbus service. Although, I didnt find a way to export net.connman.Manager object to an xml file.It seems that not all of the dbus properties / interfaces can be browsed by introspection and specially those i need.
If there is a better way to do this, i'd appreciate some pointers.
Then i moved desperately to 2.2, that is use dbus plain API and do that manually
I use qtdbusviewer to check the different services and parameters types, and started to implement some code around it
Here is what i did :
First i started with the net.connman.manager GetServices Dbus method.-> Qtbusviewer mentions that the output parameter type is a(oa{sv}).
Looking at the qtconnmanmanager bearer code i can see that they map that to :
struct ConnmanMap {     QDBusObjectPath objectPath;     QVariantMap propertyMap;};
typedef QList<ConnmanMap> ConnmanMapList;
but then when i use :
 QDBusConnection bus = QDBusConnection::systemBus();        QDBusInterface *interface = new QDBusInterface("net.connman",                                                       "/",                                                       "net.connman.Manager",                                                       bus);
QDBusReply<ConnmanMapList> reply = interface->call("GetServices");
i'm getting a SEGV which seems to be due to the ConnmanMapList parameter in the template (will work fine if i replace QDBusReply<ConnmanMapList>  with QDbusMessage
I would like to avoid the QDbusMessage::arguments() parsing field by filed because of the hassle.What am i doing wrong ?
Before proceeding, i'd love to get some hints on how to proceed with this, that is what is the direction i should go, typically with that xml2cpp tool if there is any way to do this. If not, then how can I use a proper casting of the DBUS types into declared structs ?
Thanks in advance for your help :)
Lionel.
 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20150316/7da11416/attachment.html>


More information about the Interest mailing list