diff options
Diffstat (limited to 'src/plugins/bearer/connman/qconnmanservice_linux.cpp')
-rw-r--r-- | src/plugins/bearer/connman/qconnmanservice_linux.cpp | 113 |
1 files changed, 109 insertions, 4 deletions
diff --git a/src/plugins/bearer/connman/qconnmanservice_linux.cpp b/src/plugins/bearer/connman/qconnmanservice_linux.cpp index da421bc..0ffada9 100644 --- a/src/plugins/bearer/connman/qconnmanservice_linux.cpp +++ b/src/plugins/bearer/connman/qconnmanservice_linux.cpp @@ -53,6 +53,8 @@ #include "qconnmanservice_linux_p.h" +#ifndef QT_NO_BEARERMANAGEMENT +#ifndef QT_NO_DBUS QT_BEGIN_NAMESPACE static QDBusConnection dbusConnection = QDBusConnection::systemBus(); @@ -129,8 +131,10 @@ QVariant QConnmanManagerInterface::getProperty(const QString &property) QVariantMap QConnmanManagerInterface::getProperties() { - QDBusReply<QVariantMap > reply = this->call(QLatin1String("GetProperties")); - return reply.value(); + if(this->isValid()) { + QDBusReply<QVariantMap > reply = this->call(QLatin1String("GetProperties")); + return reply.value(); + } else return QVariantMap(); } QString QConnmanManagerInterface::getState() @@ -551,8 +555,12 @@ void QConnmanServiceInterface::disconnectNotify(const char *signal) QVariantMap QConnmanServiceInterface::getProperties() { - QDBusReply<QVariantMap> reply = this->call(QLatin1String("GetProperties")); - return reply.value(); + if(this->isValid()) { + QDBusReply<QVariantMap> reply = this->call(QLatin1String("GetProperties")); + return reply.value(); + } + else + return QVariantMap(); } QVariant QConnmanServiceInterface::getProperty(const QString &property) @@ -725,6 +733,99 @@ QVariantMap QConnmanServiceInterface::getEthernet() return qdbus_cast<QVariantMap >(var); } +QString QConnmanServiceInterface::getMethod() +{ + QVariant var; + QVariantMap map = getEthernet(); + QMapIterator<QString,QVariant> it(map); + while(it.hasNext()) { + it.next(); + if(it.key() == "Method") { + return it.value().toString(); + } + } + return QString(); +} + +QString QConnmanServiceInterface::getInterface() +{ + QVariant var; + QVariantMap map = getEthernet(); + + QMapIterator<QString,QVariant> it(map); + while(it.hasNext()) { + it.next(); + if(it.key() == "Interface") { + return it.value().toString(); + } + } + + return QString(); +} + +QString QConnmanServiceInterface::getMacAddress() +{ + QVariant var; + QVariantMap map = getEthernet(); + + QMapIterator<QString,QVariant> it(map); + while(it.hasNext()) { + it.next(); + if(it.key() == "Address") { + return it.value().toString(); + } + } + return QString(); +} + +quint16 QConnmanServiceInterface::getMtu() +{ + quint16 mtu=0; + QVariant var; + QVariantMap map = getEthernet(); + + QMapIterator<QString,QVariant> it(map); + while(it.hasNext()) { + it.next(); + if(it.key() == "MTU") { + return it.value().toUInt(); + } + } + return mtu; +} + +quint16 QConnmanServiceInterface::getSpeed() +{ + quint16 speed=0; + QVariant var; + QVariantMap map = getEthernet(); + + QMapIterator<QString,QVariant> it(map); + while(it.hasNext()) { + it.next(); + if(it.key() == "Speed") { + return it.value().toUInt(); + } + } + return speed; +} + +QString QConnmanServiceInterface::getDuplex() +{ + QVariant var; + QVariantMap map = getEthernet(); + + QMapIterator<QString,QVariant> it(map); + while(it.hasNext()) { + it.next(); + if(it.key() == "Duplex") { + return it.value().toString(); + } + } + return QString(); +} + + bool QConnmanServiceInterface::isOfflineMode() { QVariant var = getProperty("OfflineMode"); @@ -1070,3 +1171,7 @@ void QConnmanDBusHelper::propertyChanged(const QString &item, const QDBusVariant ///////////////// QT_END_NAMESPACE + +#endif // QT_NO_DBUS +#endif // QT_NO_BEARERMANAGEMENT + |