summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorLorn Potter <lorn.potter@nokia.com>2010-06-30 02:20:14 (GMT)
committerLorn Potter <lorn.potter@nokia.com>2010-06-30 02:20:14 (GMT)
commit5a6d8c40791da2e8751965d05ae2d5ef69bed301 (patch)
treea0e214468531cf18793f98cc51c3360c809b12a5 /src/plugins
parent676ef3a5ffd7aa1c8f85bce6010205e2d101b8d5 (diff)
downloadQt-5a6d8c40791da2e8751965d05ae2d5ef69bed301.zip
Qt-5a6d8c40791da2e8751965d05ae2d5ef69bed301.tar.gz
Qt-5a6d8c40791da2e8751965d05ae2d5ef69bed301.tar.bz2
make sure ap's are removed when the device is removed
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/bearer/connman/qconnmanengine.cpp24
-rw-r--r--src/plugins/bearer/connman/qconnmanservice_linux.cpp44
-rw-r--r--src/plugins/bearer/connman/qconnmanservice_linux_p.h34
3 files changed, 74 insertions, 28 deletions
diff --git a/src/plugins/bearer/connman/qconnmanengine.cpp b/src/plugins/bearer/connman/qconnmanengine.cpp
index bdff815..8775623 100644
--- a/src/plugins/bearer/connman/qconnmanengine.cpp
+++ b/src/plugins/bearer/connman/qconnmanengine.cpp
@@ -250,7 +250,7 @@ QNetworkSession::State QConnmanEngine::sessionStateForId(const QString &id)
QConnmanServiceInterface serv(service);
QString servState = serv.getState();
- if(serv.isFavorite() && servState == "idle" || servState == "failure") {
+ if(serv.isFavorite() && (servState == "idle" || servState == "failure")) {
return QNetworkSession::Disconnected;
}
@@ -285,6 +285,7 @@ quint64 QConnmanEngine::bytesWritten(const QString &id)
in >> result;
tx.close();
}
+
return result;
}
@@ -347,6 +348,9 @@ QString QConnmanEngine::getServiceForNetwork(const QString &netPath)
void QConnmanEngine::propertyChangedContext(const QString &path,const QString &item, const QDBusVariant &value)
{
+ Q_UNUSED(path);
+// qDebug() << __FUNCTION__ << path << item << value.variant();
+
QMutexLocker locker(&mutex);
if(item == "Services") {
QDBusArgument arg = qvariant_cast<QDBusArgument>(value.variant());
@@ -421,11 +425,10 @@ void QConnmanEngine::devicePropertyChangedContext(const QString &devpath,const Q
while(i.hasNext()) {
i.next();
if(i.value().contains(devpath)) {
- devicetype = i.key();
+ devicetype = i.key().section("/",-1);
}
}
-
QStringList oldnetworks = knownNetworks[devicetype];
if(remainingNetworks.count() > oldnetworks.count()) {
@@ -593,14 +596,16 @@ void QConnmanEngine::addServiceConfiguration(const QString &servicePath)
QConnmanNetworkInterface *network;
network = new QConnmanNetworkInterface(netPath, this);
- serviceNetworks.insert(servicePath,netPath);
const QString id = QString::number(qHash(servicePath));
if (!accessPointConfigurations.contains(id)) {
-
QConnmanDeviceInterface device(netPath.section("/",0,5),this);
- knownNetworks[device.getType()]<< netPath;
+
+ serviceNetworks.insert(servicePath,netPath);
+
+ knownNetworks[device.getType()].append(netPath);
+
connect(serv,SIGNAL(propertyChangedContext(QString,QString,QDBusVariant)),
this,SLOT(servicePropertyChangedContext(QString,QString, QDBusVariant)));
QNetworkConfigurationPrivate* cpPriv = new QNetworkConfigurationPrivate();
@@ -661,10 +666,13 @@ void QConnmanEngine::addNetworkConfiguration(const QString &networkPath)
connect(serv,SIGNAL(propertyChangedContext(QString,QString,QDBusVariant)),
this,SLOT(servicePropertyChangedContext(QString,QString, QDBusVariant)));
}
- knownNetworks[device.getType()]<< networkPath;
- serviceNetworks.insert(servicePath,networkPath);
if (!accessPointConfigurations.contains(id)) {
+
+ knownNetworks[device.getType()].append(networkPath);
+
+ serviceNetworks.insert(servicePath,networkPath);
+
connect(network,SIGNAL(propertyChangedContext(QString,QString,QDBusVariant)),
this,SLOT(networkPropertyChangedContext(QString,QString, QDBusVariant)));
diff --git a/src/plugins/bearer/connman/qconnmanservice_linux.cpp b/src/plugins/bearer/connman/qconnmanservice_linux.cpp
index ca76ffd..b20e7c1 100644
--- a/src/plugins/bearer/connman/qconnmanservice_linux.cpp
+++ b/src/plugins/bearer/connman/qconnmanservice_linux.cpp
@@ -208,17 +208,29 @@ void QConnmanManagerInterface::unregisterAgent(QDBusObjectPath /*path*/)
{
}
-void QConnmanManagerInterface::registerCounter(QDBusObjectPath /*path*/, quint32 /*interval*/)
-{
+void QConnmanManagerInterface::registerCounter(const QString &path, quint32 interval)
+{ QDBusReply<QList<QDBusObjectPath> > reply = this->call(QLatin1String("RegisterCounter"),
+ QVariant::fromValue(path),
+ QVariant::fromValue(interval));
+ bool ok = true;
+ if(reply.error().type() == QDBusError::InvalidArgs) {
+ qWarning() << reply.error().message();
+ }
}
-void QConnmanManagerInterface::unregisterCounter(QDBusObjectPath /*path*/)
-{
+void QConnmanManagerInterface::unregisterCounter(const QString &path)
+{ QDBusReply<QList<QDBusObjectPath> > reply = this->call(QLatin1String("UnregisterCounter"),
+ QVariant::fromValue(path));
+ bool ok = true;
+ if(reply.error().type() == QDBusError::InvalidArgs) {
+ qWarning() << reply.error().message();
+ }
}
QString QConnmanManagerInterface::requestSession(const QString &bearerName)
{
- QDBusReply<QList<QDBusObjectPath> > reply = this->call(QLatin1String("RequestSession"), QVariant::fromValue(bearerName));
+ QDBusReply<QList<QDBusObjectPath> > reply = this->call(QLatin1String("RequestSession"),
+ QVariant::fromValue(bearerName));
return QString();
}
@@ -863,7 +875,29 @@ void QConnmanAgentInterface::cancel()
/////////////////////////////////////////
+QConnmanCounterInterface::QConnmanCounterInterface(const QString &dbusPathName,QObject *parent)
+ : QDBusAbstractInterface(QLatin1String(CONNMAN_SERVICE),
+ dbusPathName,
+ CONNMAN_COUNTER_INTERFACE,
+ QDBusConnection::systemBus(), parent)
+{
+}
+
+QConnmanCounterInterface::~QConnmanCounterInterface()
+{
+}
+
+quint32 QConnmanCounterInterface::getReceivedByteCount()
+{
+return 0;
+}
+
+quint32 QConnmanCounterInterface::getTransmittedByteCount()
+{
+return 0;
+}
+/////////////////////////////////////////
QConnmanDeviceInterface::QConnmanDeviceInterface(const QString &dbusPathName,QObject *parent)
: QDBusAbstractInterface(QLatin1String(CONNMAN_SERVICE),
dbusPathName,
diff --git a/src/plugins/bearer/connman/qconnmanservice_linux_p.h b/src/plugins/bearer/connman/qconnmanservice_linux_p.h
index 9475296..35e3f3d 100644
--- a/src/plugins/bearer/connman/qconnmanservice_linux_p.h
+++ b/src/plugins/bearer/connman/qconnmanservice_linux_p.h
@@ -115,8 +115,8 @@ public:
QDBusObjectPath connectService(QVariantMap &map);
void registerAgent(QDBusObjectPath &path);
void unregisterAgent(QDBusObjectPath path);
- void registerCounter(QDBusObjectPath path, quint32 interval);
- void unregisterCounter(QDBusObjectPath path);
+ void registerCounter(const QString &path, quint32 interval);
+ void unregisterCounter(const QString &path);
QString requestSession(const QString &bearerName);
void releaseSession();
@@ -307,20 +307,24 @@ protected:
void disconnectNotify(const char *signal);
};
-//class QConnmanCounterInterfacePrivate;
-//class QConnmanCounterInterface : public QDBusAbstractInterface
-//{
-// Q_OBJECT
-//
-//public:
-//
-// QConnmanCounterInterface(QObject *parent = 0);
-// ~QConnmanCounterInterface();
-//
+class QConnmanCounterInterfacePrivate;
+class QConnmanCounterInterface : public QDBusAbstractInterface
+{
+ Q_OBJECT
+
+public:
+
+ QConnmanCounterInterface(const QString &dbusPathName, QObject *parent = 0);
+ ~QConnmanCounterInterface();
+
// void release();
-//private:
-// QConnmanCounterInterfacePrivate *d;
-//};
+ QString getInterface();
+ quint32 getReceivedByteCount();
+ quint32 getTransmittedByteCount();
+
+private:
+ QConnmanCounterInterfacePrivate *d;
+};
class QConnmanDeviceInterface : public QDBusAbstractInterface
{