summaryrefslogtreecommitdiffstats
path: root/src/plugins/bearer
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/bearer')
-rw-r--r--src/plugins/bearer/bearer.pro3
-rw-r--r--src/plugins/bearer/connman/connman.pro19
-rw-r--r--src/plugins/bearer/connman/main.cpp93
-rw-r--r--src/plugins/bearer/connman/qconnmanengine.cpp651
-rw-r--r--src/plugins/bearer/connman/qconnmanengine.h144
-rw-r--r--src/plugins/bearer/connman/qconnmanservice_linux.cpp1038
-rw-r--r--src/plugins/bearer/connman/qconnmanservice_linux_p.h377
7 files changed, 2324 insertions, 1 deletions
diff --git a/src/plugins/bearer/bearer.pro b/src/plugins/bearer/bearer.pro
index f95e8af..6d8f7f2 100644
--- a/src/plugins/bearer/bearer.pro
+++ b/src/plugins/bearer/bearer.pro
@@ -4,7 +4,8 @@ contains(QT_CONFIG, dbus) {
contains(QT_CONFIG, icd) {
SUBDIRS += icd
} else {
- SUBDIRS += networkmanager generic
+ SUBDIRS += generic
+ !mac:SUBDIRS += connman networkmanager
}
}
diff --git a/src/plugins/bearer/connman/connman.pro b/src/plugins/bearer/connman/connman.pro
new file mode 100644
index 0000000..4be752b
--- /dev/null
+++ b/src/plugins/bearer/connman/connman.pro
@@ -0,0 +1,19 @@
+TARGET = qconnmanbearer
+include(../../qpluginbase.pri)
+
+QT = core network dbus
+
+HEADERS += qconnmanservice_linux_p.h \
+ qconnmanengine.h \
+ ../qnetworksession_impl.h \
+ ../qbearerengine_impl.h
+
+SOURCES += main.cpp \
+ qconnmanservice_linux.cpp \
+ qconnmanengine.cpp \
+ ../qnetworksession_impl.cpp
+
+QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/bearer
+target.path += $$[QT_INSTALL_PLUGINS]/bearer
+INSTALLS += target
+
diff --git a/src/plugins/bearer/connman/main.cpp b/src/plugins/bearer/connman/main.cpp
new file mode 100644
index 0000000..d483cf0
--- /dev/null
+++ b/src/plugins/bearer/connman/main.cpp
@@ -0,0 +1,93 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include "qconnmanengine.h"
+
+#include <QtNetwork/private/qbearerplugin_p.h>
+
+#include <QtCore/qdebug.h>
+
+#ifndef QT_NO_BEARERMANAGEMENT
+#ifndef QT_NO_DBUS
+
+QT_BEGIN_NAMESPACE
+
+class QConnmanEnginePlugin : public QBearerEnginePlugin
+{
+public:
+ QConnmanEnginePlugin();
+ ~QConnmanEnginePlugin();
+
+ QStringList keys() const;
+ QBearerEngine *create(const QString &key) const;
+};
+
+QConnmanEnginePlugin::QConnmanEnginePlugin()
+{
+}
+
+QConnmanEnginePlugin::~QConnmanEnginePlugin()
+{
+}
+
+QStringList QConnmanEnginePlugin::keys() const
+{
+ return QStringList() << QLatin1String("connman");
+}
+
+QBearerEngine *QConnmanEnginePlugin::create(const QString &key) const
+{
+ if (key == QLatin1String("connman")) {
+ QConnmanEngine *engine = new QConnmanEngine;
+ if (engine->connmanAvailable())
+ return engine;
+ else
+ delete engine;
+ }
+ return 0;
+}
+
+Q_EXPORT_STATIC_PLUGIN(QConnmanEnginePlugin)
+Q_EXPORT_PLUGIN2(qconnmanbearer, QConnmanEnginePlugin)
+
+QT_END_NAMESPACE
+
+#endif
+#endif // QT_NO_BEARERMANAGEMENT
diff --git a/src/plugins/bearer/connman/qconnmanengine.cpp b/src/plugins/bearer/connman/qconnmanengine.cpp
new file mode 100644
index 0000000..e4cab92
--- /dev/null
+++ b/src/plugins/bearer/connman/qconnmanengine.cpp
@@ -0,0 +1,651 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qconnmanengine.h"
+#include "qconnmanservice_linux_p.h"
+#include "../qnetworksession_impl.h"
+
+#include <QtNetwork/private/qnetworkconfiguration_p.h>
+
+#include <QtNetwork/qnetworksession.h>
+
+#include <QtCore/qdebug.h>
+
+#include <QtDBus/QtDBus>
+#include <QtDBus/QDBusConnection>
+//#include <QtDBus/QDBusError>
+#include <QtDBus/QDBusInterface>
+#include <QtDBus/QDBusMessage>
+#include <QtDBus/QDBusReply>
+
+#ifndef QT_NO_BEARERMANAGEMENT
+#ifndef QT_NO_DBUS
+
+QT_BEGIN_NAMESPACE
+
+QConnmanEngine::QConnmanEngine(QObject *parent)
+: QBearerEngineImpl(parent),
+ connmanManager(new QConnmanManagerInterface(this))
+{
+// qWarning() << Q_FUNC_INFO;
+}
+
+QConnmanEngine::~QConnmanEngine()
+{
+}
+
+bool QConnmanEngine::connmanAvailable() const
+{
+ QMutexLocker locker(&mutex);
+ return connmanManager->isValid();
+}
+
+void QConnmanEngine::initialize()
+{
+ connect(connmanManager,SIGNAL(propertyChangedContext(QString,QString,QDBusVariant)),
+ this,SLOT(propertyChangedContext(QString,QString,QDBusVariant)));
+
+ foreach(const QString techPath, connmanManager->getTechnologies()) {
+ QConnmanTechnologyInterface *tech;
+ tech = new QConnmanTechnologyInterface(techPath, this);
+
+ connect(tech,SIGNAL(propertyChangedContext(QString,QString,QDBusVariant)),
+ this,SLOT(technologyPropertyChangedContext(QString,QString,QDBusVariant)));
+
+ foreach(const QString devicePath,tech->getDevices()) {
+ QConnmanDeviceInterface *dev;
+ dev = new QConnmanDeviceInterface(devicePath);
+ connect(dev,SIGNAL(propertyChangedContext(QString,QString,QDBusVariant)),
+ this,SLOT(devicePropertyChangedContext(QString,QString,QDBusVariant)));
+ deviceMap.insert(techPath,QStringList() << devicePath);
+ }
+ }
+ // Get current list of access points.
+ getConfigurations();
+}
+
+QList<QNetworkConfigurationPrivate *> QConnmanEngine::getConfigurations()
+{
+ QMutexLocker locker(&mutex);
+ foundConfigurations.clear();
+ getNetworkListing();
+ return foundConfigurations;
+}
+
+void QConnmanEngine::getNetworkListing()
+{
+ QMutexLocker locker(&mutex);
+
+ QMapIterator<QString,QStringList> i(deviceMap);
+ while(i.hasNext()) {
+ i.next();
+ QConnmanDeviceInterface dev(i.value().at(0));
+ if(dev.isValid()) {
+ foreach(const QString network,dev.getNetworks()) {
+ addNetworkConfiguration(network);
+ }
+ }
+ }
+}
+
+void QConnmanEngine::doRequestUpdate()
+{
+ getConfigurations();
+ emit updateCompleted();
+}
+
+QString QConnmanEngine::getInterfaceFromId(const QString &id)
+{
+ QMutexLocker locker(&mutex);
+
+ QString servicePath = serviceFromId(id);
+ QString netPath = getNetworkForService(servicePath);
+
+ QMapIterator<QString,QStringList> i(deviceMap);
+ while(i.hasNext()) {
+ i.next();
+ if(i.value().count() > 0) {
+ QConnmanDeviceInterface dev(i.value().at(0));
+ foreach(const QString network, dev.getNetworks()) {
+ if(network == netPath) {
+ return dev.getInterface();
+ }
+ }
+ }
+ }
+ return QString();
+}
+
+bool QConnmanEngine::hasIdentifier(const QString &id)
+{
+ QMutexLocker locker(&mutex);
+ return accessPointConfigurations.contains(id);
+}
+
+QString QConnmanEngine::bearerName(const QString &id)
+{
+ QMutexLocker locker(&mutex);
+ QConnmanServiceInterface serv(serviceFromId(id));
+ QString connectionType = serv.getType();
+
+ if (connectionType == "ethernet")
+ return QLatin1String("Ethernet");
+ else if (connectionType == "wifi")
+ return QLatin1String("WLAN");
+ else if (connectionType == "cellular") {
+ QString mode = serv.getMode();
+ if(mode == "gprs" || mode == "edge") {
+ return QLatin1String("2G");
+ } else if(mode == "umts") {
+ return QLatin1String("WCDMA");
+ }
+ }
+ else if (connectionType == "wimax")
+ return QLatin1String("WIMAX");
+
+ return QString();
+}
+
+void QConnmanEngine::connectToId(const QString &id)
+{
+ QMutexLocker locker(&mutex);
+ QConnmanServiceInterface serv(serviceFromId(id));
+ if(!serv.isValid()) {
+ emit connectionError(id, InterfaceLookupError);
+ } else {
+ serv.connect();
+ }
+}
+
+void QConnmanEngine::disconnectFromId(const QString &id)
+{
+ QMutexLocker locker(&mutex);
+ QConnmanServiceInterface serv(serviceFromId(id));
+ if(!serv.isValid()) {
+ emit connectionError(id, DisconnectionError);
+ } else {
+ serv.disconnect();
+ }
+}
+
+void QConnmanEngine::requestUpdate()
+{
+ QMutexLocker locker(&mutex);
+ QTimer::singleShot(0, this, SLOT(doRequestUpdate()));
+}
+
+QString QConnmanEngine::serviceFromId(const QString &id)
+{
+ QMutexLocker locker(&mutex);
+ foreach(QString service, connmanManager->getServices()) {
+ if (id == QString::number(qHash(service)))
+ return service;
+ }
+
+ return QString();
+}
+
+QNetworkSession::State QConnmanEngine::sessionStateForId(const QString &id)
+{
+ QMutexLocker locker(&mutex);
+
+ QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(id);
+
+ if (!ptr)
+ return QNetworkSession::Invalid;
+
+ if (!ptr->isValid) {
+ return QNetworkSession::Invalid;
+ } else if ((ptr->state & QNetworkConfiguration::Active) == QNetworkConfiguration::Active) {
+ return QNetworkSession::Connected;
+ } else if ((ptr->state & QNetworkConfiguration::Discovered) ==
+ QNetworkConfiguration::Discovered) {
+ return QNetworkSession::Disconnected;
+ } else if ((ptr->state & QNetworkConfiguration::Defined) == QNetworkConfiguration::Defined) {
+ return QNetworkSession::NotAvailable;
+ } else if ((ptr->state & QNetworkConfiguration::Undefined) ==
+ QNetworkConfiguration::Undefined) {
+ return QNetworkSession::NotAvailable;
+ }
+
+ return QNetworkSession::Invalid;
+}
+
+quint64 QConnmanEngine::bytesWritten(const QString &id)
+{//TODO use connman counter API
+ QMutexLocker locker(&mutex);
+ quint64 result = 0;
+ QString devFile = getInterfaceFromId(id);
+ QFile tx("/sys/class/net/"+devFile+"/statistics/tx_bytes");
+ if(tx.exists() && tx.open(QIODevice::ReadOnly | QIODevice::Text)) {
+ QTextStream in(&tx);
+ in >> result;
+ tx.close();
+ }
+ return result;
+}
+
+quint64 QConnmanEngine::bytesReceived(const QString &id)
+{//TODO use connman counter API
+ QMutexLocker locker(&mutex);
+ quint64 result = 0;
+ QString devFile = getInterfaceFromId(id);
+ QFile rx("/sys/class/net/"+devFile+"/statistics/rx_bytes");
+ if(rx.exists() && rx.open(QIODevice::ReadOnly | QIODevice::Text)) {
+ QTextStream in(&rx);
+ in >> result;
+ rx.close();
+ }
+ return result;
+}
+
+quint64 QConnmanEngine::startTime(const QString &/*id*/)
+{
+ // TODO
+ QMutexLocker locker(&mutex);
+ if (activeTime.isNull()) {
+ return 0;
+ }
+ return activeTime.secsTo(QDateTime::currentDateTime());
+}
+
+QNetworkConfigurationManager::Capabilities QConnmanEngine::capabilities() const
+{
+ return QNetworkConfigurationManager::ForcedRoaming |
+ QNetworkConfigurationManager::DataStatistics |
+ QNetworkConfigurationManager::CanStartAndStopInterfaces;
+}
+
+QNetworkSessionPrivate *QConnmanEngine::createSessionBackend()
+{
+ return new QNetworkSessionPrivateImpl;
+}
+
+QNetworkConfigurationPrivatePointer QConnmanEngine::defaultConfiguration()
+{
+ return QNetworkConfigurationPrivatePointer();
+}
+
+
+QString QConnmanEngine::getServiceForNetwork(const QString &netPath)
+{
+ QMutexLocker locker(&mutex);
+ QConnmanNetworkInterface network(netPath, this);
+ foreach(QString service,connmanManager->getServices()) {
+ QConnmanServiceInterface serv(service,this);
+ if(serv.getName() == network.getName()
+ && network.getSignalStrength() == serv.getSignalStrength()) {
+ return service;
+ }
+ }
+ return QString();
+}
+
+QString QConnmanEngine::getNetworkForService(const QString &servPath)
+{
+ QMutexLocker locker(&mutex);
+ QMap<QString,QString> map;
+
+ QMapIterator<QString,QStringList> i(deviceMap);
+ while(i.hasNext()) {
+ i.next();
+ if(i.value().count() > 0) {
+ QConnmanDeviceInterface device(i.value().at(0));
+ QMap<QString,int> netMapStrength;
+
+ foreach(const QString netPath, knownNetworks[device.getType()]) {
+ QConnmanNetworkInterface network1(netPath, this);
+ QString netname = network1.getName();
+ qint32 sigStrength = network1.getSignalStrength();
+
+ if(netMapStrength.contains(netname)
+ && netMapStrength.value(netname) < sigStrength) {
+ netMapStrength.remove(netname);
+ map.remove(netname);
+ }
+ netMapStrength.insert(netname, sigStrength);
+ map.insert(netname,netPath);
+ }
+ }
+ }
+
+ QConnmanServiceInterface *serv;
+ serv = new QConnmanServiceInterface(servPath);
+ if(map.contains(serv->getName())) {
+ return map.value(serv->getName());
+ }
+ return QString();
+}
+
+void QConnmanEngine::propertyChangedContext(const QString &path,const QString &item, const QDBusVariant &value)
+{
+// qDebug() << __FUNCTION__ << path << item;
+ QMutexLocker locker(&mutex);
+
+ if(item == "Technologies") {
+ QDBusArgument arg = qvariant_cast<QDBusArgument>(value.variant());
+ QStringList newlist = qdbus_cast<QStringList>(arg);
+ if(newlist.count() > 0) {
+ QMap<QString,QConnmanTechnologyInterface *> oldtech = technologies;
+
+ foreach(const QString listPath, newlist) {
+ if(!oldtech.contains(listPath)) {
+ QConnmanTechnologyInterface *tech;
+ tech = new QConnmanTechnologyInterface(listPath,this);
+ connect(tech,SIGNAL(propertyChangedContext(QString,QString,QDBusVariant)),
+ this,SLOT(technologyPropertyChangedContext(QString,QString,QDBusVariant)));
+ technologies.insert(listPath, tech);
+ }
+ }
+
+ foreach(const QString old, oldtech.keys()) {
+ if(!newlist.contains(old)) {
+ QConnmanTechnologyInterface *tech = oldtech.value(old);
+ disconnect(tech,SIGNAL(propertyChangedContext(QString,QString,QDBusVariant)),
+ this,SLOT(technologyPropertyChangedContext(QString,QString,QDBusVariant)));
+
+ technologies.remove(old);
+ getNetworkListing();
+ }
+ }
+ }
+ }
+}
+
+void QConnmanEngine::servicePropertyChangedContext(const QString &path,const QString &item, const QDBusVariant &value)
+{
+// qDebug() << __FUNCTION__ << path << item;
+ QMutexLocker locker(&mutex);
+ if(item == "State") {
+ configurationChange(QString::number(qHash(path)));
+ if(value.variant().toString() == "failure") {
+ QConnmanServiceInterface serv(path);
+ qDebug() <<__FUNCTION__ <<"Error" << serv.getError();
+ emit connectionError(QString::number(qHash(path)), ConnectError);
+ }
+ }
+}
+
+void QConnmanEngine::networkPropertyChangedContext(const QString &path,const QString &item, const QDBusVariant &/*value*/)
+{
+// qDebug() << __FUNCTION__ << path << item;
+ QMutexLocker locker(&mutex);
+}
+
+void QConnmanEngine::devicePropertyChangedContext(const QString &path,const QString &item,const QDBusVariant &value)
+{
+// qDebug() << __FUNCTION__ << path << item << value.variant();
+ QMutexLocker locker(&mutex);
+ if(item == "Networks") {
+ QDBusArgument arg = qvariant_cast<QDBusArgument>(value.variant());
+ QStringList remainingNetworks = qdbus_cast<QStringList>(arg);
+
+ QConnmanDeviceInterface dev(path);
+ QStringList oldnetworks = knownNetworks[dev.getType()];
+ if(remainingNetworks.count() != oldnetworks.count()) {
+
+ foreach(const QString netPath, remainingNetworks) {
+ if(!oldnetworks.contains(netPath)) {
+ addNetworkConfiguration(netPath);
+ }
+ }
+
+ foreach(const QString netPath, oldnetworks) {
+ QString servicePath = getServiceForNetwork(netPath);
+ if(!remainingNetworks.contains(netPath)) {
+ if(servicePath.isEmpty()) {
+ removeConfiguration(netPath);
+ } else {
+ if(!remainingNetworks.contains(servicePath)) {
+ removeConfiguration(QString::number(qHash(servicePath)));
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+void QConnmanEngine::technologyPropertyChangedContext(const QString & path, const QString &item, const QDBusVariant &value)
+{
+// qWarning() << __FUNCTION__ << path << item << value.variant();
+// if(item == "Devices") {
+// QDBusArgument arg = qvariant_cast<QDBusArgument>(value.variant());
+// QStringList list = qdbus_cast<QStringList>(arg);
+// }
+ if(item == "State") {
+ if(value.variant().toString() == "enabled") {
+ }
+ if(value.variant().toString() == "offline") {
+ deviceMap.remove(path);
+ }
+ if(value.variant().toString() == "available") {
+ QConnmanTechnologyInterface tech(connmanManager->getPathForTechnology(path));
+ foreach(const QString devPath, tech.getDevices()) {
+ QConnmanDeviceInterface *dev;
+ dev = new QConnmanDeviceInterface(devPath,this);
+ connect(dev,SIGNAL(propertyChangedContext(QString,QString,QDBusVariant)),
+ this,SLOT(devicePropertyChangedContext(QString,QString,QDBusVariant)));
+
+ deviceMap.insert(path,QStringList() << devPath);
+ }
+ }
+ }
+}
+
+void QConnmanEngine::configurationChange(const QString &id)
+{
+ QMutexLocker locker(&mutex);
+ bool changed = false;
+
+ if (accessPointConfigurations.contains(id)) {
+ QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(id);
+
+ QString servicePath = serviceFromId(id);
+ QConnmanServiceInterface *serv;
+ serv = new QConnmanServiceInterface(servicePath);
+ QString networkName = serv->getName();
+ QNetworkConfiguration::StateFlags curState = getStateForService(servicePath);
+
+ ptr->mutex.lock();
+
+ if (!ptr->isValid) {
+ ptr->isValid = true;
+ changed = true;
+ }
+
+ if (ptr->name != networkName) {
+ ptr->name = networkName;
+ changed = true;
+ }
+
+ if (ptr->state != curState) {
+ ptr->state = curState;
+ changed = true;
+ }
+
+ ptr->mutex.unlock();
+
+ if (changed) {
+ locker.unlock();
+ emit configurationChanged(ptr);
+ locker.relock();
+ }
+
+ }
+ locker.unlock();
+ emit updateCompleted();
+}
+
+QNetworkConfiguration::StateFlags QConnmanEngine::getStateForService(const QString &service)
+{
+ qWarning() << __FUNCTION__;
+ QMutexLocker locker(&mutex);
+ QConnmanServiceInterface serv(service);
+ QNetworkConfiguration::StateFlags flag = QNetworkConfiguration::Defined;
+ if(serv.isFavorite()) {
+ flag = ( flag | QNetworkConfiguration::Discovered);
+ } else {
+ flag = QNetworkConfiguration::Undefined;
+ }
+
+ if(serv.getState() == "ready" || serv.getState() == "online") {
+ flag = ( flag | QNetworkConfiguration::Active);
+ }
+
+ return flag;
+}
+
+QString QConnmanEngine::typeToBearer(const QString &type)
+{
+ QMutexLocker locker(&mutex);
+ if(type == "wifi")
+ return "WLAN";
+ if(type == "ethernet")
+ return "Ethernet";
+ if(type == "bluetooth")
+ return "Bluetooth";
+ if(type == "cellular") {
+ return "Cellular";
+ // not handled: CDMA2000 HSPA
+ }
+ if(type == "wimax")
+ return "WiMax";
+// if(type == "gps")
+// if(type == "vpn")
+
+ return "Unknown";
+}
+
+void QConnmanEngine::removeConfiguration(const QString &netpath)
+{
+ QMutexLocker locker(&mutex);
+ const QString id = QString::number(qHash(netpath));
+ if (accessPointConfigurations.contains(id)) {
+ QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.take(id);
+ QConnmanDeviceInterface device(netpath.section("/",0,5),this);
+ locker.unlock();
+ knownNetworks[device.getType()].removeAll(netpath);
+ emit configurationRemoved(ptr);
+ locker.relock();
+ }
+}
+
+void QConnmanEngine::addNetworkConfiguration(const QString &networkPath)
+{
+// qWarning() << __FUNCTION__ << networkPath;
+ QMutexLocker locker(&mutex);
+
+ QConnmanNetworkInterface *network;
+ network = new QConnmanNetworkInterface(networkPath, this);
+ QString servicePath = getServiceForNetwork(networkPath);
+ QConnmanServiceInterface *serv;
+
+ QString id;
+ if(servicePath.isEmpty()) {
+ id = QString::number(qHash(networkPath));
+ } else {
+ id = QString::number(qHash(servicePath));
+ }
+ if (!accessPointConfigurations.contains(id)) {
+ connect(network,SIGNAL(propertyChangedContext(QString,QString,QDBusVariant)),
+ this,SLOT(networkPropertyChangedContext(QString,QString, QDBusVariant)));
+
+ QNetworkConfigurationPrivate* cpPriv = new QNetworkConfigurationPrivate();
+
+ QString networkName = network->getName();
+
+ if(networkName.isEmpty())
+ networkName = "Hidden Network";
+
+ QString bearerName;
+
+ QConnmanDeviceInterface device(networkPath.section("/",0,5),this);
+ if(servicePath.isEmpty()) {
+ bearerName = typeToBearer(device.getType());
+ } else {
+ serv = new QConnmanServiceInterface(servicePath,this);
+ bearerName = typeToBearer(serv->getType());
+ connect(serv,SIGNAL(propertyChangedContext(QString,QString,QDBusVariant)),
+ this,SLOT(servicePropertyChangedContext(QString,QString, QDBusVariant)));
+ }
+ knownNetworks[device.getType()]<< networkPath;
+
+ if(bearerName == "Cellular") {
+ QString mode = serv->getMode();
+ if(mode == "gprs" || mode == "edge") {
+ bearerName = "2G";
+ } else if(mode == "umts") {
+ bearerName = "WCDMA";
+ }
+ networkName = serv->getAPN();
+ }
+
+ cpPriv->name = networkName;
+ cpPriv->isValid = true;
+ cpPriv->id = id;
+ cpPriv->type = QNetworkConfiguration::InternetAccessPoint;
+ cpPriv->bearer = bearerName;
+
+ if(network->getWifiSecurity() == "none") {
+ cpPriv->purpose = QNetworkConfiguration::PublicPurpose;
+ } else {
+ cpPriv->purpose = QNetworkConfiguration::PrivatePurpose;
+ }
+
+ if(servicePath.isEmpty())
+ cpPriv->state = QNetworkConfiguration::Undefined;
+ else
+ cpPriv->state = getStateForService(servicePath);
+
+ QNetworkConfigurationPrivatePointer ptr(cpPriv);
+ accessPointConfigurations.insert(ptr->id, ptr);
+ foundConfigurations.append(cpPriv);
+ locker.unlock();
+ emit configurationAdded(ptr);
+ locker.relock();
+ }
+}
+
+QT_END_NAMESPACE
+
+#endif // QT_NO_DBUS
+#endif // QT_NO_BEARERMANAGEMENT
diff --git a/src/plugins/bearer/connman/qconnmanengine.h b/src/plugins/bearer/connman/qconnmanengine.h
new file mode 100644
index 0000000..849d8c9
--- /dev/null
+++ b/src/plugins/bearer/connman/qconnmanengine.h
@@ -0,0 +1,144 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QCONNMANENGINE_P_H
+#define QCONNMANENGINE_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of the QLibrary class. This header file may change from
+// version to version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include "../qbearerengine_impl.h"
+
+#include "qconnmanservice_linux_p.h"
+
+#include <QMap>
+#include <QVariant>
+
+#ifndef QT_NO_BEARERMANAGEMENT
+#ifndef QT_NO_DBUS
+
+QT_BEGIN_NAMESPACE
+
+class QConnmanEngine : public QBearerEngineImpl
+{
+ Q_OBJECT
+
+public:
+ QConnmanEngine(QObject *parent = 0);
+ ~QConnmanEngine();
+
+ bool connmanAvailable() const;
+
+ virtual QString getInterfaceFromId(const QString &id);
+ bool hasIdentifier(const QString &id);
+
+ virtual QString bearerName(const QString &id);
+
+ virtual void connectToId(const QString &id);
+ virtual void disconnectFromId(const QString &id);
+
+ Q_INVOKABLE void initialize();
+ Q_INVOKABLE void requestUpdate();
+
+ QNetworkSession::State sessionStateForId(const QString &id);
+ QNetworkSessionPrivate *createSessionBackend();
+
+ virtual quint64 bytesWritten(const QString &id);
+ virtual quint64 bytesReceived(const QString &id);
+ virtual quint64 startTime(const QString &id);
+
+
+ virtual QNetworkConfigurationManager::Capabilities capabilities() const;
+ virtual QNetworkConfigurationPrivatePointer defaultConfiguration();
+
+ void configurationChange(const QString &id);
+ QList<QNetworkConfigurationPrivate *> getConfigurations();
+
+
+private Q_SLOTS:
+
+ void doRequestUpdate();
+ void servicePropertyChangedContext(const QString &,const QString &,const QDBusVariant &);
+ void networkPropertyChangedContext(const QString &,const QString &,const QDBusVariant &);
+ void devicePropertyChangedContext(const QString &,const QString &,const QDBusVariant &);
+ void propertyChangedContext(const QString &,const QString &,const QDBusVariant &);
+ void technologyPropertyChangedContext(const QString &,const QString &, const QDBusVariant &);
+
+private:
+ QConnmanManagerInterface *connmanManager;
+
+ QList<QNetworkConfigurationPrivate *> foundConfigurations;
+ void getNetworkListing();
+
+ QString getServiceForNetwork(const QString &network);
+ QString getNetworkForService(const QString &network);
+
+ QString serviceFromId(const QString &id);
+ QString networkFromId(const QString &id);
+
+ QNetworkConfiguration::StateFlags getStateForService(const QString &service);
+ QString typeToBearer(const QString &type);
+
+ void removeConfiguration(const QString &path);
+ void addNetworkConfiguration(const QString &worknetPath);
+ QDateTime activeTime;
+
+
+ QMap<QString,QConnmanTechnologyInterface *> technologies;
+ QMap<QString,QStringList> knownNetworks;
+ QMap<QString,QStringList> deviceMap;
+};
+
+QT_END_NAMESPACE
+
+#endif // QT_NO_DBUS
+#endif // QT_NO_BEARERMANAGEMENT
+
+#endif
+
diff --git a/src/plugins/bearer/connman/qconnmanservice_linux.cpp b/src/plugins/bearer/connman/qconnmanservice_linux.cpp
new file mode 100644
index 0000000..ca76ffd
--- /dev/null
+++ b/src/plugins/bearer/connman/qconnmanservice_linux.cpp
@@ -0,0 +1,1038 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QObject>
+#include <QList>
+#include <QtDBus/QtDBus>
+#include <QtDBus/QDBusConnection>
+#include <QtDBus/QDBusError>
+#include <QtDBus/QDBusInterface>
+#include <QtDBus/QDBusMessage>
+#include <QtDBus/QDBusReply>
+#include <QtDBus/QDBusPendingCallWatcher>
+#include <QtDBus/QDBusObjectPath>
+#include <QtDBus/QDBusPendingCall>
+
+#include "qconnmanservice_linux_p.h"
+
+
+QT_BEGIN_NAMESPACE
+static QDBusConnection dbusConnection = QDBusConnection::systemBus();
+
+
+QConnmanManagerInterface::QConnmanManagerInterface( QObject *parent)
+ : QDBusAbstractInterface(QLatin1String(CONNMAN_SERVICE),
+ QLatin1String(CONNMAN_MANAGER_PATH),
+ CONNMAN_MANAGER_INTERFACE,
+ QDBusConnection::systemBus(), parent)
+{
+}
+
+QConnmanManagerInterface::~QConnmanManagerInterface()
+{
+}
+
+void QConnmanManagerInterface::connectNotify(const char *signal)
+{
+if (QLatin1String(signal) == SIGNAL(propertyChanged(QString,QDBusVariant))) {
+ if(!connection().connect(QLatin1String(CONNMAN_SERVICE),
+ QLatin1String(CONNMAN_MANAGER_PATH),
+ QLatin1String(CONNMAN_MANAGER_INTERFACE),
+ QLatin1String("PropertyChanged"),
+ this,SIGNAL(propertyChanged(const QString &, const QDBusVariant & )))) {
+ qWarning() << "PropertyCHanged not connected";
+ }
+ }
+
+ if (QLatin1String(signal) == SIGNAL(stateChanged(QString))) {
+ if (!connection().connect(QLatin1String(CONNMAN_SERVICE),
+ QLatin1String(CONNMAN_MANAGER_PATH),
+ QLatin1String(CONNMAN_MANAGER_INTERFACE),
+ QLatin1String("StateChanged"),
+ this,SIGNAL(stateChanged(const QString&)))) {
+ qWarning() << "StateChanged not connected";
+
+ }
+ }
+ if (QLatin1String(signal) == SIGNAL(propertyChangedContext(QString,QString,QDBusVariant))) {
+ QConnmanDBusHelper *helper;
+ helper = new QConnmanDBusHelper(this);
+
+ dbusConnection.connect(QLatin1String(CONNMAN_SERVICE),
+ QLatin1String(CONNMAN_MANAGER_PATH),
+ QLatin1String(CONNMAN_MANAGER_INTERFACE),
+ QLatin1String("PropertyChanged"),
+ helper,SLOT(propertyChanged(QString,QDBusVariant)));
+
+
+ QObject::connect(helper,SIGNAL(propertyChangedContext(const QString &,const QString &,const QDBusVariant &)),
+ this,SIGNAL(propertyChangedContext(const QString &,const QString &,const QDBusVariant &)));
+ }
+}
+
+void QConnmanManagerInterface::disconnectNotify(const char *signal)
+{
+ if (QLatin1String(signal) == SIGNAL(propertyChanged(QString,QVariant))) {
+
+ }
+}
+
+QVariant QConnmanManagerInterface::getProperty(const QString &property)
+{
+ QVariant var;
+ QVariantMap map = getProperties();
+ if (map.contains(property)) {
+ var = map.value(property);
+ } else {
+ qDebug() << "does not contain" << property;
+ }
+ return var;
+}
+
+QVariantMap QConnmanManagerInterface::getProperties()
+{
+ QDBusReply<QVariantMap > reply = this->call(QLatin1String("GetProperties"));
+ return reply.value();
+}
+
+QString QConnmanManagerInterface::getState()
+{
+ QDBusReply<QString > reply = this->call("GetState");
+ return reply.value();
+}
+
+bool QConnmanManagerInterface::setProperty(const QString &name, const QDBusVariant &value)
+{
+ Q_UNUSED(name);
+ Q_UNUSED(value);
+ return false;
+}
+
+QDBusObjectPath QConnmanManagerInterface::createProfile(const QString &/*name*/)
+{
+ return QDBusObjectPath();
+}
+
+bool QConnmanManagerInterface::removeProfile(QDBusObjectPath /*path*/)
+{
+ return false;
+}
+
+bool QConnmanManagerInterface::requestScan(const QString &type)
+{
+ QDBusReply<QString> reply = this->call(QLatin1String("RequestScan"), QVariant::fromValue(type));
+
+ bool ok = true;
+ if(reply.error().type() == QDBusError::InvalidArgs) {
+ qWarning() << reply.error().message();
+ ok = false;
+ }
+ return ok;
+}
+
+bool QConnmanManagerInterface::enableTechnology(const QString &type)
+{
+ QDBusReply<QList<QDBusObjectPath> > reply = this->call(QLatin1String("EnableTechnology"), QVariant::fromValue(type));
+ bool ok = true;
+ if(reply.error().type() == QDBusError::InvalidArgs) {
+ qWarning() << reply.error().message();
+ ok = false;
+ }
+ return ok;
+}
+
+bool QConnmanManagerInterface::disableTechnology(const QString &type)
+{
+ QDBusReply<QList<QDBusObjectPath> > reply = this->call(QLatin1String("DisableTechnology"), QVariant::fromValue(type));
+ bool ok = true;
+ if(reply.error().type() == QDBusError::InvalidArgs) {
+ qWarning() << reply.error().message();
+ ok = false;
+ }
+ return ok;
+}
+
+QDBusObjectPath QConnmanManagerInterface::connectService(QVariantMap &map)
+{
+ QDBusReply<QDBusObjectPath > reply = this->call(QLatin1String("ConnectService"), QVariant::fromValue(map));
+ if(!reply.isValid()) {
+ qDebug() << reply.error().message();
+
+ }
+ return reply;
+}
+
+void QConnmanManagerInterface::registerAgent(QDBusObjectPath &/*path*/)
+{
+}
+
+void QConnmanManagerInterface::unregisterAgent(QDBusObjectPath /*path*/)
+{
+}
+
+void QConnmanManagerInterface::registerCounter(QDBusObjectPath /*path*/, quint32 /*interval*/)
+{
+}
+
+void QConnmanManagerInterface::unregisterCounter(QDBusObjectPath /*path*/)
+{
+}
+
+QString QConnmanManagerInterface::requestSession(const QString &bearerName)
+{
+ QDBusReply<QList<QDBusObjectPath> > reply = this->call(QLatin1String("RequestSession"), QVariant::fromValue(bearerName));
+ return QString();
+}
+
+void QConnmanManagerInterface::releaseSession()
+{
+ QDBusReply<QList<QDBusObjectPath> > reply = this->call(QLatin1String("ReleaseSession"));
+}
+
+
+QDBusObjectPath QConnmanManagerInterface::lookupService(const QString &service)
+{
+ QDBusReply<QDBusObjectPath > reply = this->call(QLatin1String("LookupService"), QVariant::fromValue(service));
+ if(!reply.isValid()) {
+ qDebug() << reply.error().message();
+ }
+ return reply;
+}
+
+// properties
+
+QStringList QConnmanManagerInterface::getAvailableTechnologies()
+{
+ QVariant var = getProperty("AvailableTechnologies");
+ return qdbus_cast<QStringList>(var);
+}
+
+QStringList QConnmanManagerInterface::getEnabledTechnologies()
+{
+ QVariant var = getProperty("EnabledTechnologies");
+ return qdbus_cast<QStringList>(var);
+}
+
+QStringList QConnmanManagerInterface::getConnectedTechnologies()
+{
+ QVariant var = getProperty("ConnectedTechnologies");
+ return qdbus_cast<QStringList>(var);
+}
+
+QString QConnmanManagerInterface::getDefaultTechnology()
+{
+ QVariant var = getProperty("DefaultTechnology");
+ return qdbus_cast<QString>(var);
+}
+
+bool QConnmanManagerInterface::getOfflineMode()
+{
+ QVariant var = getProperty("OfflineMode");
+ return qdbus_cast<bool>(var);
+}
+
+QString QConnmanManagerInterface::getActiveProfile()
+{
+ QVariant var = getProperty("ActiveProfile");
+ return qdbus_cast<QString>(var);
+}
+
+QStringList QConnmanManagerInterface::getProfiles()
+{
+ QVariant var = getProperty("Profiles");
+ return qdbus_cast<QStringList>(var);
+}
+
+QStringList QConnmanManagerInterface::getTechnologies()
+{
+ QVariant var = getProperty("Technologies");
+ return qdbus_cast<QStringList >(var);
+}
+
+QStringList QConnmanManagerInterface::getServices()
+{
+ QVariant var = getProperty("Services");
+ return qdbus_cast<QStringList >(var);
+}
+
+QString QConnmanManagerInterface::getPathForTechnology(const QString &name)
+{
+ foreach(const QString path, getTechnologies()) {
+ if(path.contains(name)) {
+ return path;
+ }
+ }
+ return "";
+}
+
+QConnmanNetworkInterface::QConnmanNetworkInterface(const QString &dbusPathName, QObject *parent)
+ : QDBusAbstractInterface(QLatin1String(CONNMAN_SERVICE),
+ dbusPathName,
+ CONNMAN_NETWORK_INTERFACE,
+ QDBusConnection::systemBus(), parent)
+{
+}
+
+QConnmanNetworkInterface::~QConnmanNetworkInterface()
+{
+}
+
+void QConnmanNetworkInterface::connectNotify(const char *signal)
+{
+ if (QLatin1String(signal) == SIGNAL(propertyChanged(QString,QDBusVariant))) {
+ if(!connection().connect(QLatin1String(CONNMAN_SERVICE),
+ this->path(),
+ QLatin1String(CONNMAN_NETWORK_INTERFACE),
+ QLatin1String("PropertyChanged"),
+ this,SIGNAL(propertyChanged(QString,QDBusVariant))) ) {
+ qWarning() << "network properties not connected";
+ }
+ }
+ if (QLatin1String(signal) == SIGNAL(propertyChangedContext(QString,QString,QDBusVariant))) {
+ QConnmanDBusHelper *helper;
+ helper = new QConnmanDBusHelper(this);
+
+ dbusConnection.connect(QLatin1String(CONNMAN_SERVICE),
+ this->path(),
+ QLatin1String(CONNMAN_NETWORK_INTERFACE),
+ QLatin1String("PropertyChanged"),
+ helper,SLOT(propertyChanged(QString,QDBusVariant)));
+
+ QObject::connect(helper,SIGNAL(propertyChangedContext(const QString &,const QString &,const QDBusVariant &)),
+ this,SIGNAL(propertyChangedContext(const QString &,const QString &,const QDBusVariant &)));
+ }
+}
+
+void QConnmanNetworkInterface::disconnectNotify(const char *signal)
+{
+ if (QLatin1String(signal) == SIGNAL(propertyChanged(QString,QDBusVariant))) {
+
+ }
+}
+
+QVariantMap QConnmanNetworkInterface::getProperties()
+{
+ QDBusReply<QVariantMap > reply = this->call(QLatin1String("GetProperties"));
+ return reply.value();
+}
+
+QVariant QConnmanNetworkInterface::getProperty(const QString &property)
+{
+ QVariant var;
+ QVariantMap map = getProperties();
+ if (map.contains(property)) {
+ var = map.value(property);
+ }
+ return var;
+}
+
+//properties
+
+QString QConnmanNetworkInterface::getAddress()
+{
+ QVariant var = getProperty("Address");
+ return qdbus_cast<QString>(var);
+}
+
+QString QConnmanNetworkInterface::getName()
+{
+ QVariant var = getProperty("Name");
+ return qdbus_cast<QString>(var);
+}
+
+bool QConnmanNetworkInterface::isConnected()
+{
+ QVariant var = getProperty("Connected");
+ return qdbus_cast<bool>(var);
+}
+
+quint8 QConnmanNetworkInterface::getSignalStrength()
+{
+ QVariant var = getProperty("Strength");
+ return qdbus_cast<quint8>(var);
+}
+
+QString QConnmanNetworkInterface::getDevice()
+{
+ QVariant var = getProperty("Device");
+ return qdbus_cast<QString>(var);
+}
+
+QString QConnmanNetworkInterface::getWifiSsid()
+{
+ QVariant var = getProperty("WiFi.SSID");
+ return qdbus_cast<QString>(var);
+}
+
+QString QConnmanNetworkInterface::getWifiMode()
+{
+ QVariant var = getProperty("WiFi.Mode");
+ return qdbus_cast<QString>(var);
+}
+
+QString QConnmanNetworkInterface::getWifiSecurity()
+{
+ QVariant var = getProperty("WiFi.Security");
+ return qdbus_cast<QString>(var);
+}
+
+QString QConnmanNetworkInterface::getWifiPassphrase()
+{
+ QVariant var = getProperty("WiFi.Passphrase");
+ return qdbus_cast<QString>(var);
+}
+
+
+//////////////////////////
+
+QConnmanProfileInterface::QConnmanProfileInterface(const QString &dbusPathName,QObject *parent)
+ : QDBusAbstractInterface(QLatin1String(CONNMAN_SERVICE),
+ dbusPathName,
+ CONNMAN_PROFILE_INTERFACE,
+ QDBusConnection::systemBus(), parent)
+{
+}
+
+QConnmanProfileInterface::~QConnmanProfileInterface()
+{
+}
+
+void QConnmanProfileInterface::connectNotify(const char *signal)
+{
+ if (QLatin1String(signal) == SIGNAL(propertyChanged(QString,QDBusVariant))) {
+ dbusConnection.connect(QLatin1String(CONNMAN_SERVICE),
+ this->path(),
+ QLatin1String(CONNMAN_PROFILE_INTERFACE),
+ QLatin1String("PropertyChanged"),
+ this,SIGNAL(propertyChanged(QString,QDBusVariant)));
+ }
+}
+
+void QConnmanProfileInterface::disconnectNotify(const char *signal)
+{
+ if (QLatin1String(signal) == SIGNAL(propertyChanged(QString, QVariant))) {
+
+ }
+}
+
+QVariantMap QConnmanProfileInterface::getProperties()
+{
+ QDBusReply<QVariantMap > reply = this->call(QLatin1String("GetProperties"));
+ return reply.value();
+}
+
+QVariant QConnmanProfileInterface::getProperty(const QString &property)
+{
+ QVariant var;
+ QVariantMap map = getProperties();
+ if (map.contains(property)) {
+ var = map.value(property);
+ } else {
+ qDebug() <<__FUNCTION__<< "Could not find" << property;
+ }
+ return var;
+}
+
+// properties
+QString QConnmanProfileInterface::getName()
+{
+
+ QVariant var = getProperty("Name");
+ return qdbus_cast<QString>(var);
+}
+
+bool QConnmanProfileInterface::isOfflineMode()
+{
+ QVariant var = getProperty("OfflineMode");
+ return qdbus_cast<bool>(var);
+}
+
+QStringList QConnmanProfileInterface::getServices()
+{
+ QVariant var = getProperty("Services");
+ return qdbus_cast<QStringList>(var);
+}
+
+///////////////////////////
+QConnmanServiceInterface::QConnmanServiceInterface(const QString &dbusPathName,QObject *parent)
+ : QDBusAbstractInterface(QLatin1String(CONNMAN_SERVICE),
+ dbusPathName,
+ CONNMAN_SERVICE_INTERFACE,
+ QDBusConnection::systemBus(), parent)
+{
+}
+
+QConnmanServiceInterface::~QConnmanServiceInterface()
+{
+}
+
+void QConnmanServiceInterface::connectNotify(const char *signal)
+{
+// qWarning() << __FUNCTION__ << signal << this->path();
+
+ if (QLatin1String(signal) == SIGNAL(propertyChanged(QString,QDBusVariant))) {
+ dbusConnection.connect(QLatin1String(CONNMAN_SERVICE),
+ this->path(),
+ QLatin1String(CONNMAN_SERVICE_INTERFACE),
+ QLatin1String("PropertyChanged"),
+ this,SIGNAL(propertyChanged(QString,QDBusVariant)));
+ }
+ if (QLatin1String(signal) == SIGNAL(propertyChangedContext(QString,QString,QDBusVariant))) {
+ QConnmanDBusHelper *helper;
+ helper = new QConnmanDBusHelper(this);
+
+ dbusConnection.connect(QLatin1String(CONNMAN_SERVICE),
+ this->path(),
+ QLatin1String(CONNMAN_SERVICE_INTERFACE),
+ QLatin1String("PropertyChanged"),
+ helper,SLOT(propertyChanged(QString,QDBusVariant)));
+
+ QObject::connect(helper,SIGNAL(propertyChangedContext(const QString &,const QString &,const QDBusVariant &)),
+ this,SIGNAL(propertyChangedContext(const QString &,const QString &,const QDBusVariant &)));
+ }
+}
+
+void QConnmanServiceInterface::disconnectNotify(const char *signal)
+{
+ if (QLatin1String(signal) == SIGNAL(propertyChanged(QString,QVariant))) {
+
+ }
+}
+
+QVariantMap QConnmanServiceInterface::getProperties()
+{
+ QDBusReply<QVariantMap> reply = this->call(QLatin1String("GetProperties"));
+ return reply.value();
+}
+
+QVariant QConnmanServiceInterface::getProperty(const QString &property)
+{
+ QVariant var;
+ QVariantMap map = getProperties();
+ if (map.contains(property)) {
+ var = map.value(property);
+ } else {
+// qDebug() <<__FUNCTION__<< "Could not find" << property;
+ }
+ return var;
+}
+
+// clearProperty
+void QConnmanServiceInterface::connect()
+{
+ QDBusReply<QVariantMap> reply = this->call(QLatin1String("Connect"));
+}
+
+void QConnmanServiceInterface::disconnect()
+{
+ QDBusReply<QVariantMap> reply = this->call(QLatin1String("Disconnect"));
+}
+
+void QConnmanServiceInterface::remove()
+{
+ QDBusReply<QVariantMap> reply = this->call(QLatin1String("Remove"));
+}
+
+// void moveBefore(QDBusObjectPath &service);
+// void moveAfter(QDBusObjectPath &service);
+
+// properties
+QString QConnmanServiceInterface::getState()
+{
+ QVariant var = getProperty("State");
+ return qdbus_cast<QString>(var);
+}
+
+QString QConnmanServiceInterface::getError()
+{
+ QVariant var = getProperty("Error");
+ return qdbus_cast<QString>(var);
+}
+
+QString QConnmanServiceInterface::getName()
+{
+ QVariant var = getProperty("Name");
+ return qdbus_cast<QString>(var);
+}
+
+QString QConnmanServiceInterface::getType()
+{
+ QVariant var = getProperty("Type");
+ return qdbus_cast<QString>(var);
+}
+
+QString QConnmanServiceInterface::getMode()
+{
+ QVariant var = getProperty("Mode");
+ return qdbus_cast<QString>(var);
+}
+
+QString QConnmanServiceInterface::getSecurity()
+{
+ QVariant var = getProperty("Security");
+ return qdbus_cast<QString>(var);
+}
+
+QString QConnmanServiceInterface::getPassphrase()
+{
+ QVariant var = getProperty("Passphrase");
+ return qdbus_cast<QString>(var);
+}
+
+bool QConnmanServiceInterface::isPassphraseRequired()
+{
+ QVariant var = getProperty("PassphraseRequired");
+ return qdbus_cast<bool>(var);
+}
+
+quint8 QConnmanServiceInterface::getSignalStrength()
+{
+ QVariant var = getProperty("Strength");
+ return qdbus_cast<quint8>(var);
+}
+
+bool QConnmanServiceInterface::isFavorite()
+{
+ QVariant var = getProperty("Favorite");
+ return qdbus_cast<bool>(var);
+}
+
+bool QConnmanServiceInterface::isImmutable()
+{
+ QVariant var = getProperty("Immutable");
+ return qdbus_cast<bool>(var);
+}
+
+bool QConnmanServiceInterface::isAutoConnect()
+{
+ QVariant var = getProperty("AutoConnect");
+ return qdbus_cast<bool>(var);
+}
+
+bool QConnmanServiceInterface::isSetupRequired()
+{
+ QVariant var = getProperty("SetupRequired");
+ return qdbus_cast<bool>(var);
+}
+
+QString QConnmanServiceInterface::getAPN()
+{
+ QVariant var = getProperty("APN");
+ return qdbus_cast<QString>(var);
+}
+
+QString QConnmanServiceInterface::getMCC()
+{
+ QVariant var = getProperty("MCC");
+ return qdbus_cast<QString>(var);
+}
+
+QString QConnmanServiceInterface::getMNC()
+{
+ QVariant var = getProperty("MNC");
+ return qdbus_cast<QString>(var);
+}
+
+bool QConnmanServiceInterface::isRoaming()
+{
+ QVariant var = getProperty("Roaming");
+ return qdbus_cast<bool>(var);
+}
+
+QStringList QConnmanServiceInterface::getNameservers()
+{
+ QVariant var = getProperty("NameServers");
+ return qdbus_cast<QStringList>(var);
+}
+
+QStringList QConnmanServiceInterface::getDomains()
+{
+ QVariant var = getProperty("Domains");
+ return qdbus_cast<QStringList>(var);
+}
+
+QVariantMap QConnmanServiceInterface::getIPv4()
+{
+ QVariant var = getProperty("IPv4");
+ return qdbus_cast<QVariantMap >(var);
+}
+
+QVariantMap QConnmanServiceInterface::getIPv4Configuration()
+{
+ QVariant var = getProperty("IPv4.Configuration");
+ return qdbus_cast<QVariantMap >(var);
+}
+
+QVariantMap QConnmanServiceInterface::getProxy()
+{
+ QVariant var = getProperty("Proxy");
+ return qdbus_cast<QVariantMap >(var);
+}
+
+QVariantMap QConnmanServiceInterface::getEthernet()
+{
+ QVariant var = getProperty("Ethernet");
+ return qdbus_cast<QVariantMap >(var);
+}
+
+bool QConnmanServiceInterface::isOfflineMode()
+{
+ QVariant var = getProperty("OfflineMode");
+ return qdbus_cast<bool>(var);
+}
+
+QStringList QConnmanServiceInterface::getServices()
+{
+ QVariant var = getProperty("Services");
+ return qdbus_cast<QStringList>(var);
+}
+
+
+//////////////////////////
+QConnmanTechnologyInterface::QConnmanTechnologyInterface(const QString &dbusPathName,QObject *parent)
+ : QDBusAbstractInterface(QLatin1String(CONNMAN_SERVICE),
+ dbusPathName,
+ CONNMAN_TECHNOLOGY_INTERFACE,
+ QDBusConnection::systemBus(), parent)
+{
+}
+
+QConnmanTechnologyInterface::~QConnmanTechnologyInterface()
+{
+}
+
+void QConnmanTechnologyInterface::connectNotify(const char *signal)
+{
+ if (QLatin1String(signal) == SIGNAL(propertyChanged(QString,QDBusVariant))) {
+ dbusConnection.connect(QLatin1String(CONNMAN_SERVICE),
+ this->path(),
+ QLatin1String(CONNMAN_TECHNOLOGY_INTERFACE),
+ QLatin1String("PropertyChanged"),
+ this,SIGNAL(propertyChanged(QString,QDBusVariant)));
+ }
+ if (QLatin1String(signal) == SIGNAL(propertyChangedContext(QString,QString,QDBusVariant))) {
+ QConnmanDBusHelper *helper;
+ helper = new QConnmanDBusHelper(this);
+
+ dbusConnection.connect(QLatin1String(CONNMAN_SERVICE),
+ this->path(),
+ QLatin1String(CONNMAN_TECHNOLOGY_INTERFACE),
+ QLatin1String("PropertyChanged"),
+ helper,SLOT(propertyChanged(QString,QDBusVariant)));
+
+ QObject::connect(helper,SIGNAL(propertyChangedContext(const QString &,const QString &,const QDBusVariant &)),
+ this,SIGNAL(propertyChangedContext(const QString &,const QString &,const QDBusVariant &)));
+ }
+}
+
+void QConnmanTechnologyInterface::disconnectNotify(const char *signal)
+{
+ if (QLatin1String(signal) == SIGNAL(propertyChanged(QString,QVariant))) {
+
+ }
+}
+
+QVariantMap QConnmanTechnologyInterface::getProperties()
+{
+ QDBusReply<QVariantMap> reply = this->call(QLatin1String("GetProperties"));
+ return reply.value();
+}
+
+QVariant QConnmanTechnologyInterface::getProperty(const QString &property)
+{
+ QVariant var;
+ QVariantMap map = getProperties();
+ if (map.contains(property)) {
+ var = map.value(property);
+ }
+ return var;
+}
+
+// properties
+QString QConnmanTechnologyInterface::getState()
+{
+ QVariant var = getProperty("State");
+ return qdbus_cast<QString>(var);
+}
+
+QString QConnmanTechnologyInterface::getName()
+{
+ QVariant var = getProperty("Name");
+ return qdbus_cast<QString>(var);
+}
+
+QString QConnmanTechnologyInterface::getType()
+{
+ QVariant var = getProperty("Type");
+ return qdbus_cast<QString>(var);
+}
+
+
+QStringList QConnmanTechnologyInterface::getDevices()
+{
+ QVariant var = getProperty("Devices");
+ return qdbus_cast<QStringList>(var);
+}
+
+
+//////////////////////////////////
+QConnmanAgentInterface::QConnmanAgentInterface(const QString &dbusPathName, QObject *parent)
+ : QDBusAbstractInterface(QLatin1String(CONNMAN_SERVICE),
+ dbusPathName,
+ CONNMAN_AGENT_INTERFACE,
+ QDBusConnection::systemBus(), parent)
+{
+}
+
+QConnmanAgentInterface::~QConnmanAgentInterface()
+{
+}
+
+void QConnmanAgentInterface::connectNotify(const char *signal)
+{
+ if (QLatin1String(signal) == SIGNAL(propertyChanged(QString,QDBusVariant))) {
+// dbusConnection.connect(QLatin1String(CONNMAN_SERVICE),
+// this->path(),
+// QLatin1String(CONNMAN_NETWORK_INTERFACE),
+// QLatin1String("PropertyChanged"),
+// this,SIGNAL(propertyChanged(const QString &, QVariant &)));
+ }
+}
+
+void QConnmanAgentInterface::disconnectNotify(const char *signal)
+{
+ if (QLatin1String(signal) == SIGNAL(propertyChanged(QString, QDBusVariant))) {
+
+ }
+}
+
+
+void QConnmanAgentInterface::release()
+{
+}
+
+void QConnmanAgentInterface::reportError(QDBusObjectPath &/*path*/, const QString &/*error*/)
+{
+}
+
+//dict QConnmanAgentInterface::requestInput(QDBusObjectPath &path, dict fields)
+//{
+//}
+
+void QConnmanAgentInterface::cancel()
+{
+}
+
+
+/////////////////////////////////////////
+
+QConnmanDeviceInterface::QConnmanDeviceInterface(const QString &dbusPathName,QObject *parent)
+ : QDBusAbstractInterface(QLatin1String(CONNMAN_SERVICE),
+ dbusPathName,
+ CONNMAN_DEVICE_INTERFACE,
+ QDBusConnection::systemBus(), parent)
+{
+}
+
+QConnmanDeviceInterface::~QConnmanDeviceInterface()
+{
+}
+
+void QConnmanDeviceInterface::connectNotify(const char *signal)
+{
+ if (QLatin1String(signal) == SIGNAL(propertyChanged(QString,QDBusVariant))) {
+ dbusConnection.connect(QLatin1String(CONNMAN_SERVICE),
+ this->path(),
+ QLatin1String(CONNMAN_DEVICE_INTERFACE),
+ QLatin1String("PropertyChanged"),
+ this,SIGNAL(propertyChanged(QString,QDBusVariant)));
+
+ }
+ if (QLatin1String(signal) == SIGNAL(propertyChangedContext(QString,QString,QDBusVariant))) {
+ QConnmanDBusHelper *helper;
+ helper = new QConnmanDBusHelper(this);
+
+ dbusConnection.connect(QLatin1String(CONNMAN_SERVICE),
+ this->path(),
+ QLatin1String(CONNMAN_DEVICE_INTERFACE),
+ QLatin1String("PropertyChanged"),
+ helper,SLOT(propertyChanged(QString,QDBusVariant)));
+
+ QObject::connect(helper,SIGNAL(propertyChangedContext(const QString &,const QString &,const QDBusVariant &)),
+ this,SIGNAL(propertyChangedContext(const QString &,const QString &,const QDBusVariant &)));
+ }
+}
+
+void QConnmanDeviceInterface::disconnectNotify(const char *signal)
+{
+ if (QLatin1String(signal) == SIGNAL(propertyChanged(QString,QVariant))) {
+
+ }
+}
+
+QVariantMap QConnmanDeviceInterface::getProperties()
+{
+ QDBusReply<QVariantMap> reply = this->call(QLatin1String("GetProperties"));
+ return reply.value();
+}
+
+bool QConnmanDeviceInterface::setProperty(const QString &name, const QDBusVariant &value)
+{
+
+// QList<QVariant> args;
+ qWarning() << __FUNCTION__ << name << value.variant();
+// args << qVariantFromValue(name);
+// args << qVariantFromValue(value);
+
+ QDBusMessage reply = this->call(QLatin1String("SetProperty"),name, qVariantFromValue(value));
+qWarning() << reply.errorMessage();
+
+ return true;
+}
+
+void QConnmanDeviceInterface::scan()
+{
+ QDBusReply<QVariantMap> reply = this->call(QLatin1String("ProposeScan"));
+ if(!reply.isValid()) {
+ qDebug() << reply.error().message();
+ }
+}
+
+QVariant QConnmanDeviceInterface::getProperty(const QString &property)
+{
+ QVariant var;
+ QVariantMap map = getProperties();
+ if (map.contains(property)) {
+ var = map.value(property);
+ }
+ return var;
+}
+
+//properties
+QString QConnmanDeviceInterface::getAddress()
+{
+ QVariant var = getProperty("Address");
+ return qdbus_cast<QString>(var);
+}
+
+QString QConnmanDeviceInterface::getName()
+{
+ QVariant var = getProperty("Name");
+ return qdbus_cast<QString>(var);
+}
+
+QString QConnmanDeviceInterface::getType()
+{
+ QVariant var = getProperty("Type");
+ return qdbus_cast<QString>(var);
+}
+
+QString QConnmanDeviceInterface::getInterface()
+{
+ QVariant var = getProperty("Interface");
+ return qdbus_cast<QString>(var);
+}
+
+bool QConnmanDeviceInterface::isPowered()
+{
+ QVariant var = getProperty("Powered");
+ return qdbus_cast<bool>(var);
+}
+
+quint16 QConnmanDeviceInterface::getScanInterval()
+{
+ QVariant var = getProperty("ScanInterval");
+ return qdbus_cast<quint16>(var);
+}
+
+bool QConnmanDeviceInterface::setScanInterval(const QString & interval)
+{
+// QList<QVariant> args;
+// args << qVariantFromValue(name)
+// << value.variant();
+
+// QDBusMessage reply = this->callWithArgumentList(QDBus::AutoDetect,QLatin1String("SetProperty"),args);
+
+ return setProperty("ScanInterval", QDBusVariant(interval));
+}
+
+bool QConnmanDeviceInterface::isScanning()
+{
+ QVariant var = getProperty("Scanning");
+ return qdbus_cast<bool>(var);
+}
+
+QStringList QConnmanDeviceInterface::getNetworks()
+{
+ QVariant var = getProperty("Networks");
+ return qdbus_cast<QStringList>(var);
+}
+
+bool QConnmanDeviceInterface::setEnabled(bool powered)
+{
+ QList<QVariant> args;
+ args << qVariantFromValue(QString("Powered"))
+ << qVariantFromValue(QDBusVariant(powered));
+
+ QDBusMessage reply = this->callWithArgumentList(QDBus::AutoDetect,QLatin1String("SetProperty"),args);
+ qWarning() << reply.errorMessage() << reply.errorName();
+ return true;
+}
+
+QConnmanDBusHelper::QConnmanDBusHelper(QObject * parent)
+ : QObject(parent)
+{
+}
+
+QConnmanDBusHelper::~QConnmanDBusHelper()
+{
+}
+
+void QConnmanDBusHelper::propertyChanged(const QString &item, const QDBusVariant &var)
+{
+ QDBusMessage msg = this->message();
+// qWarning() << sender();
+ // qWarning() << msg.interface() << msg.path() << item << var.variant() <<"\n";
+ Q_EMIT propertyChangedContext(msg.path() ,item, var);
+}
+
+/////////////////
+QT_END_NAMESPACE
diff --git a/src/plugins/bearer/connman/qconnmanservice_linux_p.h b/src/plugins/bearer/connman/qconnmanservice_linux_p.h
new file mode 100644
index 0000000..9475296
--- /dev/null
+++ b/src/plugins/bearer/connman/qconnmanservice_linux_p.h
@@ -0,0 +1,377 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QCONNMANSERVICE_H
+#define QCONNMANSERVICE_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtDBus/QtDBus>
+#include <QtDBus/QDBusConnection>
+#include <QtDBus/QDBusError>
+#include <QtDBus/QDBusInterface>
+#include <QtDBus/QDBusMessage>
+#include <QtDBus/QDBusReply>
+
+#include <QtDBus/QDBusPendingCallWatcher>
+#include <QtDBus/QDBusObjectPath>
+#include <QtDBus/QDBusContext>
+#include <QMap>
+
+#ifndef __CONNMAN_DBUS_H
+
+#define CONNMAN_SERVICE "org.moblin.connman"
+#define CONNMAN_PATH "/org/moblin/connman"
+
+#define CONNMAN_DEBUG_INTERFACE CONNMAN_SERVICE ".Debug"
+#define CONNMAN_ERROR_INTERFACE CONNMAN_SERVICE ".Error"
+#define CONNMAN_AGENT_INTERFACE CONNMAN_SERVICE ".Agent"
+#define CONNMAN_COUNTER_INTERFACE CONNMAN_SERVICE ".Counter"
+
+#define CONNMAN_MANAGER_INTERFACE CONNMAN_SERVICE ".Manager"
+#define CONNMAN_MANAGER_PATH "/"
+
+#define CONNMAN_TASK_INTERFACE CONNMAN_SERVICE ".Task"
+#define CONNMAN_PROFILE_INTERFACE CONNMAN_SERVICE ".Profile"
+#define CONNMAN_SERVICE_INTERFACE CONNMAN_SERVICE ".Service"
+#define CONNMAN_DEVICE_INTERFACE CONNMAN_SERVICE ".Device"
+#define CONNMAN_NETWORK_INTERFACE CONNMAN_SERVICE ".Network"
+#define CONNMAN_PROVIDER_INTERFACE CONNMAN_SERVICE ".Provider"
+#define CONNMAN_TECHNOLOGY_INTERFACE CONNMAN_SERVICE ".Technology"
+#endif
+
+QT_BEGIN_NAMESPACE
+
+QT_END_NAMESPACE
+
+
+QT_BEGIN_NAMESPACE
+
+class QConnmanManagerInterface : public QDBusAbstractInterface
+{
+ Q_OBJECT
+
+public:
+
+ QConnmanManagerInterface( QObject *parent = 0);
+ ~QConnmanManagerInterface();
+
+ QDBusObjectPath path() const;
+
+ QVariantMap getProperties();
+ bool setProperty(const QString &name, const QDBusVariant &value);
+ QDBusObjectPath createProfile(const QString &name);
+ bool removeProfile(QDBusObjectPath path);
+ bool requestScan(const QString &type);
+ bool enableTechnology(const QString &type);
+ bool disableTechnology(const QString &type);
+ QDBusObjectPath connectService(QVariantMap &map);
+ void registerAgent(QDBusObjectPath &path);
+ void unregisterAgent(QDBusObjectPath path);
+ void registerCounter(QDBusObjectPath path, quint32 interval);
+ void unregisterCounter(QDBusObjectPath path);
+
+ QString requestSession(const QString &bearerName);
+ void releaseSession();
+
+ // properties
+ QString getState();
+ QStringList getAvailableTechnologies();
+ QStringList getEnabledTechnologies();
+ QStringList getConnectedTechnologies();
+ QString getDefaultTechnology();
+ bool getOfflineMode();
+ QString getActiveProfile();
+ QStringList getProfiles();
+ QStringList getTechnologies();
+ QStringList getServices();
+ QDBusObjectPath lookupService(const QString &);
+
+ QString getPathForTechnology(const QString &tech);
+
+
+Q_SIGNALS:
+ void propertyChanged(const QString &, const QDBusVariant &value);
+ void stateChanged(const QString &);
+ void propertyChangedContext(const QString &,const QString &,const QDBusVariant &);
+
+protected:
+ void connectNotify(const char *signal);
+ void disconnectNotify(const char *signal);
+ QVariant getProperty(const QString &);
+};
+
+
+class QConnmanNetworkInterface : public QDBusAbstractInterface
+{
+ Q_OBJECT
+
+public:
+
+ QConnmanNetworkInterface(const QString &dbusPathName, QObject *parent = 0);
+ ~QConnmanNetworkInterface();
+
+ QVariantMap getProperties();
+
+ //properties
+ QString getAddress();
+ QString getName();
+ bool isConnected();
+ quint8 getSignalStrength();
+ QString getDevice();
+ QString getWifiSsid();
+ QString getWifiMode();
+ QString getWifiSecurity();
+ QString getWifiPassphrase();
+
+Q_SIGNALS:
+ void propertyChanged(const QString &, const QDBusVariant &value);
+ void propertyChangedContext(const QString &,const QString &,const QDBusVariant &);
+protected:
+ void connectNotify(const char *signal);
+ void disconnectNotify(const char *signal);
+ QVariant getProperty(const QString &);
+};
+
+class QConnmanProfileInterfacePrivate;
+class QConnmanProfileInterface : public QDBusAbstractInterface
+{
+ Q_OBJECT
+
+public:
+
+ QConnmanProfileInterface(const QString &dbusPathName,QObject *parent = 0);
+ ~QConnmanProfileInterface();
+
+ QVariantMap getProperties();
+// properties
+ QString getName();
+ bool isOfflineMode();
+ QStringList getServices();
+
+Q_SIGNALS:
+ void propertyChanged(const QString &, const QDBusVariant &value);
+private:
+ QConnmanProfileInterfacePrivate *d;
+
+protected:
+ void connectNotify(const char *signal);
+ void disconnectNotify(const char *signal);
+ QVariant getProperty(const QString &);
+};
+
+class QConnmanServiceInterface : public QDBusAbstractInterface
+{
+ Q_OBJECT
+
+public:
+
+ QConnmanServiceInterface(const QString &dbusPathName,QObject *parent = 0);
+ ~QConnmanServiceInterface();
+
+ QVariantMap getProperties();
+ // clearProperty
+ void connect();
+ void disconnect();
+ void remove();
+ // void moveBefore(QDBusObjectPath &service);
+ // void moveAfter(QDBusObjectPath &service);
+
+// properties
+ QString getState();
+ QString getError();
+ QString getName();
+ QString getType();
+ QString getMode();
+ QString getSecurity();
+ QString getPassphrase();
+ bool isPassphraseRequired();
+ quint8 getSignalStrength();
+ bool isFavorite();
+ bool isImmutable();
+ bool isAutoConnect();
+ bool isSetupRequired();
+ QString getAPN();
+ QString getMCC();
+ QString getMNC();
+ bool isRoaming();
+ QStringList getNameservers();
+ QStringList getDomains();
+ QVariantMap getIPv4();
+ QVariantMap getIPv4Configuration();
+ QVariantMap getProxy();
+ QVariantMap getEthernet();
+
+ bool isOfflineMode();
+ QStringList getServices();
+
+Q_SIGNALS:
+ void propertyChanged(const QString &, const QDBusVariant &value);
+ void propertyChangedContext(const QString &,const QString &,const QDBusVariant &);
+
+protected:
+ void connectNotify(const char *signal);
+ void disconnectNotify(const char *signal);
+ QVariant getProperty(const QString &);
+};
+
+class QConnmanTechnologyInterface : public QDBusAbstractInterface
+{
+ Q_OBJECT
+
+public:
+
+ QConnmanTechnologyInterface(const QString &dbusPathName,QObject *parent = 0);
+ ~QConnmanTechnologyInterface();
+
+ QVariantMap getProperties();
+// properties
+ QString getState();
+ QString getName();
+ QString getType();
+
+ QStringList getDevices();
+
+Q_SIGNALS:
+ void propertyChanged(const QString &, const QDBusVariant &value);
+ void propertyChangedContext(const QString &,const QString &,const QDBusVariant &);
+protected:
+ void connectNotify(const char *signal);
+ void disconnectNotify(const char *signal);
+ QVariant getProperty(const QString &);
+
+};
+
+class QConnmanAgentInterface : public QDBusAbstractInterface
+{
+ Q_OBJECT
+
+public:
+
+ QConnmanAgentInterface(const QString &dbusPathName,QObject *parent = 0);
+ ~QConnmanAgentInterface();
+
+ void release();
+ void reportError(QDBusObjectPath &path, const QString &error);
+// dict requestInput(QDBusObjectPath &path, dict fields);
+ void cancel();
+protected:
+ void connectNotify(const char *signal);
+ void disconnectNotify(const char *signal);
+};
+
+//class QConnmanCounterInterfacePrivate;
+//class QConnmanCounterInterface : public QDBusAbstractInterface
+//{
+// Q_OBJECT
+//
+//public:
+//
+// QConnmanCounterInterface(QObject *parent = 0);
+// ~QConnmanCounterInterface();
+//
+// void release();
+//private:
+// QConnmanCounterInterfacePrivate *d;
+//};
+
+class QConnmanDeviceInterface : public QDBusAbstractInterface
+{
+ Q_OBJECT
+
+public:
+
+ QConnmanDeviceInterface(const QString &dbusPathName,QObject *parent = 0);
+ ~QConnmanDeviceInterface();
+
+ QVariantMap getProperties();
+ void scan();
+
+//properties
+ QString getAddress();
+ QString getName();
+ QString getType();
+ QString getInterface();
+ bool isPowered();
+ quint16 getScanInterval();
+ bool setScanInterval(const QString &interval);
+
+ bool isScanning();
+ QStringList getNetworks();
+ bool setEnabled(bool powered);
+ bool setProperty(const QString &name, const QDBusVariant &value);
+
+Q_SIGNALS:
+ void propertyChanged(const QString &, const QDBusVariant &value);
+ void propertyChangedContext(const QString &,const QString &,const QDBusVariant &);
+protected:
+ void connectNotify(const char *signal);
+ void disconnectNotify(const char *signal);
+ QVariant getProperty(const QString &);
+
+};
+
+class QConnmanDBusHelper: public QObject, protected QDBusContext
+ {
+ Q_OBJECT
+ public:
+ QConnmanDBusHelper(QObject *parent = 0);
+ ~QConnmanDBusHelper();
+
+ public slots:
+ void propertyChanged(const QString &, const QDBusVariant &);
+
+Q_SIGNALS:
+ void propertyChangedContext(const QString &,const QString &,const QDBusVariant &);
+};
+
+QT_END_NAMESPACE
+
+#endif //QCONNMANSERVICE_H