update the network configuration list
when changes in the networks happen. Task-number: QTBUG-34021 Change-Id: I2bd187e7d04d6876294f18d917c9a384afe5db35 Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
This commit is contained in:
parent
67cf8bf9a8
commit
c28763d83c
@ -65,6 +65,9 @@ QConnmanEngine::QConnmanEngine(QObject *parent)
|
|||||||
: QBearerEngineImpl(parent),
|
: QBearerEngineImpl(parent),
|
||||||
connmanManager(new QConnmanManagerInterface(this))
|
connmanManager(new QConnmanManagerInterface(this))
|
||||||
{
|
{
|
||||||
|
qDBusRegisterMetaType<ConnmanMap>();
|
||||||
|
qDBusRegisterMetaType<ConnmanMapList>();
|
||||||
|
qRegisterMetaType<ConnmanMapList>("ConnmanMapList");
|
||||||
}
|
}
|
||||||
|
|
||||||
QConnmanEngine::~QConnmanEngine()
|
QConnmanEngine::~QConnmanEngine()
|
||||||
@ -82,6 +85,9 @@ void QConnmanEngine::initialize()
|
|||||||
connect(connmanManager,SIGNAL(propertyChangedContext(QString,QString,QDBusVariant)),
|
connect(connmanManager,SIGNAL(propertyChangedContext(QString,QString,QDBusVariant)),
|
||||||
this,SLOT(propertyChangedContext(QString,QString,QDBusVariant)));
|
this,SLOT(propertyChangedContext(QString,QString,QDBusVariant)));
|
||||||
|
|
||||||
|
connect(connmanManager,SIGNAL(servicesChanged(ConnmanMapList, QList<QDBusObjectPath>)),
|
||||||
|
this, SLOT(updateServices(ConnmanMapList, QList<QDBusObjectPath>)));
|
||||||
|
|
||||||
foreach (const QString &techPath, connmanManager->getTechnologies()) {
|
foreach (const QString &techPath, connmanManager->getTechnologies()) {
|
||||||
QConnmanTechnologyInterface *tech;
|
QConnmanTechnologyInterface *tech;
|
||||||
tech = new QConnmanTechnologyInterface(techPath, this);
|
tech = new QConnmanTechnologyInterface(techPath, this);
|
||||||
@ -172,6 +178,22 @@ void QConnmanEngine::requestUpdate()
|
|||||||
QTimer::singleShot(0, this, SLOT(doRequestUpdate()));
|
QTimer::singleShot(0, this, SLOT(doRequestUpdate()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QConnmanEngine::updateServices(const ConnmanMapList &changed, const QList<QDBusObjectPath> &removed)
|
||||||
|
{
|
||||||
|
foreach (const QDBusObjectPath &objectPath, removed) {
|
||||||
|
removeConfiguration(QString::number(qHash(objectPath.path())));
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (const ConnmanMap &connmanMap, changed) {
|
||||||
|
const QString id = QString::number(qHash(connmanMap.objectPath.path()));
|
||||||
|
if (accessPointConfigurations.contains(id)) {
|
||||||
|
configurationChange(id);
|
||||||
|
} else {
|
||||||
|
addServiceConfiguration(connmanMap.objectPath.path());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
QString QConnmanEngine::serviceFromId(const QString &id)
|
QString QConnmanEngine::serviceFromId(const QString &id)
|
||||||
{
|
{
|
||||||
QMutexLocker locker(&mutex);
|
QMutexLocker locker(&mutex);
|
||||||
|
@ -105,6 +105,7 @@ private Q_SLOTS:
|
|||||||
void servicePropertyChangedContext(const QString &,const QString &,const QDBusVariant &);
|
void servicePropertyChangedContext(const QString &,const QString &,const QDBusVariant &);
|
||||||
void propertyChangedContext(const QString &,const QString &,const QDBusVariant &);
|
void propertyChangedContext(const QString &,const QString &,const QDBusVariant &);
|
||||||
void technologyPropertyChangedContext(const QString &,const QString &, const QDBusVariant &);
|
void technologyPropertyChangedContext(const QString &,const QString &, const QDBusVariant &);
|
||||||
|
void updateServices(const ConnmanMapList &changed, const QList<QDBusObjectPath> &removed);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QConnmanManagerInterface *connmanManager;
|
QConnmanManagerInterface *connmanManager;
|
||||||
|
@ -127,8 +127,24 @@ void QConnmanManagerInterface::connectNotify(const QMetaMethod &signal)
|
|||||||
QObject::connect(helper,SIGNAL(propertyChangedContext(QString,QString,QDBusVariant)),
|
QObject::connect(helper,SIGNAL(propertyChangedContext(QString,QString,QDBusVariant)),
|
||||||
this,SIGNAL(propertyChangedContext(QString,QString,QDBusVariant)), Qt::UniqueConnection);
|
this,SIGNAL(propertyChangedContext(QString,QString,QDBusVariant)), Qt::UniqueConnection);
|
||||||
}
|
}
|
||||||
|
static const QMetaMethod servicesChangedSignal = QMetaMethod::fromSignal(&QConnmanManagerInterface::servicesChanged);
|
||||||
|
if (signal == servicesChangedSignal) {
|
||||||
|
if (!connection().connect(QLatin1String(CONNMAN_SERVICE),
|
||||||
|
QLatin1String(CONNMAN_MANAGER_PATH),
|
||||||
|
QLatin1String(CONNMAN_MANAGER_INTERFACE),
|
||||||
|
QLatin1String("ServicesChanged"),
|
||||||
|
this,SLOT(onServicesChanged(ConnmanMapList, QList<QDBusObjectPath>)))) {
|
||||||
|
qWarning() << "servicesChanged not connected";
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QConnmanManagerInterface::onServicesChanged(const ConnmanMapList &changed, const QList<QDBusObjectPath> &removed)
|
||||||
|
{
|
||||||
|
emit servicesChanged(changed, removed);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void QConnmanManagerInterface::disconnectNotify(const QMetaMethod &signal)
|
void QConnmanManagerInterface::disconnectNotify(const QMetaMethod &signal)
|
||||||
{
|
{
|
||||||
static const QMetaMethod propertyChangedSignal = QMetaMethod::fromSignal(&QConnmanManagerInterface::propertyChanged);
|
static const QMetaMethod propertyChangedSignal = QMetaMethod::fromSignal(&QConnmanManagerInterface::propertyChanged);
|
||||||
|
@ -155,11 +155,16 @@ Q_SIGNALS:
|
|||||||
void propertyChanged(const QString &, const QDBusVariant &value);
|
void propertyChanged(const QString &, const QDBusVariant &value);
|
||||||
void stateChanged(const QString &);
|
void stateChanged(const QString &);
|
||||||
void propertyChangedContext(const QString &,const QString &,const QDBusVariant &);
|
void propertyChangedContext(const QString &,const QString &,const QDBusVariant &);
|
||||||
|
void servicesChanged(const ConnmanMapList&, const QList<QDBusObjectPath> &);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void connectNotify(const QMetaMethod &signal);
|
void connectNotify(const QMetaMethod &signal);
|
||||||
void disconnectNotify(const QMetaMethod &signal);
|
void disconnectNotify(const QMetaMethod &signal);
|
||||||
QVariant getProperty(const QString &);
|
QVariant getProperty(const QString &);
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void onServicesChanged(const ConnmanMapList&, const QList<QDBusObjectPath> &);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class QConnmanProfileInterfacePrivate;
|
class QConnmanProfileInterfacePrivate;
|
||||||
|
Loading…
Reference in New Issue
Block a user