diff options
author | Leena Gunda <leena.gunda@wipro.com> | 2010-12-09 05:54:24 (GMT) |
---|---|---|
committer | Leena Gunda <leena.gunda@wipro.com> | 2010-12-09 06:01:16 (GMT) |
commit | 8eab49de0548363b18c6e2c7b4ff4a8b722992d6 (patch) | |
tree | 9659ba2376bd4b99da008af6a12a6bf55d2842da /src/plugins/bearer | |
parent | 6af078b2a13f4855a35d48376e58154ee2d57ec1 (diff) | |
download | Qt-8eab49de0548363b18c6e2c7b4ff4a8b722992d6.zip Qt-8eab49de0548363b18c6e2c7b4ff4a8b722992d6.tar.gz Qt-8eab49de0548363b18c6e2c7b4ff4a8b722992d6.tar.bz2 |
Fix ConnMan bearer plugin to use new net.connman service name.
Diffstat (limited to 'src/plugins/bearer')
-rw-r--r-- | src/plugins/bearer/connman/qconnmanengine.cpp | 247 | ||||
-rw-r--r-- | src/plugins/bearer/connman/qconnmanengine.h | 11 | ||||
-rw-r--r-- | src/plugins/bearer/connman/qconnmanservice_linux.cpp | 271 | ||||
-rw-r--r-- | src/plugins/bearer/connman/qconnmanservice_linux_p.h | 76 |
4 files changed, 20 insertions, 585 deletions
diff --git a/src/plugins/bearer/connman/qconnmanengine.cpp b/src/plugins/bearer/connman/qconnmanengine.cpp index 7f3501e..5b12b1e 100644 --- a/src/plugins/bearer/connman/qconnmanengine.cpp +++ b/src/plugins/bearer/connman/qconnmanengine.cpp @@ -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..55067d8 100644 --- a/src/plugins/bearer/connman/qconnmanengine.h +++ b/src/plugins/bearer/connman/qconnmanengine.h @@ -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 0545422..092bea9 100644 --- a/src/plugins/bearer/connman/qconnmanservice_linux.cpp +++ b/src/plugins/bearer/connman/qconnmanservice_linux.cpp @@ -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), @@ -994,151 +870,8 @@ quint64 QConnmanCounterInterface::getTimeOnline() return 0; } -///////////////////////////////////////// -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, qVariantFromValue(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 << qVariantFromValue(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 << qVariantFromValue(QString("Powered")) - << qVariantFromValue(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..9615b33 100644 --- a/src/plugins/bearer/connman/qconnmanservice_linux_p.h +++ b/src/plugins/bearer/connman/qconnmanservice_linux_p.h @@ -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 |