summaryrefslogtreecommitdiffstats
path: root/src/plugins/bearer/connman
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/bearer/connman')
-rw-r--r--src/plugins/bearer/connman/.prev_CMakeLists.txt26
-rw-r--r--src/plugins/bearer/connman/CMakeLists.txt22
-rw-r--r--src/plugins/bearer/connman/connman.json3
-rw-r--r--src/plugins/bearer/connman/connman.pro16
-rw-r--r--src/plugins/bearer/connman/main.cpp85
-rw-r--r--src/plugins/bearer/connman/qconnmanengine.cpp570
-rw-r--r--src/plugins/bearer/connman/qconnmanengine.h145
-rw-r--r--src/plugins/bearer/connman/qconnmanservice_linux.cpp516
-rw-r--r--src/plugins/bearer/connman/qconnmanservice_linux_p.h230
9 files changed, 0 insertions, 1613 deletions
diff --git a/src/plugins/bearer/connman/.prev_CMakeLists.txt b/src/plugins/bearer/connman/.prev_CMakeLists.txt
deleted file mode 100644
index 55aaa41491..0000000000
--- a/src/plugins/bearer/connman/.prev_CMakeLists.txt
+++ /dev/null
@@ -1,26 +0,0 @@
-# Generated from connman.pro.
-
-#####################################################################
-## QConnmanEnginePlugin Plugin:
-#####################################################################
-
-qt_add_plugin(QConnmanEnginePlugin
- OUTPUT_NAME qconnmanbearer
- CLASS_NAME QConnmanEnginePlugin
- TYPE bearer
- SOURCES
- main.cpp
- qconnmanengine.cpp qconnmanengine.h
- qconnmanservice_linux.cpp qconnmanservice_linux_p.h
- LIBRARIES
- Qt::LinuxOfonoSupportPrivate
- Qt::NetworkPrivate
- PUBLIC_LIBRARIES
- Qt::Core
- Qt::DBus
- Qt::LinuxOfonoSupport
- Qt::Network
-)
-
-#### Keys ignored in scope 1:.:.:connman.pro:<TRUE>:
-# OTHER_FILES = "connman.json"
diff --git a/src/plugins/bearer/connman/CMakeLists.txt b/src/plugins/bearer/connman/CMakeLists.txt
deleted file mode 100644
index 745f48b6e0..0000000000
--- a/src/plugins/bearer/connman/CMakeLists.txt
+++ /dev/null
@@ -1,22 +0,0 @@
-# Generated from connman.pro.
-
-#####################################################################
-## QConnmanEnginePlugin Plugin:
-#####################################################################
-
-qt_add_plugin(QConnmanEnginePlugin
- OUTPUT_NAME qconnmanbearer
- TYPE bearer
- SOURCES
- main.cpp
- qconnmanengine.cpp qconnmanengine.h
- qconnmanservice_linux.cpp qconnmanservice_linux_p.h
- PUBLIC_LIBRARIES
- Qt::Core
- Qt::DBus
- Qt::LinuxOfonoSupportPrivate
- Qt::NetworkPrivate
-)
-
-#### Keys ignored in scope 1:.:.:connman.pro:<TRUE>:
-# OTHER_FILES = "connman.json"
diff --git a/src/plugins/bearer/connman/connman.json b/src/plugins/bearer/connman/connman.json
deleted file mode 100644
index 7a80b8c9be..0000000000
--- a/src/plugins/bearer/connman/connman.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "Keys": [ "connman" ]
-}
diff --git a/src/plugins/bearer/connman/connman.pro b/src/plugins/bearer/connman/connman.pro
deleted file mode 100644
index 03e94cfe6a..0000000000
--- a/src/plugins/bearer/connman/connman.pro
+++ /dev/null
@@ -1,16 +0,0 @@
-TARGET = qconnmanbearer
-
-QT = core network-private dbus linuxofono_support_private
-
-HEADERS += qconnmanservice_linux_p.h \
- qconnmanengine.h
-
-SOURCES += main.cpp \
- qconnmanservice_linux.cpp \
- qconnmanengine.cpp
-
-OTHER_FILES += connman.json
-
-PLUGIN_TYPE = bearer
-PLUGIN_CLASS_NAME = QConnmanEnginePlugin
-load(qt_plugin)
diff --git a/src/plugins/bearer/connman/main.cpp b/src/plugins/bearer/connman/main.cpp
deleted file mode 100644
index 03c8a7f6c5..0000000000
--- a/src/plugins/bearer/connman/main.cpp
+++ /dev/null
@@ -1,85 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#include "qconnmanengine.h"
-
-#include <QtNetwork/private/qbearerplugin_p.h>
-
-#include <QtCore/qdebug.h>
-
-#ifndef QT_NO_DBUS
-
-QT_BEGIN_NAMESPACE
-
-class QConnmanEnginePlugin : public QBearerEnginePlugin
-{
- Q_OBJECT
- Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QBearerEngineFactoryInterface" FILE "connman.json")
-
-public:
- QConnmanEnginePlugin();
- ~QConnmanEnginePlugin();
-
- QBearerEngine *create(const QString &key) const;
-};
-
-QConnmanEnginePlugin::QConnmanEnginePlugin()
-{
-}
-
-QConnmanEnginePlugin::~QConnmanEnginePlugin()
-{
-}
-
-QBearerEngine *QConnmanEnginePlugin::create(const QString &key) const
-{
- if (key == QLatin1String("connman")) {
- QConnmanEngine *engine = new QConnmanEngine;
- if (engine->connmanAvailable())
- return engine;
- else
- delete engine;
- }
- return 0;
-}
-
-QT_END_NAMESPACE
-
-#include "main.moc"
-
-#endif
diff --git a/src/plugins/bearer/connman/qconnmanengine.cpp b/src/plugins/bearer/connman/qconnmanengine.cpp
deleted file mode 100644
index a673834825..0000000000
--- a/src/plugins/bearer/connman/qconnmanengine.cpp
+++ /dev/null
@@ -1,570 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qconnmanengine.h"
-#include "qconnmanservice_linux_p.h"
-#include <private/qnetworksession_impl_p.h>
-
-#include <QtNetwork/private/qnetworkconfiguration_p.h>
-
-#include <QtNetwork/qnetworksession.h>
-
-#include <QtCore/qdebug.h>
-#include <QtCore/private/qlocking_p.h>
-
-#include <QtDBus/QtDBus>
-#include <QtDBus/QDBusConnection>
-#include <QtDBus/QDBusInterface>
-#include <QtDBus/QDBusMessage>
-#include <QtDBus/QDBusReply>
-#ifndef QT_NO_DBUS
-
-QT_BEGIN_NAMESPACE
-
-QConnmanEngine::QConnmanEngine(QObject *parent)
-: QBearerEngineImpl(parent),
- connmanManager(new QConnmanManagerInterface(this)),
- ofonoManager(new QOfonoManagerInterface(this)),
- ofonoNetwork(0),
- ofonoContextManager(0)
-{
- qDBusRegisterMetaType<ConnmanMap>();
- qDBusRegisterMetaType<ConnmanMapList>();
- qRegisterMetaType<ConnmanMapList>("ConnmanMapList");
-}
-
-QConnmanEngine::~QConnmanEngine()
-{
-}
-
-bool QConnmanEngine::connmanAvailable() const
-{
- const auto locker = qt_scoped_lock(mutex);
- return connmanManager->isValid();
-}
-
-void QConnmanEngine::initialize()
-{
- const auto locker = qt_scoped_lock(mutex);
- connect(ofonoManager,SIGNAL(modemChanged()),this,SLOT(changedModem()));
-
- ofonoNetwork = new QOfonoNetworkRegistrationInterface(ofonoManager->currentModem(),this);
- ofonoContextManager = new QOfonoDataConnectionManagerInterface(ofonoManager->currentModem(),this);
- connect(ofonoContextManager,SIGNAL(roamingAllowedChanged(bool)),this,SLOT(reEvaluateCellular()));
-
- connect(connmanManager,SIGNAL(servicesChanged(ConnmanMapList,QList<QDBusObjectPath>)),
- this, SLOT(updateServices(ConnmanMapList,QList<QDBusObjectPath>)));
-
- connect(connmanManager,SIGNAL(servicesReady(QStringList)),this,SLOT(servicesReady(QStringList)));
- connect(connmanManager,SIGNAL(scanFinished(bool)),this,SLOT(finishedScan(bool)));
-
- const auto servPaths = connmanManager->getServices();
- for (const QString &servPath : servPaths)
- addServiceConfiguration(servPath);
- Q_EMIT updateCompleted();
-}
-
-void QConnmanEngine::changedModem()
-{
- const auto locker = qt_scoped_lock(mutex);
- if (ofonoNetwork)
- delete ofonoNetwork;
-
- ofonoNetwork = new QOfonoNetworkRegistrationInterface(ofonoManager->currentModem(),this);
-
- if (ofonoContextManager)
- delete ofonoContextManager;
- ofonoContextManager = new QOfonoDataConnectionManagerInterface(ofonoManager->currentModem(),this);
-}
-
-void QConnmanEngine::servicesReady(const QStringList &list)
-{
- const auto locker = qt_scoped_lock(mutex);
- for (const QString &servPath : list)
- addServiceConfiguration(servPath);
-
- Q_EMIT updateCompleted();
-}
-
-QList<QNetworkConfigurationPrivate *> QConnmanEngine::getConfigurations()
-{
- const auto locker = qt_scoped_lock(mutex);
- QList<QNetworkConfigurationPrivate *> fetchedConfigurations;
- QNetworkConfigurationPrivate* cpPriv = 0;
- const int numFoundConfigurations = foundConfigurations.count();
- fetchedConfigurations.reserve(numFoundConfigurations);
-
- for (int i = 0; i < numFoundConfigurations; ++i) {
- QNetworkConfigurationPrivate *config = new QNetworkConfigurationPrivate;
- cpPriv = foundConfigurations.at(i);
-
- config->name = cpPriv->name;
- config->isValid = cpPriv->isValid;
- config->id = cpPriv->id;
- config->state = cpPriv->state;
- config->type = cpPriv->type;
- config->roamingSupported = cpPriv->roamingSupported;
- config->purpose = cpPriv->purpose;
- config->bearerType = cpPriv->bearerType;
-
- fetchedConfigurations.append(config);
- delete config;
- }
- return fetchedConfigurations;
-}
-
-QString QConnmanEngine::getInterfaceFromId(const QString &id)
-{
- const auto locker = qt_scoped_lock(mutex);
- return configInterfaces.value(id);
-}
-
-bool QConnmanEngine::hasIdentifier(const QString &id)
-{
- const auto locker = qt_scoped_lock(mutex);
- return accessPointConfigurations.contains(id);
-}
-
-void QConnmanEngine::connectToId(const QString &id)
-{
- const auto locker = qt_scoped_lock(mutex);
-
- QConnmanServiceInterface *serv = connmanServiceInterfaces.value(id);
-
- if (!serv || !serv->isValid()) {
- emit connectionError(id, QBearerEngineImpl::InterfaceLookupError);
- } else {
- if (serv->type() == QLatin1String("cellular")) {
- if (serv->roaming()) {
- if (!isRoamingAllowed(serv->path())) {
- emit connectionError(id, QBearerEngineImpl::OperationNotSupported);
- return;
- }
- }
- }
- if (serv->autoConnect())
- serv->connect();
- }
-}
-
-void QConnmanEngine::disconnectFromId(const QString &id)
-{
- const auto locker = qt_scoped_lock(mutex);
- QConnmanServiceInterface *serv = connmanServiceInterfaces.value(id);
-
- if (!serv || !serv->isValid()) {
- emit connectionError(id, DisconnectionError);
- } else {
- serv->disconnect();
- }
-}
-
-void QConnmanEngine::requestUpdate()
-{
- const auto locker = qt_scoped_lock(mutex);
- QTimer::singleShot(0, this, SLOT(doRequestUpdate()));
-}
-
-void QConnmanEngine::doRequestUpdate()
-{
- bool scanned = connmanManager->requestScan("wifi");
- if (!scanned)
- Q_EMIT updateCompleted();
-}
-
-void QConnmanEngine::finishedScan(bool error)
-{
- if (error)
- Q_EMIT updateCompleted();
-}
-
-void QConnmanEngine::updateServices(const ConnmanMapList &changed, const QList<QDBusObjectPath> &removed)
-{
- const auto locker = qt_scoped_lock(mutex);
-
- foreach (const QDBusObjectPath &objectPath, removed) {
- removeConfiguration(objectPath.path());
- }
-
- foreach (const ConnmanMap &connmanMap, changed) {
- const QString id = connmanMap.objectPath.path();
- if (accessPointConfigurations.contains(id)) {
- configurationChange(connmanServiceInterfaces.value(id));
- } else {
- addServiceConfiguration(connmanMap.objectPath.path());
- }
- }
- Q_EMIT updateCompleted();
-}
-
-QNetworkSession::State QConnmanEngine::sessionStateForId(const QString &id)
-{
- const auto locker = qt_scoped_lock(mutex);
-
- QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(id);
-
- if (!ptr || !ptr->isValid)
- return QNetworkSession::Invalid;
-
- QString service = id;
- QConnmanServiceInterface *serv = connmanServiceInterfaces.value(service);
- if (!serv)
- return QNetworkSession::Invalid;
-
- QString servState = serv->state();
-
- if (serv->favorite() && (servState == QLatin1String("idle") || servState == QLatin1String("failure"))) {
- return QNetworkSession::Disconnected;
- }
-
- if (servState == QLatin1String("association") || servState == QLatin1String("configuration")) {
- return QNetworkSession::Connecting;
- }
-
- if (servState == QLatin1String("online") || servState == QLatin1String("ready")) {
- return QNetworkSession::Connected;
- }
-
- if ((ptr->state & QNetworkConfiguration::Discovered) ==
- QNetworkConfiguration::Discovered) {
- return QNetworkSession::Disconnected;
- } else if ((ptr->state & QNetworkConfiguration::Defined) == QNetworkConfiguration::Defined) {
- return QNetworkSession::NotAvailable;
- } else if ((ptr->state & QNetworkConfiguration::Undefined) ==
- QNetworkConfiguration::Undefined) {
- return QNetworkSession::NotAvailable;
- }
-
- return QNetworkSession::Invalid;
-}
-
-quint64 QConnmanEngine::bytesWritten(const QString &id)
-{//TODO use connman counter API
- const auto locker = qt_scoped_lock(mutex);
- quint64 result = 0;
- QString devFile = getInterfaceFromId(id);
- QFile tx("/sys/class/net/"+devFile+"/statistics/tx_bytes");
- if (tx.open(QIODevice::ReadOnly | QIODevice::Text)) {
- QTextStream in(&tx);
- in >> result;
- tx.close();
- }
-
- return result;
-}
-
-quint64 QConnmanEngine::bytesReceived(const QString &id)
-{//TODO use connman counter API
- const auto locker = qt_scoped_lock(mutex);
- quint64 result = 0;
- QString devFile = getInterfaceFromId(id);
- QFile rx("/sys/class/net/"+devFile+"/statistics/rx_bytes");
- if (rx.open(QIODevice::ReadOnly | QIODevice::Text)) {
- QTextStream in(&rx);
- in >> result;
- rx.close();
- }
- return result;
-}
-
-quint64 QConnmanEngine::startTime(const QString &/*id*/)
-{
- // TODO
- const auto locker = qt_scoped_lock(mutex);
- if (activeTime.isNull()) {
- return 0;
- }
- return activeTime.secsTo(QDateTime::currentDateTime());
-}
-
-QNetworkConfigurationManager::Capabilities QConnmanEngine::capabilities() const
-{
- return QNetworkConfigurationManager::ForcedRoaming |
- QNetworkConfigurationManager::DataStatistics |
- QNetworkConfigurationManager::CanStartAndStopInterfaces |
- QNetworkConfigurationManager::NetworkSessionRequired;
-}
-
-QNetworkSessionPrivate *QConnmanEngine::createSessionBackend()
-{
- return new QNetworkSessionPrivateImpl;
-}
-
-QNetworkConfigurationPrivatePointer QConnmanEngine::defaultConfiguration()
-{
- const auto locker = qt_scoped_lock(mutex);
- const auto servPaths = connmanManager->getServices();
- for (const QString &servPath : servPaths) {
- if (connmanServiceInterfaces.contains(servPath)) {
- if (accessPointConfigurations.contains(servPath))
- return accessPointConfigurations.value(servPath);
- }
- }
- return QNetworkConfigurationPrivatePointer();
-}
-
-void QConnmanEngine::serviceStateChanged(const QString &state)
-{
- QConnmanServiceInterface *service = qobject_cast<QConnmanServiceInterface *>(sender());
- configurationChange(service);
-
- if (state == QLatin1String("failure")) {
- emit connectionError(service->path(), ConnectError);
- }
-}
-
-void QConnmanEngine::configurationChange(QConnmanServiceInterface *serv)
-{
- if (!serv)
- return;
- auto locker = qt_unique_lock(mutex);
- QString id = serv->path();
-
- if (accessPointConfigurations.contains(id)) {
- bool changed = false;
- QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(id);
- QString networkName = serv->name();
- QNetworkConfiguration::StateFlags curState = getStateForService(serv->path());
- ptr->mutex.lock();
-
- if (!ptr->isValid) {
- ptr->isValid = true;
- }
-
- if (ptr->name != networkName) {
- ptr->name = networkName;
- changed = true;
- }
-
- if (ptr->state != curState) {
- ptr->state = curState;
- changed = true;
- }
-
- ptr->mutex.unlock();
-
- if (changed) {
- locker.unlock();
- emit configurationChanged(ptr);
- locker.lock();
- }
- }
-
- locker.unlock();
- emit updateCompleted();
-}
-
-QNetworkConfiguration::StateFlags QConnmanEngine::getStateForService(const QString &service)
-{
- const auto locker = qt_scoped_lock(mutex);
- QConnmanServiceInterface *serv = connmanServiceInterfaces.value(service);
- if (!serv)
- return QNetworkConfiguration::Undefined;
-
- QString state = serv->state();
- QNetworkConfiguration::StateFlags flag = QNetworkConfiguration::Defined;
-
- if (serv->type() == QLatin1String("cellular")) {
-
- if (!serv->autoConnect()|| (serv->roaming()
- && !isRoamingAllowed(serv->path()))) {
- flag = (flag | QNetworkConfiguration::Defined);
- } else {
- flag = (flag | QNetworkConfiguration::Discovered);
- }
- } else {
- if (serv->favorite()) {
- if (serv->autoConnect()) {
- flag = (flag | QNetworkConfiguration::Discovered);
- }
- } else {
- flag = QNetworkConfiguration::Undefined;
- }
- }
- if (state == QLatin1String("online") || state == QLatin1String("ready")) {
- flag = (flag | QNetworkConfiguration::Active);
- }
-
- return flag;
-}
-
-QNetworkConfiguration::BearerType QConnmanEngine::typeToBearer(const QString &type)
-{
- if (type == QLatin1String("wifi"))
- return QNetworkConfiguration::BearerWLAN;
- if (type == QLatin1String("ethernet"))
- return QNetworkConfiguration::BearerEthernet;
- if (type == QLatin1String("bluetooth"))
- return QNetworkConfiguration::BearerBluetooth;
- if (type == QLatin1String("cellular")) {
- return ofonoTechToBearerType(type);
- }
- if (type == QLatin1String("wimax"))
- return QNetworkConfiguration::BearerWiMAX;
-
- return QNetworkConfiguration::BearerUnknown;
-}
-
-QNetworkConfiguration::BearerType QConnmanEngine::ofonoTechToBearerType(const QString &/*type*/)
-{
- if (ofonoNetwork) {
- QString currentTechnology = ofonoNetwork->getTechnology();
- if (currentTechnology == QLatin1String("gsm")) {
- return QNetworkConfiguration::Bearer2G;
- } else if (currentTechnology == QLatin1String("edge")) {
- return QNetworkConfiguration::BearerCDMA2000; //wrong, I know
- } else if (currentTechnology == QLatin1String("umts")) {
- return QNetworkConfiguration::BearerWCDMA;
- } else if (currentTechnology == QLatin1String("hspa")) {
- return QNetworkConfiguration::BearerHSPA;
- } else if (currentTechnology == QLatin1String("lte")) {
- return QNetworkConfiguration::BearerLTE;
- }
- }
- return QNetworkConfiguration::BearerUnknown;
-}
-
-bool QConnmanEngine::isRoamingAllowed(const QString &context)
-{
- const auto dcPaths = ofonoContextManager->contexts();
- for (const QString &dcPath : dcPaths) {
- if (dcPath.contains(context.section("_",-1))) {
- return ofonoContextManager->roamingAllowed();
- }
- }
- return false;
-}
-
-void QConnmanEngine::removeConfiguration(const QString &id)
-{
- auto locker = qt_unique_lock(mutex);
-
- if (accessPointConfigurations.contains(id)) {
-
- disconnect(connmanServiceInterfaces.value(id),SIGNAL(stateChanged(QString)),
- this,SLOT(serviceStateChanged(QString)));
- serviceNetworks.removeOne(id);
- QConnmanServiceInterface *service = connmanServiceInterfaces.take(id);
- delete service;
- QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.take(id);
- foundConfigurations.removeOne(ptr.data());
- locker.unlock();
- emit configurationRemoved(ptr);
- }
-}
-
-void QConnmanEngine::addServiceConfiguration(const QString &servicePath)
-{
- auto locker = qt_unique_lock(mutex);
- if (!connmanServiceInterfaces.contains(servicePath)) {
- QConnmanServiceInterface *serv = new QConnmanServiceInterface(servicePath, this);
- connmanServiceInterfaces.insert(serv->path(),serv);
- }
-
- if (!accessPointConfigurations.contains(servicePath)) {
-
- serviceNetworks.append(servicePath);
-
- connect(connmanServiceInterfaces.value(servicePath),SIGNAL(stateChanged(QString)),
- this,SLOT(serviceStateChanged(QString)));
-
- QNetworkConfigurationPrivate* cpPriv = new QNetworkConfigurationPrivate();
- QConnmanServiceInterface *service = connmanServiceInterfaces.value(servicePath);
-
- QString networkName = service->name();
-
- const QString connectionType = service->type();
- if (connectionType == QLatin1String("ethernet")) {
- cpPriv->bearerType = QNetworkConfiguration::BearerEthernet;
- } else if (connectionType == QLatin1String("wifi")) {
- cpPriv->bearerType = QNetworkConfiguration::BearerWLAN;
- } else if (connectionType == QLatin1String("cellular")) {
- cpPriv->bearerType = ofonoTechToBearerType(QLatin1String("cellular"));
- cpPriv->roamingSupported = service->roaming() && isRoamingAllowed(servicePath);
- } else if (connectionType == QLatin1String("wimax")) {
- cpPriv->bearerType = QNetworkConfiguration::BearerWiMAX;
- } else {
- cpPriv->bearerType = QNetworkConfiguration::BearerUnknown;
- }
-
- cpPriv->name = networkName;
- cpPriv->isValid = true;
- cpPriv->id = servicePath;
- cpPriv->type = QNetworkConfiguration::InternetAccessPoint;
-
- if (service->security() == QLatin1String("none")) {
- cpPriv->purpose = QNetworkConfiguration::PublicPurpose;
- } else {
- cpPriv->purpose = QNetworkConfiguration::PrivatePurpose;
- }
-
- cpPriv->state = getStateForService(servicePath);
-
- QNetworkConfigurationPrivatePointer ptr(cpPriv);
- accessPointConfigurations.insert(ptr->id, ptr);
- if (connectionType == QLatin1String("cellular")) {
- foundConfigurations.append(cpPriv);
- } else {
- foundConfigurations.prepend(cpPriv);
- }
- configInterfaces[cpPriv->id] = service->serviceInterface();
-
- locker.unlock();
- Q_EMIT configurationAdded(ptr);
- }
-}
-
-bool QConnmanEngine::requiresPolling() const
-{
- return false;
-}
-
-void QConnmanEngine::reEvaluateCellular()
-{
- const auto servicePaths = connmanManager->getServices();
- for (const QString &servicePath : servicePaths) {
- if (servicePath.contains("cellular") && accessPointConfigurations.contains(servicePath)) {
- configurationChange(connmanServiceInterfaces.value(servicePath));
- }
- }
-}
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_DBUS
diff --git a/src/plugins/bearer/connman/qconnmanengine.h b/src/plugins/bearer/connman/qconnmanengine.h
deleted file mode 100644
index 969eed45b1..0000000000
--- a/src/plugins/bearer/connman/qconnmanengine.h
+++ /dev/null
@@ -1,145 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QCONNMANENGINE_P_H
-#define QCONNMANENGINE_P_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 <private/qbearerengine_impl_p.h>
-
-#include "qconnmanservice_linux_p.h"
-#include <private/qofonoservice_linux_p.h>
-
-#include <QMap>
-#include <QVariant>
-
-#ifndef QT_NO_DBUS
-
-QT_BEGIN_NAMESPACE
-
-class QConnmanEngine : public QBearerEngineImpl
-{
- Q_OBJECT
-
-public:
- QConnmanEngine(QObject *parent = nullptr);
- ~QConnmanEngine();
-
- bool connmanAvailable() const;
-
- virtual QString getInterfaceFromId(const QString &id);
- bool hasIdentifier(const QString &id);
-
- virtual void connectToId(const QString &id);
- virtual void disconnectFromId(const QString &id);
-
- Q_INVOKABLE void initialize();
- Q_INVOKABLE void requestUpdate();
-
- QNetworkSession::State sessionStateForId(const QString &id);
- QNetworkSessionPrivate *createSessionBackend();
-
- virtual quint64 bytesWritten(const QString &id);
- virtual quint64 bytesReceived(const QString &id);
- virtual quint64 startTime(const QString &id);
-
- virtual QNetworkConfigurationManager::Capabilities capabilities() const;
- virtual QNetworkConfigurationPrivatePointer defaultConfiguration();
-
- QList<QNetworkConfigurationPrivate *> getConfigurations();
-
-private Q_SLOTS:
-
- void doRequestUpdate();
- void updateServices(const ConnmanMapList &changed, const QList<QDBusObjectPath> &removed);
-
- void servicesReady(const QStringList &);
- void finishedScan(bool error);
- void changedModem();
- void serviceStateChanged(const QString &state);
- void configurationChange(QConnmanServiceInterface * service);
- void reEvaluateCellular();
-private:
- QConnmanManagerInterface *connmanManager;
-
- QOfonoManagerInterface *ofonoManager;
- QOfonoNetworkRegistrationInterface *ofonoNetwork;
- QOfonoDataConnectionManagerInterface *ofonoContextManager;
-
- QList<QNetworkConfigurationPrivate *> foundConfigurations;
-
- QString networkFromId(const QString &id);
-
- QNetworkConfiguration::StateFlags getStateForService(const QString &service);
- QNetworkConfiguration::BearerType typeToBearer(const QString &type);
-
- void removeConfiguration(const QString &servicePath);
- void addServiceConfiguration(const QString &servicePath);
- QDateTime activeTime;
-
-
- QMap<QString,QConnmanTechnologyInterface *> technologies; // techpath, tech interface
- QMap<QString,QString> configInterfaces; // id, interface name
- QList<QString> serviceNetworks; //servpath
-
- QNetworkConfiguration::BearerType ofonoTechToBearerType(const QString &type);
- bool isRoamingAllowed(const QString &context);
- QMap <QString,QConnmanServiceInterface *> connmanServiceInterfaces;
-
-protected:
- bool requiresPolling() const;
-};
-
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_DBUS
-
-#endif
-
diff --git a/src/plugins/bearer/connman/qconnmanservice_linux.cpp b/src/plugins/bearer/connman/qconnmanservice_linux.cpp
deleted file mode 100644
index 35d9c40680..0000000000
--- a/src/plugins/bearer/connman/qconnmanservice_linux.cpp
+++ /dev/null
@@ -1,516 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $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 "qconnmanservice_linux_p.h"
-
-#ifndef QT_NO_DBUS
-
-QT_BEGIN_NAMESPACE
-
-QDBusArgument &operator<<(QDBusArgument &argument, const ConnmanMap &map)
-{
- argument.beginStructure();
- argument << map.objectPath << map.propertyMap;
- argument.endStructure();
- return argument;
-}
-
-const QDBusArgument &operator>>(const QDBusArgument &argument, ConnmanMap &map)
-{
- argument.beginStructure();
- argument >> map.objectPath >> map.propertyMap;
- argument.endStructure();
- return argument;
-}
-
-QConnmanManagerInterface::QConnmanManagerInterface( QObject *parent)
- : QDBusAbstractInterface(QLatin1String(CONNMAN_SERVICE),
- QLatin1String(CONNMAN_MANAGER_PATH),
- CONNMAN_MANAGER_INTERFACE,
- QDBusConnection::systemBus(), parent)
-{
- qDBusRegisterMetaType<ConnmanMap>();
- qDBusRegisterMetaType<ConnmanMapList>();
-
- QDBusPendingReply<QVariantMap> props_reply = asyncCall(QLatin1String("GetProperties"));
- QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(props_reply, this);
-
- QObject::connect(watcher,SIGNAL(finished(QDBusPendingCallWatcher*)),
- this, SLOT(propertiesReply(QDBusPendingCallWatcher*)));
-
- QDBusConnection::systemBus().connect(QLatin1String(CONNMAN_SERVICE),
- QLatin1String(CONNMAN_MANAGER_PATH),
- QLatin1String(CONNMAN_SERVICE_INTERFACE),
- QLatin1String("PropertyChanged"),
- this,SLOT(changedProperty(QString,QDBusVariant)));
-
-
- QDBusConnection::systemBus().connect(QLatin1String(CONNMAN_SERVICE),
- QLatin1String(CONNMAN_MANAGER_PATH),
- QLatin1String(CONNMAN_SERVICE_INTERFACE),
- QLatin1String("TechnologyAdded"),
- this,SLOT(technologyAdded(QDBusObjectPath,QVariantMap)));
-
- QDBusConnection::systemBus().connect(QLatin1String(CONNMAN_SERVICE),
- QLatin1String(CONNMAN_MANAGER_PATH),
- QLatin1String(CONNMAN_SERVICE_INTERFACE),
- QLatin1String("TechnologyRemoved"),
- this,SLOT(technologyRemoved(QDBusObjectPath)));
-
- QDBusPendingReply<ConnmanMapList> serv_reply = asyncCall(QLatin1String("GetServices"));
- QDBusPendingCallWatcher *watcher2 = new QDBusPendingCallWatcher(serv_reply, this);
-
- QObject::connect(watcher2,SIGNAL(finished(QDBusPendingCallWatcher*)),
- this, SLOT(servicesReply(QDBusPendingCallWatcher*)));
-
-}
-
-QConnmanManagerInterface::~QConnmanManagerInterface()
-{
-}
-
-void QConnmanManagerInterface::changedProperty(const QString &name, const QDBusVariant &value)
-{
- propertiesCacheMap[name] = value.variant();
-}
-
-void QConnmanManagerInterface::propertiesReply(QDBusPendingCallWatcher *call)
-{
- QDBusPendingReply<QVariantMap> props_reply = *call;
-
- if (props_reply.isError()) {
- qDebug() << props_reply.error().message();
- } else {
- propertiesCacheMap = props_reply.value();
- }
- call->deleteLater();
-}
-
-void QConnmanManagerInterface::servicesReply(QDBusPendingCallWatcher *call)
-{
- QDBusPendingReply<ConnmanMapList> serv_reply = *call;
-
- if (serv_reply.isError()) {
- qDebug() << serv_reply.error().message();
- } else {
- servicesList.clear(); //connman list changes order
- const ConnmanMapList connmanobjs = serv_reply.value();
- for (const ConnmanMap &connmanobj : connmanobjs)
- servicesList << connmanobj.objectPath.path();
- Q_EMIT servicesReady(servicesList);
- }
- call->deleteLater();
-}
-
-void QConnmanManagerInterface::connectNotify(const QMetaMethod &signal)
-{
- static const QMetaMethod propertyChangedSignal = QMetaMethod::fromSignal(&QConnmanManagerInterface::propertyChanged);
- if (signal == propertyChangedSignal) {
- if (!connection().connect(QLatin1String(CONNMAN_SERVICE),
- QLatin1String(CONNMAN_MANAGER_PATH),
- QLatin1String(CONNMAN_MANAGER_INTERFACE),
- QLatin1String("PropertyChanged"),
- this,SIGNAL(propertyChanged(QString,QDBusVariant)))) {
- qWarning("PropertyChanged not connected");
- }
- }
-
- static const QMetaMethod servicesChangedSignal = QMetaMethod::fromSignal(&QConnmanManagerInterface::servicesChanged);
- if (signal == servicesChangedSignal) {
- if (!connection().connect(QLatin1String(CONNMAN_SERVICE),
- QLatin1String(CONNMAN_MANAGER_PATH),
- QLatin1String(CONNMAN_MANAGER_INTERFACE),
- QLatin1String("ServicesChanged"),
- this,SLOT(onServicesChanged(ConnmanMapList,QList<QDBusObjectPath>)))) {
- qWarning("servicesChanged not connected");
- }
- }
-}
-
-void QConnmanManagerInterface::onServicesChanged(const ConnmanMapList &changed, const QList<QDBusObjectPath> &removed)
-{
- servicesList.clear(); //connman list changes order
- for (const ConnmanMap &connmanobj : changed) {
- const QString svcPath(connmanobj.objectPath.path());
- servicesList << svcPath;
- }
-
- Q_EMIT servicesChanged(changed, removed);
-}
-
-QVariant QConnmanManagerInterface::getProperty(const QString &property)
-{
- QVariant var;
- var = propertiesCacheMap.value(property);
- return var;
-}
-
-QVariantMap QConnmanManagerInterface::getProperties()
-{
- if (propertiesCacheMap.isEmpty()) {
- QDBusPendingReply<QVariantMap> reply = call(QLatin1String("GetProperties"));
- reply.waitForFinished();
- if (!reply.isError()) {
- propertiesCacheMap = reply.value();
- }
- }
- return propertiesCacheMap;
-}
-
-QString QConnmanManagerInterface::getState()
-{
- return getProperty(QStringLiteral("State")).toString();
-}
-
-bool QConnmanManagerInterface::getOfflineMode()
-{
- QVariant var = getProperty(QStringLiteral("OfflineMode"));
- return qdbus_cast<bool>(var);
-}
-
-QStringList QConnmanManagerInterface::getTechnologies()
-{
- if (technologiesMap.isEmpty()) {
- QDBusPendingReply<ConnmanMapList> reply = call(QLatin1String("GetTechnologies"));
- reply.waitForFinished();
- if (!reply.isError()) {
- const ConnmanMapList maps = reply.value();
- for (const ConnmanMap &map : maps) {
- if (!technologiesMap.contains(map.objectPath.path())) {
- technologyAdded(map.objectPath, map.propertyMap);
- }
- }
- }
- }
- return technologiesMap.keys();
-}
-
-QStringList QConnmanManagerInterface::getServices()
-{
- if (servicesList.isEmpty()) {
- QDBusPendingReply<ConnmanMapList> reply = call(QLatin1String("GetServices"));
- reply.waitForFinished();
- if (!reply.isError()) {
- const ConnmanMapList maps = reply.value();
- for (const ConnmanMap &map : maps)
- servicesList << map.objectPath.path();
- }
- }
- return servicesList;
-}
-
-bool QConnmanManagerInterface::requestScan(const QString &type)
-{
- bool scanned = false;
- if (technologiesMap.isEmpty())
- getTechnologies();
- Q_FOREACH (QConnmanTechnologyInterface *tech, technologiesMap) {
- if (tech->type() == type) {
- tech->scan();
- scanned = true;
- }
- }
- return scanned;
-}
-
-void QConnmanManagerInterface::technologyAdded(const QDBusObjectPath &path, const QVariantMap &)
-{
- if (!technologiesList.contains(path.path())) {
- technologiesList << path.path();
- QConnmanTechnologyInterface *tech;
- tech = new QConnmanTechnologyInterface(path.path(),this);
- technologiesMap.insert(path.path(),tech);
- connect(tech,SIGNAL(scanFinished(bool)),this,SIGNAL(scanFinished(bool)));
- }
-}
-
-void QConnmanManagerInterface::technologyRemoved(const QDBusObjectPath &path)
-{
- if (technologiesList.contains(path.path())) {
- technologiesList.removeOne(path.path());
- QConnmanTechnologyInterface * tech = technologiesMap.take(path.path());
- delete tech;
- }
-}
-
-QConnmanServiceInterface::QConnmanServiceInterface(const QString &dbusPathName,QObject *parent)
- : QDBusAbstractInterface(QLatin1String(CONNMAN_SERVICE),
- dbusPathName,
- CONNMAN_SERVICE_INTERFACE,
- QDBusConnection::systemBus(), parent)
-{
- QDBusPendingReply<QVariantMap> props_reply = asyncCall(QLatin1String("GetProperties"));
-
- QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(props_reply, this);
-
- QObject::connect(watcher,SIGNAL(finished(QDBusPendingCallWatcher*)),
- this, SLOT(propertiesReply(QDBusPendingCallWatcher*)));
-
- QDBusConnection::systemBus().connect(QLatin1String(CONNMAN_SERVICE),
- path(),
- QLatin1String(CONNMAN_SERVICE_INTERFACE),
- QLatin1String("PropertyChanged"),
- this,SLOT(changedProperty(QString,QDBusVariant)));
-}
-
-QConnmanServiceInterface::~QConnmanServiceInterface()
-{
-}
-
-QVariantMap QConnmanServiceInterface::getProperties()
-{
- if (propertiesCacheMap.isEmpty()) {
- QDBusPendingReply<QVariantMap> reply = call(QLatin1String("GetProperties"));
- reply.waitForFinished();
- if (!reply.isError()) {
- propertiesCacheMap = reply.value();
- Q_EMIT propertiesReady();
- }
- }
- return propertiesCacheMap;
-}
-
-void QConnmanServiceInterface::propertiesReply(QDBusPendingCallWatcher *call)
-{
- QDBusPendingReply<QVariantMap> props_reply = *call;
- if (props_reply.isError()) {
- qDebug() << props_reply.error().message();
- return;
- }
- propertiesCacheMap = props_reply.value();
- Q_EMIT propertiesReady();
-}
-
-void QConnmanServiceInterface::connectNotify(const QMetaMethod &signal)
-{
- static const QMetaMethod propertyChangedSignal = QMetaMethod::fromSignal(&QConnmanServiceInterface::propertyChanged);
- if (signal == propertyChangedSignal) {
- QDBusConnection::systemBus().connect(QLatin1String(CONNMAN_SERVICE),
- path(),
- QLatin1String(CONNMAN_SERVICE_INTERFACE),
- QLatin1String("PropertyChanged"),
- this,SIGNAL(propertyChanged(QString,QDBusVariant)));
- }
-}
-
-void QConnmanServiceInterface::changedProperty(const QString &name, const QDBusVariant &value)
-{
- propertiesCacheMap[name] = value.variant();
- if (name == QLatin1String("State"))
- Q_EMIT stateChanged(value.variant().toString());
-}
-
-QVariant QConnmanServiceInterface::getProperty(const QString &property)
-{
- QVariant var;
- QVariantMap map = getProperties();
- var = map.value(property);
- return var;
-}
-
-void QConnmanServiceInterface::connect()
-{
- asyncCall(QLatin1String("Connect"));
-}
-
-void QConnmanServiceInterface::disconnect()
-{
- asyncCall(QLatin1String("Disconnect"));
-}
-
-void QConnmanServiceInterface::remove()
-{
- asyncCall(QLatin1String("Remove"));
-}
-
-// properties
-QString QConnmanServiceInterface::state()
-{
- QVariant var = getProperty(QStringLiteral("State"));
- return qdbus_cast<QString>(var);
-}
-
-QString QConnmanServiceInterface::lastError()
-{
- QVariant var = getProperty(QStringLiteral("Error"));
- return qdbus_cast<QString>(var);
-}
-
-QString QConnmanServiceInterface::name()
-{
- QVariant var = getProperty(QStringLiteral("Name"));
- return qdbus_cast<QString>(var);
-}
-
-QString QConnmanServiceInterface::type()
-{
- QVariant var = getProperty(QStringLiteral("Type"));
- return qdbus_cast<QString>(var);
-}
-
-QString QConnmanServiceInterface::security()
-{
- QVariant var = getProperty(QStringLiteral("Security"));
- return qdbus_cast<QString>(var);
-}
-
-bool QConnmanServiceInterface::favorite()
-{
- QVariant var = getProperty(QStringLiteral("Favorite"));
- return qdbus_cast<bool>(var);
-}
-
-bool QConnmanServiceInterface::autoConnect()
-{
- QVariant var = getProperty(QStringLiteral("AutoConnect"));
- return qdbus_cast<bool>(var);
-}
-
-bool QConnmanServiceInterface::roaming()
-{
- QVariant var = getProperty(QStringLiteral("Roaming"));
- return qdbus_cast<bool>(var);
-}
-
-QVariantMap QConnmanServiceInterface::ethernet()
-{
- QVariant var = getProperty(QStringLiteral("Ethernet"));
- return qdbus_cast<QVariantMap >(var);
-}
-
-QString QConnmanServiceInterface::serviceInterface()
-{
- QVariantMap map = ethernet();
- return map.value(QStringLiteral("Interface")).toString();
-}
-
-bool QConnmanServiceInterface::isOfflineMode()
-{
- QVariant var = getProperty(QStringLiteral("OfflineMode"));
- return qdbus_cast<bool>(var);
-}
-
-QStringList QConnmanServiceInterface::services()
-{
- QVariant var = getProperty(QStringLiteral("Services"));
- return qdbus_cast<QStringList>(var);
-}
-
-//////////////////////////
-QConnmanTechnologyInterface::QConnmanTechnologyInterface(const QString &dbusPathName,QObject *parent)
- : QDBusAbstractInterface(QLatin1String(CONNMAN_SERVICE),
- dbusPathName,
- CONNMAN_TECHNOLOGY_INTERFACE,
- QDBusConnection::systemBus(), parent)
-{
-}
-
-QConnmanTechnologyInterface::~QConnmanTechnologyInterface()
-{
-}
-
-void QConnmanTechnologyInterface::connectNotify(const QMetaMethod &signal)
-{
- static const QMetaMethod propertyChangedSignal = QMetaMethod::fromSignal(&QConnmanTechnologyInterface::propertyChanged);
- if (signal == propertyChangedSignal) {
- QDBusConnection::systemBus().connect(QLatin1String(CONNMAN_SERVICE),
- path(),
- QLatin1String(CONNMAN_TECHNOLOGY_INTERFACE),
- QLatin1String("PropertyChanged"),
- this,SIGNAL(propertyChanged(QString,QDBusVariant)));
- }
-}
-
-QVariantMap QConnmanTechnologyInterface::properties()
-{
- if (propertiesMap.isEmpty()) {
- QDBusPendingReply<QVariantMap> reply = call(QLatin1String("GetProperties"));
- reply.waitForFinished();
- propertiesMap = reply.value();
- }
- return propertiesMap;
-}
-
-QVariant QConnmanTechnologyInterface::getProperty(const QString &property)
-{
- QVariant var;
- QVariantMap map = properties();
- var = map.value(property);
- return var;
-}
-
-QString QConnmanTechnologyInterface::type()
-{
- QVariant var = getProperty(QStringLiteral("Type"));
- return qdbus_cast<QString>(var);
-}
-
-void QConnmanTechnologyInterface::scan()
-{
- QDBusPendingReply<> reply = asyncCall(QLatin1String("Scan"));
- QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(reply, this);
- connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)),
- this, SLOT(scanReply(QDBusPendingCallWatcher*)));
-}
-
-void QConnmanTechnologyInterface::scanReply(QDBusPendingCallWatcher *call)
-{
- QDBusPendingReply<> props_reply = *call;
- if (props_reply.isError()) {
- qDebug() << props_reply.error().message();
- }
- Q_EMIT scanFinished(props_reply.isError());
- call->deleteLater();
-}
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_DBUS
diff --git a/src/plugins/bearer/connman/qconnmanservice_linux_p.h b/src/plugins/bearer/connman/qconnmanservice_linux_p.h
deleted file mode 100644
index 790325f9a1..0000000000
--- a/src/plugins/bearer/connman/qconnmanservice_linux_p.h
+++ /dev/null
@@ -1,230 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QCONNMANSERVICE_H
-#define QCONNMANSERVICE_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/QDBusArgument>
-
-#include <QtDBus/QDBusPendingCallWatcher>
-#include <QtDBus/QDBusObjectPath>
-#include <QtDBus/QDBusContext>
-#include <QMap>
-
-#ifndef QT_NO_DBUS
-
-#ifndef __CONNMAN_DBUS_H
-
-#define CONNMAN_SERVICE "net.connman"
-#define CONNMAN_PATH "/net/connman"
-#define CONNMAN_MANAGER_INTERFACE CONNMAN_SERVICE ".Manager"
-#define CONNMAN_MANAGER_PATH "/"
-#define CONNMAN_SERVICE_INTERFACE CONNMAN_SERVICE ".Service"
-#define CONNMAN_TECHNOLOGY_INTERFACE CONNMAN_SERVICE ".Technology"
-#endif
-
-QT_BEGIN_NAMESPACE
-
-struct ConnmanMap {
- QDBusObjectPath objectPath;
- QVariantMap propertyMap;
-};
-Q_DECLARE_TYPEINFO(ConnmanMap, Q_MOVABLE_TYPE); // QDBusObjectPath is movable, but cannot be
- // marked as such until Qt 6
-typedef QVector<ConnmanMap> ConnmanMapList;
-
-QT_END_NAMESPACE
-
-Q_DECLARE_METATYPE(QT_PREPEND_NAMESPACE(ConnmanMap))
-Q_DECLARE_METATYPE(QT_PREPEND_NAMESPACE(ConnmanMapList))
-
-QT_BEGIN_NAMESPACE
-
-QDBusArgument &operator<<(QDBusArgument &argument, const ConnmanMap &obj);
-const QDBusArgument &operator>>(const QDBusArgument &argument, ConnmanMap &obj);
-
-class QConnmanTechnologyInterface;
-class QConnmanServiceInterface;
-
-class QConnmanManagerInterface : public QDBusAbstractInterface
-{
- Q_OBJECT
-
-public:
-
- QConnmanManagerInterface( QObject *parent = nullptr);
- ~QConnmanManagerInterface();
-
- QDBusObjectPath path() const;
- QVariantMap getProperties();
-
- QString getState();
- bool getOfflineMode();
- QStringList getTechnologies();
- QStringList getServices();
- bool requestScan(const QString &type);
-
- QHash<QString, QConnmanTechnologyInterface *> technologiesMap;
-
-Q_SIGNALS:
- void propertyChanged(const QString &, const QDBusVariant &value);
- void stateChanged(const QString &);
- void propertyChangedContext(const QString &,const QString &,const QDBusVariant &);
- void servicesChanged(const ConnmanMapList&, const QList<QDBusObjectPath> &);
-
- void servicesReady(const QStringList &);
- void scanFinished(bool error);
-
-protected:
- void connectNotify(const QMetaMethod &signal);
- QVariant getProperty(const QString &);
-
-private:
- QVariantMap propertiesCacheMap;
- QStringList servicesList;
- QStringList technologiesList;
-
-private slots:
- void onServicesChanged(const ConnmanMapList&, const QList<QDBusObjectPath> &);
- void changedProperty(const QString &, const QDBusVariant &value);
-
- void propertiesReply(QDBusPendingCallWatcher *call);
- void servicesReply(QDBusPendingCallWatcher *call);
-
- void technologyAdded(const QDBusObjectPath &technology, const QVariantMap &properties);
- void technologyRemoved(const QDBusObjectPath &technology);
-
-};
-
-class QConnmanServiceInterface : public QDBusAbstractInterface
-{
- Q_OBJECT
-
-public:
-
- explicit QConnmanServiceInterface(const QString &dbusPathName,QObject *parent = nullptr);
- ~QConnmanServiceInterface();
-
- QVariantMap getProperties();
- // clearProperty
- void connect();
- void disconnect();
- void remove();
-
-// properties
- QString state();
- QString lastError();
- QString name();
- QString type();
- QString security();
- bool favorite();
- bool autoConnect();
- bool roaming();
- QVariantMap ethernet();
- QString serviceInterface();
-
- bool isOfflineMode();
- QStringList services();
-
-Q_SIGNALS:
- void propertyChanged(const QString &, const QDBusVariant &value);
- void propertyChangedContext(const QString &,const QString &,const QDBusVariant &);
- void propertiesReady();
- void stateChanged(const QString &state);
-
-protected:
- void connectNotify(const QMetaMethod &signal);
- QVariant getProperty(const QString &);
-private:
- QVariantMap propertiesCacheMap;
-private slots:
- void propertiesReply(QDBusPendingCallWatcher *call);
- void changedProperty(const QString &, const QDBusVariant &value);
-
-};
-
-class QConnmanTechnologyInterface : public QDBusAbstractInterface
-{
- Q_OBJECT
-
-public:
-
- explicit QConnmanTechnologyInterface(const QString &dbusPathName,QObject *parent = nullptr);
- ~QConnmanTechnologyInterface();
-
- QString type();
-
- void scan();
-Q_SIGNALS:
- void propertyChanged(const QString &, const QDBusVariant &value);
- void propertyChangedContext(const QString &,const QString &,const QDBusVariant &);
- void scanFinished(bool error);
-protected:
- void connectNotify(const QMetaMethod &signal);
- QVariant getProperty(const QString &);
-private:
- QVariantMap properties();
- QVariantMap propertiesMap;
-private Q_SLOTS:
- void scanReply(QDBusPendingCallWatcher *call);
-
-};
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_DBUS
-
-#endif //QCONNMANSERVICE_H