summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorLorn Potter <lorn.potter@jollamobile.com>2012-12-05 06:08:11 (GMT)
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-02-20 02:13:13 (GMT)
commit7a9c6c1de3467faa534ce7aa6e1b065691aea662 (patch)
treebfb8d5c92c9168079a00ffa4fde0371a33328e56 /src/plugins
parent6ecf8502fe49ad50689635f7d7bc0215986ba76c (diff)
downloadQt-7a9c6c1de3467faa534ce7aa6e1b065691aea662.zip
Qt-7a9c6c1de3467faa534ce7aa6e1b065691aea662.tar.gz
Qt-7a9c6c1de3467faa534ce7aa6e1b065691aea662.tar.bz2
fix connman bearer for new API.
back ported from qt5 sha 2efccfeeef70ebd8a2db2ebccb3c63722ae76e1f Change-Id: Ib9cdbb6e4bdfed8420cdc2364503445924c8c57c Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/bearer/connman/qconnmanservice_linux.cpp57
-rw-r--r--src/plugins/bearer/connman/qconnmanservice_linux_p.h14
2 files changed, 65 insertions, 6 deletions
diff --git a/src/plugins/bearer/connman/qconnmanservice_linux.cpp b/src/plugins/bearer/connman/qconnmanservice_linux.cpp
index 9c6a9a7..50132c2 100644
--- a/src/plugins/bearer/connman/qconnmanservice_linux.cpp
+++ b/src/plugins/bearer/connman/qconnmanservice_linux.cpp
@@ -57,6 +57,24 @@
#ifndef QT_NO_DBUS
QT_BEGIN_NAMESPACE
+
+
+QDBusArgument &operator<<(QDBusArgument &argument, const ConnmanMap &map)
+{
+ argument.beginStructure();
+ argument << map.objectPath << map.propertyMap;
+ argument.endStructure();
+ return argument;
+}
+
+const QDBusArgument &operator>>(const QDBusArgument &argument, ConnmanMap &map)
+{
+ argument.beginStructure();
+ argument >> map.objectPath >> map.propertyMap;
+ argument.endStructure();
+ return argument;
+}
+
static QDBusConnection dbusConnection = QDBusConnection::systemBus();
@@ -66,6 +84,9 @@ QConnmanManagerInterface::QConnmanManagerInterface( QObject *parent)
CONNMAN_MANAGER_INTERFACE,
QDBusConnection::systemBus(), parent)
{
+ qDBusRegisterMetaType<ConnmanMap>();
+ qDBusRegisterMetaType<ConnmanMapList>();
+ qRegisterMetaType<ConnmanMapList>("ConnmanMapList");
}
QConnmanManagerInterface::~QConnmanManagerInterface()
@@ -297,14 +318,38 @@ QStringList QConnmanManagerInterface::getProfiles()
QStringList QConnmanManagerInterface::getTechnologies()
{
- QVariant var = getProperty("Technologies");
- return qdbus_cast<QStringList >(var);
+ QStringList list;
+ QDBusReply<ConnmanMapList> replyList = this->call(QLatin1String("GetTechnologies"));
+ if (replyList.isValid()) {
+ Q_FOREACH (ConnmanMap map, replyList.value()) {
+ list << map.objectPath.path();
+ }
+ } else {
+ // try for older version
+ QVariant var = getProperty("Technologies");
+ if (!var.isNull()) {
+ list = qdbus_cast<QStringList>(var);
+ }
+ }
+ return list;
}
QStringList QConnmanManagerInterface::getServices()
{
- QVariant var = getProperty("Services");
- return qdbus_cast<QStringList >(var);
+ QStringList list;
+ QDBusReply<ConnmanMapList> replyList = this->call(QLatin1String("GetServices"));
+ if (replyList.isValid()) {
+ Q_FOREACH (ConnmanMap map, replyList.value()) {
+ list << map.objectPath.path();
+ }
+ } else {
+ // try for older version
+ QVariant var = getProperty("Services");
+ if (!var.isNull()) {
+ list = qdbus_cast<QStringList>(var);
+ }
+ }
+ return list;
}
QString QConnmanManagerInterface::getPathForTechnology(const QString &name)
@@ -361,7 +406,7 @@ QVariant QConnmanProfileInterface::getProperty(const QString &property)
QVariantMap map = getProperties();
if (map.contains(property)) {
var = map.value(property);
- }
+ }
return var;
}
@@ -446,7 +491,7 @@ QVariant QConnmanServiceInterface::getProperty(const QString &property)
QVariantMap map = getProperties();
if (map.contains(property)) {
var = map.value(property);
- }
+ }
return var;
}
diff --git a/src/plugins/bearer/connman/qconnmanservice_linux_p.h b/src/plugins/bearer/connman/qconnmanservice_linux_p.h
index 0fef8bf..113b3d9 100644
--- a/src/plugins/bearer/connman/qconnmanservice_linux_p.h
+++ b/src/plugins/bearer/connman/qconnmanservice_linux_p.h
@@ -59,6 +59,7 @@
#include <QtDBus/QDBusInterface>
#include <QtDBus/QDBusMessage>
#include <QtDBus/QDBusReply>
+#include <QtDBus/QDBusArgument>
#include <QtDBus/QDBusPendingCallWatcher>
#include <QtDBus/QDBusObjectPath>
@@ -90,11 +91,24 @@
QT_BEGIN_NAMESPACE
+struct ConnmanMap {
+ QDBusObjectPath objectPath;
+ QVariantMap propertyMap;
+};
+
+typedef QList< ConnmanMap > ConnmanMapList;
+
QT_END_NAMESPACE
+Q_DECLARE_METATYPE(QT_PREPEND_NAMESPACE(ConnmanMap));
+Q_DECLARE_METATYPE(QT_PREPEND_NAMESPACE(ConnmanMapList))
QT_BEGIN_NAMESPACE
+QDBusArgument &operator<<(QDBusArgument &argument, const ConnmanMap &obj);
+const QDBusArgument &operator>>(const QDBusArgument &argument, ConnmanMap &obj);
+
+
class QConnmanManagerInterface : public QDBusAbstractInterface
{
Q_OBJECT