summaryrefslogtreecommitdiffstats
path: root/src/plugins/bearer/connman/qconnmanservice_linux.cpp
diff options
context:
space:
mode:
authorLorn Potter <lorn.potter@nokia.com>2010-07-30 05:06:55 (GMT)
committerLorn Potter <lorn.potter@nokia.com>2010-07-30 05:06:55 (GMT)
commit172107be09761b703b6025c98b46a2798ee0e3da (patch)
tree8be7cb0bfacfb6bd234e01368f0e8103b4f7f9fd /src/plugins/bearer/connman/qconnmanservice_linux.cpp
parent3197a2f05c07e5641b581dd46460ccb194c2b8e0 (diff)
downloadQt-172107be09761b703b6025c98b46a2798ee0e3da.zip
Qt-172107be09761b703b6025c98b46a2798ee0e3da.tar.gz
Qt-172107be09761b703b6025c98b46a2798ee0e3da.tar.bz2
add convience methods for getting ethernet service details.
Diffstat (limited to 'src/plugins/bearer/connman/qconnmanservice_linux.cpp')
-rw-r--r--src/plugins/bearer/connman/qconnmanservice_linux.cpp107
1 files changed, 103 insertions, 4 deletions
diff --git a/src/plugins/bearer/connman/qconnmanservice_linux.cpp b/src/plugins/bearer/connman/qconnmanservice_linux.cpp
index b20e7c1..00cfb31 100644
--- a/src/plugins/bearer/connman/qconnmanservice_linux.cpp
+++ b/src/plugins/bearer/connman/qconnmanservice_linux.cpp
@@ -129,8 +129,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 +553,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 +731,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");