summaryrefslogtreecommitdiffstats
path: root/src/plugins/bearer
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/bearer')
-rw-r--r--src/plugins/bearer/connman/connman.pro2
-rw-r--r--src/plugins/bearer/connman/qconnmanengine.cpp162
-rw-r--r--src/plugins/bearer/connman/qconnmanengine.h3
-rw-r--r--src/plugins/bearer/connman/qconnmanservice_linux.cpp9
-rw-r--r--src/plugins/bearer/connman/qconnmanservice_linux_p.h1
-rw-r--r--src/plugins/bearer/connman/qofonoservice_linux.cpp940
-rw-r--r--src/plugins/bearer/connman/qofonoservice_linux_p.h332
-rw-r--r--src/plugins/bearer/corewlan/qcorewlanengine.mm85
-rw-r--r--src/plugins/bearer/symbian/qnetworksession_impl.cpp131
-rw-r--r--src/plugins/bearer/symbian/qnetworksession_impl.h12
-rw-r--r--src/plugins/bearer/symbian/symbianengine.cpp86
-rw-r--r--src/plugins/bearer/symbian/symbianengine.h17
12 files changed, 1592 insertions, 188 deletions
diff --git a/src/plugins/bearer/connman/connman.pro b/src/plugins/bearer/connman/connman.pro
index 4be752b..dec408c 100644
--- a/src/plugins/bearer/connman/connman.pro
+++ b/src/plugins/bearer/connman/connman.pro
@@ -4,12 +4,14 @@ include(../../qpluginbase.pri)
QT = core network dbus
HEADERS += qconnmanservice_linux_p.h \
+ qofonoservice_linux_p.h \
qconnmanengine.h \
../qnetworksession_impl.h \
../qbearerengine_impl.h
SOURCES += main.cpp \
qconnmanservice_linux.cpp \
+ qofonoservice_linux.cpp \
qconnmanengine.cpp \
../qnetworksession_impl.cpp
diff --git a/src/plugins/bearer/connman/qconnmanengine.cpp b/src/plugins/bearer/connman/qconnmanengine.cpp
index 341f7cd..a8b8911 100644
--- a/src/plugins/bearer/connman/qconnmanengine.cpp
+++ b/src/plugins/bearer/connman/qconnmanengine.cpp
@@ -41,6 +41,7 @@
#include "qconnmanengine.h"
#include "qconnmanservice_linux_p.h"
+#include "qofonoservice_linux_p.h"
#include "../qnetworksession_impl.h"
#include <QtNetwork/private/qnetworkconfiguration_p.h>
@@ -109,7 +110,6 @@ void QConnmanEngine::initialize()
QList<QNetworkConfigurationPrivate *> QConnmanEngine::getConfigurations()
{
QMutexLocker locker(&mutex);
- // foundConfigurations.clear();
getNetworkListing();
QList<QNetworkConfigurationPrivate *> fetchedConfigurations;
QNetworkConfigurationPrivate* cpPriv = 0;
@@ -131,7 +131,6 @@ QList<QNetworkConfigurationPrivate *> QConnmanEngine::getConfigurations()
delete config;
}
return fetchedConfigurations;
-// return foundConfigurations;
}
void QConnmanEngine::getNetworkListing()
@@ -149,7 +148,6 @@ void QConnmanEngine::getNetworkListing()
}
}
-
void QConnmanEngine::doRequestUpdate()
{
connmanManager->requestScan("");
@@ -184,11 +182,24 @@ void QConnmanEngine::connectToId(const QString &id)
void QConnmanEngine::disconnectFromId(const QString &id)
{
QMutexLocker locker(&mutex);
- QConnmanServiceInterface serv(serviceFromId(id));
+ QString servicePath = serviceFromId(id);
+ QConnmanServiceInterface serv(servicePath);
if(!serv.isValid()) {
emit connectionError(id, DisconnectionError);
} else {
- serv.disconnect();
+ if(serv.getType() != "cellular") {
+ serv.disconnect();
+ } else {
+ QOfonoManagerInterface ofonoManager(0);
+ QString modemPath = ofonoManager.currentModem().path();
+ QOfonoDataConnectionManagerInterface dc(modemPath,0);
+ foreach(const QDBusObjectPath dcPath,dc.getPrimaryContexts()) {
+ if(dcPath.path().contains(servicePath.section("_",-1))) {
+ QOfonoPrimaryDataContextInterface primaryContext(dcPath.path(),0);
+ primaryContext.setActive(false);
+ }
+ }
+ }
}
}
@@ -324,7 +335,6 @@ QString QConnmanEngine::getServiceForNetwork(const QString &netPath)
return QString();
}
-
void QConnmanEngine::propertyChangedContext(const QString &path,const QString &item, const QDBusVariant &value)
{
Q_UNUSED(path);
@@ -376,7 +386,7 @@ void QConnmanEngine::servicePropertyChangedContext(const QString &path,const QSt
}
}
-void QConnmanEngine::networkPropertyChangedContext(const QString &path,const QString &item, const QDBusVariant &value)
+void QConnmanEngine::networkPropertyChangedContext(const QString &/*path*/,const QString &/*item*/, const QDBusVariant &/*value*/)
{
QMutexLocker locker(&mutex);
}
@@ -388,7 +398,6 @@ void QConnmanEngine::devicePropertyChangedContext(const QString &devpath,const Q
QConnmanNetworkInterface network(devpath, this);
-
QDBusArgument arg = qvariant_cast<QDBusArgument>(value.variant());
QStringList remainingNetworks = qdbus_cast<QStringList>(arg);
QString devicetype;
@@ -502,10 +511,18 @@ QNetworkConfiguration::StateFlags QConnmanEngine::getStateForService(const QStri
QMutexLocker locker(&mutex);
QConnmanServiceInterface serv(service);
QNetworkConfiguration::StateFlags flag = QNetworkConfiguration::Defined;
- if(serv.isFavorite()) {
- flag = ( flag | QNetworkConfiguration::Discovered);
+ if( serv.getType() == "cellular") {
+ if(serv.isSetupRequired()) {
+ flag = ( flag | QNetworkConfiguration::Defined);
+ } else {
+ flag = ( flag | QNetworkConfiguration::Discovered);
+ }
} else {
- flag = QNetworkConfiguration::Undefined;
+ if(serv.isFavorite()) {
+ flag = ( flag | QNetworkConfiguration::Discovered);
+ } else {
+ flag = QNetworkConfiguration::Undefined;
+ }
}
if(serv.getState() == "ready" || serv.getState() == "online") {
@@ -524,8 +541,7 @@ QNetworkConfiguration::BearerType QConnmanEngine::typeToBearer(const QString &ty
if (type == "bluetooth")
return QNetworkConfiguration::BearerBluetooth;
if (type == "cellular") {
- return QNetworkConfiguration::Bearer2G;
- // not handled: CDMA2000 HSPA
+ return ofonoTechToBearerType(type);
}
if (type == "wimax")
return QNetworkConfiguration::BearerWiMAX;
@@ -536,6 +552,51 @@ QNetworkConfiguration::BearerType QConnmanEngine::typeToBearer(const QString &ty
return QNetworkConfiguration::BearerUnknown;
}
+QNetworkConfiguration::BearerType QConnmanEngine::ofonoTechToBearerType(const QString &/*type*/)
+{
+ QOfonoManagerInterface ofonoManager(this);
+ QOfonoNetworkRegistrationInterface ofonoNetwork(ofonoManager.currentModem().path(),this);
+
+ if(ofonoNetwork.isValid()) {
+ foreach(const QDBusObjectPath op,ofonoNetwork.getOperators() ) {
+ QOfonoNetworkOperatorInterface opIface(op.path(),this);
+
+ foreach(const QString opTech, opIface.getTechnologies()) {
+
+ if(opTech == "gsm") {
+ return QNetworkConfiguration::Bearer2G;
+ }
+ if(opTech == "edge"){
+ return QNetworkConfiguration::BearerCDMA2000; //wrong, I know
+ }
+ if(opTech == "umts"){
+ return QNetworkConfiguration::BearerWCDMA;
+ }
+ if(opTech == "hspa"){
+ return QNetworkConfiguration::BearerHSPA;
+ }
+ if(opTech == "lte"){
+ return QNetworkConfiguration::BearerWiMAX; //not exact
+ }
+ }
+ }
+ }
+ return QNetworkConfiguration::BearerUnknown;
+}
+
+bool QConnmanEngine::isRoamingAllowed(const QString &context)
+{
+ QOfonoManagerInterface ofonoManager(this);
+ QString modemPath = ofonoManager.currentModem().path();
+ QOfonoDataConnectionManagerInterface dc(modemPath,this);
+ foreach(const QDBusObjectPath dcPath,dc.getPrimaryContexts()) {
+ if(dcPath.path().contains(context.section("_",-1))) {
+ return dc.isRoamingAllowed();
+ }
+ }
+ return false;
+}
+
void QConnmanEngine::removeConfiguration(const QString &id)
{
QMutexLocker locker(&mutex);
@@ -564,7 +625,6 @@ void QConnmanEngine::removeConfiguration(const QString &id)
void QConnmanEngine::addServiceConfiguration(const QString &servicePath)
{
-
QMutexLocker locker(&mutex);
QConnmanServiceInterface *serv;
serv = new QConnmanServiceInterface(servicePath);
@@ -589,36 +649,31 @@ void QConnmanEngine::addServiceConfiguration(const QString &servicePath)
QString networkName = serv->getName();
- if(serv->getType() == "cellular") {
- networkName = serv->getAPN();
- if(networkName.isEmpty()) {
- networkName = serv->getName();
- }
- }
-
- cpPriv->name = networkName;
- cpPriv->isValid = true;
- cpPriv->id = id;
- cpPriv->type = QNetworkConfiguration::InternetAccessPoint;
-
-
const QString connectionType = serv->getType();
if (connectionType == "ethernet") {
cpPriv->bearerType = QNetworkConfiguration::BearerEthernet;
} else if (connectionType == "wifi") {
cpPriv->bearerType = QNetworkConfiguration::BearerWLAN;
} else if (connectionType == "cellular") {
- const QString mode = serv->getMode();
- if (mode == "gprs" || mode == "edge")
- cpPriv->bearerType = QNetworkConfiguration::Bearer2G;
- else if (mode == "umts")
- cpPriv->bearerType = QNetworkConfiguration::BearerWCDMA;
+ cpPriv->bearerType = ofonoTechToBearerType("cellular");
+ if(servicePath.isEmpty()) {
+ networkName = serv->getAPN();
+ if(networkName.isEmpty()) {
+ networkName = serv->getName();
+ }
+ }
+ cpPriv->roamingSupported = isRoamingAllowed(servicePath);
} else if (connectionType == "wimax") {
cpPriv->bearerType = QNetworkConfiguration::BearerWiMAX;
} else {
cpPriv->bearerType = QNetworkConfiguration::BearerUnknown;
}
+ cpPriv->name = networkName;
+ cpPriv->isValid = true;
+ cpPriv->id = id;
+ cpPriv->type = QNetworkConfiguration::InternetAccessPoint;
+
if(serv->getSecurity() == "none") {
cpPriv->purpose = QNetworkConfiguration::PublicPurpose;
} else {
@@ -635,7 +690,6 @@ void QConnmanEngine::addServiceConfiguration(const QString &servicePath)
foundConfigurations.append(cpPriv);
configInterfaces[cpPriv->id] = device.getInterface();
-
locker.unlock();
emit configurationAdded(ptr);
locker.relock();
@@ -646,7 +700,6 @@ void QConnmanEngine::addServiceConfiguration(const QString &servicePath)
void QConnmanEngine::addNetworkConfiguration(const QString &networkPath)
{
QMutexLocker locker(&mutex);
-
if(networkPath.isNull())
return;
@@ -662,10 +715,9 @@ void QConnmanEngine::addNetworkConfiguration(const QString &networkPath)
id = QString::number(qHash(networkPath));
} else {
id = QString::number(qHash(servicePath));
- serv = new QConnmanServiceInterface(servicePath,this);
- connect(serv,SIGNAL(propertyChangedContext(QString,QString,QDBusVariant)),
- this,SLOT(servicePropertyChangedContext(QString,QString, QDBusVariant)));
-
+ serv = new QConnmanServiceInterface(servicePath,this);
+ connect(serv,SIGNAL(propertyChangedContext(QString,QString,QDBusVariant)),
+ this,SLOT(servicePropertyChangedContext(QString,QString, QDBusVariant)));
}
if (!id.isEmpty() && !accessPointConfigurations.contains(id)) {
@@ -684,7 +736,6 @@ void QConnmanEngine::addNetworkConfiguration(const QString &networkPath)
if(networkName.isEmpty())
networkName = "Hidden Network";
-
QNetworkConfiguration::BearerType bearerType;
if(servicePath.isEmpty()) {
@@ -693,21 +744,14 @@ void QConnmanEngine::addNetworkConfiguration(const QString &networkPath)
QConnmanDeviceInterface device(devicePath,this);
bearerType = typeToBearer(device.getType());
} else {
- bearerType = typeToBearer(serv->getType());
- }
-
- if (bearerType == QNetworkConfiguration::Bearer2G) {
- QString mode = serv->getMode();
- if (mode == "gprs" || mode == "edge") {
- bearerType = QNetworkConfiguration::Bearer2G;
- } else if (mode == "umts") {
- bearerType = QNetworkConfiguration::BearerWCDMA;
- }
- if(servicePath.isEmpty()) {
- networkName = serv->getAPN();
- if(networkName.isEmpty()) {
+ if(serv->getType() == "cellular") {
+ bearerType = ofonoTechToBearerType("cellular");
+ if(servicePath.isEmpty()) {
networkName = serv->getName();
}
+ cpPriv->roamingSupported = isRoamingAllowed(servicePath);
+ } else {
+ bearerType = typeToBearer(serv->getType());
}
}
@@ -775,7 +819,19 @@ void QConnmanConnectThread::run()
if(!serv.isValid()) {
emit connectionError(identifier, QBearerEngineImpl::InterfaceLookupError);
} else {
- serv.connect();
+ if(serv.getType() != "cellular") {
+ serv.connect();
+ } else {
+ QOfonoManagerInterface ofonoManager(0);
+ QString modemPath = ofonoManager.currentModem().path();
+ QOfonoDataConnectionManagerInterface dc(modemPath,0);
+ foreach(const QDBusObjectPath dcPath,dc.getPrimaryContexts()) {
+ if(dcPath.path().contains(servicePath.section("_",-1))) {
+ QOfonoPrimaryDataContextInterface primaryContext(dcPath.path(),0);
+ primaryContext.setActive(true);
+ }
+ }
+ }
}
}
diff --git a/src/plugins/bearer/connman/qconnmanengine.h b/src/plugins/bearer/connman/qconnmanengine.h
index 2ee6da5..569bbc7 100644
--- a/src/plugins/bearer/connman/qconnmanengine.h
+++ b/src/plugins/bearer/connman/qconnmanengine.h
@@ -137,7 +137,8 @@ private:
QMap<QString,QStringList> deviceMap; //tech path, device path
QMap<QString, QString> serviceNetworks; //service, network
-
+ QNetworkConfiguration::BearerType ofonoTechToBearerType(const QString &type);
+ bool isRoamingAllowed(const QString &context);
protected:
bool requiresPolling() const;
QConnmanConnectThread *connThread;
diff --git a/src/plugins/bearer/connman/qconnmanservice_linux.cpp b/src/plugins/bearer/connman/qconnmanservice_linux.cpp
index 3722c43..549a07a 100644
--- a/src/plugins/bearer/connman/qconnmanservice_linux.cpp
+++ b/src/plugins/bearer/connman/qconnmanservice_linux.cpp
@@ -984,12 +984,17 @@ QConnmanCounterInterface::~QConnmanCounterInterface()
quint32 QConnmanCounterInterface::getReceivedByteCount()
{
-return 0;
+ return 0;
}
quint32 QConnmanCounterInterface::getTransmittedByteCount()
{
-return 0;
+ return 0;
+}
+
+quint64 QConnmanCounterInterface::getTimeOnline()
+{
+ return 0;
}
/////////////////////////////////////////
diff --git a/src/plugins/bearer/connman/qconnmanservice_linux_p.h b/src/plugins/bearer/connman/qconnmanservice_linux_p.h
index a2b1e73..6e6b702 100644
--- a/src/plugins/bearer/connman/qconnmanservice_linux_p.h
+++ b/src/plugins/bearer/connman/qconnmanservice_linux_p.h
@@ -331,6 +331,7 @@ public:
QString getInterface();
quint32 getReceivedByteCount();
quint32 getTransmittedByteCount();
+ quint64 getTimeOnline();
private:
QConnmanCounterInterfacePrivate *d;
diff --git a/src/plugins/bearer/connman/qofonoservice_linux.cpp b/src/plugins/bearer/connman/qofonoservice_linux.cpp
new file mode 100644
index 0000000..955f4b1
--- /dev/null
+++ b/src/plugins/bearer/connman/qofonoservice_linux.cpp
@@ -0,0 +1,940 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QObject>
+#include <QList>
+#include <QtDBus/QtDBus>
+#include <QtDBus/QDBusConnection>
+#include <QtDBus/QDBusError>
+#include <QtDBus/QDBusInterface>
+#include <QtDBus/QDBusMessage>
+#include <QtDBus/QDBusReply>
+#include <QtDBus/QDBusPendingCallWatcher>
+#include <QtDBus/QDBusObjectPath>
+#include <QtDBus/QDBusPendingCall>
+
+#include "qofonoservice_linux_p.h"
+
+
+QT_BEGIN_NAMESPACE
+static QDBusConnection dbusConnection = QDBusConnection::systemBus();
+
+
+QOfonoManagerInterface::QOfonoManagerInterface( QObject *parent)
+ : QDBusAbstractInterface(QLatin1String(OFONO_SERVICE),
+ QLatin1String(OFONO_MANAGER_PATH),
+ OFONO_MANAGER_INTERFACE,
+ QDBusConnection::systemBus(), parent)
+{
+}
+
+QOfonoManagerInterface::~QOfonoManagerInterface()
+{
+}
+
+QList <QDBusObjectPath> QOfonoManagerInterface::getModems()
+{
+ QVariant var = getProperty("Modems");
+ return qdbus_cast<QList<QDBusObjectPath> >(var);
+}
+
+QDBusObjectPath QOfonoManagerInterface::currentModem()
+{
+ QList<QDBusObjectPath> modems = getModems();
+ foreach(const QDBusObjectPath modem, modems) {
+ QOfonoModemInterface device(modem.path());
+ if(device.isPowered() && device.isOnline())
+ return modem;;
+ }
+ return QDBusObjectPath();
+}
+
+
+void QOfonoManagerInterface::connectNotify(const char *signal)
+{
+if (QLatin1String(signal) == SIGNAL(propertyChanged(QString,QDBusVariant))) {
+ if(!connection().connect(QLatin1String(OFONO_SERVICE),
+ QLatin1String(OFONO_MANAGER_PATH),
+ QLatin1String(OFONO_MANAGER_INTERFACE),
+ QLatin1String("PropertyChanged"),
+ this,SIGNAL(propertyChanged(const QString &, const QDBusVariant & )))) {
+ qWarning() << "PropertyCHanged not connected";
+ }
+ }
+
+ if (QLatin1String(signal) == SIGNAL(propertyChangedContext(QString,QString,QDBusVariant))) {
+ QOfonoDBusHelper *helper;
+ helper = new QOfonoDBusHelper(this);
+
+ dbusConnection.connect(QLatin1String(OFONO_SERVICE),
+ QLatin1String(OFONO_MANAGER_PATH),
+ QLatin1String(OFONO_MANAGER_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 &)));
+ }
+}
+
+void QOfonoManagerInterface::disconnectNotify(const char *signal)
+{
+ if (QLatin1String(signal) == SIGNAL(propertyChanged(QString,QVariant))) {
+
+ }
+}
+
+QVariant QOfonoManagerInterface::getProperty(const QString &property)
+{
+ QVariantMap map = getProperties();
+ if (map.contains(property)) {
+ return map.value(property);
+ } else {
+ qDebug() << Q_FUNC_INFO << "does not contain" << property;
+ }
+ return QVariant();
+}
+
+QVariantMap QOfonoManagerInterface::getProperties()
+{
+ QDBusReply<QVariantMap > reply = this->call(QLatin1String("GetProperties"));
+ if(reply.isValid())
+ return reply.value();
+ else
+ return QVariantMap();
+}
+
+QOfonoDBusHelper::QOfonoDBusHelper(QObject * parent)
+ : QObject(parent)
+{
+}
+
+QOfonoDBusHelper::~QOfonoDBusHelper()
+{
+}
+
+void QOfonoDBusHelper::propertyChanged(const QString &item, const QDBusVariant &var)
+{
+ QDBusMessage msg = this->message();
+ Q_EMIT propertyChangedContext(msg.path() ,item, var);
+}
+
+
+QOfonoModemInterface::QOfonoModemInterface(const QString &dbusPathName, QObject *parent)
+ : QDBusAbstractInterface(QLatin1String(OFONO_SERVICE),
+ dbusPathName,
+ OFONO_MODEM_INTERFACE,
+ QDBusConnection::systemBus(), parent)
+{
+}
+
+QOfonoModemInterface::~QOfonoModemInterface()
+{
+}
+
+bool QOfonoModemInterface::isPowered()
+{
+ QVariant var = getProperty("Powered");
+ return qdbus_cast<bool>(var);
+}
+
+bool QOfonoModemInterface::isOnline()
+{
+ QVariant var = getProperty("Online");
+ return qdbus_cast<bool>(var);
+}
+
+QString QOfonoModemInterface::getName()
+{
+ QVariant var = getProperty("Name");
+ return qdbus_cast<QString>(var);
+}
+
+QString QOfonoModemInterface::getManufacturer()
+{
+ QVariant var = getProperty("Manufacturer");
+ return qdbus_cast<QString>(var);
+
+}
+
+QString QOfonoModemInterface::getModel()
+{
+
+ QVariant var = getProperty("Model");
+ return qdbus_cast<QString>(var);
+}
+
+QString QOfonoModemInterface::getRevision()
+{
+ QVariant var = getProperty("Revision");
+ return qdbus_cast<QString>(var);
+
+}
+QString QOfonoModemInterface::getSerial()
+{
+ QVariant var = getProperty("Serial");
+ return qdbus_cast<QString>(var);
+
+}
+
+QStringList QOfonoModemInterface::getFeatures()
+{
+ //sms, sim
+ QVariant var = getProperty("Features");
+ return qdbus_cast<QStringList>(var);
+}
+
+QStringList QOfonoModemInterface::getInterfaces()
+{
+ QVariant var = getProperty("Interfaces");
+ return qdbus_cast<QStringList>(var);
+}
+
+QString QOfonoModemInterface::defaultInterface()
+{
+ foreach(const QString &modem,getInterfaces()) {
+ return modem;
+ }
+ return QString();
+}
+
+
+void QOfonoModemInterface::connectNotify(const char *signal)
+{
+ if (QLatin1String(signal) == SIGNAL(propertyChanged(QString,QDBusVariant))) {
+ if(!connection().connect(QLatin1String(OFONO_SERVICE),
+ this->path(),
+ QLatin1String(OFONO_MODEM_INTERFACE),
+ QLatin1String("PropertyChanged"),
+ this,SIGNAL(propertyChanged(const QString &, const QDBusVariant & )))) {
+ qWarning() << "PropertyCHanged not connected";
+ }
+ }
+
+ if (QLatin1String(signal) == SIGNAL(propertyChangedContext(QString,QString,QDBusVariant))) {
+ QOfonoDBusHelper *helper;
+ helper = new QOfonoDBusHelper(this);
+
+ dbusConnection.connect(QLatin1String(OFONO_SERVICE),
+ this->path(),
+ QLatin1String(OFONO_MODEM_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 &)));
+ }}
+
+void QOfonoModemInterface::disconnectNotify(const char *signal)
+{
+ if (QLatin1String(signal) == SIGNAL(propertyChanged(QString,QVariant))) {
+
+ }
+}
+
+QVariantMap QOfonoModemInterface::getProperties()
+{
+ QDBusReply<QVariantMap > reply = this->call(QLatin1String("GetProperties"));
+ return reply.value();
+}
+
+QVariant QOfonoModemInterface::getProperty(const QString &property)
+{
+ QVariant var;
+ QVariantMap map = getProperties();
+ if (map.contains(property)) {
+ var = map.value(property);
+ } else {
+ qDebug() << Q_FUNC_INFO << "does not contain" << property;
+ }
+ return var;
+}
+
+
+QOfonoNetworkRegistrationInterface::QOfonoNetworkRegistrationInterface(const QString &dbusPathName, QObject *parent)
+ : QDBusAbstractInterface(QLatin1String(OFONO_SERVICE),
+ dbusPathName,
+ OFONO_NETWORK_REGISTRATION_INTERFACE,
+ QDBusConnection::systemBus(), parent)
+{
+}
+
+QOfonoNetworkRegistrationInterface::~QOfonoNetworkRegistrationInterface()
+{
+}
+
+QString QOfonoNetworkRegistrationInterface::getStatus()
+{
+ /*
+ "unregistered" Not registered to any network
+ "registered" Registered to home network
+ "searching" Not registered, but searching
+ "denied" Registration has been denied
+ "unknown" Status is unknown
+ "roaming" Registered, but roaming*/
+ QVariant var = getProperty("Status");
+ return qdbus_cast<QString>(var);
+}
+
+quint16 QOfonoNetworkRegistrationInterface::getLac()
+{
+ QVariant var = getProperty("LocationAreaCode");
+ return var.value<quint16>();
+}
+
+
+quint32 QOfonoNetworkRegistrationInterface::getCellId()
+{
+ QVariant var = getProperty("CellId");
+ return var.value<quint32>();
+}
+
+QString QOfonoNetworkRegistrationInterface::getTechnology()
+{
+ // "gsm", "edge", "umts", "hspa","lte"
+ QVariant var = getProperty("Technology");
+ return qdbus_cast<QString>(var);
+}
+
+QString QOfonoNetworkRegistrationInterface::getOperatorName()
+{
+ QVariant var = getProperty("Name");
+ return qdbus_cast<QString>(var);
+}
+
+int QOfonoNetworkRegistrationInterface::getSignalStrength()
+{
+ QVariant var = getProperty("Strength");
+ return qdbus_cast<int>(var);
+
+}
+
+QString QOfonoNetworkRegistrationInterface::getBaseStation()
+{
+ QVariant var = getProperty("BaseStation");
+ return qdbus_cast<QString>(var);
+}
+
+QList <QDBusObjectPath> QOfonoNetworkRegistrationInterface::getOperators()
+{
+ QVariant var = getProperty("Operators");
+ return qdbus_cast<QList <QDBusObjectPath> >(var);
+}
+
+void QOfonoNetworkRegistrationInterface::connectNotify(const char *signal)
+{
+if (QLatin1String(signal) == SIGNAL(propertyChanged(QString,QDBusVariant))) {
+ if(!connection().connect(QLatin1String(OFONO_SERVICE),
+ this->path(),
+ QLatin1String(OFONO_NETWORK_REGISTRATION_INTERFACE),
+ QLatin1String("PropertyChanged"),
+ this,SIGNAL(propertyChanged(const QString &, const QDBusVariant & )))) {
+ qWarning() << "PropertyCHanged not connected";
+ }
+ }
+
+ if (QLatin1String(signal) == SIGNAL(propertyChangedContext(QString,QString,QDBusVariant))) {
+ QOfonoDBusHelper *helper;
+ helper = new QOfonoDBusHelper(this);
+
+ dbusConnection.connect(QLatin1String(OFONO_SERVICE),
+ this->path(),
+ QLatin1String(OFONO_NETWORK_REGISTRATION_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 &)));
+ }
+}
+
+void QOfonoNetworkRegistrationInterface::disconnectNotify(const char *signal)
+{
+ if (QLatin1String(signal) == SIGNAL(propertyChanged(QString,QVariant))) {
+
+ }
+}
+
+QVariant QOfonoNetworkRegistrationInterface::getProperty(const QString &property)
+{
+ QVariant var;
+ QVariantMap map = getProperties();
+ if (map.contains(property)) {
+ var = map.value(property);
+ } else {
+ qDebug() << Q_FUNC_INFO << "does not contain" << property;
+ }
+ return var;
+}
+
+QVariantMap QOfonoNetworkRegistrationInterface::getProperties()
+{
+ QDBusReply<QVariantMap > reply = this->call(QLatin1String("GetProperties"));
+ return reply.value();
+}
+
+
+
+QOfonoNetworkOperatorInterface::QOfonoNetworkOperatorInterface(const QString &dbusPathName, QObject *parent)
+ : QDBusAbstractInterface(QLatin1String(OFONO_SERVICE),
+ dbusPathName,
+ OFONO_NETWORK_OPERATOR_INTERFACE,
+ QDBusConnection::systemBus(), parent)
+{
+}
+
+QOfonoNetworkOperatorInterface::~QOfonoNetworkOperatorInterface()
+{
+}
+
+QString QOfonoNetworkOperatorInterface::getName()
+{
+ QVariant var = getProperty("Name");
+ return qdbus_cast<QString>(var);
+}
+
+QString QOfonoNetworkOperatorInterface::getStatus()
+{
+ // "unknown", "available", "current" and "forbidden"
+ QVariant var = getProperty("Status");
+ return qdbus_cast<QString>(var);
+}
+
+QString QOfonoNetworkOperatorInterface::getMcc()
+{
+ QVariant var = getProperty("MobileCountryCode");
+ return qdbus_cast<QString>(var);
+}
+
+QString QOfonoNetworkOperatorInterface::getMnc()
+{
+ QVariant var = getProperty("MobileNetworkCode");
+ return qdbus_cast<QString>(var);
+}
+
+QStringList QOfonoNetworkOperatorInterface::getTechnologies()
+{
+ QVariant var = getProperty("Technologies");
+ return qdbus_cast<QStringList>(var);
+}
+
+void QOfonoNetworkOperatorInterface::connectNotify(const char *signal)
+{
+if (QLatin1String(signal) == SIGNAL(propertyChanged(QString,QDBusVariant))) {
+ if(!connection().connect(QLatin1String(OFONO_SERVICE),
+ this->path(),
+ QLatin1String(OFONO_NETWORK_OPERATOR_INTERFACE),
+ QLatin1String("PropertyChanged"),
+ this,SIGNAL(propertyChanged(const QString &, const QDBusVariant & )))) {
+ qWarning() << "PropertyCHanged not connected";
+ }
+ }
+
+ if (QLatin1String(signal) == SIGNAL(propertyChangedContext(QString,QString,QDBusVariant))) {
+ QOfonoDBusHelper *helper;
+ helper = new QOfonoDBusHelper(this);
+
+ dbusConnection.connect(QLatin1String(OFONO_SERVICE),
+ this->path(),
+ QLatin1String(OFONO_NETWORK_OPERATOR_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 &)));
+ }
+}
+
+void QOfonoNetworkOperatorInterface::disconnectNotify(const char *signal)
+{
+ if (QLatin1String(signal) == SIGNAL(propertyChanged(QString,QVariant))) {
+
+ }
+}
+
+QVariant QOfonoNetworkOperatorInterface::getProperty(const QString &property)
+{
+ QVariant var;
+ QVariantMap map = getProperties();
+ if (map.contains(property)) {
+ var = map.value(property);
+ } else {
+ qDebug() << Q_FUNC_INFO << "does not contain" << property;
+ }
+ return var;
+}
+
+QVariantMap QOfonoNetworkOperatorInterface::getProperties()
+{
+ QDBusReply<QVariantMap > reply = this->call(QLatin1String("GetProperties"));
+ return reply.value();
+}
+
+QOfonoSimInterface::QOfonoSimInterface(const QString &dbusPathName, QObject *parent)
+ : QDBusAbstractInterface(QLatin1String(OFONO_SERVICE),
+ dbusPathName,
+ OFONO_SIM_MANAGER_INTERFACE,
+ QDBusConnection::systemBus(), parent)
+{
+}
+
+QOfonoSimInterface::~QOfonoSimInterface()
+{
+}
+
+bool QOfonoSimInterface::isPresent()
+{
+ QVariant var = getProperty("Present");
+ return qdbus_cast<bool>(var);
+}
+
+QString QOfonoSimInterface::getHomeMcc()
+{
+ QVariant var = getProperty("MobileCountryCode");
+ return qdbus_cast<QString>(var);
+}
+
+QString QOfonoSimInterface::getHomeMnc()
+{
+ QVariant var = getProperty("MobileNetworkCode");
+ return qdbus_cast<QString>(var);
+}
+
+// QStringList subscriberNumbers();
+// QMap<QString,QString> serviceNumbers();
+QString QOfonoSimInterface::pinRequired()
+{
+ QVariant var = getProperty("PinRequired");
+ return qdbus_cast<QString>(var);
+}
+
+QString QOfonoSimInterface::lockedPins()
+{
+ QVariant var = getProperty("LockedPins");
+ return qdbus_cast<QString>(var);
+}
+
+QString QOfonoSimInterface::cardIdentifier()
+{
+ QVariant var = getProperty("CardIdentifier");
+ return qdbus_cast<QString>(var);
+}
+
+void QOfonoSimInterface::connectNotify(const char *signal)
+{
+if (QLatin1String(signal) == SIGNAL(propertyChanged(QString,QDBusVariant))) {
+ if(!connection().connect(QLatin1String(OFONO_SERVICE),
+ this->path(),
+ QLatin1String(OFONO_SIM_MANAGER_INTERFACE),
+ QLatin1String("PropertyChanged"),
+ this,SIGNAL(propertyChanged(const QString &, const QDBusVariant & )))) {
+ qWarning() << "PropertyCHanged not connected";
+ }
+ }
+
+ if (QLatin1String(signal) == SIGNAL(propertyChangedContext(QString,QString,QDBusVariant))) {
+ QOfonoDBusHelper *helper;
+ helper = new QOfonoDBusHelper(this);
+
+ dbusConnection.connect(QLatin1String(OFONO_SERVICE),
+ this->path(),
+ QLatin1String(OFONO_SIM_MANAGER_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 &)));
+ }
+}
+
+void QOfonoSimInterface::disconnectNotify(const char *signal)
+{
+ if (QLatin1String(signal) == SIGNAL(propertyChanged(QString,QVariant))) {
+
+ }
+}
+
+QVariant QOfonoSimInterface::getProperty(const QString &property)
+{
+ QVariant var;
+ QVariantMap map = getProperties();
+ if (map.contains(property)) {
+ var = map.value(property);
+ } else {
+ qDebug() << Q_FUNC_INFO << "does not contain" << property;
+ }
+ return var;
+}
+
+QVariantMap QOfonoSimInterface::getProperties()
+{
+ QDBusReply<QVariantMap > reply = this->call(QLatin1String("GetProperties"));
+ return reply.value();
+}
+
+QOfonoDataConnectionManagerInterface::QOfonoDataConnectionManagerInterface(const QString &dbusPathName, QObject *parent)
+ : QDBusAbstractInterface(QLatin1String(OFONO_SERVICE),
+ dbusPathName,
+ OFONO_DATA_CONNECTION_MANAGER_INTERFACE,
+ QDBusConnection::systemBus(), parent)
+{
+}
+
+QOfonoDataConnectionManagerInterface::~QOfonoDataConnectionManagerInterface()
+{
+}
+
+QList<QDBusObjectPath> QOfonoDataConnectionManagerInterface::getPrimaryContexts()
+{
+ QVariant var = getProperty("PrimaryContexts");
+ return qdbus_cast<QList<QDBusObjectPath> >(var);
+}
+
+bool QOfonoDataConnectionManagerInterface::isAttached()
+{
+ QVariant var = getProperty("Attached");
+ return qdbus_cast<bool>(var);
+}
+
+bool QOfonoDataConnectionManagerInterface::isRoamingAllowed()
+{
+ QVariant var = getProperty("RoamingAllowed");
+ return qdbus_cast<bool>(var);
+}
+
+bool QOfonoDataConnectionManagerInterface::isPowered()
+{
+ QVariant var = getProperty("Powered");
+ return qdbus_cast<bool>(var);
+}
+
+void QOfonoDataConnectionManagerInterface::connectNotify(const char *signal)
+{
+if (QLatin1String(signal) == SIGNAL(propertyChanged(QString,QDBusVariant))) {
+ if(!connection().connect(QLatin1String(OFONO_SERVICE),
+ this->path(),
+ QLatin1String(OFONO_DATA_CONNECTION_MANAGER_INTERFACE),
+ QLatin1String("PropertyChanged"),
+ this,SIGNAL(propertyChanged(const QString &, const QDBusVariant & )))) {
+ qWarning() << "PropertyCHanged not connected";
+ }
+ }
+
+ if (QLatin1String(signal) == SIGNAL(propertyChangedContext(QString,QString,QDBusVariant))) {
+ QOfonoDBusHelper *helper;
+ helper = new QOfonoDBusHelper(this);
+
+ dbusConnection.connect(QLatin1String(OFONO_SERVICE),
+ this->path(),
+ QLatin1String(OFONO_DATA_CONNECTION_MANAGER_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 &)));
+ }
+}
+
+void QOfonoDataConnectionManagerInterface::disconnectNotify(const char *signal)
+{
+ if (QLatin1String(signal) == SIGNAL(propertyChanged(QString,QVariant))) {
+
+ }
+}
+
+QVariant QOfonoDataConnectionManagerInterface::getProperty(const QString &property)
+{
+ QVariant var;
+ QVariantMap map = getProperties();
+ if (map.contains(property)) {
+ var = map.value(property);
+ } else {
+ qDebug() << Q_FUNC_INFO << "does not contain" << property;
+ }
+ return var;
+}
+
+QVariantMap QOfonoDataConnectionManagerInterface::getProperties()
+{
+ QDBusReply<QVariantMap > reply = this->call(QLatin1String("GetProperties"));
+ return reply.value();
+}
+
+QOfonoPrimaryDataContextInterface::QOfonoPrimaryDataContextInterface(const QString &dbusPathName, QObject *parent)
+ : QDBusAbstractInterface(QLatin1String(OFONO_SERVICE),
+ dbusPathName,
+ OFONO_DATA_CONTEXT_INTERFACE,
+ QDBusConnection::systemBus(), parent)
+{
+}
+
+QOfonoPrimaryDataContextInterface::~QOfonoPrimaryDataContextInterface()
+{
+}
+
+bool QOfonoPrimaryDataContextInterface::isActive()
+{
+ QVariant var = getProperty("Active");
+ return qdbus_cast<bool>(var);
+}
+
+QString QOfonoPrimaryDataContextInterface::getApName()
+{
+ QVariant var = getProperty("AccessPointName");
+ return qdbus_cast<QString>(var);
+}
+
+QString QOfonoPrimaryDataContextInterface::getType()
+{
+ QVariant var = getProperty("Type");
+ return qdbus_cast<QString>(var);
+}
+
+QString QOfonoPrimaryDataContextInterface::getName()
+{
+ QVariant var = getProperty("Name");
+ return qdbus_cast<QString>(var);
+}
+
+QVariantMap QOfonoPrimaryDataContextInterface::getSettings()
+{
+ QVariant var = getProperty("Settings");
+ return qdbus_cast<QVariantMap>(var);
+}
+
+QString QOfonoPrimaryDataContextInterface::getInterface()
+{
+ QVariant var = getProperty("Interface");
+ return qdbus_cast<QString>(var);
+}
+
+QString QOfonoPrimaryDataContextInterface::getAddress()
+{
+ QVariant var = getProperty("Address");
+ return qdbus_cast<QString>(var);
+}
+
+bool QOfonoPrimaryDataContextInterface::setActive(bool on)
+{
+// this->setProperty("Active", QVariant(on));
+
+ return setProp("Active", qVariantFromValue(on));
+}
+
+bool QOfonoPrimaryDataContextInterface::setApn(const QString &name)
+{
+ return setProp("AccessPointName", QVariant::fromValue(name));
+}
+
+void QOfonoPrimaryDataContextInterface::connectNotify(const char *signal)
+{
+if (QLatin1String(signal) == SIGNAL(propertyChanged(QString,QDBusVariant))) {
+ if(!connection().connect(QLatin1String(OFONO_SERVICE),
+ this->path(),
+ QLatin1String(OFONO_DATA_CONTEXT_INTERFACE),
+ QLatin1String("PropertyChanged"),
+ this,SIGNAL(propertyChanged(const QString &, const QDBusVariant & )))) {
+ qWarning() << "PropertyCHanged not connected";
+ }
+ }
+
+ if (QLatin1String(signal) == SIGNAL(propertyChangedContext(QString,QString,QDBusVariant))) {
+ QOfonoDBusHelper *helper;
+ helper = new QOfonoDBusHelper(this);
+
+ dbusConnection.connect(QLatin1String(OFONO_SERVICE),
+ this->path(),
+ QLatin1String(OFONO_DATA_CONTEXT_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 &)));
+ }
+}
+
+void QOfonoPrimaryDataContextInterface::disconnectNotify(const char *signal)
+{
+ if (QLatin1String(signal) == SIGNAL(propertyChanged(QString,QVariant))) {
+
+ }
+}
+
+QVariant QOfonoPrimaryDataContextInterface::getProperty(const QString &property)
+{
+ QVariant var;
+ QVariantMap map = getProperties();
+ if (map.contains(property)) {
+ var = map.value(property);
+ } else {
+ qDebug() << Q_FUNC_INFO << "does not contain" << property;
+ }
+ return var;
+}
+
+QVariantMap QOfonoPrimaryDataContextInterface::getProperties()
+{
+ QDBusReply<QVariantMap > reply = this->call(QLatin1String("GetProperties"));
+ return reply.value();
+}
+
+bool QOfonoPrimaryDataContextInterface::setProp(const QString &property, const QVariant &var)
+{
+ QList<QVariant> args;
+ args << qVariantFromValue(property) << qVariantFromValue(QDBusVariant(var));
+
+ QDBusMessage reply = this->callWithArgumentList(QDBus::AutoDetect,
+ QLatin1String("SetProperty"),
+ args);
+ bool ok = true;
+ if(reply.type() != QDBusMessage::ReplyMessage) {
+ qWarning() << reply.errorMessage();
+ ok = false;
+ }
+ qWarning() << reply.errorMessage();
+ return ok;
+}
+
+QOfonoSmsInterface::QOfonoSmsInterface(const QString &dbusPathName, QObject *parent)
+ : QDBusAbstractInterface(QLatin1String(OFONO_SERVICE),
+ dbusPathName,
+ OFONO_SMS_MANAGER_INTERFACE,
+ QDBusConnection::systemBus(), parent)
+{
+}
+
+QOfonoSmsInterface::~QOfonoSmsInterface()
+{
+}
+
+void QOfonoSmsInterface::connectNotify(const char *signal)
+{
+ if (QLatin1String(signal) == SIGNAL(propertyChanged(QString,QDBusVariant))) {
+ if(!connection().connect(QLatin1String(OFONO_SERVICE),
+ this->path(),
+ QLatin1String(OFONO_SMS_MANAGER_INTERFACE),
+ QLatin1String("PropertyChanged"),
+ this,SIGNAL(propertyChanged(const QString &, const QDBusVariant & )))) {
+ qWarning() << "PropertyCHanged not connected";
+ }
+ }
+
+ if (QLatin1String(signal) == SIGNAL(propertyChangedContext(QString,QString,QDBusVariant))) {
+ QOfonoDBusHelper *helper;
+ helper = new QOfonoDBusHelper(this);
+
+ dbusConnection.connect(QLatin1String(OFONO_SERVICE),
+ this->path(),
+ QLatin1String(OFONO_SMS_MANAGER_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 &)));
+ }
+
+ if (QLatin1String(signal) == SIGNAL(immediateMessage(QString,QVariantMap))) {
+ if(!connection().connect(QLatin1String(OFONO_SERVICE),
+ this->path(),
+ QLatin1String(OFONO_SMS_MANAGER_INTERFACE),
+ QLatin1String("ImmediateMessage"),
+ this,SIGNAL(immediateMessage(QString,QVariantMap )))) {
+ qWarning() << "PropertyCHanged not connected";
+ }
+ }
+
+ if (QLatin1String(signal) == SIGNAL(incomingMessage(QString,QVariantMap))) {
+ if(!connection().connect(QLatin1String(OFONO_SERVICE),
+ this->path(),
+ QLatin1String(OFONO_SMS_MANAGER_INTERFACE),
+ QLatin1String("IncomingMessage"),
+ this,SIGNAL(incomingMessage(QString,QVariantMap)))) {
+ qWarning() << "PropertyCHanged not connected";
+ }
+ }
+}
+
+void QOfonoSmsInterface::disconnectNotify(const char *signal)
+{
+ if (QLatin1String(signal) == SIGNAL(propertyChanged(QString,QVariant))) {
+
+ }
+}
+
+QVariant QOfonoSmsInterface::getProperty(const QString &property)
+{
+ QVariant var;
+ QVariantMap map = getProperties();
+ if (map.contains(property)) {
+ var = map.value(property);
+ } else {
+ qDebug() << Q_FUNC_INFO << "does not contain" << property;
+ }
+ return var;
+}
+
+QVariantMap QOfonoSmsInterface::getProperties()
+{
+ QDBusReply<QVariantMap > reply = this->call(QLatin1String("GetProperties"));
+ return reply.value();
+}
+
+void QOfonoSmsInterface::sendMessage(const QString &to, const QString &message)
+{
+ QDBusReply<QString> reply = this->call(QLatin1String("SendMessage"),
+ QVariant::fromValue(to),
+ QVariant::fromValue(message));
+ bool ok = true;
+ if(reply.error().type() == QDBusError::InvalidArgs) {
+ qWarning() << reply.error().message();
+ ok = false;
+ }
+}
+
+QT_END_NAMESPACE
diff --git a/src/plugins/bearer/connman/qofonoservice_linux_p.h b/src/plugins/bearer/connman/qofonoservice_linux_p.h
new file mode 100644
index 0000000..4892666
--- /dev/null
+++ b/src/plugins/bearer/connman/qofonoservice_linux_p.h
@@ -0,0 +1,332 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QOFONOSERVICE_H
+#define QOFONOSERVICE_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtDBus/QtDBus>
+#include <QtDBus/QDBusConnection>
+#include <QtDBus/QDBusError>
+#include <QtDBus/QDBusInterface>
+#include <QtDBus/QDBusMessage>
+#include <QtDBus/QDBusReply>
+
+#include <QtDBus/QDBusPendingCallWatcher>
+#include <QtDBus/QDBusObjectPath>
+#include <QtDBus/QDBusContext>
+#include <QMap>
+
+#define OFONO_SERVICE "org.ofono"
+#define OFONO_MANAGER_INTERFACE "org.ofono.Manager"
+#define OFONO_MANAGER_PATH "/"
+#define OFONO_MODEM_INTERFACE "org.ofono.Modem"
+#define OFONO_NETWORK_REGISTRATION_INTERFACE "org.ofono.NetworkRegistration"
+#define OFONO_NETWORK_OPERATOR_INTERFACE "org.ofono.NetworkOperator"
+#define OFONO_DATA_CONNECTION_MANAGER_INTERFACE "org.ofono.DataConnectionManager"
+#define OFONO_SIM_MANAGER_INTERFACE "org.ofono.SimManager"
+#define OFONO_DATA_CONTEXT_INTERFACE "org.ofono.PrimaryDataContext"
+
+#define OFONO_SMS_MANAGER_INTERFACE "org.ofono.SmsManager"
+#define OFONO_PHONEBOOK_INTERFACE "org.ofono.Phonebook"
+#define OFONO_MESSAGE_WAITING_INTERFACE "org.ofono.MessageWaiting"
+
+
+
+QT_BEGIN_NAMESPACE
+
+QT_END_NAMESPACE
+
+
+QT_BEGIN_NAMESPACE
+
+class QOfonoManagerInterface : public QDBusAbstractInterface
+{
+ Q_OBJECT
+
+public:
+
+ QOfonoManagerInterface( QObject *parent = 0);
+ ~QOfonoManagerInterface();
+
+ QDBusObjectPath path() const;
+
+ QVariantMap getProperties();
+ bool setProperty(const QString &name, const QDBusVariant &value);
+ QList <QDBusObjectPath> getModems();
+ QDBusObjectPath currentModem();
+
+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 QOfonoDBusHelper: public QObject, protected QDBusContext
+ {
+ Q_OBJECT
+ public:
+ QOfonoDBusHelper(QObject *parent = 0);
+ ~QOfonoDBusHelper();
+
+ public slots:
+ void propertyChanged(const QString &, const QDBusVariant &);
+ Q_SIGNALS:
+ void propertyChangedContext(const QString &,const QString &,const QDBusVariant &);
+};
+
+class QOfonoModemInterface : public QDBusAbstractInterface
+{
+ Q_OBJECT
+
+public:
+
+ QOfonoModemInterface(const QString &dbusModemPathName, QObject *parent = 0);
+ ~QOfonoModemInterface();
+
+ QVariantMap getProperties();
+ //properties
+ bool isPowered();
+ bool isOnline();
+ QString getName();
+ QString getManufacturer();
+ QString getModel();
+ QString getRevision();
+ QString getSerial();
+
+ QStringList getFeatures(); //sms, sim
+ QStringList getInterfaces();
+ QString defaultInterface();
+
+protected:
+ void connectNotify(const char *signal);
+ void disconnectNotify(const char *signal);
+ QVariant getProperty(const QString &);
+Q_SIGNALS:
+ void propertyChanged(const QString &, const QDBusVariant &value);
+ void propertyChangedContext(const QString &,const QString &,const QDBusVariant &);
+};
+
+
+class QOfonoNetworkRegistrationInterface : public QDBusAbstractInterface
+{
+ Q_OBJECT
+
+public:
+
+ QOfonoNetworkRegistrationInterface(const QString &dbusModemPathName, QObject *parent = 0);
+ ~QOfonoNetworkRegistrationInterface();
+
+ QVariantMap getProperties();
+
+ //properties
+ QString getStatus();
+ quint16 getLac();
+ quint32 getCellId();
+ QString getTechnology();
+ QString getOperatorName();
+ int getSignalStrength();
+ QString getBaseStation();
+ QList <QDBusObjectPath> getOperators();
+
+protected:
+ void connectNotify(const char *signal);
+ void disconnectNotify(const char *signal);
+ QVariant getProperty(const QString &);
+Q_SIGNALS:
+ void propertyChanged(const QString &, const QDBusVariant &value);
+ void propertyChangedContext(const QString &,const QString &,const QDBusVariant &);
+
+};
+
+class QOfonoNetworkOperatorInterface : public QDBusAbstractInterface
+{
+ Q_OBJECT
+
+public:
+//modem or operator paths
+ QOfonoNetworkOperatorInterface(const QString &dbusPathName, QObject *parent = 0);
+ ~QOfonoNetworkOperatorInterface();
+
+ QVariantMap getProperties();
+
+ //properties
+ QString getName();
+ QString getStatus();// "unknown", "available", "current" and "forbidden"
+ QString getMcc();
+ QString getMnc();
+ QStringList getTechnologies();
+
+protected:
+ void connectNotify(const char *signal);
+ void disconnectNotify(const char *signal);
+ QVariant getProperty(const QString &);
+};
+
+class QOfonoSimInterface : public QDBusAbstractInterface
+{
+ Q_OBJECT
+
+public:
+
+ QOfonoSimInterface(const QString &dbusModemPathName, QObject *parent = 0);
+ ~QOfonoSimInterface();
+
+ QVariantMap getProperties();
+
+ //properties
+ bool isPresent();
+ QString getHomeMcc();
+ QString getHomeMnc();
+// QStringList subscriberNumbers();
+// QMap<QString,QString> serviceNumbers();
+ QString pinRequired();
+ QString lockedPins();
+ QString cardIdentifier();
+
+protected:
+ void connectNotify(const char *signal);
+ void disconnectNotify(const char *signal);
+ QVariant getProperty(const QString &);
+};
+
+
+class QOfonoDataConnectionManagerInterface : public QDBusAbstractInterface
+{
+ Q_OBJECT
+
+public:
+
+ QOfonoDataConnectionManagerInterface(const QString &dbusPathName, QObject *parent = 0);
+ ~QOfonoDataConnectionManagerInterface();
+
+ QVariantMap getProperties();
+
+ //properties
+ QList<QDBusObjectPath> getPrimaryContexts();
+ bool isAttached();
+ bool isRoamingAllowed();
+ bool isPowered();
+
+ bool setPower(bool on);
+
+protected:
+ void connectNotify(const char *signal);
+ void disconnectNotify(const char *signal);
+ QVariant getProperty(const QString &);
+};
+
+
+class QOfonoPrimaryDataContextInterface : public QDBusAbstractInterface
+{
+ Q_OBJECT
+
+public:
+
+ QOfonoPrimaryDataContextInterface(const QString &dbusPathName, QObject *parent = 0);
+ ~QOfonoPrimaryDataContextInterface();
+
+ QVariantMap getProperties();
+
+ //properties
+ bool isActive();
+ QString getApName();
+ QString getType();
+ QString getName();
+ QVariantMap getSettings();
+ QString getInterface();
+ QString getAddress();
+
+ bool setActive(bool on);
+ bool setApn(const QString &name);
+
+protected:
+ void connectNotify(const char *signal);
+ void disconnectNotify(const char *signal);
+ QVariant getProperty(const QString &);
+ bool setProp(const QString &, const QVariant &var);
+};
+
+class QOfonoSmsInterface : public QDBusAbstractInterface
+{
+ Q_OBJECT
+
+public:
+
+ QOfonoSmsInterface(const QString &dbusModemPathName, QObject *parent = 0);
+ ~QOfonoSmsInterface();
+
+ QVariantMap getProperties();
+ void sendMessage(const QString &to, const QString &message);
+
+ //properties
+ QString serviceCenterAddress();
+ bool useDeliveryReports();
+ QString bearer();
+
+protected:
+ void connectNotify(const char *signal);
+ void disconnectNotify(const char *signal);
+ QVariant getProperty(const QString &);
+
+Q_SIGNALS:
+ void propertyChanged(const QString &, const QDBusVariant &value);
+ void propertyChangedContext(const QString &,const QString &,const QDBusVariant &);
+ void immediateMessage(const QString &message, const QVariantMap &info);
+ void incomingMessage(const QString &message, const QVariantMap &info);
+};
+
+#endif //QOFONOSERVICE_H
diff --git a/src/plugins/bearer/corewlan/qcorewlanengine.mm b/src/plugins/bearer/corewlan/qcorewlanengine.mm
index 131f36d..844e38b 100644
--- a/src/plugins/bearer/corewlan/qcorewlanengine.mm
+++ b/src/plugins/bearer/corewlan/qcorewlanengine.mm
@@ -305,50 +305,53 @@ void QScanThread::getUserConfigurations()
SCDynamicStoreRef dynRef = SCDynamicStoreCreate(kCFAllocatorSystemDefault, (CFStringRef)@"Qt corewlan", nil, nil);
NSDictionary * airportPlist = (NSDictionary *)SCDynamicStoreCopyValue(dynRef, (CFStringRef)[NSString stringWithFormat:@"Setup:/Network/Interface/%@/AirPort", nsInterfaceName]);
CFRelease(dynRef);
-
- NSDictionary *prefNetDict = [airportPlist objectForKey:@"PreferredNetworks"];
-
- NSArray *thisSsidarray = [prefNetDict valueForKey:@"SSID_STR"];
- for(NSString *ssidkey in thisSsidarray) {
- QString thisSsid = qt_mac_NSStringToQString(ssidkey);
- if(!userProfiles.contains(thisSsid)) {
- QMap <QString,QString> map;
- map.insert(thisSsid, qt_mac_NSStringToQString(nsInterfaceName));
- userProfiles.insert(thisSsid, map);
+ if(airportPlist != nil) {
+ NSDictionary *prefNetDict = [airportPlist objectForKey:@"PreferredNetworks"];
+
+ NSArray *thisSsidarray = [prefNetDict valueForKey:@"SSID_STR"];
+ for(NSString *ssidkey in thisSsidarray) {
+ QString thisSsid = qt_mac_NSStringToQString(ssidkey);
+ if(!userProfiles.contains(thisSsid)) {
+ QMap <QString,QString> map;
+ map.insert(thisSsid, qt_mac_NSStringToQString(nsInterfaceName));
+ userProfiles.insert(thisSsid, map);
+ }
}
+ CFRelease(airportPlist);
}
- CFRelease(airportPlist);
// 802.1X user profiles
QString userProfilePath = QDir::homePath() + "/Library/Preferences/com.apple.eap.profiles.plist";
NSDictionary* eapDict = [[[NSDictionary alloc] initWithContentsOfFile:qt_mac_QStringToNSString(userProfilePath)] autorelease];
- NSString *profileStr= @"Profiles";
- NSString *nameStr = @"UserDefinedName";
- NSString *networkSsidStr = @"Wireless Network";
- for (id profileKey in eapDict) {
- if ([profileStr isEqualToString:profileKey]) {
- NSDictionary *itemDict = [eapDict objectForKey:profileKey];
- for (id itemKey in itemDict) {
-
- NSInteger dictSize = [itemKey count];
- id objects[dictSize];
- id keys[dictSize];
-
- [itemKey getObjects:objects andKeys:keys];
- QString networkName;
- QString ssid;
- for(int i = 0; i < dictSize; i++) {
- if([nameStr isEqualToString:keys[i]]) {
- networkName = qt_mac_NSStringToQString(objects[i]);
- }
- if([networkSsidStr isEqualToString:keys[i]]) {
- ssid = qt_mac_NSStringToQString(objects[i]);
- }
- if(!userProfiles.contains(networkName)
- && !ssid.isEmpty()) {
- QMap<QString,QString> map;
- map.insert(ssid, qt_mac_NSStringToQString(nsInterfaceName));
- userProfiles.insert(networkName, map);
+ if(eapDict != nil) {
+ NSString *profileStr= @"Profiles";
+ NSString *nameStr = @"UserDefinedName";
+ NSString *networkSsidStr = @"Wireless Network";
+ for (id profileKey in eapDict) {
+ if ([profileStr isEqualToString:profileKey]) {
+ NSDictionary *itemDict = [eapDict objectForKey:profileKey];
+ for (id itemKey in itemDict) {
+
+ NSInteger dictSize = [itemKey count];
+ id objects[dictSize];
+ id keys[dictSize];
+
+ [itemKey getObjects:objects andKeys:keys];
+ QString networkName;
+ QString ssid;
+ for(int i = 0; i < dictSize; i++) {
+ if([nameStr isEqualToString:keys[i]]) {
+ networkName = qt_mac_NSStringToQString(objects[i]);
+ }
+ if([networkSsidStr isEqualToString:keys[i]]) {
+ ssid = qt_mac_NSStringToQString(objects[i]);
+ }
+ if(!userProfiles.contains(networkName)
+ && !ssid.isEmpty()) {
+ QMap<QString,QString> map;
+ map.insert(ssid, qt_mac_NSStringToQString(nsInterfaceName));
+ userProfiles.insert(networkName, map);
+ }
}
}
}
@@ -855,6 +858,8 @@ quint64 QCoreWlanEngine::startTime(const QString &id)
NSString *filePath = @"/Library/Preferences/SystemConfiguration/com.apple.airport.preferences.plist";
NSDictionary* plistDict = [[[NSDictionary alloc] initWithContentsOfFile:filePath] autorelease];
+ if(plistDict == nil)
+ return timestamp;
NSString *input = @"KnownNetworks";
NSString *timeStampStr = @"_timeStamp";
@@ -864,9 +869,13 @@ quint64 QCoreWlanEngine::startTime(const QString &id)
if ([input isEqualToString:key]) {
NSDictionary *knownNetworksDict = [plistDict objectForKey:key];
+ if(knownNetworksDict == nil)
+ return timestamp;
for (id networkKey in knownNetworksDict) {
bool isFound = false;
NSDictionary *itemDict = [knownNetworksDict objectForKey:networkKey];
+ if(itemDict == nil)
+ return timestamp;
NSInteger dictSize = [itemDict count];
id objects[dictSize];
id keys[dictSize];
diff --git a/src/plugins/bearer/symbian/qnetworksession_impl.cpp b/src/plugins/bearer/symbian/qnetworksession_impl.cpp
index 32eb61a..7f81397 100644
--- a/src/plugins/bearer/symbian/qnetworksession_impl.cpp
+++ b/src/plugins/bearer/symbian/qnetworksession_impl.cpp
@@ -48,6 +48,14 @@
#include <stdapis/sys/socket.h>
#include <stdapis/net/if.h>
+#ifdef SNAP_FUNCTIONALITY_AVAILABLE
+#include <cmmanager.h>
+#endif
+
+#if defined(OCC_FUNCTIONALITY_AVAILABLE) && defined(SNAP_FUNCTIONALITY_AVAILABLE)
+#include <extendedconnpref.h>
+#endif
+
#ifndef QT_NO_BEARERMANAGEMENT
QT_BEGIN_NAMESPACE
@@ -103,17 +111,19 @@ QNetworkSessionPrivateImpl::~QNetworkSessionPrivateImpl()
Cancel();
iSocketServ.Close();
- // Restore default interface to system default
- restoreDefaultIf();
+ // Close global 'Open C' RConnection
+ // Clears also possible unsetdefaultif() flags.
+ setdefaultif(0);
iConnectionMonitor.Close();
iOpenCLibrary.Close();
#ifdef QT_BEARERMGMT_SYMBIAN_DEBUG
- qDebug() << "QNS this : " << QString::number((uint)this) << " - destroyed (and restoreDefaultIf())";
+ qDebug() << "QNS this : " << QString::number((uint)this)
+ << " - destroyed (and setdefaultif(0))";
#endif
}
-void QNetworkSessionPrivateImpl::configurationStateChanged(TUint32 accessPointId, TUint32 connMonId, QNetworkSession::State newState)
+void QNetworkSessionPrivateImpl::configurationStateChanged(quint32 accessPointId, quint32 connMonId, QNetworkSession::State newState)
{
if (iHandleStateNotificationsFromManager) {
#ifdef QT_BEARERMGMT_SYMBIAN_DEBUG
@@ -170,8 +180,10 @@ void QNetworkSessionPrivateImpl::syncStateWithInterface()
return;
if (iFirstSync) {
- QObject::connect(engine, SIGNAL(configurationStateChanged(TUint32, TUint32, QNetworkSession::State)),
- this, SLOT(configurationStateChanged(TUint32, TUint32, QNetworkSession::State)));
+ QObject::connect(engine,
+ SIGNAL(configurationStateChanged(quint32,quint32,QNetworkSession::State)),
+ this,
+ SLOT(configurationStateChanged(quint32,quint32,QNetworkSession::State)));
// Listen to configuration removals, so that in case the configuration
// this session is based on is removed, session knows to enter Invalid -state.
QObject::connect(engine, SIGNAL(configurationRemoved(QNetworkConfigurationPrivatePointer)),
@@ -523,8 +535,15 @@ void QNetworkSessionPrivateImpl::close(bool allowSignals)
Cancel(); // closes iConnection
iSocketServ.Close();
- // Restore default interface to system default
- restoreDefaultIf();
+ // Close global 'Open C' RConnection. If OpenC supports,
+ // close the defaultif for good to avoid difficult timing
+ // and bouncing issues of network going immediately back up
+ // because of e.g. select() thread etc.
+ if (iDynamicUnSetdefaultif) {
+ iDynamicUnSetdefaultif();
+ } else {
+ setdefaultif(0);
+ }
// If UserChoice, go down immediately. If some other configuration,
// go down immediately if there is no reports expected from the platform;
@@ -902,13 +921,13 @@ QNetworkConfiguration QNetworkSessionPrivateImpl::activeConfiguration(TUint32 ia
if (iapId == 0) {
_LIT(KSetting, "IAP\\Id");
iConnection.GetIntSetting(KSetting, iapId);
-#if defined(OCC_FUNCTIONALITY_AVAILABLE) && defined(SNAP_FUNCTIONALITY_AVAILABLE)
+#ifdef SNAP_FUNCTIONALITY_AVAILABLE
// Check if this is an Easy WLAN configuration. On Symbian^3 RConnection may report
// the used configuration as 'EasyWLAN' IAP ID if someone has just opened the configuration
// from WLAN Scan dialog, _and_ that connection is still up. We need to find the
// real matching configuration. Function alters the Easy WLAN ID to real IAP ID (only if
// easy WLAN):
- engine->easyWlanTrueIapId(iapId);
+ easyWlanTrueIapId(iapId);
#endif
}
@@ -948,12 +967,18 @@ QNetworkConfiguration QNetworkSessionPrivateImpl::activeConfiguration(TUint32 ia
}
}
} else {
-#if defined(OCC_FUNCTIONALITY_AVAILABLE) && defined(SNAP_FUNCTIONALITY_AVAILABLE)
- // On Symbian^3 (only, not earlier or Symbian^4) if the SNAP was not reachable, it triggers
- // user choice type of activity (EasyWLAN). As a result, a new IAP may be created, and
- // hence if was not found yet. Therefore update configurations and see if there is something new.
+#ifdef SNAP_FUNCTIONALITY_AVAILABLE
+ // On Symbian^3 (only, not earlier or Symbian^4) if the SNAP was not reachable, it
+ // triggers user choice type of activity (EasyWLAN). As a result, a new IAP may be
+ // created, and hence if was not found yet. Therefore update configurations and see if
+ // there is something new.
+
// 1. Update knowledge from the databases.
- engine->requestUpdate();
+ if (thread() != engine->thread())
+ QMetaObject::invokeMethod(engine, "requestUpdate", Qt::BlockingQueuedConnection);
+ else
+ engine->requestUpdate();
+
// 2. Check if new configuration was created during connection creation
QList<QString> knownConfigs = engine->accessPointConfigurationIdentifiers();
#ifdef QT_BEARERMGMT_SYMBIAN_DEBUG
@@ -1006,7 +1031,12 @@ QNetworkConfiguration QNetworkSessionPrivateImpl::activeConfiguration(TUint32 ia
} else {
// Check if new (WLAN) IAP was created in IAP/SNAP dialog
// 1. Sync internal configurations array to commsdb first
- engine->updateConfigurations();
+ if (thread() != engine->thread()) {
+ QMetaObject::invokeMethod(engine, "requestUpdate",
+ Qt::BlockingQueuedConnection);
+ } else {
+ engine->requestUpdate();
+ }
// 2. Check if new configuration was created during connection creation
QStringList knownConfigs = engine->accessPointConfigurationIdentifiers();
if (knownConfigs.count() > iKnownConfigsBeforeConnectionStart.count()) {
@@ -1319,7 +1349,7 @@ bool QNetworkSessionPrivateImpl::newState(QNetworkSession::State newState, TUint
}
}
}
-#if defined(OCC_FUNCTIONALITY_AVAILABLE) && defined(SNAP_FUNCTIONALITY_AVAILABLE)
+#ifdef SNAP_FUNCTIONALITY_AVAILABLE
// If the retVal is not true here, it means that the status update may apply to an IAP outside of
// SNAP (session is based on SNAP but follows IAP outside of it), which may occur on Symbian^3 EasyWlan.
if (retVal == false && activeConfig.isValid() &&
@@ -1449,28 +1479,63 @@ void QNetworkSessionPrivateImpl::handleSymbianConnectionStatusChange(TInt aConne
}
}
-void QNetworkSessionPrivateImpl::restoreDefaultIf()
+#if defined(SNAP_FUNCTIONALITY_AVAILABLE)
+bool QNetworkSessionPrivateImpl::easyWlanTrueIapId(TUint32 &trueIapId) const
{
- QNetworkConfigurationPrivatePointer config = engine->defaultConfiguration();
+ RCmManager iCmManager;
+ TRAPD(err, iCmManager.OpenL());
+ if (err != KErrNone)
+ return false;
- QMutexLocker locker(&config->mutex);
+ // Check if this is easy wlan id in the first place
+ if (trueIapId != iCmManager.EasyWlanIdL()) {
+ iCmManager.Close();
+ return false;
+ }
- ifreq ifr;
- memset(&ifr, 0, sizeof(ifreq));
+ iCmManager.Close();
- switch (config->type) {
- case QNetworkConfiguration::InternetAccessPoint:
- strcpy(ifr.ifr_name, config->name.toUtf8().constData());
- break;
- case QNetworkConfiguration::ServiceNetwork:
- ifr.ifr_ifru.snap_id = toSymbianConfig(config)->numericId;
- break;
- default:
- ;
- };
+ // Loop through all connections that connection monitor is aware
+ // and check for IAPs based on easy WLAN
+ TRequestStatus status;
+ TUint connectionCount;
+ iConnectionMonitor.GetConnectionCount(connectionCount, status);
+ User::WaitForRequest(status);
+ TUint connectionId;
+ TUint subConnectionCount;
+ TUint apId;
+ if (status.Int() == KErrNone) {
+ for (TUint i = 1; i <= connectionCount; i++) {
+ iConnectionMonitor.GetConnectionInfo(i, connectionId, subConnectionCount);
+ iConnectionMonitor.GetUintAttribute(connectionId, subConnectionCount,
+ KIAPId, apId, status);
+ User::WaitForRequest(status);
+ if (apId == trueIapId) {
+ TBuf<50>easyWlanNetworkName;
+ iConnectionMonitor.GetStringAttribute(connectionId, 0, KNetworkName,
+ easyWlanNetworkName, status);
+ User::WaitForRequest(status);
+ if (status.Int() != KErrNone)
+ continue;
+
+ const QString ssid = QString::fromUtf16(easyWlanNetworkName.Ptr(),
+ easyWlanNetworkName.Length());
- setdefaultif(&ifr);
+ QNetworkConfigurationPrivatePointer ptr = engine->configurationFromSsid(ssid);
+ if (ptr) {
+#ifdef QT_BEARERMGMT_SYMBIAN_DEBUG
+ qDebug() << "QNCM easyWlanTrueIapId(), found true IAP ID: "
+ << toSymbianConfig(ptr)->numericIdentifier();
+#endif
+ trueIapId = toSymbianConfig(ptr)->numericIdentifier();
+ return true;
+ }
+ }
+ }
+ }
+ return false;
}
+#endif
ConnectionProgressNotifier::ConnectionProgressNotifier(QNetworkSessionPrivateImpl& owner, RConnection& connection)
: CActive(CActive::EPriorityUserInput), iOwner(owner), iConnection(connection)
diff --git a/src/plugins/bearer/symbian/qnetworksession_impl.h b/src/plugins/bearer/symbian/qnetworksession_impl.h
index 1b0e968..8e3e997 100644
--- a/src/plugins/bearer/symbian/qnetworksession_impl.h
+++ b/src/plugins/bearer/symbian/qnetworksession_impl.h
@@ -64,9 +64,6 @@
#ifdef SNAP_FUNCTIONALITY_AVAILABLE
#include <comms-infras/cs_mobility_apiext.h>
#endif
-#if defined(OCC_FUNCTIONALITY_AVAILABLE) && defined(SNAP_FUNCTIONALITY_AVAILABLE)
- #include <extendedconnpref.h>
-#endif
QT_BEGIN_NAMESPACE
@@ -132,7 +129,8 @@ protected: // From CActive
void DoCancel();
private Q_SLOTS:
- void configurationStateChanged(TUint32 accessPointId, TUint32 connMonId, QNetworkSession::State newState);
+ void configurationStateChanged(quint32 accessPointId, quint32 connMonId,
+ QNetworkSession::State newState);
void configurationRemoved(QNetworkConfigurationPrivatePointer config);
void configurationAdded(QNetworkConfigurationPrivatePointer config);
@@ -143,11 +141,15 @@ private:
void handleSymbianConnectionStatusChange(TInt aConnectionStatus, TInt aError, TUint accessPointId = 0);
QNetworkConfiguration bestConfigFromSNAP(const QNetworkConfiguration& snapConfig) const;
QNetworkConfiguration activeConfiguration(TUint32 iapId = 0) const;
- void restoreDefaultIf();
#ifndef QT_NO_NETWORKINTERFACE
QNetworkInterface interface(TUint iapId) const;
#endif
+#if defined(SNAP_FUNCTIONALITY_AVAILABLE)
+ bool easyWlanTrueIapId(TUint32 &trueIapId) const;
+#endif
+
+
private: // data
SymbianEngine *engine;
diff --git a/src/plugins/bearer/symbian/symbianengine.cpp b/src/plugins/bearer/symbian/symbianengine.cpp
index 9593461..2e2b671 100644
--- a/src/plugins/bearer/symbian/symbianengine.cpp
+++ b/src/plugins/bearer/symbian/symbianengine.cpp
@@ -692,7 +692,7 @@ void SymbianEngine::updateActiveAccessPoints()
User::WaitForRequest(status);
QString ident = QT_BEARERMGMT_CONFIGURATION_IAP_PREFIX+QString::number(qHash(apId));
QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(ident);
-#if defined(OCC_FUNCTIONALITY_AVAILABLE) && defined(SNAP_FUNCTIONALITY_AVAILABLE)
+#ifdef SNAP_FUNCTIONALITY_AVAILABLE
if (!ptr) {
// If IAP was not found, check if the update was about EasyWLAN
ptr = configurationFromEasyWlan(apId, connectionId);
@@ -1054,7 +1054,7 @@ void SymbianEngine::EventL(const CConnMonEventBase& aEvent)
QString ident = QT_BEARERMGMT_CONFIGURATION_IAP_PREFIX+QString::number(qHash(apId));
QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(ident);
-#if defined(OCC_FUNCTIONALITY_AVAILABLE) && defined(SNAP_FUNCTIONALITY_AVAILABLE)
+#ifdef SNAP_FUNCTIONALITY_AVAILABLE
if (!ptr) {
// Check if status was regarding EasyWLAN
ptr = configurationFromEasyWlan(apId, connectionId);
@@ -1079,7 +1079,7 @@ void SymbianEngine::EventL(const CConnMonEventBase& aEvent)
User::WaitForRequest(status);
QString ident = QT_BEARERMGMT_CONFIGURATION_IAP_PREFIX+QString::number(qHash(apId));
QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(ident);
-#if defined(OCC_FUNCTIONALITY_AVAILABLE) && defined(SNAP_FUNCTIONALITY_AVAILABLE)
+#ifdef SNAP_FUNCTIONALITY_AVAILABLE
if (!ptr) {
// Check for EasyWLAN
ptr = configurationFromEasyWlan(apId, connectionId);
@@ -1189,7 +1189,7 @@ void SymbianEngine::EventL(const CConnMonEventBase& aEvent)
User::WaitForRequest(status);
QString ident = QT_BEARERMGMT_CONFIGURATION_IAP_PREFIX+QString::number(qHash(apId));
QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(ident);
-#if defined(OCC_FUNCTIONALITY_AVAILABLE) && defined(SNAP_FUNCTIONALITY_AVAILABLE)
+#ifdef SNAP_FUNCTIONALITY_AVAILABLE
if (!ptr) {
// If IAP was not found, check if the update was about EasyWLAN
ptr = configurationFromEasyWlan(apId, connectionId);
@@ -1210,11 +1210,39 @@ void SymbianEngine::EventL(const CConnMonEventBase& aEvent)
}
}
-#if defined(OCC_FUNCTIONALITY_AVAILABLE) && defined(SNAP_FUNCTIONALITY_AVAILABLE)
+/*
+ Returns the network configuration that matches the given SSID.
+*/
+QNetworkConfigurationPrivatePointer SymbianEngine::configurationFromSsid(const QString &ssid)
+{
+ QMutexLocker locker(&mutex);
+
+ // Browser through all items and check their name for match
+ QHash<QString, QNetworkConfigurationPrivatePointer>::ConstIterator i =
+ accessPointConfigurations.constBegin();
+ while (i != accessPointConfigurations.constEnd()) {
+ QNetworkConfigurationPrivatePointer ptr = i.value();
+
+ QMutexLocker configLocker(&ptr->mutex);
+
+ if (ptr->name == ssid) {
+#ifdef QT_BEARERMGMT_SYMBIAN_DEBUG
+ qDebug() << "QNCM EasyWlan uses real SSID: " << ssid;
+#endif
+ return ptr;
+ }
+ ++i;
+ }
+
+ return QNetworkConfigurationPrivatePointer();
+}
+
+#ifdef SNAP_FUNCTIONALITY_AVAILABLE
// Tries to derive configuration from EasyWLAN.
// First checks if the interface brought up was EasyWLAN, then derives the real SSID,
// and looks up configuration based on that one.
-QNetworkConfigurationPrivatePointer SymbianEngine::configurationFromEasyWlan(TUint32 apId, TUint connectionId)
+QNetworkConfigurationPrivatePointer SymbianEngine::configurationFromEasyWlan(TUint32 apId,
+ TUint connectionId)
{
if (apId == iCmManager.EasyWlanIdL()) {
TRequestStatus status;
@@ -1223,11 +1251,12 @@ QNetworkConfigurationPrivatePointer SymbianEngine::configurationFromEasyWlan(TUi
easyWlanNetworkName, status );
User::WaitForRequest(status);
if (status.Int() == KErrNone) {
- QString realSSID = QString::fromUtf16(easyWlanNetworkName.Ptr(), easyWlanNetworkName.Length());
+ const QString realSSID = QString::fromUtf16(easyWlanNetworkName.Ptr(),
+ easyWlanNetworkName.Length());
// Browser through all items and check their name for match
- QHash<QString, QExplicitlySharedDataPointer<QNetworkConfigurationPrivate> >::const_iterator i =
- accessPointConfigurations.constBegin();
+ QHash<QString, QNetworkConfigurationPrivatePointer>::ConstIterator i =
+ accessPointConfigurations.constBegin();
while (i != accessPointConfigurations.constEnd()) {
QNetworkConfigurationPrivatePointer ptr = i.value();
@@ -1245,45 +1274,6 @@ QNetworkConfigurationPrivatePointer SymbianEngine::configurationFromEasyWlan(TUi
}
return QNetworkConfigurationPrivatePointer();
}
-
-bool SymbianEngine::easyWlanTrueIapId(TUint32& trueIapId)
-{
- // Check if this is easy wlan id in the first place
- if (trueIapId != iCmManager.EasyWlanIdL())
- return false;
-
- // Loop through all connections that connection monitor is aware
- // and check for IAPs based on easy WLAN
- TRequestStatus status;
- TUint connectionCount;
- iConnectionMonitor.GetConnectionCount(connectionCount, status);
- User::WaitForRequest(status);
- TUint connectionId;
- TUint subConnectionCount;
- TUint apId;
- if (status.Int() == KErrNone) {
- for (TUint i = 1; i <= connectionCount; i++) {
- iConnectionMonitor.GetConnectionInfo(i, connectionId, subConnectionCount);
- iConnectionMonitor.GetUintAttribute(connectionId, subConnectionCount,
- KIAPId, apId, status);
- User::WaitForRequest(status);
- if (apId == trueIapId) {
- QNetworkConfigurationPrivatePointer ptr =
- configurationFromEasyWlan(apId, connectionId);
- if (ptr) {
-#ifdef QT_BEARERMGMT_SYMBIAN_DEBUG
- qDebug() << "QNCM easyWlanTrueIapId(), found true IAP ID: "
- << toSymbianConfig(ptr)->numericIdentifier();
-#endif
- trueIapId = toSymbianConfig(ptr)->numericIdentifier();
- return true;
- }
- }
- }
- }
- return false;
-}
-
#endif
// Sessions may use this function to report configuration state changes,
diff --git a/src/plugins/bearer/symbian/symbianengine.h b/src/plugins/bearer/symbian/symbianengine.h
index 1fe6395..7c1076e 100644
--- a/src/plugins/bearer/symbian/symbianengine.h
+++ b/src/plugins/bearer/symbian/symbianengine.h
@@ -138,10 +138,15 @@ public:
QStringList accessPointConfigurationIdentifiers();
+ QNetworkConfigurationPrivatePointer configurationFromSsid(const QString &ssid);
+
+ // For QNetworkSessionPrivateImpl to indicate about state changes
+ void configurationStateChangeReport(TUint32 accessPointId, QNetworkSession::State newState);
+
Q_SIGNALS:
void onlineStateChanged(bool isOnline);
- void configurationStateChanged(TUint32 accessPointId, TUint32 connMonId,
+ void configurationStateChanged(quint32 accessPointId, quint32 connMonId,
QNetworkSession::State newState);
public Q_SLOTS:
@@ -187,12 +192,9 @@ protected:
private:
// MConnectionMonitorObserver
void EventL(const CConnMonEventBase& aEvent);
- // For QNetworkSessionPrivate to indicate about state changes
- void configurationStateChangeReport(TUint32 accessPointId,
- QNetworkSession::State newState);
-#ifdef OCC_FUNCTIONALITY_AVAILABLE
- QNetworkConfigurationPrivatePointer configurationFromEasyWlan(TUint32 apId, TUint connectionId);
- bool easyWlanTrueIapId(TUint32& trueIapId);
+#ifdef SNAP_FUNCTIONALITY_AVAILABLE
+ QNetworkConfigurationPrivatePointer configurationFromEasyWlan(TUint32 apId,
+ TUint connectionId);
#endif
private: // Data
@@ -212,7 +214,6 @@ private: // Data
friend class QNetworkSessionPrivate;
friend class AccessPointsAvailabilityScanner;
- friend class QNetworkSessionPrivateImpl;
#ifdef SNAP_FUNCTIONALITY_AVAILABLE
RCmManager iCmManager;