diff options
author | axis <qt-info@nokia.com> | 2011-01-31 11:37:19 (GMT) |
---|---|---|
committer | axis <qt-info@nokia.com> | 2011-01-31 11:37:19 (GMT) |
commit | 5cd39cd8a70be4c22164fe060ad64a1d9108bf41 (patch) | |
tree | 4b072c7d4e4d717fe8f0977dd2108837ac71f7c3 /src/plugins/bearer/connman | |
parent | c40ae86025856225e74289249ecc509bf61dc9ba (diff) | |
parent | 9c132451acc7fbed1611fd3676cceb26e815f50d (diff) | |
download | Qt-5cd39cd8a70be4c22164fe060ad64a1d9108bf41.zip Qt-5cd39cd8a70be4c22164fe060ad64a1d9108bf41.tar.gz Qt-5cd39cd8a70be4c22164fe060ad64a1d9108bf41.tar.bz2 |
Merge branch 'master' of scm.dev.nokia.troll.no:qt/qt into earth-master
Diffstat (limited to 'src/plugins/bearer/connman')
-rw-r--r-- | src/plugins/bearer/connman/main.cpp | 2 | ||||
-rw-r--r-- | src/plugins/bearer/connman/qconnmanengine.cpp | 249 | ||||
-rw-r--r-- | src/plugins/bearer/connman/qconnmanengine.h | 13 | ||||
-rw-r--r-- | src/plugins/bearer/connman/qconnmanservice_linux.cpp | 272 | ||||
-rw-r--r-- | src/plugins/bearer/connman/qconnmanservice_linux_p.h | 78 | ||||
-rw-r--r-- | src/plugins/bearer/connman/qofonoservice_linux.cpp | 2 | ||||
-rw-r--r-- | src/plugins/bearer/connman/qofonoservice_linux_p.h | 2 |
7 files changed, 26 insertions, 592 deletions
diff --git a/src/plugins/bearer/connman/main.cpp b/src/plugins/bearer/connman/main.cpp index d483cf0..681b871 100644 --- a/src/plugins/bearer/connman/main.cpp +++ b/src/plugins/bearer/connman/main.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/bearer/connman/qconnmanengine.cpp b/src/plugins/bearer/connman/qconnmanengine.cpp index 7f3501e..53c9a7d 100644 --- a/src/plugins/bearer/connman/qconnmanengine.cpp +++ b/src/plugins/bearer/connman/qconnmanengine.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -88,19 +88,10 @@ void QConnmanEngine::initialize() connect(tech,SIGNAL(propertyChangedContext(QString,QString,QDBusVariant)), this,SLOT(technologyPropertyChangedContext(QString,QString,QDBusVariant))); + } - foreach(const QString devicePath,tech->getDevices()) { - QConnmanDeviceInterface *dev; - dev = new QConnmanDeviceInterface(devicePath); - if(!deviceMap.value(techPath).contains(devicePath)) { - connect(dev,SIGNAL(propertyChangedContext(QString,QString,QDBusVariant)), - this,SLOT(devicePropertyChangedContext(QString,QString,QDBusVariant))); - deviceMap.insert(techPath,QStringList() << devicePath); - foreach(const QString network,dev->getNetworks()) { - serviceNetworks.insert(getServiceForNetwork(network),network); - } - } - } + foreach(const QString servPath, connmanManager->getServices()) { + addServiceConfiguration(servPath); } // Get current list of access points. @@ -110,7 +101,6 @@ void QConnmanEngine::initialize() QList<QNetworkConfigurationPrivate *> QConnmanEngine::getConfigurations() { QMutexLocker locker(&mutex); - getNetworkListing(); QList<QNetworkConfigurationPrivate *> fetchedConfigurations; QNetworkConfigurationPrivate* cpPriv = 0; @@ -133,21 +123,6 @@ QList<QNetworkConfigurationPrivate *> QConnmanEngine::getConfigurations() return fetchedConfigurations; } -void QConnmanEngine::getNetworkListing() -{ - QMutexLocker locker(&mutex); - QMapIterator<QString,QStringList> i(deviceMap); - while(i.hasNext()) { - i.next(); - QConnmanDeviceInterface dev(i.value().at(0)); - if(dev.isValid()) { - foreach(const QString network,dev.getNetworks()) { - addNetworkConfiguration(network); - } - } - } -} - void QConnmanEngine::doRequestUpdate() { connmanManager->requestScan(""); @@ -225,7 +200,7 @@ void QConnmanEngine::requestUpdate() QString QConnmanEngine::serviceFromId(const QString &id) { QMutexLocker locker(&mutex); - foreach(const QString service, serviceNetworks.keys()) { + foreach(const QString service, serviceNetworks) { if (id == QString::number(qHash(service))) return service; } @@ -330,24 +305,6 @@ QNetworkConfigurationPrivatePointer QConnmanEngine::defaultConfiguration() return QNetworkConfigurationPrivatePointer(); } - -QString QConnmanEngine::getServiceForNetwork(const QString &netPath) -{ - QMutexLocker locker(&mutex); - QConnmanNetworkInterface network(netPath, this); - foreach(QString service,connmanManager->getServices()) { - - QString devicePath = netPath.section("/",5,5); - - QConnmanServiceInterface serv(service,this); - if(serv.getName() == network.getName() - && network.getSignalStrength() == serv.getSignalStrength()) { - return service; - } - } - return QString(); -} - void QConnmanEngine::propertyChangedContext(const QString &path,const QString &item, const QDBusVariant &value) { Q_UNUSED(path); @@ -399,86 +356,19 @@ void QConnmanEngine::servicePropertyChangedContext(const QString &path,const QSt } } -void QConnmanEngine::networkPropertyChangedContext(const QString &/*path*/,const QString &/*item*/, const QDBusVariant &/*value*/) -{ - QMutexLocker locker(&mutex); -} - -void QConnmanEngine::devicePropertyChangedContext(const QString &devpath,const QString &item,const QDBusVariant &value) +void QConnmanEngine::technologyPropertyChangedContext(const QString & path, const QString &item, const QDBusVariant &value) { - QMutexLocker locker(&mutex); - if(item == "Networks") { - - QConnmanNetworkInterface network(devpath, this); + if(item == "State") { + if(value.variant().toString() == "offline") { + QConnmanTechnologyInterface tech(path); + disconnect(&tech,SIGNAL(propertyChangedContext(QString,QString,QDBusVariant)), + this,SLOT(technologyPropertyChangedContext(QString,QString,QDBusVariant))); - QDBusArgument arg = qvariant_cast<QDBusArgument>(value.variant()); - QStringList remainingNetworks = qdbus_cast<QStringList>(arg); - QString devicetype; - QMapIterator<QString,QStringList> i(deviceMap); - while(i.hasNext()) { - i.next(); - if(i.value().contains(devpath)) { - devicetype = i.key().section("/",-1); - } - } - - QStringList oldnetworks = knownNetworks[devicetype]; - - if(remainingNetworks.count() > oldnetworks.count()) { - foreach(const QString netPath, remainingNetworks) { - if(!oldnetworks.contains(netPath)) { - addNetworkConfiguration(netPath); - } - } - } else { - foreach(const QString netPath, oldnetworks) { - QString servicePath = serviceNetworks.key(netPath); - if(!remainingNetworks.contains(netPath)) { - if(servicePath.isEmpty()) { - removeConfiguration(QString::number(qHash(netPath))); - } else { - removeConfiguration(QString::number(qHash(servicePath))); - } - knownNetworks[devicetype].removeAll(netPath); - } - } + technologies.remove(path); } } } -void QConnmanEngine::technologyPropertyChangedContext(const QString & path, const QString &item, const QDBusVariant &value) -{ - if(item == "Devices") { - QDBusArgument arg = qvariant_cast<QDBusArgument>(value.variant()); - QStringList list = qdbus_cast<QStringList>(arg); - } - if(item == "State") { - - if(value.variant().toString() == "available") { - QConnmanTechnologyInterface tech(connmanManager->getPathForTechnology(path)); - foreach(const QString devPath, tech.getDevices()) { - - if(!deviceMap.value(path).contains(devPath)) { - QConnmanDeviceInterface *dev; - dev = new QConnmanDeviceInterface(devPath,this); - connect(dev,SIGNAL(propertyChangedContext(QString,QString,QDBusVariant)), - this,SLOT(devicePropertyChangedContext(QString,QString,QDBusVariant))); - deviceMap.insert(path,QStringList() << devPath); - } - } - } - if(value.variant().toString() == "offline") { - deviceMap.remove(path); - QConnmanTechnologyInterface tech(path); - disconnect(&tech,SIGNAL(propertyChangedContext(QString,QString,QDBusVariant)), - this,SLOT(technologyPropertyChangedContext(QString,QString,QDBusVariant))); - - technologies.remove(path); - getNetworkListing(); - } - } -} - void QConnmanEngine::configurationChange(const QString &id) { QMutexLocker locker(&mutex); @@ -513,8 +403,8 @@ void QConnmanEngine::configurationChange(const QString &id) locker.unlock(); emit configurationChanged(ptr); locker.relock(); - } + locker.unlock(); emit updateCompleted(); } @@ -622,12 +512,7 @@ void QConnmanEngine::removeConfiguration(const QString &id) disconnect(&serv,SIGNAL(propertyChangedContext(QString,QString,QDBusVariant)), this,SLOT(servicePropertyChangedContext(QString,QString, QDBusVariant))); - QString netPath = serviceNetworks.value(service); - serviceNetworks.remove(service); - - QConnmanServiceInterface network(netPath); - disconnect(&network,SIGNAL(propertyChangedContext(QString,QString,QDBusVariant)), - this,SLOT(networkPropertyChangedContext(QString,QString, QDBusVariant))); + serviceNetworks.removeOne(service); QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.take(id); locker.unlock(); @@ -641,20 +526,11 @@ void QConnmanEngine::addServiceConfiguration(const QString &servicePath) QMutexLocker locker(&mutex); QConnmanServiceInterface *serv; serv = new QConnmanServiceInterface(servicePath); - const QString netPath = serviceNetworks.value(servicePath); - - QConnmanNetworkInterface *network; - network = new QConnmanNetworkInterface(netPath, this); - const QString id = QString::number(qHash(servicePath)); if (!accessPointConfigurations.contains(id)) { - QConnmanDeviceInterface device(netPath.section("/",0,5),this); - - serviceNetworks.insert(servicePath,netPath); - - knownNetworks[device.getType()].append(netPath); + serviceNetworks.append(servicePath); connect(serv,SIGNAL(propertyChangedContext(QString,QString,QDBusVariant)), this,SLOT(servicePropertyChangedContext(QString,QString, QDBusVariant))); @@ -693,15 +569,12 @@ void QConnmanEngine::addServiceConfiguration(const QString &servicePath) cpPriv->purpose = QNetworkConfiguration::PrivatePurpose; } - connect(network,SIGNAL(propertyChangedContext(QString,QString,QDBusVariant)), - this,SLOT(networkPropertyChangedContext(QString,QString, QDBusVariant))); - cpPriv->state = getStateForService(servicePath); QNetworkConfigurationPrivatePointer ptr(cpPriv); accessPointConfigurations.insert(ptr->id, ptr); foundConfigurations.append(cpPriv); - configInterfaces[cpPriv->id] = device.getInterface(); + configInterfaces[cpPriv->id] = serv->getInterface(); locker.unlock(); emit configurationAdded(ptr); @@ -710,96 +583,6 @@ void QConnmanEngine::addServiceConfiguration(const QString &servicePath) } } -void QConnmanEngine::addNetworkConfiguration(const QString &networkPath) -{ - QMutexLocker locker(&mutex); - if(networkPath.isNull()) - return; - - QConnmanNetworkInterface *network; - network = new QConnmanNetworkInterface(networkPath, this); - QString servicePath = getServiceForNetwork(networkPath); - QConnmanServiceInterface *serv; - - QString id; - QConnmanDeviceInterface device(networkPath.section("/",0,5),this); - - if(servicePath.isEmpty()) { - id = QString::number(qHash(networkPath)); - serv = 0; - } else { - id = QString::number(qHash(servicePath)); - serv = new QConnmanServiceInterface(servicePath,this); - connect(serv,SIGNAL(propertyChangedContext(QString,QString,QDBusVariant)), - this,SLOT(servicePropertyChangedContext(QString,QString, QDBusVariant))); - } - - if (!id.isEmpty() && !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))); - - QNetworkConfigurationPrivate* cpPriv = new QNetworkConfigurationPrivate(); - - QString networkName = network->getName(); - - if(networkName.isEmpty()) - networkName = "Hidden Network"; - - QNetworkConfiguration::BearerType bearerType; - - if(servicePath.isEmpty()) { - QString devicePath = networkPath.section("/",0,5); - - QConnmanDeviceInterface device(devicePath,this); - bearerType = typeToBearer(device.getType()); - } else { - if(serv->getType() == "cellular") { - bearerType = ofonoTechToBearerType("cellular"); - if(servicePath.isEmpty()) { - networkName = serv->getName(); - } - cpPriv->roamingSupported = isRoamingAllowed(servicePath); - } else { - bearerType = typeToBearer(serv->getType()); - } - } - - cpPriv->name = networkName; - cpPriv->isValid = true; - cpPriv->id = id; - cpPriv->type = QNetworkConfiguration::InternetAccessPoint; - cpPriv->bearerType = bearerType; - - if(network->getWifiSecurity() == "none") { - cpPriv->purpose = QNetworkConfiguration::PublicPurpose; - } else { - cpPriv->purpose = QNetworkConfiguration::PrivatePurpose; - } - - if(servicePath.isEmpty()) - cpPriv->state = QNetworkConfiguration::Undefined; - else - cpPriv->state = getStateForService(servicePath); - - QNetworkConfigurationPrivatePointer ptr(cpPriv); - accessPointConfigurations.insert(ptr->id, ptr); - foundConfigurations.append(cpPriv); - configInterfaces[cpPriv->id] = device.getInterface(); - - locker.unlock(); - emit configurationAdded(ptr); - locker.relock(); - emit updateCompleted(); - } /*else { - qDebug() << "Not added~~~~~~~~~~~"; - }*/ -} - bool QConnmanEngine::requiresPolling() const { return false; diff --git a/src/plugins/bearer/connman/qconnmanengine.h b/src/plugins/bearer/connman/qconnmanengine.h index 2a2308f..8219c12 100644 --- a/src/plugins/bearer/connman/qconnmanengine.h +++ b/src/plugins/bearer/connman/qconnmanengine.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -103,8 +103,6 @@ private Q_SLOTS: void doRequestUpdate(); void servicePropertyChangedContext(const QString &,const QString &,const QDBusVariant &); - void networkPropertyChangedContext(const QString &,const QString &,const QDBusVariant &); - void devicePropertyChangedContext(const QString &,const QString &,const QDBusVariant &); void propertyChangedContext(const QString &,const QString &,const QDBusVariant &); void technologyPropertyChangedContext(const QString &,const QString &, const QDBusVariant &); @@ -113,10 +111,6 @@ private: QList<QNetworkConfigurationPrivate *> foundConfigurations; - void getNetworkListing(); - - QString getServiceForNetwork(const QString &network); - QString serviceFromId(const QString &id); QString networkFromId(const QString &id); @@ -125,15 +119,12 @@ private: void removeConfiguration(const QString &servicePath); void addServiceConfiguration(const QString &servicePath); - void addNetworkConfiguration(const QString &worknetPath); QDateTime activeTime; QMap<QString,QConnmanTechnologyInterface *> technologies; // techpath, tech interface QMap<QString,QString> configInterfaces; // id, interface name - QMap<QString,QStringList> knownNetworks; //device path, net paths list - QMap<QString,QStringList> deviceMap; //tech path, device path - QMap<QString, QString> serviceNetworks; //service, network + QList<QString> serviceNetworks; //servpath QNetworkConfiguration::BearerType ofonoTechToBearerType(const QString &type); bool isRoamingAllowed(const QString &context); diff --git a/src/plugins/bearer/connman/qconnmanservice_linux.cpp b/src/plugins/bearer/connman/qconnmanservice_linux.cpp index 98b3663..02b5eb9 100644 --- a/src/plugins/bearer/connman/qconnmanservice_linux.cpp +++ b/src/plugins/bearer/connman/qconnmanservice_linux.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -317,126 +317,8 @@ QString QConnmanManagerInterface::getPathForTechnology(const QString &name) return ""; } -QConnmanNetworkInterface::QConnmanNetworkInterface(const QString &dbusPathName, QObject *parent) - : QDBusAbstractInterface(QLatin1String(CONNMAN_SERVICE), - dbusPathName, - CONNMAN_NETWORK_INTERFACE, - QDBusConnection::systemBus(), parent) -{ -} - -QConnmanNetworkInterface::~QConnmanNetworkInterface() -{ -} - -void QConnmanNetworkInterface::connectNotify(const char *signal) -{ - if (QLatin1String(signal) == SIGNAL(propertyChanged(QString,QDBusVariant))) { - if(!connection().connect(QLatin1String(CONNMAN_SERVICE), - this->path(), - QLatin1String(CONNMAN_NETWORK_INTERFACE), - QLatin1String("PropertyChanged"), - this,SIGNAL(propertyChanged(QString,QDBusVariant)))) { - qWarning() << "network properties not connected"; - } - } - if (QLatin1String(signal) == SIGNAL(propertyChangedContext(QString,QString,QDBusVariant))) { - QConnmanDBusHelper *helper; - helper = new QConnmanDBusHelper(this); - - dbusConnection.connect(QLatin1String(CONNMAN_SERVICE), - this->path(), - QLatin1String(CONNMAN_NETWORK_INTERFACE), - QLatin1String("PropertyChanged"), - helper,SLOT(propertyChanged(QString,QDBusVariant))); - - QObject::connect(helper,SIGNAL(propertyChangedContext(const QString &,const QString &,const QDBusVariant &)), - this,SIGNAL(propertyChangedContext(const QString &,const QString &,const QDBusVariant &)), Qt::UniqueConnection); - } -} - -void QConnmanNetworkInterface::disconnectNotify(const char *signal) -{ - if (QLatin1String(signal) == SIGNAL(propertyChanged(QString,QDBusVariant))) { - - } -} - -QVariantMap QConnmanNetworkInterface::getProperties() -{ - QDBusReply<QVariantMap > reply = this->call(QLatin1String("GetProperties")); - return reply.value(); -} - -QVariant QConnmanNetworkInterface::getProperty(const QString &property) -{ - QVariant var; - QVariantMap map = getProperties(); - if (map.contains(property)) { - var = map.value(property); - } - return var; -} - -//properties - -QString QConnmanNetworkInterface::getAddress() -{ - QVariant var = getProperty("Address"); - return qdbus_cast<QString>(var); -} - -QString QConnmanNetworkInterface::getName() -{ - QVariant var = getProperty("Name"); - return qdbus_cast<QString>(var); -} - -bool QConnmanNetworkInterface::isConnected() -{ - QVariant var = getProperty("Connected"); - return qdbus_cast<bool>(var); -} - -quint8 QConnmanNetworkInterface::getSignalStrength() -{ - QVariant var = getProperty("Strength"); - return qdbus_cast<quint8>(var); -} - -QString QConnmanNetworkInterface::getDevice() -{ - QVariant var = getProperty("Device"); - return qdbus_cast<QString>(var); -} - -QString QConnmanNetworkInterface::getWifiSsid() -{ - QVariant var = getProperty("WiFi.SSID"); - return qdbus_cast<QString>(var); -} - -QString QConnmanNetworkInterface::getWifiMode() -{ - QVariant var = getProperty("WiFi.Mode"); - return qdbus_cast<QString>(var); -} - -QString QConnmanNetworkInterface::getWifiSecurity() -{ - QVariant var = getProperty("WiFi.Security"); - return qdbus_cast<QString>(var); -} - -QString QConnmanNetworkInterface::getWifiPassphrase() -{ - QVariant var = getProperty("WiFi.Passphrase"); - return qdbus_cast<QString>(var); -} - ////////////////////////// - QConnmanProfileInterface::QConnmanProfileInterface(const QString &dbusPathName,QObject *parent) : QDBusAbstractInterface(QLatin1String(CONNMAN_SERVICE), dbusPathName, @@ -503,6 +385,7 @@ QStringList QConnmanProfileInterface::getServices() return qdbus_cast<QStringList>(var); } + /////////////////////////// QConnmanServiceInterface::QConnmanServiceInterface(const QString &dbusPathName,QObject *parent) : QDBusAbstractInterface(QLatin1String(CONNMAN_SERVICE), @@ -910,13 +793,6 @@ QString QConnmanTechnologyInterface::getType() } -QStringList QConnmanTechnologyInterface::getDevices() -{ - QVariant var = getProperty("Devices"); - return qdbus_cast<QStringList>(var); -} - - ////////////////////////////////// QConnmanAgentInterface::QConnmanAgentInterface(const QString &dbusPathName, QObject *parent) : QDBusAbstractInterface(QLatin1String(CONNMAN_SERVICE), @@ -995,150 +871,6 @@ quint64 QConnmanCounterInterface::getTimeOnline() } ///////////////////////////////////////// -QConnmanDeviceInterface::QConnmanDeviceInterface(const QString &dbusPathName,QObject *parent) - : QDBusAbstractInterface(QLatin1String(CONNMAN_SERVICE), - dbusPathName, - CONNMAN_DEVICE_INTERFACE, - QDBusConnection::systemBus(), parent) -{ -} - -QConnmanDeviceInterface::~QConnmanDeviceInterface() -{ -} - -void QConnmanDeviceInterface::connectNotify(const char *signal) -{ - if (QLatin1String(signal) == SIGNAL(propertyChanged(QString,QDBusVariant))) { - dbusConnection.connect(QLatin1String(CONNMAN_SERVICE), - this->path(), - QLatin1String(CONNMAN_DEVICE_INTERFACE), - QLatin1String("PropertyChanged"), - this,SIGNAL(propertyChanged(QString,QDBusVariant))); - - } - if (QLatin1String(signal) == SIGNAL(propertyChangedContext(QString,QString,QDBusVariant))) { - QConnmanDBusHelper *helper; - helper = new QConnmanDBusHelper(this); - - dbusConnection.connect(QLatin1String(CONNMAN_SERVICE), - this->path(), - QLatin1String(CONNMAN_DEVICE_INTERFACE), - QLatin1String("PropertyChanged"), - helper,SLOT(propertyChanged(QString,QDBusVariant))); - - QObject::connect(helper,SIGNAL(propertyChangedContext(const QString &,const QString &,const QDBusVariant &)), - this,SIGNAL(propertyChangedContext(const QString &,const QString &,const QDBusVariant &)), Qt::UniqueConnection); - } -} - -void QConnmanDeviceInterface::disconnectNotify(const char *signal) -{ - if (QLatin1String(signal) == SIGNAL(propertyChanged(QString,QVariant))) { - - } -} - -QVariantMap QConnmanDeviceInterface::getProperties() -{ - QDBusReply<QVariantMap> reply = this->call(QLatin1String("GetProperties")); - return reply.value(); -} - -bool QConnmanDeviceInterface::setProperty(const QString &name, const QDBusVariant &value) -{ - QDBusMessage reply = this->call(QLatin1String("SetProperty"),name, QVariant::fromValue(value)); - return true; -} - -void QConnmanDeviceInterface::scan() -{ - QDBusReply<QVariantMap> reply = this->call(QLatin1String("ProposeScan")); - if(!reply.isValid()) { - qDebug() << reply.error().message(); - } -} - -QVariant QConnmanDeviceInterface::getProperty(const QString &property) -{ - QVariant var; - QVariantMap map = getProperties(); - if (map.contains(property)) { - var = map.value(property); - } - return var; -} - -//properties -QString QConnmanDeviceInterface::getAddress() -{ - QVariant var = getProperty("Address"); - return qdbus_cast<QString>(var); -} - -QString QConnmanDeviceInterface::getName() -{ - QVariant var = getProperty("Name"); - return qdbus_cast<QString>(var); -} - -QString QConnmanDeviceInterface::getType() -{ - QVariant var = getProperty("Type"); - return qdbus_cast<QString>(var); -} - -QString QConnmanDeviceInterface::getInterface() -{ - QVariant var = getProperty("Interface"); - return qdbus_cast<QString>(var); -} - -bool QConnmanDeviceInterface::isPowered() -{ - QVariant var = getProperty("Powered"); - return qdbus_cast<bool>(var); -} - -quint16 QConnmanDeviceInterface::getScanInterval() -{ - QVariant var = getProperty("ScanInterval"); - return qdbus_cast<quint16>(var); -} - -bool QConnmanDeviceInterface::setScanInterval(const QString & interval) -{ -// QList<QVariant> args; -// args << QVariant::fromValue(name) -// << value.variant(); - -// QDBusMessage reply = this->callWithArgumentList(QDBus::AutoDetect,QLatin1String("SetProperty"),args); - - return setProperty("ScanInterval", QDBusVariant(interval)); -} - -bool QConnmanDeviceInterface::isScanning() -{ - QVariant var = getProperty("Scanning"); - return qdbus_cast<bool>(var); -} - -QStringList QConnmanDeviceInterface::getNetworks() -{ - QVariant var = getProperty("Networks"); - return qdbus_cast<QStringList>(var); -} - -bool QConnmanDeviceInterface::setEnabled(bool powered) -{ - QList<QVariant> args; - args << QVariant::fromValue(QString("Powered")) - << QVariant::fromValue(QDBusVariant(powered)); - - QDBusMessage reply = this->callWithArgumentList(QDBus::AutoDetect,QLatin1String("SetProperty"),args); - return true; -} - QConnmanDBusHelper::QConnmanDBusHelper(QObject * parent) : QObject(parent) { diff --git a/src/plugins/bearer/connman/qconnmanservice_linux_p.h b/src/plugins/bearer/connman/qconnmanservice_linux_p.h index 6e6b702..d0ef6dc 100644 --- a/src/plugins/bearer/connman/qconnmanservice_linux_p.h +++ b/src/plugins/bearer/connman/qconnmanservice_linux_p.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -70,8 +70,8 @@ #ifndef __CONNMAN_DBUS_H -#define CONNMAN_SERVICE "org.moblin.connman" -#define CONNMAN_PATH "/org/moblin/connman" +#define CONNMAN_SERVICE "net.connman" +#define CONNMAN_PATH "/net/connman" #define CONNMAN_DEBUG_INTERFACE CONNMAN_SERVICE ".Debug" #define CONNMAN_ERROR_INTERFACE CONNMAN_SERVICE ".Error" @@ -84,8 +84,6 @@ #define CONNMAN_TASK_INTERFACE CONNMAN_SERVICE ".Task" #define CONNMAN_PROFILE_INTERFACE CONNMAN_SERVICE ".Profile" #define CONNMAN_SERVICE_INTERFACE CONNMAN_SERVICE ".Service" -#define CONNMAN_DEVICE_INTERFACE CONNMAN_SERVICE ".Device" -#define CONNMAN_NETWORK_INTERFACE CONNMAN_SERVICE ".Network" #define CONNMAN_PROVIDER_INTERFACE CONNMAN_SERVICE ".Provider" #define CONNMAN_TECHNOLOGY_INTERFACE CONNMAN_SERVICE ".Technology" #endif @@ -151,38 +149,6 @@ protected: QVariant getProperty(const QString &); }; - -class QConnmanNetworkInterface : public QDBusAbstractInterface -{ - Q_OBJECT - -public: - - QConnmanNetworkInterface(const QString &dbusPathName, QObject *parent = 0); - ~QConnmanNetworkInterface(); - - QVariantMap getProperties(); - - //properties - QString getAddress(); - QString getName(); - bool isConnected(); - quint8 getSignalStrength(); - QString getDevice(); - QString getWifiSsid(); - QString getWifiMode(); - QString getWifiSecurity(); - QString getWifiPassphrase(); - -Q_SIGNALS: - void propertyChanged(const QString &, const QDBusVariant &value); - void propertyChangedContext(const QString &,const QString &,const QDBusVariant &); -protected: - void connectNotify(const char *signal); - void disconnectNotify(const char *signal); - QVariant getProperty(const QString &); -}; - class QConnmanProfileInterfacePrivate; class QConnmanProfileInterface : public QDBusAbstractInterface { @@ -287,8 +253,6 @@ public: QString getName(); QString getType(); - QStringList getDevices(); - Q_SIGNALS: void propertyChanged(const QString &, const QDBusVariant &value); void propertyChangedContext(const QString &,const QString &,const QDBusVariant &); @@ -337,42 +301,6 @@ private: QConnmanCounterInterfacePrivate *d; }; -class QConnmanDeviceInterface : public QDBusAbstractInterface -{ - Q_OBJECT - -public: - - QConnmanDeviceInterface(const QString &dbusPathName,QObject *parent = 0); - ~QConnmanDeviceInterface(); - - QVariantMap getProperties(); - void scan(); - -//properties - QString getAddress(); - QString getName(); - QString getType(); - QString getInterface(); - bool isPowered(); - quint16 getScanInterval(); - bool setScanInterval(const QString &interval); - - bool isScanning(); - QStringList getNetworks(); - bool setEnabled(bool powered); - bool setProperty(const QString &name, const QDBusVariant &value); - -Q_SIGNALS: - void propertyChanged(const QString &, const QDBusVariant &value); - void propertyChangedContext(const QString &,const QString &,const QDBusVariant &); -protected: - void connectNotify(const char *signal); - void disconnectNotify(const char *signal); - QVariant getProperty(const QString &); - -}; - class QConnmanDBusHelper: public QObject, protected QDBusContext { Q_OBJECT diff --git a/src/plugins/bearer/connman/qofonoservice_linux.cpp b/src/plugins/bearer/connman/qofonoservice_linux.cpp index 52f596b..2a22280 100644 --- a/src/plugins/bearer/connman/qofonoservice_linux.cpp +++ b/src/plugins/bearer/connman/qofonoservice_linux.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/bearer/connman/qofonoservice_linux_p.h b/src/plugins/bearer/connman/qofonoservice_linux_p.h index 0ac1e4a..4db08f5 100644 --- a/src/plugins/bearer/connman/qofonoservice_linux_p.h +++ b/src/plugins/bearer/connman/qofonoservice_linux_p.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** |