I'm doing an small application based in Qt to get all Wifi bearer near my embedded Linux and for that I'm using Connman with QtDBus. In order to get all wifi signals, I'm trying to get autogenerated adaptor code using qdbusxml2cpp application. To do that, I'm using connman-dbus.conf file as descritpion of the service with the next content:
<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
<busconfig>
<policy user="root">
<allow own="net.connman"/>
<allow send_destination="net.connman"/>
<allow send_interface="net.connman.Agent"/>
<allow send_interface="net.connman.Counter"/>
<allow send_interface="net.connman.Notification"/>
<allow send_interface="net.connman.Manager"/>
</policy>
<policy at_console="true">
<allow send_destination="net.connman"/>
</policy>
<policy context="default">
<deny send_destination="net.connman"/>
</policy>
</busconfig>
Then, I execute the next command:
$ qdbusxml2cpp -N -v /etc/dbus-1/system.d/connman-dbus.conf -a connmandbusexample.h:connmandbusexample.cpp
But the result of this is the following code:
connmandbusexample.cpp
/*
* This file was generated by qdbusxml2cpp version 0.8
* Command line was: qdbusxml2cpp -N -v /etc/dbus-1/system.d/connman-dbus.conf -a connmandbusexample.h:connmandbusexample.cpp
*
* qdbusxml2cpp is Copyright (C) 2015 Digia Plc and/or its subsidiary(-ies).
*
* This is an auto-generated file.
* Do not edit! All changes made to it will be lost.
*/
#include "connmandbusexample.h"
#include <QtCore/QMetaObject>
#include <QtCore/QByteArray>
#include <QtCore/QList>
#include <QtCore/QMap>
#include <QtCore/QString>
#include <QtCore/QStringList>
#include <QtCore/QVariant>
connmandbusexample.h
/*
* This file was generated by qdbusxml2cpp version 0.8
* Command line was: qdbusxml2cpp -N -v /etc/dbus-1/system.d/connman-dbus.conf -a connmandbusexample.h:connmandbusexample.cpp
*
* qdbusxml2cpp is Copyright (C) 2015 Digia Plc and/or its subsidiary(-ies).
*
* This is an auto-generated file.
* This file may have been hand-edited. Look for HAND-EDIT comments
* before re-generating it.
*/
#ifndef CONNMANDBUSEXAMPLE_H_1462807819
#define CONNMANDBUSEXAMPLE_H_1462807819
#include <QtCore/QObject>
#include <QtDBus/QtDBus>
QT_BEGIN_NAMESPACE
class QByteArray;
template<class T> class QList;
template<class Key, class Value> class QMap;
class QString;
class QStringList;
class QVariant;
QT_END_NAMESPACE
#endif
As you can see, this code is not useful so I'm wondering if I'm doing something wrong with qdbusxml2cpp. Also, I don't know if I can do that with other more right approach that using QtDBus. Last, Is possible to connect to a wifi network from Qt App that is not working with root permissions? I think all of the above are very related questions that can help in this topic.